diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-05-04 15:30:52 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-05-04 15:30:52 +0300 |
commit | d86d7c935ef3d44890fa71256c9045688fb3044a (patch) | |
tree | 8e11cdd01d38cb5482ad1870dd9d2dc6a33b0721 /source | |
parent | cbeb8770cc4daec5c81f8d8ce060a1b594c039bb (diff) |
Fix T97827: material preview not displaying textures
Caused by rB281bcc1c1dd6 which did not properly made use
of `vec4` for UVs which are now loaded as attributes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl | 7 | ||||
-rw-r--r-- | source/blender/gpu/shaders/material/gpu_shader_material_texture_coordinates.glsl | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl index e0931128485..d7c50e213e5 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_bump.glsl @@ -5,6 +5,13 @@ void differentiate_texco(vec3 v, out vec3 df) df = v + dF_impl(v); } +/* Overload for UVs which are loaded as generic attributes. */ +void differentiate_texco(vec4 v, out vec3 df) +{ + /* Implementation defined. */ + df = v.xyz + dF_impl(v.xyz); +} + void node_bump( float strength, float dist, float height, vec3 N, vec2 dHd, float invert, out vec3 result) { diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_texture_coordinates.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_texture_coordinates.glsl index a3666164cf7..204f134dfa6 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_texture_coordinates.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_texture_coordinates.glsl @@ -1,7 +1,7 @@ void node_tex_coord(mat4 obmatinv, vec3 attr_orco, - vec3 attr_uv, + vec4 attr_uv, out vec3 generated, out vec3 normal, out vec3 uv, @@ -12,7 +12,7 @@ void node_tex_coord(mat4 obmatinv, { generated = attr_orco; normal = normal_world_to_object(g_data.N); - uv = attr_uv; + uv = attr_uv.xyz; object = transform_point((obmatinv[3][3] == 0.0) ? ModelMatrixInverse : obmatinv, g_data.P); camera = coordinate_camera(g_data.P); window = coordinate_screen(g_data.P); |