-
Notifications
You must be signed in to change notification settings - Fork 956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling the StageError::InputNotConsumed
error
#3748
Comments
The error was introduced by #2704 but this doesn't seem to be a requirement of the WebGPU spec. The spec only requires that fragment inputs were output by the previous vertex stage.
from https://gpuweb.github.io/gpuweb/#abstract-opdef-validating-inter-stage-interfaces So, we most likely need a workaround for gfx-rs/naga#1945. |
Yeah, that requirement was backed out. Afaik, we just need to pipe the full list of vertex outputs into the fragment input in Naga so Naga can generate the correct struct. |
See gfx-rs/wgpu#4915 Also: * Remove unused vert-out frag-in variables from shaders (naga doesn't like this probably because they are optimized out on the fragment side). This restriction from naga may be relaxed in the future see gfx-rs/wgpu#3748. * Enable OptimizationLevel::Performance for shaderc by default * Add a environment variable VOXYGEN_SHADERC_OPTS for disabling this (e.g. to test if it actually makes a difference on any platform). (TODO: testing might be easier if there was a way to do toggle it without restarting...)
See gfx-rs/wgpu#4915 Also: * Remove unused vert-out frag-in variables from shaders (naga doesn't like this probably because they are optimized out on the fragment side). This restriction from naga may be relaxed in the future see gfx-rs/wgpu#3748. * Enable OptimizationLevel::Performance for shaderc by default * Add a environment variable VOXYGEN_SHADERC_OPTS for disabling this (e.g. to test if it actually makes a difference on any platform). (TODO: testing might be easier if there was a way to do toggle it without restarting...)
I've been looking into this a bit. The place where we have both vertex and fragment shaders, |
We'd ideally do this in the HLSL backend. |
It looks like dawn implemented this by removing the outputs on the vertex shader side https://bugs.chromium.org/p/dawn/issues/detail?id=1493#c20. |
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::writer. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
outputs when generating HLSL. Fixes gfx-rs#3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
Is your feature request related to a problem? Please describe.
StageError::InputNotConsumed` is produced.
The Ruffle project dynamically builds Naga shaders and wgpu render passes/pipelines based on user-provided code. It turns out that some user-provided input shaders have vertex shader outputs that are unused by the fragment shader. When we compile these shaders to Naga and pass the
naga::Module
to wgpu, aDescribe the solution you'd like
It would be very useful to be able to disable the wgpu check that produces
StageError::InputNotConsumed
. Since Ruffle is compiling user-provided shaders, the original input shaders are never going to be fixed (as they would be if the error occured when compiling Ruffle's own internal shaders).Describe alternatives you've considered
Ruffle could duplicate the wgpu
InputNotConsumed
logic, and modify its shader compilation to produce anaga::Module
that has no unused outputs in the vertex shaders. However, this adds unnecessary complexity and runtime overhead, as AFAIK all of the target wgpu backends should be able to handle a vertex shader with unused outputs.Additional context
Ruffle is compiling to naga by building up a
naga::Module
, and then using awgpu::ShaderSource::Naga
with the built module.The text was updated successfully, but these errors were encountered: