Skip to content

Assertion `def && "Definition is not registered."' failed #2759

@jasuarez

Description

@jasuarez

When the following shader is run through the optimizer for performance, the above assertion hits

OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var
OpExecutionMode %main LocalSize 8 1 1

OpDecorate %gid_var BuiltIn GlobalInvocationId

OpDecorate %int_rta ArrayStride 4
OpDecorate %struct Block
OpMemberDecorate %struct 0 Offset 0
OpDecorate %in_var DescriptorSet 0
OpDecorate %in_var Binding 0
OpDecorate %out_var DescriptorSet 0
OpDecorate %out_var Binding 1

OpDecorateId %then_ld UniformId %workgroup

%void = OpTypeVoid
%bool = OpTypeBool
%int = OpTypeInt 32 0
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%workgroup = OpConstant %int 2
%int3 = OpTypeVector %int 3

%int_rta = OpTypeRuntimeArray %int
%struct = OpTypeStruct %int_rta
%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
%in_var = OpVariable %ptr_ssbo_struct StorageBuffer
%out_var = OpVariable %ptr_ssbo_struct StorageBuffer

%ptr_input_int3 = OpTypePointer Input %int3
%gid_var = OpVariable %ptr_input_int3 Input

%void_fn = OpTypeFunction %void
%main = OpFunction %void None %void_fn
%entry = OpLabel
%gid = OpLoad %int3 %gid_var
%gid_x = OpCompositeExtract %int %gid 0
%in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x
%mod = OpUMod %int %gid_x %int_2
%eq = OpIEqual %bool %mod %int_0
OpSelectionMerge %merge None
OpBranchConditional %eq %then %else

%then = OpLabel
%then_ld = OpLoad %int %in_gep
OpBranch %merge

%else = OpLabel
%else_ld = OpLoad %int %in_gep
OpBranch %merge

%merge = OpLabel
%phi = OpPhi %int %then_ld %then %else_ld %else
%out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x
OpStore %out_gep %phi
OpReturn
OpFunctionEnd

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions