Fix issue with new glslang behavior for samplers as parameters.
Check case where storage class uniform is passed as function parameter.
This commit is contained in:
parent
3c285a15e0
commit
d5dc5f3f1c
@ -2,7 +2,7 @@
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(binding = 0) uniform sampler2DMS uSampler;
|
||||
layout(binding = 0) uniform mediump sampler2DMS uSampler;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
|
@ -163,9 +163,9 @@ void CompilerCPP::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (type.pointer && type.storage == StorageClassUniform && !is_builtin_variable(var) &&
|
||||
(meta[type.self].decoration.decoration_flags &
|
||||
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))))
|
||||
if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassUniform &&
|
||||
!is_builtin_variable(var) && (meta[type.self].decoration.decoration_flags &
|
||||
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))))
|
||||
{
|
||||
emit_buffer_block(var);
|
||||
}
|
||||
@ -179,7 +179,7 @@ void CompilerCPP::emit_resources()
|
||||
{
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
if (type.pointer && type.storage == StorageClassPushConstant)
|
||||
if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassPushConstant)
|
||||
emit_push_constant_block(var);
|
||||
}
|
||||
}
|
||||
@ -192,8 +192,8 @@ void CompilerCPP::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (!is_builtin_variable(var) && !var.remapped_variable && type.pointer &&
|
||||
(var.storage == StorageClassInput || var.storage == StorageClassOutput))
|
||||
if (var.storage != StorageClassFunction && !is_builtin_variable(var) && !var.remapped_variable &&
|
||||
type.pointer && (var.storage == StorageClassInput || var.storage == StorageClassOutput))
|
||||
{
|
||||
emit_interface_block(var);
|
||||
}
|
||||
@ -208,7 +208,8 @@ void CompilerCPP::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (!is_builtin_variable(var) && !var.remapped_variable && type.pointer &&
|
||||
if (var.storage != StorageClassFunction && !is_builtin_variable(var) && !var.remapped_variable &&
|
||||
type.pointer &&
|
||||
(type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter))
|
||||
{
|
||||
emit_uniform(var);
|
||||
|
@ -411,7 +411,9 @@ ShaderResources Compiler::get_shader_resources() const
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (!type.pointer || is_builtin_variable(var))
|
||||
// It is possible for uniform storage classes to be passed as function parameters, so detect
|
||||
// that. To detect function parameters, check of StorageClass of variable is function scope.
|
||||
if (var.storage == StorageClassFunction || !type.pointer || is_builtin_variable(var))
|
||||
continue;
|
||||
|
||||
// Input
|
||||
|
@ -1018,9 +1018,9 @@ void CompilerGLSL::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (type.pointer && type.storage == StorageClassUniform && !is_builtin_variable(var) &&
|
||||
(meta[type.self].decoration.decoration_flags &
|
||||
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))))
|
||||
if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassUniform &&
|
||||
!is_builtin_variable(var) && (meta[type.self].decoration.decoration_flags &
|
||||
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))))
|
||||
{
|
||||
emit_buffer_block(var);
|
||||
}
|
||||
@ -1034,7 +1034,7 @@ void CompilerGLSL::emit_resources()
|
||||
{
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
if (type.pointer && type.storage == StorageClassPushConstant)
|
||||
if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassPushConstant)
|
||||
emit_push_constant_block(var);
|
||||
}
|
||||
}
|
||||
@ -1049,7 +1049,8 @@ void CompilerGLSL::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (!is_builtin_variable(var) && !var.remapped_variable && type.pointer &&
|
||||
if (var.storage != StorageClassFunction && !is_builtin_variable(var) && !var.remapped_variable &&
|
||||
type.pointer &&
|
||||
(type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter))
|
||||
{
|
||||
emit_uniform(var);
|
||||
@ -1070,8 +1071,8 @@ void CompilerGLSL::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (!is_builtin_variable(var) && !var.remapped_variable && type.pointer &&
|
||||
(var.storage == StorageClassInput || var.storage == StorageClassOutput))
|
||||
if (var.storage != StorageClassFunction && !is_builtin_variable(var) && !var.remapped_variable &&
|
||||
type.pointer && (var.storage == StorageClassInput || var.storage == StorageClassOutput))
|
||||
{
|
||||
emit_interface_block(var);
|
||||
emitted = true;
|
||||
|
@ -418,8 +418,9 @@ void CompilerMSL::emit_resources()
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
|
||||
if (type.pointer && (type.storage == StorageClassUniform || type.storage == StorageClassUniformConstant ||
|
||||
type.storage == StorageClassPushConstant) &&
|
||||
if (var.storage != StorageClassFunction && type.pointer &&
|
||||
(type.storage == StorageClassUniform || type.storage == StorageClassUniformConstant ||
|
||||
type.storage == StorageClassPushConstant) &&
|
||||
!is_builtin_variable(var) && (meta[type.self].decoration.decoration_flags &
|
||||
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user