-
Notifications
You must be signed in to change notification settings - Fork 253
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
SPIRV - OpAccessChain result type (OpTypePointer) does not match the type that results from indexing into the base <id> (OpTypePointer) #4380
Comments
This is a known problem in spirvopt. Slang generates valid spirv output if you specify |
Closing as it is not related to slang. |
@csyonghe I can confirm this works, thank you! |
@csyonghe have you seen this in the past? PS C:\Users\BeastLe9enD\Documents\Projects\greek\assets\shaders\virtualized_geometry> slangc.exe -emit-spirv-directly -O3 .\transcode.comp.slang -o transcode.comp.spv | spirv-val.exe transcode.comp.spv PS C:\Users\BeastLe9enD\Documents\Projects\greek\assets\shaders\virtualized_geometry> slangc.exe -emit-spirv-directly -O0 .\transcode.comp.slang -o transcode.comp.spv | spirv-val.exe transcode.comp.spv I see different errors when using I added all relevant files in case u are interested: this is the output spirv text: I tried with |
No I haven't. Seems like a bug if -O0 also fails validation. |
@csyonghe okay, should I make a separate issue for this? |
We can take it from here, assuming this is reproducible from the files you attached? |
@csyonghe I tried to reproduce it in a more compact file.
The shader:
this is the resulting spirv assembly:
|
by the way, if I comment out the |
any progress on this? would be neat as it is a total blocker for me atm |
I will see what is going on. |
I think this might be a known issue. I will do more investigation and file a new issue if needed. |
@jkwak-work I can indeed confirm, that if I add |
I am currently trying to understand the nature of the problem. When |
Here is a simpler repro case for a future reference.
|
By default, [mutating] passes "this" as an inout parameter. Inout parameter is copy-in and copy-out so the compiler can create intermediate variables. If atomic operations are used through the this parameter, it shall be passed by reference. Putting [__Ref] attribute on the member method will do that. Internally, the compiler also inlines all functions with __ref parameter when generating spirv. |
Using |
indeed. I now realize that your original function don't even need [mutating] because it is not modifying anything inside the struct. It is modifying memory pointed to by p, but that is not in the struct itself so mutating is not needed there. However using mutating and passing this as inout shouldn't result in invalid code. |
@csyonghe yea I was only using |
With PR #4600 I am no longer seeing any validation errors with |
Hey, when I store a pointer inside a structure, I get errors from
spirv-val
.compiling it with
slangc.exe -emit-spirv-directly .\bruh.slang -o bruh.spv | spirv-val.exe .\bruh.spv
returns errors fromspirv-val
:The
slangc
version isv2024.1.21
andspirv-val
version isSPIRV-Tools v2024.2 v2024.2.rc1-0-gdd4b663e
.The text was updated successfully, but these errors were encountered: