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:
authorBrecht Van Lommel <brecht@blender.org>2020-05-07 23:01:26 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-05-07 23:02:39 +0300
commit05fafb05b199729916f10504336747a504cf8563 (patch)
treee7b18c0bd67d946d6245dcd15743413a25cfd159 /source/blender/gpu/intern/gpu_texture.c
parent5473f0c49dc8e6bd4708ab48bb944b7265c88ace (diff)
Fix T76510: Eevee OpenVDB render artifacts due to texture clamping
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.c')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 686a20d05a8..fd01ddf8597 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1856,11 +1856,11 @@ void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter)
glTexParameteri(tex->target_base, GL_TEXTURE_MAG_FILTER, filter);
}
-void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
+void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat, bool use_clamp)
{
WARN_NOT_BOUND(tex);
- GLenum repeat = (use_repeat) ? GL_REPEAT : GL_CLAMP_TO_EDGE;
+ GLenum repeat = (use_repeat) ? GL_REPEAT : (use_clamp) ? GL_CLAMP_TO_EDGE : GL_CLAMP_TO_BORDER;
glActiveTexture(GL_TEXTURE0 + tex->number);
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_S, repeat);
@@ -1870,6 +1870,11 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
if (tex->target_base == GL_TEXTURE_3D) {
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_R, repeat);
}
+
+ if (repeat == GL_CLAMP_TO_BORDER) {
+ const float black[] = {0.0f, 0.0f, 0.0f, 0.0f};
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, black);
+ }
}
void GPU_texture_swizzle_channel_auto(GPUTexture *tex, int channels)