mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
wgpu-core: Only produce StageError::InputNotConsumed on DX11/DX12 (#4222)
Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
This commit is contained in:
parent
75b41fe9ec
commit
49d16f7488
@ -365,6 +365,9 @@ fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> {
|
||||
if features.contains(wgpu_types::Features::SHADER_EARLY_DEPTH_TEST) {
|
||||
return_features.push("shader-early-depth-test");
|
||||
}
|
||||
if features.contains(wgpu_types::Features::SHADER_UNUSED_VERTEX_OUTPUT) {
|
||||
return_features.push("shader-unused-vertex-output");
|
||||
}
|
||||
|
||||
return_features
|
||||
}
|
||||
@ -624,6 +627,10 @@ impl From<GpuRequiredFeatures> for wgpu_types::Features {
|
||||
wgpu_types::Features::SHADER_EARLY_DEPTH_TEST,
|
||||
required_features.0.contains("shader-early-depth-test"),
|
||||
);
|
||||
features.set(
|
||||
wgpu_types::Features::SHADER_UNUSED_VERTEX_OUTPUT,
|
||||
required_features.0.contains("shader-unused-vertex-output"),
|
||||
);
|
||||
|
||||
features
|
||||
}
|
||||
|
@ -1179,7 +1179,12 @@ impl Interface {
|
||||
}
|
||||
|
||||
// Check all vertex outputs and make sure the fragment shader consumes them.
|
||||
if shader_stage == naga::ShaderStage::Fragment {
|
||||
// This requirement is removed if the `SHADER_UNUSED_VERTEX_OUTPUT` feature is enabled.
|
||||
if shader_stage == naga::ShaderStage::Fragment
|
||||
&& !self
|
||||
.features
|
||||
.contains(wgt::Features::SHADER_UNUSED_VERTEX_OUTPUT)
|
||||
{
|
||||
for &index in inputs.keys() {
|
||||
// This is a linear scan, but the count should be low enough
|
||||
// that this should be fine.
|
||||
|
@ -368,6 +368,7 @@ impl super::Adapter {
|
||||
ver >= (3, 2) || extensions.contains("OES_geometry_shader"),
|
||||
);
|
||||
features.set(wgt::Features::SHADER_EARLY_DEPTH_TEST, ver >= (3, 1));
|
||||
features.set(wgt::Features::SHADER_UNUSED_VERTEX_OUTPUT, true);
|
||||
let gles_bcn_exts = [
|
||||
"GL_EXT_texture_compression_s3tc_srgb",
|
||||
"GL_EXT_texture_compression_rgtc",
|
||||
|
@ -806,6 +806,7 @@ impl super::PrivateCapabilities {
|
||||
features.set(F::ADDRESS_MODE_CLAMP_TO_ZERO, true);
|
||||
|
||||
features.set(F::RG11B10UFLOAT_RENDERABLE, self.format_rg11b10_all);
|
||||
features.set(F::SHADER_UNUSED_VERTEX_OUTPUT, true);
|
||||
|
||||
features
|
||||
}
|
||||
|
@ -519,6 +519,7 @@ impl PhysicalDeviceFeatures {
|
||||
| vk::FormatFeatureFlags::COLOR_ATTACHMENT_BLEND,
|
||||
);
|
||||
features.set(F::RG11B10UFLOAT_RENDERABLE, rg11b10ufloat_renderable);
|
||||
features.set(F::SHADER_UNUSED_VERTEX_OUTPUT, true);
|
||||
|
||||
(features, dl_flags)
|
||||
}
|
||||
|
@ -730,7 +730,16 @@ bitflags::bitflags! {
|
||||
/// This is a native only feature.
|
||||
const VERTEX_ATTRIBUTE_64BIT = 1 << 53;
|
||||
|
||||
// 54..59 available
|
||||
/// Allows vertex shaders to have outputs which are not consumed
|
||||
/// by the fragment shader.
|
||||
///
|
||||
/// Supported platforms:
|
||||
/// - Vulkan
|
||||
/// - Metal
|
||||
/// - OpenGL
|
||||
const SHADER_UNUSED_VERTEX_OUTPUT = 1 << 54;
|
||||
|
||||
// 55..59 available
|
||||
|
||||
// Shader:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user