Help end child hunger

I don’t know where to put this. I’ve tried the AMD forum but got no reply. So here goes:

I’ve only tested this on Windows 7 64 bits. Anyone with different/same results on same or other systems?

 – ARB Debug Output Extension

When not in debug mode the following instruction causes an Access Violation in Visual Studio:

glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);

This only occurs when not in Debug OpenGL context  and it does not cause any problem with nVidia hardware.

I’ve not tried it with Linux yet.

 

- Uniform Buffers

Consider a uniform block declared as follows:

layout (std140) uniform Matrices {

	mat4 modelviewMatrix;
	mat4 projModelViewMatrix;
	mat3 normalMatrix[2];
};

This is what I get when I use glGetActiveUniformsiv to retrieve info on the block:

Matrices, Binding: 2 Datasize: 320 ActiveUniforms: 3
Referenced by: TessEval  Shader(s)
modelviewMatrix 1 16 mat4 0
normalMatrix 2 16 mat3 128
projModelViewMatrix 1 16 mat4 64

The data for each uniform is size, matrix stride, type and offset.

My problem lies with the size of the buffer. AMD’s driver claims, as shown above, that the size is 320, but in reality it is 224 (nVidia reports the right value), considering the reported matrix stride of 16. The math is pretty simple:

16×4 = 64 bytes for each 4×4 matrix times 2 = 128

16×3 = 48 bytes for each 3×3 matrix times 2 = 96

Total = 128 + 96 = 224.

Strangely enough,  if I define the normalMatrix as an array with 3 mat3 (so one more than previously), I get a reported data size of 464.

I’ve tested several possibilities to set one of the mat3 without success. With nVidia it works OK . The only difference in the information reported, besides the data size, is the name of the normalMatrix uniform, that nVidia chooses to call it normalMatrix[0].

 

- Querying the primitive counter

I always get zero! Again works nicely in nVidia.

2 Responses to “AMD Catalyst 11.9 Bugs?”

  1. Just for the math.

    mat4 = (4 * 4) * float (4 bytes) = 64 bytes
    mat3 = (3 * 3) * float (4 bytes) = 36 bytes

    total: mat4*2 + mat3*2 = 2*64 bytes + 2*36 bytes = 200 bytes

    correct me if I am wrong.

    • Hi Namarius,

      That would be too easy :-)

      The issue is related to how matrix’s columns/rows are stored in a Uniform buffer. Each column of a mat3 is a vec3, and the are three of these. The stride between columns can be obtained with glGetActiveUniformsiv(p, 1, &indices[k], GL_UNIFORM_MATRIX_STRIDE, &uniStride);, and in particular the stride for mat3 is 16, meaning each column takes up 16 bytes. Hence 16×3 = 48. (Spec section 2.11.7).

      OpenGL stores each column/row as if it were a vector, and the base alignment in this case is 4, not 3.

      Hope I got it clearer now :-)

Leave a Reply

(required)

(required)


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha