You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Debugging an issue running Tomb Raider II by using the mesa/virgl driver within a Qemu VM showed a problem with the gamma correction as done with fshack: The shader doesn't specify any layout for the gamma array values which results that in this case the array values being allocated with a stride of 16 byte (vec4), but when the data is uploaded by using glBufferData it expects that the array is densely packed, and the result is that the "gamma corrected" output has only an incorrect red component.
According to OpenGL 4.6 (Core profile) May 14, 2018, section 7.6.2.2. the uniforms contained within a uniform block are extracted from buffer storage in an implementation-dependent manner and the offsets and alignments can by queried by using glGetActiveUniformsiv, and this latter step is missing here.
To avoid the querying and the dynamic setup of the data to be passed into the buffer one can declare the UBO as std140, and in this case the alignment of each array element is vec4 (according to the same section in the spec).
With that one could, for instance, use a shader like
Debugging an issue running
Tomb Raider II
by using the mesa/virgl driver within a Qemu VM showed a problem with the gamma correction as done with fshack: The shader doesn't specify any layout for the gamma array values which results that in this case the array values being allocated with a stride of 16 byte (vec4), but when the data is uploaded by usingglBufferData
it expects that the array is densely packed, and the result is that the "gamma corrected" output has only an incorrect red component.According to
OpenGL 4.6 (Core profile) May 14, 2018
, section 7.6.2.2. theuniforms contained within a uniform block are extracted from buffer storage in an implementation-dependent manner
and the offsets and alignments can by queried by usingglGetActiveUniformsiv
, and this latter step is missing here.To avoid the querying and the dynamic setup of the data to be passed into the buffer one can declare the UBO as
std140
, and in this case the alignment of each array element isvec4
(according to the same section in the spec).With that one could, for instance, use a shader like
And pack the data passed into an array of
4 * 256 * sizeof(float)
ordered [r,g,b,0].The text was updated successfully, but these errors were encountered: