Driver regression in 373.06 from 372.70

I’ve found a possible bug in driver 373.06 that was not present in driver 372.70 on Win7 x64 SP1.

A call to vkCreateGraphicsPipelines fails with an AccessViolation to 0x0 about a dozen calls deep into nvoglv64.dll. The PSO is very simple, with a small vertex and fragment shader. The application works as intended with driver 372.70. The validation layers (1.0.26) report no errors and the error manifests in the new driver even without validation layers.

I can provide access to an API dump up to the point of the failing call and the two shaders in both GLSL and SPIR-V.

Regards

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

Tested with driver version 375.70, the problem is still present.

Callstack:

nvoglv64.dll with version 21.21.13.7570 loaded at 0000000051DE0000-0000000053F2F000
Access violation reading location 0x0000000000000000

nvoglv64.dll 0000000051e4b11e
nvoglv64.dll 0000000051e4c85c
nvoglv64.dll 0000000051ecac3a
nvoglv64.dll 0000000051ec54a8
nvoglv64.dll 0000000051ec5f64
nvoglv64.dll 0000000051ece578
nvoglv64.dll 0000000051ece1ff
nvoglv64.dll 0000000051e099b1
nvoglv64.dll 0000000051e0c834
nvoglv64.dll 000000005279c48f
nvoglv64.dll 00000000527a19c2
nvoglv64.dll 00000000527a1372
nvoglv64.dll 0000000052cb4ee5
nvoglv64.dll 0000000052cb10cb
nvoglv64.dll 0000000052cac9c8
nvoglv64.dll 0000000052cba6cb
nvoglv64.dll 0000000052ca3bdd
...Application code call to vkCreateGraphicsPipelines...

The driver itself catches this SEH exception, returns VK_ERROR_INVALID_SHADER_NV from vkCreateGraphicsPipelines and reports to VK_EXT_debug_report:

flags        = VK_DEBUG_REPORT_ERROR_BIT_EXT
objectType   = VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT
object       = 104066016
location     = 11
messageCode  = 2
pLayerPrefix = "Driver"

pMessage:
Fragment info
-------------
(0) : fatal error C9999: *** exception during compilation ***

I do not have VK_NV_glsl_shader activated. The SPIR-V binary code is as shown in my post above and does work in driver 372.70.

Regards

Alright, i’ve made a minimal repro app that shows the error. Just select the fragment .spv file at the top of the cpp file to see the difference. Comes with the SPIR-V binaries and MSVC 2015 files.

Download here: https://mega.nz/#!NoNi2Y5T!qICW2_K-T5JbaRbHNT2yi2qpqzuno8hI7JT5SfVj7Fk

My system, again, is Win7 SP1 x64 with a GTX970. The last driver version that works with both SPIR-V files is 372.70, later versions up to and including 375.70 fail with frag_minlod.spv.

I would appreciate it if someone with the same or a different system could test this as well. Using the MSVC project the output gets written to stdout.txt.

Regards

Just as an update, the bug is still present in driver 375.86.

Regards

Bump, the bug is still present in driver 375.95.

Thanks for the bug report. We have identified the issue and will make a fix available asap.

Thanks for the report. We have filed an internal bug and fixed the issue. The fix will be included in upcoming new drivers.

This should be fixed in driver 376.33, which was released today.

Thank you, i can confirm that the bug was fixed in driver 376.33.

Regards