[Bf-blender-cvs] [42e5de3f4d7] tmp-gltexture: Cleanup: GPUTexture: Remove use of GPU_texture_create_nD

Clément Foucault noreply at git.blender.org
Sat Sep 5 01:58:28 CEST 2020


Commit: 42e5de3f4d76c29aa8b6cacf4d7c0db3cfffe6ae
Author: Clément Foucault
Date:   Fri Sep 4 22:56:30 2020 +0200
Branches: tmp-gltexture
https://developer.blender.org/rB42e5de3f4d76c29aa8b6cacf4d7c0db3cfffe6ae

Cleanup: GPUTexture: Remove use of GPU_texture_create_nD

Use creation + update function instead.

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

M	source/blender/blenfont/intern/blf_glyph.c
M	source/blender/blenkernel/intern/studiolight.c
M	source/blender/draw/engines/eevee/eevee_lightcache.c
M	source/blender/draw/engines/gpencil/gpencil_antialiasing.c
M	source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
M	source/blender/draw/intern/draw_fluid.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/imbuf/intern/util_gpu.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index f46a74a739a..b06037cf6ec 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -508,8 +508,7 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl
       if (gc->texture) {
         GPU_texture_free(gc->texture);
       }
-      gc->texture = GPU_texture_create_nD(
-          w, h, 0, 1, NULL, GPU_R8, GPU_DATA_UNSIGNED_BYTE, 0, false, NULL);
+      gc->texture = GPU_texture_create_1d_array(w, h, GPU_R8, false, NULL);
 
       gc->bitmap_len_landed = 0;
     }
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 10830a3d4ba..e08d301e5a6 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -520,16 +520,9 @@ static void studiolight_create_matcap_gputexture(StudioLightImage *sli)
     copy_v3_v3(*offset3, *offset4);
   }
 
-  sli->gputexture = GPU_texture_create_nD(ibuf->x,
-                                          ibuf->y,
-                                          0,
-                                          2,
-                                          gpu_matcap_3components,
-                                          GPU_R11F_G11F_B10F,
-                                          GPU_DATA_FLOAT,
-                                          0,
-                                          false,
-                                          NULL);
+  sli->gputexture = GPU_texture_create_2d(ibuf->x, ibuf->y, GPU_R11F_G11F_B10F, NULL, NULL);
+  GPU_texture_update(sli->gputexture, GPU_DATA_FLOAT, gpu_matcap_3components);
+
   MEM_SAFE_FREE(gpu_matcap_3components);
 }
 
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 088a08fb51a..2d846ccd1d6 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -401,16 +401,9 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
   }
 
   if (lcache->grid_tx.tex == NULL) {
-    lcache->grid_tx.tex = GPU_texture_create_nD(lcache->grid_tx.tex_size[0],
-                                                lcache->grid_tx.tex_size[1],
-                                                lcache->grid_tx.tex_size[2],
-                                                2,
-                                                lcache->grid_tx.data,
-                                                IRRADIANCE_FORMAT,
-                                                GPU_DATA_UNSIGNED_BYTE,
-                                                0,
-                                                false,
-                                                NULL);
+    lcache->grid_tx.tex = GPU_texture_create_2d_array(
+        UNPACK3(lcache->grid_tx.tex_size), IRRADIANCE_FORMAT, NULL, NULL);
+    GPU_texture_update(lcache->grid_tx.tex, GPU_DATA_UNSIGNED_BYTE, lcache->grid_tx.data);
 
     if (lcache->grid_tx.tex == NULL) {
       lcache->flag |= LIGHTCACHE_NOT_USABLE;
@@ -422,24 +415,17 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
 
   if (lcache->cube_tx.tex == NULL) {
     if (GPU_arb_texture_cube_map_array_is_supported()) {
-      lcache->cube_tx.tex = GPU_texture_cube_create(lcache->cube_tx.tex_size[0],
-                                                    lcache->cube_tx.tex_size[2] / 6,
-                                                    lcache->cube_tx.data,
-                                                    GPU_R11F_G11F_B10F,
-                                                    GPU_DATA_10_11_11_REV,
-                                                    NULL);
+      lcache->cube_tx.tex = GPU_texture_create_cube_array(lcache->cube_tx.tex_size[0],
+                                                          lcache->cube_tx.tex_size[2] / 6,
+                                                          GPU_R11F_G11F_B10F,
+                                                          NULL,
+                                                          NULL);
+      GPU_texture_update(lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, lcache->cube_tx.data);
     }
     else {
-      lcache->cube_tx.tex = GPU_texture_create_nD(lcache->cube_tx.tex_size[0],
-                                                  lcache->cube_tx.tex_size[1],
-                                                  lcache->cube_tx.tex_size[2],
-                                                  2,
-                                                  lcache->cube_tx.data,
-                                                  GPU_R11F_G11F_B10F,
-                                                  GPU_DATA_10_11_11_REV,
-                                                  0,
-                                                  false,
-                                                  NULL);
+      lcache->cube_tx.tex = GPU_texture_create_2d_array(
+          UNPACK3(lcache->cube_tx.tex_size), GPU_R11F_G11F_B10F, NULL, NULL);
+      GPU_texture_update(lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, lcache->cube_tx.data);
     }
 
     if (lcache->cube_tx.tex == NULL) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_antialiasing.c b/source/blender/draw/engines/gpencil/gpencil_antialiasing.c
index b9600ad8caf..ac96a599eb6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_antialiasing.c
+++ b/source/blender/draw/engines/gpencil/gpencil_antialiasing.c
@@ -56,27 +56,12 @@ void GPENCIL_antialiasing_init(struct GPENCIL_Data *vedata)
   }
 
   if (txl->smaa_search_tx == NULL) {
-    txl->smaa_search_tx = GPU_texture_create_nD(SEARCHTEX_WIDTH,
-                                                SEARCHTEX_HEIGHT,
-                                                0,
-                                                2,
-                                                searchTexBytes,
-                                                GPU_R8,
-                                                GPU_DATA_UNSIGNED_BYTE,
-                                                0,
-                                                false,
-                                                NULL);
-
-    txl->smaa_area_tx = GPU_texture_create_nD(AREATEX_WIDTH,
-                                              AREATEX_HEIGHT,
-                                              0,
-                                              2,
-                                              areaTexBytes,
-                                              GPU_RG8,
-                                              GPU_DATA_UNSIGNED_BYTE,
-                                              0,
-                                              false,
-                                              NULL);
+    txl->smaa_search_tx = GPU_texture_create_2d(
+        SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, GPU_R8, NULL, NULL);
+    GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UNSIGNED_BYTE, searchTexBytes);
+
+    txl->smaa_area_tx = GPU_texture_create_2d(AREATEX_WIDTH, AREATEX_HEIGHT, GPU_RG8, NULL, NULL);
+    GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UNSIGNED_BYTE, areaTexBytes);
 
     GPU_texture_filter_mode(txl->smaa_search_tx, true);
     GPU_texture_filter_mode(txl->smaa_area_tx, true);
diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
index 47a03073839..9d5ff47fc82 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
@@ -242,27 +242,13 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
 
     /* TODO could be shared for all viewports. */
     if (txl->smaa_search_tx == NULL) {
-      txl->smaa_search_tx = GPU_texture_create_nD(SEARCHTEX_WIDTH,
-                                                  SEARCHTEX_HEIGHT,
-                                                  0,
-                                                  2,
-                                                  searchTexBytes,
-                                                  GPU_R8,
-                                                  GPU_DATA_UNSIGNED_BYTE,
-                                                  0,
-                                                  false,
-                                                  NULL);
-
-      txl->smaa_area_tx = GPU_texture_create_nD(AREATEX_WIDTH,
-                                                AREATEX_HEIGHT,
-                                                0,
-                                                2,
-                                                areaTexBytes,
-                                                GPU_RG8,
-                                                GPU_DATA_UNSIGNED_BYTE,
-                                                0,
-                                                false,
-                                                NULL);
+      txl->smaa_search_tx = GPU_texture_create_2d(
+          SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, GPU_R8, NULL, NULL);
+      GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UNSIGNED_BYTE, searchTexBytes);
+
+      txl->smaa_area_tx = GPU_texture_create_2d(
+          AREATEX_WIDTH, AREATEX_HEIGHT, GPU_RG8, NULL, NULL);
+      GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UNSIGNED_BYTE, areaTexBytes);
 
       GPU_texture_filter_mode(txl->smaa_search_tx, true);
       GPU_texture_filter_mode(txl->smaa_area_tx, true);
diff --git a/source/blender/draw/intern/draw_fluid.c b/source/blender/draw/intern/draw_fluid.c
index c9f181f53db..9b63b50db61 100644
--- a/source/blender/draw/intern/draw_fluid.c
+++ b/source/blender/draw/intern/draw_fluid.c
@@ -184,8 +184,7 @@ static GPUTexture *create_volume_texture(const int dim[3],
   int final_dim[3] = {UNPACK3(dim)};
 
   while (1) {
-    tex = GPU_texture_create_nD(
-        UNPACK3(final_dim), 3, NULL, format, GPU_DATA_FLOAT, 0, false, NULL);
+    tex = GPU_texture_create_3d(UNPACK3(final_dim), format, NULL, NULL);
 
     if (tex != NULL) {
       break;
diff --git a/source/blender/e

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list