Open Vasniktel opened 4 years ago
The spec says
Variable pointer: A pointer of logical pointer type that results from one of the following instructions: ... OpPhi ...
It also says that
A variable pointer must point to one of the following storage classes: StorageBuffer Workgroup (if the VariablePointers capability is declared)
However, the following code
OpCapability VariablePointers %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" OpExecutionMode %4 OriginUpperLeft OpSource ESSL 310 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeFloat 32 %11 = OpConstant %6 23 %7 = OpTypePointer Function %6 %4 = OpFunction %2 None %3 %5 = OpLabel %8 = OpVariable %7 Function OpBranch %9 %9 = OpLabel %10 = OpPhi %7 %8 %5 OpStore %10 %11 OpReturn OpFunctionEnd
passes the validation even though the result of the OpPhi (%10) has Function storage class.
OpPhi
%10
Function
@alan-baker @s-perron ping
Yes, variable pointer validation has some gaps. There was some work to improve it, but it went dead. Hopefully it will be revived.
The spec says
It also says that
However, the following code
passes the validation even though the result of the
OpPhi
(%10
) hasFunction
storage class.