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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-08-01 19:07:19 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-08-01 23:08:36 +0300
commit4510f30026da8eb090062687f386b9e3a7cf3fa3 (patch)
tree33ef904a1f614f71d797aca3d07167f7335cf4ac /source
parentc6f55fb0db126281309a2082abf2f480a4671dc5 (diff)
GPUMaterial: Fix nearest sampling
texelFetch return vec4(0.0) if the target pixel is outside the texture rect. So we mimic the default repeate mode that we have for linear interpolation. Fix T56156 Mapping-Node doesn't work
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 464851bae21..8cc603696df 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1809,7 +1809,7 @@ void node_tex_image_linear(vec3 co, sampler2D ima, out vec4 color, out float alp
void node_tex_image_nearest(vec3 co, sampler2D ima, out vec4 color, out float alpha)
{
- ivec2 pix = ivec2(co.xy * textureSize(ima, 0).xy);
+ ivec2 pix = ivec2(fract(co.xy) * textureSize(ima, 0).xy);
color = texelFetch(ima, pix, 0);
alpha = color.a;
}