Skip to content
New issue

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

VariablePointer Capability Not Removed by --trim-capabilities #5854

Open
cwfitzgerald opened this issue Oct 15, 2024 · 0 comments
Open

VariablePointer Capability Not Removed by --trim-capabilities #5854

cwfitzgerald opened this issue Oct 15, 2024 · 0 comments

Comments

@cwfitzgerald
Copy link

The following spirv, generated by slang, doesn't appear to use the VariablePointer cap or extension at all. Manually removing it passes spirv-val, but calling spirv-opt with --trim-capabilities doesn't actually remove it.

; SPIR-V
; Version: 1.5
; Generator: Khronos; 40
; Bound: 18
; Schema: 0
OpCapability VariablePointers
OpCapability PhysicalStorageBufferAddresses
OpCapability Shader
OpExtension "SPV_KHR_variable_pointers"
OpExtension "SPV_KHR_physical_storage_buffer"
OpMemoryModel PhysicalStorageBuffer64 GLSL450
OpEntryPoint GLCompute %computeMain "main" %globalParams
OpExecutionMode %computeMain LocalSize 4 1 1

; Debug Information
OpSource Slang 1
OpName %GlobalParams_std140 "GlobalParams_std140"   ; id %5
OpMemberName %GlobalParams_std140 0 "value"
OpName %globalParams "globalParams"                 ; id %9
OpName %computeMain "computeMain"                   ; id %2

; Annotations
OpDecorate %_ptr_PhysicalStorageBuffer_uint ArrayStride 4
OpDecorate %GlobalParams_std140 Block
OpMemberDecorate %GlobalParams_std140 0 Offset 0
OpDecorate %globalParams Binding 0
OpDecorate %globalParams DescriptorSet 0

; Types, variables and constants
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint    ; ArrayStride 4
%GlobalParams_std140 = OpTypeStruct %_ptr_PhysicalStorageBuffer_uint            ; Block
%_ptr_Uniform_GlobalParams_std140 = OpTypePointer Uniform %GlobalParams_std140
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Uniform__ptr_PhysicalStorageBuffer_uint = OpTypePointer Uniform %_ptr_PhysicalStorageBuffer_uint
%uint_2 = OpConstant %uint 2
%globalParams = OpVariable %_ptr_Uniform_GlobalParams_std140 Uniform    ; Binding 0, DescriptorSet 0

; Function computeMain
%computeMain = OpFunction %void None %3
%4 = OpLabel
%13 = OpAccessChain %_ptr_Uniform__ptr_PhysicalStorageBuffer_uint %globalParams %int_0
%14 = OpLoad %_ptr_PhysicalStorageBuffer_uint %13
OpStore %14 %uint_2 Aligned 4
OpReturn
OpFunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant