Allow SPIR-V shaders to process when shader defs are present (#7772)

This commit is contained in:
Shfty 2023-03-19 09:26:26 +00:00 committed by GitHub
parent 20101647c1
commit 7b7294b8a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -296,8 +296,6 @@ pub enum ProcessShaderError {
"Not enough '# endif' lines. Each if statement should be followed by an endif statement."
)]
NotEnoughEndIfs,
#[error("This Shader's format does not support processing shader defs.")]
ShaderFormatDoesNotSupportShaderDefs,
#[error("This Shader's format does not support imports.")]
ShaderFormatDoesNotSupportImports,
#[error("Unresolved import: {0:?}.")]
@ -477,10 +475,7 @@ impl ShaderProcessor {
Source::Wgsl(source) => source.deref(),
Source::Glsl(source, _stage) => source.deref(),
Source::SpirV(source) => {
if shader_defs_unique.is_empty() {
return Ok(ProcessedShader::SpirV(source.clone()));
}
return Err(ProcessShaderError::ShaderFormatDoesNotSupportShaderDefs);
return Ok(ProcessedShader::SpirV(source.clone()));
}
};