View Full Version : glGetActiveUniformBlock on ATI
05-14-2010, 02:56 PM
I'm trying to query the uniform block name in the following shader:
layout(std140) uniform RedBlock
uniform float red;
out vec4 FragColor;
FragColor = vec4(red, 0, 0, 1);
On an ATI Radeon HD 5870 with Catalyst 10.4, glGetActiveUniformBlockName(program, 0, ...) returns "" instead of "RedBlock." Although, calls to glGetActiveUniformBlock(program, 0, ...) return correct data. I am fairly new to UBOs so I may be doing something wrong but this code works on the NVIDIA cards I tried.
05-14-2010, 05:45 PM
How do you know that it is uniform block index 0?
05-15-2010, 04:50 AM
I called GetProgramiv with ACTIVE_UNIFORM_BLOCKS and it returned one. Perhaps, I've misunderstood glGetActiveUniformBlockName in the spec but I thought that meant the uniform block must be at index zero:
uniformBlockIndex must be an active uniform block index of program, in the range zero to the value of ACTIVE_UNIFORM_BLOCKS - 1. The value of ACTIVE_-UNIFORM_BLOCKS can be queried with GetProgramiv...
If there is another way I should be querying uniform blocks, I'd be happy to do it.
Here's my code (C#/OpenTK):
private static UniformBlockCollection FindUniformBlocks(int program)
GL.GetProgram(program, ProgramParameter.ActiveUniformBlocks, out numberOfUniformBlocks);
UniformBlockCollection uniformBlocks = new UniformBlockCollection();
for (int i = 0; i < numberOfUniformBlocks; ++i)
string uniformBlockName = GL.GetActiveUniformBlockName(program, i);
GL.GetActiveUniformBlock(program, i, ActiveUniformBlockParameter.UniformBlockDataSize, out uniformBlockSizeInBytes);
GL.GetActiveUniformBlock(program, i, ActiveUniformBlockParameter.UniformBlockActiveUnif orms, out numberOfUniformsInBlock);
int uniformIndicesInBlock = new int[numberOfUniformsInBlock];
GL.GetActiveUniformBlock(program, i, ActiveUniformBlockParameter.UniformBlockActiveUnif ormIndices, uniformIndicesInBlock);
Only the call to GL.GetActiveUniformBlockName returns incorrect data, the later calls to GL.GetActiveUniformBlock return correct information.
05-17-2010, 01:34 AM
Yep, I have same issue with UBO on the current ATI 3.3/4.0 beta drivers - this lead me to abandon UBO instancing support in my engine (for now) and use TBO instead.
Yes, the first block will have an index of 0!
My code, however, relys upon obtaining the index from the blockname - so this had to work --- and it does NOT!
08-04-2010, 02:50 AM
This is no longer an issue in AMD OpenGL drivers.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.