The problem is still present in driver 375.63. I have also tested it with driver 372.90, and that driver version is also broken. This means the error was introduced between version 372.70 and 372.90. I have managed to track down the problem, the driver crashes if the fragment shader contains textureClampARB in GLSL / MinLod in SPIR-V. Again, the system is Win7 x64 SP1 with a GTX 970.
The minimal fragment shader looks like this in GLSL:
#version 450 core
#extension GL_ARB_sparse_texture_clamp : require
layout(set = 0, binding = 2) uniform sampler2D albedo;
layout(location = 0) in vec2 tc;
layout(location = 0) out vec4 color;
void main()
{
#if 1
// Enabling this line works
color = texture(albedo, tc);
#else
// Enabling this line does NOT work
color = textureClampARB(albedo, tc, 0);
#endif
}
In SPIR-V, the working code is this:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 1
; Bound: 20
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %color %tc
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 450
OpSourceExtension "GL_ARB_sparse_texture_clamp"
OpName %main "main"
OpName %color "color"
OpName %albedo "albedo"
OpName %tc "tc"
OpDecorate %color Location 0
OpDecorate %albedo DescriptorSet 0
OpDecorate %albedo Binding 2
OpDecorate %tc Location 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%color = OpVariable %_ptr_Output_v4float Output
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
%11 = OpTypeSampledImage %10
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%albedo = OpVariable %_ptr_UniformConstant_11 UniformConstant
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%tc = OpVariable %_ptr_Input_v2float Input
%main = OpFunction %void None %3
%5 = OpLabel
%14 = OpLoad %11 %albedo
%18 = OpLoad %v2float %tc
%19 = OpImageSampleImplicitLod %v4float %14 %18
OpStore %color %19
OpReturn
OpFunctionEnd
And the SPIR-V code that crashes the driver looks like this:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 1
; Bound: 21
; Schema: 0
OpCapability Shader
OpCapability MinLod
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %color %tc
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 450
OpSourceExtension "GL_ARB_sparse_texture_clamp"
OpName %main "main"
OpName %color "color"
OpName %albedo "albedo"
OpName %tc "tc"
OpDecorate %color Location 0
OpDecorate %albedo DescriptorSet 0
OpDecorate %albedo Binding 2
OpDecorate %tc Location 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%color = OpVariable %_ptr_Output_v4float Output
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
%11 = OpTypeSampledImage %10
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%albedo = OpVariable %_ptr_UniformConstant_11 UniformConstant
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%tc = OpVariable %_ptr_Input_v2float Input
%19 = OpConstant %float 0
%main = OpFunction %void None %3
%5 = OpLabel
%14 = OpLoad %11 %albedo
%18 = OpLoad %v2float %tc
%20 = OpImageSampleImplicitLod %v4float %14 %18 MinLod %19
OpStore %color %20
OpReturn
OpFunctionEnd
It would be nice if someone from NVIDIA could fix this, since this bug means i am unable to upgrade to the new driver.
Regards