We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
origin glsl:
#version 460 #extension GL_EXT_shader_explicit_arithmetic_types : enable layout(constant_id = 0) const uint32_t RANK_OUT = 4; layout(local_size_x = 64) in; void outputOffsetToIndex(uint[RANK_OUT] shape, uint offset, out uint[RANK_OUT] index) { for(uint32_t i = RANK_OUT - 1; i >= 0; i--) { index[i] = offset % shape[i]; offset /= shape[i]; } } void main() { uint offset = gl_GlobalInvocationID.x; uint[RANK_OUT] shape; if (RANK_OUT == 4) { shape[0] = 1; shape[1] = 4; shape[2] = 4; shape[3] = 1; } uint[RANK_OUT] index; outputOffsetToIndex(shape, offset, index); }
compile with glslang and used SPIRV-Cross to get decompiled glsl again, get following code:
#version 460 layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; layout(constant_id = 0) const uint RANK_OUT = 4u; const uint _19 = (RANK_OUT - 1u); const bool _53 = (RANK_OUT == 4u); void outputOffsetToIndex(uint shape[RANK_OUT], inout uint offset, inout uint index[RANK_OUT]) { for (uint i = _19; i >= 0u; i--) { index[i] = offset % shape[i]; offset /= shape[i]; } } void main() { uint offset = gl_GlobalInvocationID.x; uint shape[RANK_OUT]; if (_53) { shape[0] = 1u; shape[1] = 4u; shape[2] = 4u; shape[3] = 1u; } uint param[RANK_OUT] = shape; uint param_1 = offset; uint param_2[RANK_OUT]; outputOffsetToIndex(param, param_1, param_2); uint index[RANK_OUT] = param_2; }
but this code got compile error: 'initializer' : can't use with types containing arrays sized with a specialization constant
The text was updated successfully, but these errors were encountered:
No branches or pull requests
origin glsl:
compile with glslang and used SPIRV-Cross to get decompiled glsl again, get following code:
but this code got compile error: 'initializer' : can't use with types containing arrays sized with a specialization constant
The text was updated successfully, but these errors were encountered: