[SOLVED] GL_NV_command_list & Shader Storage Buffers

Hi,

I am trying to switch my rendering pipeline to be using the GL_NV_command_list extension.

The current issue I am running into is, that GL_NV_command_list forbids using shaders with shader storage buffers.

The specification sais, that an alternative exists:

  1. How can I use textures, images, shader storage or atomic counter buffers in combination with state objects?
    […]
    Shader storage […] are currently not directly exposed, however NV_gpu_shader5 allows storing pointers to such buffers inside uniform buffers
    […]
    (http://developer.download.nvidia.com/opengl/specs/GL_NV_command_list.txt)

However, in the specification of gpu_shader5 I couldn’t find any informations how to do this http://developer.download.nvidia.com/opengl/specs/GL_NV_gpu_shader5.txt

The nearest thing I could find was the NV_shader_buffer_load extension which doesn’t work with uniform buffer blocks and so is useless for command_lists.

Is there any way I can get the functionality of shader storage buffers (arrays with unknown length at compile time) to work with command-lists?

Not sure if that is covered by our nvpro-samples, but there are some basic and advanced GL_NV_command_list examples here:
[url]https://github.com/nvpro-samples[/url]

Check the READMEs of these examples:
gl_cadscene_rendertechniques
gl_commandlist_bk3d_models
gl_commandlist_basic

Hi,

NV_shader_buffer_load/store are implicitly part of NV_gpu_shader5 and the extensions that give you this functionality, you would work directly with pointers to those buffers that you store within the UBO.

layout(commandBindableNV) uniform;

struct SomeStruct {
  vec4  blah;
  ivec4 blubb;
};

layout(std140,binding=0) uniform myUbo {
  SomeStruct*  customData;
  vec4*        rawData;
};


// later use just like SSBO's unsized array
...

  rawData[i] = foo;

Hey thanks for your answers.

@ChristophKubish Works flawlessly :)

For future readers: If the glsl throws strange error messages, recheck, whether you are using the commandBindableNV layout.

hi, now I want to use the bindless techniqeu in my cluster fowrard pipeline, I do not use the token technique, so i do not use the layout(commandBindableNV) uniform;
in the shader i write like this:

#extension GL_ARB_gpu_shader_int64 : enable
#extension GL_ARB_bindless_texture : enable
#extension GL_ARB_gpu_shader5 : enable
#extension GL_NV_shader_buffer_load : enable
layout(std140) uniform RenderPipeline
{
mat4 SpotLightViewProjMatices[4];
sampler2D EnvTexture;
sampler2D ShadowMap;
uvec2* LightGrid_Cluster;
uint* LightIndexList_Cluster;
};

and in the C++, i get the texture handle for EnvTexture and ShadowMap like this:

{ mHandle = glGetTextureSamplerHandleARB(mResource, mSamplerState->mResource); });
glMakeTextureHandleResidentARB(mHandle)
}

and then i get the storage buffer handle for LightGrid_Cluster and LightIndexList_Cluster like this:

{
glGetNamedBufferParameterui64vNV(mResource, GL_BUFFER_GPU_ADDRESS_NV, &mHandle)
glMakeNamedBufferResidentNV(mResource, GL_READ_ONLY)
}

i write the texture handle and the strorage buffer handle to the uniform buffer like this:
{
glNamedBufferSubDataEXT(currentUniformBuffer->mResource, currentUniformBuffer->mOffset, handleCount *
sizeof(GLuint64), Handles)
}

the result is that the EnvTexture and ShadowMap can worked, but the storage buffer can not worked, can you help me to figure out where the problem is it ?

@ChristophKubish

Hi, don’t see a fundamental issue with this setup. Just double check the content of the UBO ensuring the pointer values are properly set.

yes, it worked, thanks very much!!! there are some mistakes in my c++ code with subdata the uniform

@ChristophKubish I finished the bindless work, I place the texture and storage buffer in the uniform buffer, and use the glBufferAddressRangeNV() for the VBO, IBO, UBO, when I run the program, at first it can render the scene, after a while, the program crashed in the nvoglv64.dll, there are not any used information for debug the program, the crashed information is as follow:

nvoglv64.dll!0000000052fead29()	未知
nvoglv64.dll!0000000052befa33()	未知
nvoglv64.dll!0000000052c3fd6f()	未知
nvoglv64.dll!0000000052c3e0c6()	未知
nvoglv64.dll!0000000052c2c076()	未知
nvoglv64.dll!0000000052d34f0e()	未知
nvoglv64.dll!0000000052d37cc4()	未知
nvoglv64.dll!0000000052d36f9d()	未知
nvoglv64.dll!0000000052d381cb()	未知
nvoglv64.dll!0000000052d4f5d9()	未知
nvoglv64.dll!0000000052becb6e()	未知
nvoglv64.dll!0000000052d119b2()	未知
nvoglv64.dll!0000000052cd5786()	未知
nvoglv64.dll!0000000052d358d7()	未知
nvoglv64.dll!0000000052d48806()	未知
nvoglv64.dll!0000000052cf1b5d()	未知
nvoglv64.dll!0000000052c27a84()	未知
nvoglv64.dll!0000000052bfdc00()	未知
nvoglv64.dll!0000000052bfdda5()	未知
nvoglv64.dll!0000000052bfdb8e()	未知
nvoglv64.dll!0000000052bfd686()	未知
nvoglv64.dll!0000000052be6d3c()	未知
opengl32.dll!wglSwapBuffers()	未知
gdi32full.dll!SwapBuffers()	未知

T3d.dll!T3D::WGLContext::swapBuffer() line 43 C++

or :

nvoglv64.dll!0000000052f0ad29()	未知
nvoglv64.dll!0000000052b0fa33()	未知
nvoglv64.dll!0000000052b5fd6f()	未知
nvoglv64.dll!0000000052b5e0c6()	未知
nvoglv64.dll!0000000052b4c076()	未知
nvoglv64.dll!0000000052c54f0e()	未知
nvoglv64.dll!0000000052c57cc4()	未知
nvoglv64.dll!0000000052c56f9d()	未知
nvoglv64.dll!0000000052c581cb()	未知
nvoglv64.dll!0000000052c6f5d9()	未知
nvoglv64.dll!0000000052b0cb6e()	未知
nvoglv64.dll!0000000052c319b2()	未知
nvoglv64.dll!0000000052bf5786()	未知
nvoglv64.dll!0000000052c558d7()	未知
nvoglv64.dll!0000000052c5529a()	未知
nvoglv64.dll!0000000052c58404()	未知
nvoglv64.dll!0000000052b38a83()	未知
nvoglv64.dll!0000000052d0e7b2()	未知
nvoglv64.dll!0000000052bc7b2d()	未知
nvoglv64.dll!0000000052b73d08()	未知
nvoglv64.dll!0000000052b7c8ed()	未知
nvoglv64.dll!00000000527cfc39()	未知
nvoglv64.dll!00000000527dd2c0()	未知

glNamedBufferSubData() line 2138

can you give me some suggestion?