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-09-02 01:27:41 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-05 18:49:14 +0300
commitf72c1c4547e5fab769c22652d9872192029ad7fe (patch)
tree4b89ee42810e0505ed386b76bf5f76f5d4107a1c /source/blender/draw/intern
parentc598e939ad25dfc3b4eb1c92b16de401bde0d88a (diff)
GPUTexture: Remove bind to edit calls
This is going to be unecessary after the GPU opengl texture backend refactor. For now add a save/restore mechanism to leave the state untouched. Also remove some calls where the caller would bind to particular binding point and set the shader uniform.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_volume.c2
-rw-r--r--source/blender/draw/intern/draw_color_management.c4
-rw-r--r--source/blender/draw/intern/draw_fluid.c2
-rw-r--r--source/blender/draw/intern/draw_manager_texture.c4
4 files changed, 2 insertions, 10 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_volume.c b/source/blender/draw/intern/draw_cache_impl_volume.c
index 825fec83cf1..a74e557cc29 100644
--- a/source/blender/draw/intern/draw_cache_impl_volume.c
+++ b/source/blender/draw/intern/draw_cache_impl_volume.c
@@ -265,10 +265,8 @@ static DRWVolumeGrid *volume_grid_cache_get(Volume *volume,
voxels,
NULL);
- GPU_texture_bind(cache_grid->texture, 0);
GPU_texture_swizzle_set(cache_grid->texture, (channels == 3) ? "rgb1" : "rrr1");
GPU_texture_wrap_mode(cache_grid->texture, false, false);
- GPU_texture_unbind(cache_grid->texture);
MEM_freeN(voxels);
diff --git a/source/blender/draw/intern/draw_color_management.c b/source/blender/draw/intern/draw_color_management.c
index 33000d1ecd0..bd851dc4ba7 100644
--- a/source/blender/draw/intern/draw_color_management.c
+++ b/source/blender/draw/intern/draw_color_management.c
@@ -53,10 +53,10 @@ void DRW_transform_none(GPUTexture *tex)
GPUBatch *geom = DRW_cache_fullscreen_quad_get();
GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_IMAGE_COLOR);
GPU_batch_uniform_4f(geom, "color", 1.0f, 1.0f, 1.0f, 1.0f);
- GPU_batch_uniform_1i(geom, "image", 0);
+ GPU_batch_texture_bind(geom, "image", tex);
- GPU_texture_bind(tex, 0);
GPU_batch_draw(geom);
+
GPU_texture_unbind(tex);
}
diff --git a/source/blender/draw/intern/draw_fluid.c b/source/blender/draw/intern/draw_fluid.c
index fea379126d2..89714c04351 100644
--- a/source/blender/draw/intern/draw_fluid.c
+++ b/source/blender/draw/intern/draw_fluid.c
@@ -128,9 +128,7 @@ static void swizzle_texture_channel_single(GPUTexture *tex)
{
/* Swizzle texture channels so that we get useful RGBA values when sampling
* a texture with fewer channels, e.g. when using density as color. */
- GPU_texture_bind(tex, 0);
GPU_texture_swizzle_set(tex, "rrr1");
- GPU_texture_unbind(tex);
}
static GPUTexture *create_field_texture(FluidDomainSettings *fds)
diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c
index b94a6db3bad..083d5224e16 100644
--- a/source/blender/draw/intern/draw_manager_texture.c
+++ b/source/blender/draw/intern/draw_manager_texture.c
@@ -67,9 +67,7 @@ void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags)
if (flags & DRW_TEX_MIPMAP) {
GPU_texture_mipmap_mode(tex, true, flags & DRW_TEX_FILTER);
- GPU_texture_bind(tex, 0);
GPU_texture_generate_mipmap(tex);
- GPU_texture_unbind(tex);
}
else {
GPU_texture_filter_mode(tex, flags & DRW_TEX_FILTER);
@@ -172,9 +170,7 @@ void DRW_texture_ensure_2d(
void DRW_texture_generate_mipmaps(GPUTexture *tex)
{
- GPU_texture_bind(tex, 0);
GPU_texture_generate_mipmap(tex);
- GPU_texture_unbind(tex);
}
void DRW_texture_free(GPUTexture *tex)