[Bf-blender-cvs] [decaf3c5213] tmp-texture-sampler: Cleanup: GPU: Remove uneeded texture bind for texture sampling parameters

Clément Foucault noreply at git.blender.org
Mon May 25 11:30:18 CEST 2020


Commit: decaf3c52136de4972e31fc8dd9940c6c04c3dfb
Author: Clément Foucault
Date:   Mon May 25 11:19:49 2020 +0200
Branches: tmp-texture-sampler
https://developer.blender.org/rBdecaf3c52136de4972e31fc8dd9940c6c04c3dfb

Cleanup: GPU: Remove uneeded texture bind for texture sampling parameters

===================================================================

M	source/blender/blenkernel/intern/studiolight.c
M	source/blender/draw/engines/eevee/eevee_lightcache.c
M	source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
M	source/blender/draw/intern/draw_manager_texture.c

===================================================================

diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index aef274f7d91..4892e8d6ede 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -503,10 +503,8 @@ static void studiolight_create_equirect_radiance_gputexture(StudioLight *sl)
     sl->equirect_radiance_gputexture = GPU_texture_create_2d(
         ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, NULL);
     GPUTexture *tex = sl->equirect_radiance_gputexture;
-    GPU_texture_bind(tex, 0);
     GPU_texture_filter_mode(tex, true);
     GPU_texture_wrap_mode(tex, true, true);
-    GPU_texture_unbind(tex);
   }
   sl->flag |= STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE;
 }
@@ -567,10 +565,8 @@ static void studiolight_create_equirect_irradiance_gputexture(StudioLight *sl)
     sl->equirect_irradiance_gputexture = GPU_texture_create_2d(
         ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, NULL);
     GPUTexture *tex = sl->equirect_irradiance_gputexture;
-    GPU_texture_bind(tex, 0);
     GPU_texture_filter_mode(tex, true);
     GPU_texture_wrap_mode(tex, true, true);
-    GPU_texture_unbind(tex);
   }
   sl->flag |= STUDIOLIGHT_EQUIRECT_IRRADIANCE_GPUTEXTURE;
 }
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 614c749b9aa..198d06d845c 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -379,9 +379,7 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
                                                 0,
                                                 false,
                                                 NULL);
-    GPU_texture_bind(lcache->grid_tx.tex, 0);
     GPU_texture_filter_mode(lcache->grid_tx.tex, true);
-    GPU_texture_unbind(lcache->grid_tx.tex);
   }
 
   if (lcache->cube_tx.tex == NULL) {
@@ -406,13 +404,11 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
                                                   NULL);
     }
 
-    GPU_texture_bind(lcache->cube_tx.tex, 0);
-    GPU_texture_mipmap_mode(lcache->cube_tx.tex, true, true);
     for (int mip = 0; mip < lcache->mips_len; mip++) {
       GPU_texture_add_mipmap(
           lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, mip + 1, lcache->cube_mips[mip].data);
     }
-    GPU_texture_unbind(lcache->cube_tx.tex);
+    GPU_texture_mipmap_mode(lcache->cube_tx.tex, true, true);
   }
   return true;
 }
diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
index d2bd653a656..ec7a6bac688 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
@@ -266,13 +266,8 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
                                                 false,
                                                 NULL);
 
-      GPU_texture_bind(txl->smaa_search_tx, 0);
       GPU_texture_filter_mode(txl->smaa_search_tx, true);
-      GPU_texture_unbind(txl->smaa_search_tx);
-
-      GPU_texture_bind(txl->smaa_area_tx, 0);
       GPU_texture_filter_mode(txl->smaa_area_tx, true);
-      GPU_texture_unbind(txl->smaa_area_tx);
     }
   }
   else {
diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c
index 810a2e9389b..7aa0dcb6c22 100644
--- a/source/blender/draw/intern/draw_manager_texture.c
+++ b/source/blender/draw/intern/draw_manager_texture.c
@@ -61,7 +61,6 @@ static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format)
 
 void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags)
 {
-  GPU_texture_bind(tex, 0);
   if (flags & DRW_TEX_MIPMAP) {
     GPU_texture_mipmap_mode(tex, true, flags & DRW_TEX_FILTER);
     GPU_texture_generate_mipmap(tex);
@@ -71,7 +70,6 @@ void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags)
   }
   GPU_texture_wrap_mode(tex, flags & DRW_TEX_WRAP, true);
   GPU_texture_compare_mode(tex, flags & DRW_TEX_COMPARE);
-  GPU_texture_unbind(tex);
 }
 
 GPUTexture *DRW_texture_create_1d(int w,



More information about the Bf-blender-cvs mailing list