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-07-16 21:56:17 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-18 04:43:51 +0300
commit2840782d8478f1c37c2aa91cc7f12c8e1f4dca0a (patch)
treeb6da922d89a166fd1653e273f7bf6eb346c3d25c /source/blender/gpu/intern/gpu_texture.c
parent02c09773ea07c8c0a3d7be63abdfd963a9452402 (diff)
Cleanup: GPU: Make icon drawing use GPUTexture
This remove all gl function calls. Adds a new sampler only for icon drawing.
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.c')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 56e82b94fd2..251a4d71597 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -52,6 +52,7 @@ static struct GPUTextureGlobal {
GPUTexture *invalid_tex_3D;
/** Sampler objects used to replace internal texture parameters. */
GLuint samplers[GPU_SAMPLER_MAX];
+ GLuint icon_sampler;
} GG = {NULL};
/* Maximum number of FBOs a texture can be attached to. */
@@ -2176,11 +2177,23 @@ void GPU_samplers_init(void)
* - GL_TEXTURE_LOD_BIAS is 0.0f.
**/
}
+
+ /* Custom sampler for icons. */
+ glGenSamplers(1, &GG.icon_sampler);
+ glSamplerParameteri(GG.icon_sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+ glSamplerParameteri(GG.icon_sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glSamplerParameteri(GG.icon_sampler, GL_TEXTURE_LOD_BIAS, -0.5f);
+}
+
+void GPU_sampler_icon_bind(int unit)
+{
+ glBindSampler(unit, GG.icon_sampler);
}
void GPU_samplers_free(void)
{
glDeleteSamplers(GPU_SAMPLER_MAX, GG.samplers);
+ glDeleteSamplers(1, &GG.icon_sampler);
}
/** \} */