GPUOpen-Drivers/xgl

LLVM error when using both OpImageSampleDref* and OpImageSample* on the same image

doitsujin opened this issue · 3 comments

Sampling from the same image with both an ordinary texture sampler and a depth-compare sampler causes the shader compiler to fail with the following error:

LLVM ERROR: Error: Attempt to redefine function: 
; Function Attrs: nounwind
declare spir_func %spirv.SampledImage.float_1_1_0_0_1_0_0 addrspace(1)* @_Z12SampledImagePU3AS140__spirv_SampledImage_float_1_0_0_0_1_0_0i(%spirv.SampledImage.float_1_0_0_0_1_0_0 addrspace(1)*, i32) #0
 => %spirv.SampledImage.float_1_0_0_0_1_0_0 addrspace(1)* (%spirv.SampledImage.float_1_0_0_0_1_0_0 addrspace(1)*, i32)

An example shader which triggers the issue can be found here (both disassembled SPIR-V and GLSL):
https://gist.github.com/doitsujin/bfc03c0a432c441426f10f0493c1d4f7

Changing the SPIR-V shader so that the same OpTypeSampledImage is used for both operations fixes the error, although it obviously leads to incorrect results.

Reproduced, we will fix it ASAP.

fixed in dev branch

Fix is merged to master branch