spirv: fix using OpSampledImage with OpUndef instead of OpType{Image,Sampler}
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 26 May 2020 11:54:34 +0000 (13:54 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 15 Jun 2020 15:02:53 +0000 (17:02 +0200)
commit9b6a8d17424ac5fa11ccf44c02da2a237088cb76
treef3652929acbb93cb3e063f8576226c62b6aab241
parent277b6169625f7c03c89add2857e565b9765c0c1f
spirv: fix using OpSampledImage with OpUndef instead of OpType{Image,Sampler}

This seems valid per the SPIR-V spec to use OpSampledImage with
OpUndef instead of OpTypeImage or OpTypeSampler. When the image
operand is undefined, SPIRV->NIR emits an undef instruction that
can be removed later by the compiler.

This fixes shader compilation crashes with Red Dead Redemption II.

Cc: mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5230>
src/compiler/spirv/spirv_to_nir.c