testing nv command list

Hi All,

I’ve posted this on Nvidia forums, but maybe someone here can help me too :slight_smile:

I’m beginning to play with this extension and tried to run the following code:


UniformAddressCommandNV u;
u.header = glGetCommandHeaderNV(GL_UNIFORM_ADDRESS_COMMAND_NV, sizeof UniformAddressCommandNV);
u.index = (unsigned short)materialUniLoc;
u.stage = glGetStageIndexNV(GL_FRAGMENT_SHADER);
u.addressLo = getAddressLo(myMeshes[n].uniformGPUAddr[MATERIAL_BUFFER]);
u.addressHi = getAddressHi(myMeshes[n].uniformGPUAddr[MATERIAL_BUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, commandBuffer);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof UniformAddressCommandNV, &u);
glBindBuffer(GL_ARRAY_BUFFER, 0);

GLintptr indirects[1];
GLsizei sizes[1];
indirects[0] = 0;
sizes[0] = sizeof UniformAddressCommandNV;

glDrawCommandsNV(GL_TRIANGLES, commandBuffer, indirects, sizes, 1);

The above code gives me an error, using the debug extension, in the glDrawCommandsNV line:
Type: Error; Source: API; ID: 1282; Severity: High
GL_INVALID_OPERATION error generated. Array object is not active.

However, if doing the line below instead it works OK.


glBufferAddressRangeNV(GL_UNIFORM_BUFFER_ADDRESS_NV, materialUniLoc, 
myMeshes[n].uniformGPUAddr[MATERIAL_BUFFER], 0x10000/*sizeof(struct MyMaterial)*/);

From the spec these seem identical. Cn anyone help me with this?

Best regards,

António

[QUOTE=Antonio;1282965]The above code gives me an error, using the debug extension, in the glDrawCommandsNV line:
Type: Error; Source: API; ID: 1282; Severity: High
GL_INVALID_OPERATION error generated. Array object is not active.[/QUOTE]

Sounds like you might be running with a core context in GL 3.0+ which requires a non-zero VAO to be bound for some GL commands (a netsearch indicates the above error refers to the bound VAO. Might try a compatibility context or just create a dummy VAO and leave it bound if you’re not using VAOs (bindless perf beats VAOs anyway in my experience).

Failing that, ensure that neither of these conditions listed in the NV_command_list extension for this call are true:

Thanks Dark Photon

Spot on! No more error. I knew he was complaining about a VAO, but it didn’t (and still doesn’t) make sense to me why a VAO should be bound for glDrawCommandsNV.

Thanks a lot.

Still not getting the same behaviour though. Using glBindBufferRange produces the right colors, but the token alone seems to have no effect.

Best Regards,

António

I got it working as long as I do the actual drawing with the list. It seems that the binds performed in the list are gone once the command is done. Is that the case?

Best Regards,

António

NV_command_list does not work with glBindBufferRange. Or buffer binding of any sort. It only works with bindless stuff. You must use bindless vertex arrays, bindless textures, and bindless uniform buffers.

If you’re using NV_command_list, you should never be calling glBindBufferRange (or Base).