Skip to content

Commit

Permalink
Merge #526
Browse files Browse the repository at this point in the history
526: Add optional border_color to SamplerDescriptor r=kvark a=jshrake

Depends on #891

Co-authored-by: Justin Shrake <[email protected]>
  • Loading branch information
bors[bot] and jshrake authored Aug 23, 2020
2 parents cef9bc5 + 04da221 commit 7396e92
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
package = "wgpu-core"
version = "0.6"
#git = "https://github.com/gfx-rs/wgpu"
#rev = "096c57008f2907c07ddaa7d0ff02fae21a5e676b"
#version = "0.6"
git = "https://github.com/gfx-rs/wgpu"
rev = "0bb6bb8647a652e82c795fdc27a282e131d7cba3"
features = ["raw-window-handle"]

[dependencies.wgt]
package = "wgpu-types"
version = "0.6"
#git = "https://github.com/gfx-rs/wgpu"
#rev = "096c57008f2907c07ddaa7d0ff02fae21a5e676b"
#version = "0.6"
git = "https://github.com/gfx-rs/wgpu"
rev = "0bb6bb8647a652e82c795fdc27a282e131d7cba3"

[dependencies]
arrayvec = "0.5"
Expand Down
1 change: 1 addition & 0 deletions src/backend/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ impl crate::Context for Context {
lod_max_clamp: desc.lod_max_clamp,
compare: desc.compare,
anisotropy_clamp: desc.anisotropy_clamp,
border_color: desc.border_color,
},
PhantomData
))
Expand Down
1 change: 1 addition & 0 deletions src/backend/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ fn map_address_mode(mode: wgt::AddressMode) -> web_sys::GpuAddressMode {
wgt::AddressMode::ClampToEdge => web_sys::GpuAddressMode::ClampToEdge,
wgt::AddressMode::Repeat => web_sys::GpuAddressMode::Repeat,
wgt::AddressMode::MirrorRepeat => web_sys::GpuAddressMode::MirrorRepeat,
wgt::AddressMode::ClampToBorder => unimplemented!(),
}
}

Expand Down
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ pub use wgt::{
ColorStateDescriptor, ColorWrite, CommandBufferDescriptor, CompareFunction, CullMode,
DepthStencilStateDescriptor, DeviceDescriptor, DynamicOffset, Extent3d, Features, FilterMode,
FrontFace, IndexFormat, InputStepMode, Limits, Origin3d, PowerPreference, PresentMode,
PrimitiveTopology, PushConstantRange, RasterizationStateDescriptor, ShaderLocation,
ShaderStage, StencilOperation, StencilStateDescriptor, StencilStateFaceDescriptor,
SwapChainDescriptor, SwapChainStatus, TextureAspect, TextureComponentType, TextureDataLayout,
TextureDimension, TextureFormat, TextureUsage, TextureViewDimension, VertexAttributeDescriptor,
VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT,
PUSH_CONSTANT_ALIGNMENT,
PrimitiveTopology, PushConstantRange, RasterizationStateDescriptor, SamplerBorderColor,
ShaderLocation, ShaderStage, StencilOperation, StencilStateDescriptor,
StencilStateFaceDescriptor, SwapChainDescriptor, SwapChainStatus, TextureAspect,
TextureComponentType, TextureDataLayout, TextureDimension, TextureFormat, TextureUsage,
TextureViewDimension, VertexAttributeDescriptor, VertexFormat, BIND_BUFFER_ALIGNMENT,
COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT,
};

use backend::Context as C;
Expand Down Expand Up @@ -1060,6 +1060,8 @@ pub struct SamplerDescriptor<'a> {
pub compare: Option<CompareFunction>,
/// Valid values: 1, 2, 4, 8, and 16.
pub anisotropy_clamp: Option<NonZeroU8>,
/// Border color to use when address_mode is [`AddressMode::ClampToBorder`]
pub border_color: Option<SamplerBorderColor>,
}

impl Default for SamplerDescriptor<'_> {
Expand All @@ -1076,6 +1078,7 @@ impl Default for SamplerDescriptor<'_> {
lod_max_clamp: std::f32::MAX,
compare: None,
anisotropy_clamp: None,
border_color: None,
}
}
}
Expand Down

0 comments on commit 7396e92

Please sign in to comment.