KhronosGroup / KhronosGroup/SPIRV-Tools
OpCopyObject lets you sidestep OpSampledImage validation
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
There is a `spirv-val` error
> All OpSampledImage instructions must be in the same block in which their Result are consumed
but now learning from @alan-baker in https://github.com/KhronosGroup/SPIRV-Guide/issues/27 we should not be able to side-step with `OpCopyObject`
For GPU-AV in the Vulkan Validation Layers, I have times I need to go
```swift
%result = OpLoad %1 %2
// <----- Inject an if check to make sure this access to something unrelated doesn't blow up when executed
%bad_accsss = OpAccessChain
%bad_load = OpLoad %bad_accsss
%5 = OpSampledImage %3 %4 %result
```
and my "fix" was using `OpCopyObject` to pass `%result` so that `spirv-val` didn't complain :shrug:
1. I got from @dneto0 at the F2F this was not intended
2. While here, any suggestions how something like GPU-AV should work around this case?
Contributor guide
Assessment
This issue has not been assessed yet.