Hello Community, I'm encountering a perplexing issue when attempting to deploy compute shader programs on the Redmagic 9 Pro, which is powered by an Adreno 750 GPU. My workflow involves compiling GLSL code via Shaderc. However, upon executing vkCreateComputePipelines, I'm consistently met with a VK_ERROR_UNKNOWN response. It's noteworthy that this issue is not present on the Redmagic 8, featuring the Adreno 740 GPU, where my shaders run without hitches. I'm reaching out to see if anyone else has faced similar challenges or if there are known workarounds or compatibility concerns with the Adreno 750 GPU and Vulkan's compute pipelines. Attached below is the minimal reproducible example of the code that leads to this error. I appreciate any insights or suggestions you might have.
#version 320 es
precision highp float;
precision highp int;
precision highp image2D;
layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
layout(rgba8, binding = 0) uniform writeonly image2D outSurface;
layout(std430, binding = 1) readonly buffer VDP2C { uint cram[]; };
void main() {
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
uint kdata = cram[texel.x];
kdata = ((kdata >> 8) & 0xFFu) | ((kdata << 8) & 0xFF00u);
if ((kdata&0x8000u)!=0x0u) { return; }
imageStore(outSurface,texel,vec4(float(kdata)));
}
When I change line 10th to "kdata = ((kdata >> 8) & 0xFFu) + ((kdata << 8) & 0xFF00u);" it returns VK_SUCCESS "kdata = ( ((kdata>>8)&0x00FFu) | (kdata<<8) ) & 0xFFFFu ;" is also returns VK_SUCCESS for more details check my GitHub page.
https://github.com/devmiyax/yabause/issues/998
Thank you in advance for your support and guidance.
This code failed to vkCreateComputePipelines
; SPIR-V
; Version: 1.0
; Generator: Google Shaderc over Glslang; 10
; Bound: 65
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %4 "main" %gl_GlobalInvocationID
OpExecutionMode %4 LocalSize 16 16 1
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %_runtimearr_uint ArrayStride 4
OpMemberDecorate %_struct_21 0 NonWritable
OpMemberDecorate %_struct_21 0 Offset 0
OpDecorate %_struct_21 BufferBlock
OpDecorate %23 DescriptorSet 0
OpDecorate %23 Binding 1
OpDecorate %53 DescriptorSet 0
OpDecorate %53 Binding 0
OpDecorate %53 NonReadable
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%v2uint = OpTypeVector %uint 2
%_runtimearr_uint = OpTypeRuntimeArray %uint
%_struct_21 = OpTypeStruct %_runtimearr_uint
%_ptr_Uniform__struct_21 = OpTypePointer Uniform %_struct_21
%23 = OpVariable %_ptr_Uniform__struct_21 Uniform
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int_8 = OpConstant %int 8
%uint_255 = OpConstant %uint 255
%uint_65280 = OpConstant %uint 65280
%uint_32768 = OpConstant %uint 32768
%bool = OpTypeBool
%float = OpTypeFloat 32
%51 = OpTypeImage %float 2D 0 0 0 2 Rgba8
%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
%53 = OpVariable %_ptr_UniformConstant_51 UniformConstant
%v4float = OpTypeVector %float 4
%uint_16 = OpConstant %uint 16
%uint_1 = OpConstant %uint 1
%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_1
%4 = OpFunction %void None %3
%5 = OpLabel
OpSelectionMerge %63 None
OpSwitch %uint_0 %64
%64 = OpLabel
%15 = OpLoad %v3uint %gl_GlobalInvocationID
%16 = OpVectorShuffle %v2uint %15 %15 0 1
%17 = OpBitcast %v2int %16
%28 = OpCompositeExtract %int %17 0
%30 = OpAccessChain %_ptr_Uniform_uint %23 %int_0 %28
%31 = OpLoad %uint %30
%34 = OpShiftRightLogical %uint %31 %int_8
%36 = OpBitwiseAnd %uint %34 %uint_255
%38 = OpShiftLeftLogical %uint %31 %int_8
%40 = OpBitwiseAnd %uint %38 %uint_65280
%41 = OpBitwiseOr %uint %36 %40
%44 = OpBitwiseAnd %uint %41 %uint_32768
%46 = OpINotEqual %bool %44 %uint_0
OpSelectionMerge %48 None
OpBranchConditional %46 %47 %48
%47 = OpLabel
OpBranch %63
%48 = OpLabel
%54 = OpLoad %51 %53
%57 = OpConvertUToF %float %41
%59 = OpCompositeConstruct %v4float %57 %57 %57 %57
OpImageWrite %54 %17 %59
OpBranch %63
%63 = OpLabel
OpReturn
OpFunctionEnd
This code success to vkCreateComputePipelines
; SPIR-V
; Version: 1.0
; Generator: Google Shaderc over Glslang; 10
; Bound: 65
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %4 "main" %gl_GlobalInvocationID
OpExecutionMode %4 LocalSize 16 16 1
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %_runtimearr_uint ArrayStride 4
OpMemberDecorate %_struct_21 0 NonWritable
OpMemberDecorate %_struct_21 0 Offset 0
OpDecorate %_struct_21 BufferBlock
OpDecorate %23 DescriptorSet 0
OpDecorate %23 Binding 1
OpDecorate %53 DescriptorSet 0
OpDecorate %53 Binding 0
OpDecorate %53 NonReadable
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%v2uint = OpTypeVector %uint 2
%_runtimearr_uint = OpTypeRuntimeArray %uint
%_struct_21 = OpTypeStruct %_runtimearr_uint
%_ptr_Uniform__struct_21 = OpTypePointer Uniform %_struct_21
%23 = OpVariable %_ptr_Uniform__struct_21 Uniform
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int_8 = OpConstant %int 8
%uint_255 = OpConstant %uint 255
%uint_65535 = OpConstant %uint 65535
%uint_32768 = OpConstant %uint 32768
%bool = OpTypeBool
%float = OpTypeFloat 32
%51 = OpTypeImage %float 2D 0 0 0 2 Rgba8
%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
%53 = OpVariable %_ptr_UniformConstant_51 UniformConstant
%v4float = OpTypeVector %float 4
%uint_16 = OpConstant %uint 16
%uint_1 = OpConstant %uint 1
%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_1
%4 = OpFunction %void None %3
%5 = OpLabel
OpSelectionMerge %63 None
OpSwitch %uint_0 %64
%64 = OpLabel
%15 = OpLoad %v3uint %gl_GlobalInvocationID
%16 = OpVectorShuffle %v2uint %15 %15 0 1
%17 = OpBitcast %v2int %16
%28 = OpCompositeExtract %int %17 0
%30 = OpAccessChain %_ptr_Uniform_uint %23 %int_0 %28
%31 = OpLoad %uint %30
%34 = OpShiftRightLogical %uint %31 %int_8
%36 = OpBitwiseAnd %uint %34 %uint_255
%38 = OpShiftLeftLogical %uint %31 %int_8
%39 = OpBitwiseOr %uint %36 %38
%41 = OpBitwiseAnd %uint %39 %uint_65535
%44 = OpBitwiseAnd %uint %41 %uint_32768
%46 = OpINotEqual %bool %44 %uint_0
OpSelectionMerge %48 None
OpBranchConditional %46 %47 %48
%47 = OpLabel
OpBranch %63
%48 = OpLabel
%54 = OpLoad %51 %53
%57 = OpConvertUToF %float %41
%59 = OpCompositeConstruct %v4float %57 %57 %57 %57
OpImageWrite %54 %17 %59
OpBranch %63
%63 = OpLabel
OpReturn
OpFunctionEnd
Diffrence are
--bad--
%40 = OpBitwiseAnd %uint %38 %uint_65280
%41 = OpBitwiseOr %uint %36 %40
--good--
%39 = OpBitwiseOr %uint %36 %38
%41 = OpBitwiseAnd %uint %39 %uint_65535