Cleanup: GPUTexture: Remove use of GPU_texture_create_nD
Use creation + update function instead.
This commit is contained in:
parent
7d4adbdfab
commit
bac4606937
Notes:
blender-bot
2023-02-14 05:44:22 +01:00
Referenced by issue #80533, VSE: Sequencer & Playhead drawing is broken after hibernate
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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_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_nD(AREATEX_WIDTH,
|
||||
AREATEX_HEIGHT,
|
||||
0,
|
||||
2,
|
||||
areaTexBytes,
|
||||
GPU_RG8,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
0,
|
||||
false,
|
||||
NULL);
|
||||
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);
|
||||
|
|
|
@ -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_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_nD(AREATEX_WIDTH,
|
||||
AREATEX_HEIGHT,
|
||||
0,
|
||||
2,
|
||||
areaTexBytes,
|
||||
GPU_RG8,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
0,
|
||||
false,
|
||||
NULL);
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -866,30 +866,15 @@ void UI_icons_reload_internal_textures(void)
|
|||
icongltex.invw = 1.0f / b32buf->x;
|
||||
icongltex.invh = 1.0f / b32buf->y;
|
||||
|
||||
icongltex.tex[0] = GPU_texture_create_nD(b32buf->x,
|
||||
b32buf->y,
|
||||
0,
|
||||
2,
|
||||
b32buf->rect,
|
||||
GPU_RGBA8,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
0,
|
||||
false,
|
||||
NULL);
|
||||
icongltex.tex[0] = GPU_texture_create_2d(b32buf->x, b32buf->y, GPU_RGBA8, NULL, NULL);
|
||||
GPU_texture_add_mipmap(icongltex.tex[0], GPU_DATA_UNSIGNED_BYTE, 0, b32buf->rect);
|
||||
GPU_texture_add_mipmap(icongltex.tex[0], GPU_DATA_UNSIGNED_BYTE, 1, b16buf->rect);
|
||||
}
|
||||
|
||||
if (need_icons_with_border && icongltex.tex[1] == NULL) {
|
||||
icongltex.tex[1] = GPU_texture_create_nD(b32buf_border->x,
|
||||
b32buf_border->y,
|
||||
0,
|
||||
2,
|
||||
b32buf_border->rect,
|
||||
GPU_RGBA8,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
0,
|
||||
false,
|
||||
NULL);
|
||||
icongltex.tex[1] = GPU_texture_create_2d(
|
||||
b32buf_border->x, b32buf_border->y, GPU_RGBA8, NULL, NULL);
|
||||
GPU_texture_add_mipmap(icongltex.tex[1], GPU_DATA_UNSIGNED_BYTE, 0, b32buf_border->rect);
|
||||
GPU_texture_add_mipmap(icongltex.tex[1], GPU_DATA_UNSIGNED_BYTE, 1, b16buf_border->rect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,8 +348,8 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
|
|||
|
||||
if (!target->overlay_texture) {
|
||||
eGPUTextureFormat format = col ? GPU_RGBA8 : GPU_R8;
|
||||
target->overlay_texture = GPU_texture_create_nD(
|
||||
size, size, 0, 2, buffer, format, GPU_DATA_UNSIGNED_BYTE, 0, false, NULL);
|
||||
target->overlay_texture = GPU_texture_create_2d(size, size, format, NULL, NULL);
|
||||
GPU_texture_update(target->overlay_texture, GPU_DATA_UNSIGNED_BYTE, buffer);
|
||||
|
||||
if (!col) {
|
||||
GPU_texture_swizzle_set(target->overlay_texture, "rrrr");
|
||||
|
@ -466,8 +466,8 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
|
|||
BLI_task_parallel_range(0, size, &data, load_tex_cursor_task_cb, &settings);
|
||||
|
||||
if (!cursor_snap.overlay_texture) {
|
||||
cursor_snap.overlay_texture = GPU_texture_create_nD(
|
||||
size, size, 0, 2, buffer, GPU_R8, GPU_DATA_UNSIGNED_BYTE, 0, false, NULL);
|
||||
cursor_snap.overlay_texture = GPU_texture_create_2d(size, size, GPU_R8, NULL, NULL);
|
||||
GPU_texture_update(cursor_snap.overlay_texture, GPU_DATA_UNSIGNED_BYTE, buffer);
|
||||
|
||||
GPU_texture_swizzle_set(cursor_snap.overlay_texture, "rrrr");
|
||||
}
|
||||
|
|
|
@ -1211,16 +1211,8 @@ static void draw_plane_marker_image(Scene *scene,
|
|||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
}
|
||||
|
||||
GPUTexture *texture = GPU_texture_create_nD(ibuf->x,
|
||||
ibuf->y,
|
||||
0,
|
||||
2,
|
||||
display_buffer,
|
||||
GPU_RGBA8,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
0,
|
||||
false,
|
||||
NULL);
|
||||
GPUTexture *texture = GPU_texture_create_2d(ibuf->x, ibuf->y, GPU_RGBA8, NULL, NULL);
|
||||
GPU_texture_update(texture, GPU_DATA_UNSIGNED_BYTE, display_buffer);
|
||||
GPU_texture_filter_mode(texture, false);
|
||||
|
||||
GPU_matrix_push();
|
||||
|
|
|
@ -1639,8 +1639,8 @@ static void sequencer_draw_display_buffer(const bContext *C,
|
|||
GPU_matrix_identity_projection_set();
|
||||
}
|
||||
|
||||
GPUTexture *texture = GPU_texture_create_nD(
|
||||
ibuf->x, ibuf->y, 0, 2, display_buffer, format, data, 0, false, NULL);
|
||||
GPUTexture *texture = GPU_texture_create_2d(ibuf->x, ibuf->y, format, NULL, NULL);
|
||||
GPU_texture_update(texture, data, display_buffer);
|
||||
GPU_texture_filter_mode(texture, false);
|
||||
|
||||
GPU_texture_bind(texture, 0);
|
||||
|
|
|
@ -165,8 +165,13 @@ GPUTexture *IMB_touch_gpu_texture(ImBuf *ibuf, int w, int h, int layers, bool us
|
|||
eGPUTextureFormat tex_format;
|
||||
imb_gpu_get_format(ibuf, use_high_bitdepth, &data_format, &tex_format);
|
||||
|
||||
GPUTexture *tex = GPU_texture_create_nD(
|
||||
w, h, layers, 2, NULL, tex_format, data_format, 0, false, NULL);
|
||||
GPUTexture *tex;
|
||||
if (layers > 0) {
|
||||
tex = GPU_texture_create_2d_array(w, h, layers, tex_format, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
tex = GPU_texture_create_2d(w, h, tex_format, NULL, NULL);
|
||||
}
|
||||
|
||||
GPU_texture_anisotropic_filter(tex, true);
|
||||
return tex;
|
||||
|
@ -248,7 +253,8 @@ GPUTexture *IMB_create_gpu_texture(ImBuf *ibuf, bool use_high_bitdepth, bool use
|
|||
void *data = imb_gpu_get_data(ibuf, do_rescale, size, compress_as_srgb, use_premult, &freebuf);
|
||||
|
||||
/* Create Texture. */
|
||||
tex = GPU_texture_create_nD(UNPACK2(size), 0, 2, data, tex_format, data_format, 0, false, NULL);
|
||||
tex = GPU_texture_create_2d(UNPACK2(size), tex_format, NULL, NULL);
|
||||
GPU_texture_update(tex, data_format, data);
|
||||
|
||||
GPU_texture_anisotropic_filter(tex, true);
|
||||
|
||||
|
|
|
@ -2217,8 +2217,8 @@ static void radial_control_set_tex(RadialControl *rc)
|
|||
rc->use_secondary_tex,
|
||||
!ELEM(rc->subtype, PROP_NONE, PROP_PIXEL, PROP_DISTANCE)))) {
|
||||
|
||||
rc->texture = GPU_texture_create_nD(
|
||||
ibuf->x, ibuf->y, 0, 2, ibuf->rect_float, GPU_R8, GPU_DATA_FLOAT, 0, false, NULL);
|
||||
rc->texture = GPU_texture_create_2d(ibuf->x, ibuf->y, GPU_R8, ibuf->rect_float, NULL);
|
||||
|
||||
GPU_texture_filter_mode(rc->texture, true);
|
||||
GPU_texture_swizzle_set(rc->texture, "111r");
|
||||
|
||||
|
|
Loading…
Reference in New Issue