Only declare with specialization constant when in Vulkan semantics.
This commit is contained in:
parent
86eb874568
commit
0e4ed4102b
@ -0,0 +1,13 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 9, local_size_y = 20, local_size_z = 4) in;
|
||||
|
||||
layout(binding = 0, std430) buffer SSBO
|
||||
{
|
||||
float a;
|
||||
} _4;
|
||||
|
||||
void main()
|
||||
{
|
||||
_4.a += 1.0;
|
||||
}
|
||||
|
47
shaders/asm/comp/specialization-constant-workgroup.asm.comp
Normal file
47
shaders/asm/comp/specialization-constant-workgroup.asm.comp
Normal file
@ -0,0 +1,47 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 1
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 20 1
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %SSBO "SSBO"
|
||||
OpMemberName %SSBO 0 "a"
|
||||
OpName %_ ""
|
||||
OpMemberDecorate %SSBO 0 Offset 0
|
||||
OpDecorate %SSBO BufferBlock
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %19 SpecId 10
|
||||
OpDecorate %21 SpecId 12
|
||||
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%SSBO = OpTypeStruct %float
|
||||
%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
|
||||
%_ = OpVariable %_ptr_Uniform_SSBO Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%uint = OpTypeInt 32 0
|
||||
%19 = OpSpecConstant %uint 9
|
||||
%uint_20 = OpConstant %uint 20
|
||||
%21 = OpSpecConstant %uint 4
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %19 %uint_20 %21
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%14 = OpAccessChain %_ptr_Uniform_float %_ %int_0
|
||||
%15 = OpLoad %float %14
|
||||
%16 = OpFAdd %float %15 %float_1
|
||||
%17 = OpAccessChain %_ptr_Uniform_float %_ %int_0
|
||||
OpStore %17 %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -2298,7 +2298,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
res += convert_to_string(c.scalar_f32(vector, i));
|
||||
@ -2322,7 +2322,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
{
|
||||
@ -2350,7 +2350,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
{
|
||||
@ -2380,7 +2380,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
{
|
||||
@ -2408,7 +2408,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
{
|
||||
@ -2430,7 +2430,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
res += convert_to_string(c.scalar_i32(vector, i));
|
||||
@ -2447,7 +2447,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
{
|
||||
for (uint32_t i = 0; i < c.vector_size(); i++)
|
||||
{
|
||||
if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
if (options.vulkan_semantics && c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0)
|
||||
res += to_name(c.specialization_constant_id(vector, i));
|
||||
else
|
||||
res += c.scalar(vector, i) ? "true" : "false";
|
||||
|
Loading…
Reference in New Issue
Block a user