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:
authorClément Foucault <foucault.clem@gmail.com>2020-06-03 14:03:36 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-06-03 17:18:50 +0300
commit866e067d65c1691941865ee426bc0dac5c9e3f95 (patch)
tree1cefca57555fcfb6d22890443f6af5c7ce981ea3 /source/blender/gpu/intern/gpu_texture.c
parent4184371fb04e6328f74eab8e27636580e10e84fb (diff)
GPUTexture: Add support for binding textures with custom sampler states
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.c')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 95d33a03d93..4ae897600e0 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1713,7 +1713,7 @@ void GPU_invalid_tex_free(void)
}
/* set_number is to save the the texture unit for setting texture parameters. */
-void GPU_texture_bind_ex(GPUTexture *tex, int unit, const bool set_number)
+void GPU_texture_bind_ex(GPUTexture *tex, eGPUSamplerState state, int unit, const bool set_number)
{
BLI_assert(unit >= 0);
@@ -1740,9 +1740,11 @@ void GPU_texture_bind_ex(GPUTexture *tex, int unit, const bool set_number)
glActiveTexture(GL_TEXTURE0 + unit);
+ state = (state < GPU_SAMPLER_MAX) ? state : tex->sampler_state;
+
if (tex->bindcode != 0) {
glBindTexture(tex->target, tex->bindcode);
- glBindSampler(unit, GG.samplers[tex->sampler_state]);
+ glBindSampler(unit, GG.samplers[state]);
}
else {
GPU_invalid_tex_bind(tex->target_base);
@@ -1752,7 +1754,7 @@ void GPU_texture_bind_ex(GPUTexture *tex, int unit, const bool set_number)
void GPU_texture_bind(GPUTexture *tex, int unit)
{
- GPU_texture_bind_ex(tex, unit, true);
+ GPU_texture_bind_ex(tex, GPU_SAMPLER_MAX, unit, true);
}
void GPU_texture_unbind(GPUTexture *tex)