Addressing the 4.1 pass and make sure it works on windows pc and mac

This commit is contained in:
sam gateau 2018-10-01 11:51:46 -07:00
parent 305ea80a18
commit c12115bfda

View file

@ -39,16 +39,21 @@ vec3 unpackSnorm3x10_1x2(int packedX10Y10Z10A2) {
#if defined(GPU_GL410) #if defined(GPU_GL410)
layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer; layout(binding=0) uniform samplerBuffer blendshapeOffsetsBuffer;
BlendshapeOffset getBlendshapeOffset(int i) { BlendshapeOffset getBlendshapeOffset(int i) {
int offset = 3 * i; vec4 fetched = texelFetch(blendshapeOffsetsBuffer, i);
BlendshapeOffset blendshapeOffset; ivec4 elem_packed = ivec4(floatBitsToUint(fetched.x), floatBitsToUint(fetched.y), floatBitsToUint(fetched.z), floatBitsToUint(fetched.w));
blendshapeOffset.position = texelFetch(blendshapeOffsetsBuffer, offset);
BlendshapeOffset unpacked;
vec2 pZnZ = unpackHalf2x16(uint(elem_packed.y));
unpacked.position = vec3(unpackHalf2x16(uint(elem_packed.x)), pZnZ.x);
<@if USE_NORMAL@> <@if USE_NORMAL@>
blendshapeOffset.normal = texelFetch(blendshapeOffsetsBuffer, offset + 1); unpacked.normal = vec3(unpackHalf2x16(uint(elem_packed.z)), pZnZ.y);
//unpacked.normal = unpackSnorm3x10_1x2((elem_packed.z)).xyz;
<@endif@> <@endif@>
<@if USE_TANGENT@> <@if USE_TANGENT@>
blendshapeOffset.tangent = texelFetch(blendshapeOffsetsBuffer, offset + 2); unpacked.tangent = unpackSnorm3x10_1x2((elem_packed.w)).xyz;
<@endif@> <@endif@>
return blendshapeOffset;
return unpacked;
} }
#else #else
layout(std140, binding=0) buffer blendshapeOffsetsBuffer { layout(std140, binding=0) buffer blendshapeOffsetsBuffer {