Work around an issue with Intel Gen7/7.5 GPUs where matrices default to being row major if they are not directly assigned to a matrix that has a column major layout.

This commit is contained in:
Lippy13 2020-08-31 19:50:45 +01:00
parent 7efa3373f6
commit 7c33e7d714
2 changed files with 6 additions and 5 deletions

View File

@ -73,8 +73,9 @@ void main() {
// Pre-calculate bone matrix
/* uint bone_idx = (v_ao_bone >> 2) & 0x3Fu; */
uint bone_idx = (v_pos_norm >> 27) & 0xFu;
BoneData bone_data = bones[bone_idx];
mat4 bone_mat = bone_data.bone_mat;
mat4 bone_mat = bones[bone_idx].bone_mat;
mat4 normals_mat = bones[bone_idx].normals_mat;
mat4 combined_mat = /*model_mat * */bone_mat;
vec3 pos = (vec3((uvec3(v_pos_norm) >> uvec3(0, 9, 18)) & uvec3(0x1FFu)) - 256.0) / 2.0;
@ -105,7 +106,7 @@ void main() {
// vec3 norm = normals[normal_idx];
uint axis_idx = v_atlas_pos & 3u;
vec3 norm = bone_data.normals_mat[axis_idx].xyz;
vec3 norm = normals_mat[axis_idx].xyz;
// norm = normalize(norm);
// vec3 norm = norm_mat * vec4(uvec3(1 << axis_idx) & uvec3(0x1u, 0x3u, 0x7u), 1);

View File

@ -154,8 +154,8 @@ float ShadowCalculationDirected(in vec3 fragPos)//in vec4 /*light_pos[2]*/sun_po
} */
// vec3 fragPos = sun_pos.xyz;// / sun_pos.w;//light_pos[lightIndex].xyz;
// sun_pos.z += sun_pos.w * bias;
ShadowLocals sun_shadow = shadowMats[0];
vec4 sun_pos = sun_shadow.texture_mat * vec4(fragPos, 1.0);
mat4 texture_mat = shadowMats[0].texture_mat;
vec4 sun_pos = texture_mat * vec4(fragPos, 1.0);
// sun_pos.z -= sun_pos.w * bias;
float visibility = textureProj(t_directed_shadow_maps, sun_pos);
/* float visibilityLeft = textureProj(t_directed_shadow_maps, sun_shadow.texture_mat * vec4(fragPos + vec3(0.0, -diskRadius, 0.0), 1.0));