Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Emara <mail@OmarEmara.dev>2022-05-20 14:00:43 +0300
committerOmar Emara <mail@OmarEmara.dev>2022-05-20 14:00:43 +0300
commit48006f8b5f72b233986f83bbd20a4370c6afd89d (patch)
tree277f65e497620a5b0d94194b1f721960f553babb /source/blender/gpu/shaders
parentda8844d73ed91b107691eb7a7b80c26ddd19faf0 (diff)
Viewport Compositor: Avoid using mat3 uniforms
Mat3 uniforms suffer from alignment issues that are not easy to fix, so just use mat4 uniforms for such matrices.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl2
-rw-r--r--source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh2
-rw-r--r--source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh2
3 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl b/source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl
index 9a74c7489c3..860571db025 100644
--- a/source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl
+++ b/source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl
@@ -7,7 +7,7 @@ void main()
/* First, transform the input image by transforming the domain coordinates with the inverse of
* input image's transformation. The inverse transformation is an affine matrix and thus the
* coordinates should be in homogeneous coordinates. */
- vec2 coordinates = (inverse_transformation * vec3(xy, 1.0)).xy;
+ vec2 coordinates = (mat3(inverse_transformation) * vec3(xy, 1.0)).xy;
/* Since an input image with an identity transformation is supposed to be centered in the domain,
* we subtract the offset between the lower left corners of the input image and the domain, which
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh b/source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh
index 6d8cb5a842b..9c3e075c965 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh
+++ b/source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh
@@ -5,7 +5,7 @@
GPU_SHADER_CREATE_INFO(compositor_filter)
.local_group_size(16, 16)
- .push_constant(Type::MAT3, "kernel")
+ .push_constant(Type::MAT4, "kernel")
.sampler(0, ImageType::FLOAT_2D, "input_image")
.sampler(1, ImageType::FLOAT_2D, "factor")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_image")
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh b/source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh
index 92e74448fda..249a0cd974c 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh
+++ b/source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh
@@ -5,7 +5,7 @@
GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_shared)
.local_group_size(16, 16)
- .push_constant(Type::MAT3, "inverse_transformation")
+ .push_constant(Type::MAT4, "inverse_transformation")
.sampler(0, ImageType::FLOAT_2D, "input_sampler")
.compute_source("compositor_realize_on_domain.glsl");