From 194979e92947524c6257a38ae7bee4b20dc61d9e Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 17 Jan 2022 18:13:54 +0100 Subject: Cleanup: Improve naming of immediate mode buffer draw functions Followup to the previous commit. Jeroen and I agreed the old naming was confusing. --- source/blender/editors/include/BIF_glutil.h | 114 ++++---- source/blender/editors/interface/interface_draw.c | 44 ++-- source/blender/editors/mask/mask_draw.c | 3 +- source/blender/editors/render/render_preview.cc | 22 +- source/blender/editors/screen/glutil.c | 304 +++++++++++----------- source/blender/editors/space_file/file_draw.c | 26 +- source/blender/editors/space_node/node_draw.cc | 22 +- 7 files changed, 268 insertions(+), 267 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 8546c3eae89..e8d5bc4c868 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -55,7 +55,7 @@ typedef struct IMMDrawPixelsTexState { IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); /** - * Unlike the other `immDrawPixelsTex` functions, this doesn't do tiled drawing, but draws into a + * Unlike the `immDrawPixelsTexTiled` functions, this doesn't do tiled drawing, but draws into a * full texture. * * Use the currently bound shader. @@ -98,45 +98,45 @@ void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, * model-view and projection matrices are assumed to define a * 1-to-1 mapping to screen space. */ -void immDrawPixelsTex(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float xzoom, - float yzoom, - const float color[4]); -void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float clip_min_x, - float clip_min_y, - float clip_max_x, - float clip_max_y, - float xzoom, - float yzoom, - const float color[4]); -void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float scaleX, - float scaleY, - float xzoom, - float yzoom, - const float color[4]); +void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float xzoom, + float yzoom, + const float color[4]); +void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float clip_min_x, + float clip_min_y, + float clip_max_x, + float clip_max_y, + float xzoom, + float yzoom, + const float color[4]); +void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float scaleX, + float scaleY, + float xzoom, + float yzoom, + const float color[4]); /** * Use the currently bound shader. * @@ -151,23 +151,23 @@ void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, * Be also aware that this function unbinds the shader when * it's finished. */ -void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float scaleX, - float scaleY, - float clip_min_x, - float clip_min_y, - float clip_max_x, - float clip_max_y, - float xzoom, - float yzoom, - const float color[4]); +void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float scaleX, + float scaleY, + float clip_min_x, + float clip_min_y, + float clip_max_x, + float clip_max_y, + float xzoom, + float yzoom, + const float color[4]); /* Image buffer drawing functions, with display transform * diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index f2fa375aa09..f7492e56b62 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -325,17 +325,17 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex(&state, - (float)rect->xmin, - (float)rect->ymin, - ibuf->x, - ibuf->y, - GPU_RGBA8, - false, - ibuf->rect, - 1.0f, - 1.0f, - col); + immDrawPixelsTexTiled(&state, + (float)rect->xmin, + (float)rect->ymin, + ibuf->x, + ibuf->y, + GPU_RGBA8, + false, + ibuf->rect, + 1.0f, + 1.0f, + col); GPU_blend(GPU_BLEND_NONE); @@ -2135,17 +2135,17 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region), } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex(&state, - rect.xmin, - rect.ymin + 1, - drawibuf->x, - drawibuf->y, - GPU_RGBA8, - true, - drawibuf->rect, - 1.0f, - 1.0f, - NULL); + immDrawPixelsTexTiled(&state, + rect.xmin, + rect.ymin + 1, + drawibuf->x, + drawibuf->y, + GPU_RGBA8, + true, + drawibuf->rect, + 1.0f, + 1.0f, + NULL); /* draw cross for pixel position */ GPU_matrix_translate_2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index dcd5b90bc04..0e207df7f94 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -768,7 +768,8 @@ void ED_mask_draw_region( IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR); GPU_shader_uniform_vector( state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red); - immDrawPixelsTex(&state, 0.0f, 0.0f, width, height, GPU_R16F, false, buffer, 1.0f, 1.0f, NULL); + immDrawPixelsTexTiled( + &state, 0.0f, 0.0f, width, height, GPU_R16F, false, buffer, 1.0f, 1.0f, NULL); GPU_matrix_pop(); diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index 4f94927533b..79c3b2f7ac6 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -687,17 +687,17 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect RE_AcquiredResultGet32(re, &rres, (uint *)rect_byte, 0); IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex(&state, - fx, - fy, - rres.rectx, - rres.recty, - GPU_RGBA8, - false, - rect_byte, - 1.0f, - 1.0f, - nullptr); + immDrawPixelsTexTiled(&state, + fx, + fy, + rres.rectx, + rres.recty, + GPU_RGBA8, + false, + rect_byte, + 1.0f, + 1.0f, + nullptr); MEM_freeN(rect_byte); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index cb5c5df20ec..1c00040a894 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -141,23 +141,23 @@ void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, GPU_texture_free(tex); } -void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float scaleX, - float scaleY, - float clip_min_x, - float clip_min_y, - float clip_max_x, - float clip_max_y, - float xzoom, - float yzoom, - const float color[4]) +void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float scaleX, + float scaleY, + float clip_min_x, + float clip_min_y, + float clip_max_x, + float clip_max_y, + float xzoom, + float yzoom, + const float color[4]) { int subpart_x, subpart_y, tex_w = 256, tex_h = 256; int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y; @@ -311,103 +311,103 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, GPU_unpack_row_length_set(0); } -void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float scaleX, - float scaleY, - float xzoom, - float yzoom, - const float color[4]) +void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float scaleX, + float scaleY, + float xzoom, + float yzoom, + const float color[4]) { - immDrawPixelsTexScaled_clipping(state, - x, - y, - img_w, - img_h, - gpu_format, - use_filter, - rect, - scaleX, - scaleY, - 0.0f, - 0.0f, - 0.0f, - 0.0f, - xzoom, - yzoom, - color); + immDrawPixelsTexTiled_scaling_clipping(state, + x, + y, + img_w, + img_h, + gpu_format, + use_filter, + rect, + scaleX, + scaleY, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + xzoom, + yzoom, + color); } -void immDrawPixelsTex(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float xzoom, - float yzoom, - const float color[4]) +void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float xzoom, + float yzoom, + const float color[4]) { - immDrawPixelsTexScaled_clipping(state, - x, - y, - img_w, - img_h, - gpu_format, - use_filter, - rect, - 1.0f, - 1.0f, - 0.0f, - 0.0f, - 0.0f, - 0.0f, - xzoom, - yzoom, - color); + immDrawPixelsTexTiled_scaling_clipping(state, + x, + y, + img_w, + img_h, + gpu_format, + use_filter, + rect, + 1.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + xzoom, + yzoom, + color); } -void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state, - float x, - float y, - int img_w, - int img_h, - eGPUTextureFormat gpu_format, - bool use_filter, - void *rect, - float clip_min_x, - float clip_min_y, - float clip_max_x, - float clip_max_y, - float xzoom, - float yzoom, - const float color[4]) +void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state, + float x, + float y, + int img_w, + int img_h, + eGPUTextureFormat gpu_format, + bool use_filter, + void *rect, + float clip_min_x, + float clip_min_y, + float clip_max_x, + float clip_max_y, + float xzoom, + float yzoom, + const float color[4]) { - immDrawPixelsTexScaled_clipping(state, - x, - y, - img_w, - img_h, - gpu_format, - use_filter, - rect, - 1.0f, - 1.0f, - clip_min_x, - clip_min_y, - clip_max_x, - clip_max_y, - xzoom, - yzoom, - color); + immDrawPixelsTexTiled_scaling_clipping(state, + x, + y, + img_w, + img_h, + gpu_format, + use_filter, + rect, + 1.0f, + 1.0f, + clip_min_x, + clip_min_y, + clip_max_x, + clip_max_y, + xzoom, + yzoom, + color); } /* **** Color management helper functions for GLSL display/transform ***** */ @@ -478,40 +478,40 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, } if (format != 0) { - immDrawPixelsTex_clipping(&state, - x, - y, - ibuf->x, - ibuf->y, - format, - use_filter, - ibuf->rect_float, - clip_min_x, - clip_min_y, - clip_max_x, - clip_max_y, - zoom_x, - zoom_y, - NULL); + immDrawPixelsTexTiled_clipping(&state, + x, + y, + ibuf->x, + ibuf->y, + format, + use_filter, + ibuf->rect_float, + clip_min_x, + clip_min_y, + clip_max_x, + clip_max_y, + zoom_x, + zoom_y, + NULL); } } else if (ibuf->rect) { /* ibuf->rect is always RGBA */ - immDrawPixelsTex_clipping(&state, - x, - y, - ibuf->x, - ibuf->y, - GPU_RGBA8, - use_filter, - ibuf->rect, - clip_min_x, - clip_min_y, - clip_max_x, - clip_max_y, - zoom_x, - zoom_y, - NULL); + immDrawPixelsTexTiled_clipping(&state, + x, + y, + ibuf->x, + ibuf->y, + GPU_RGBA8, + use_filter, + ibuf->rect, + clip_min_x, + clip_min_y, + clip_max_x, + clip_max_y, + zoom_x, + zoom_y, + NULL); } IMB_colormanagement_finish_glsl_draw(); @@ -530,21 +530,21 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, if (display_buffer) { IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex_clipping(&state, - x, - y, - ibuf->x, - ibuf->y, - GPU_RGBA8, - use_filter, - display_buffer, - clip_min_x, - clip_min_y, - clip_max_x, - clip_max_y, - zoom_x, - zoom_y, - NULL); + immDrawPixelsTexTiled_clipping(&state, + x, + y, + ibuf->x, + ibuf->y, + GPU_RGBA8, + use_filter, + display_buffer, + clip_min_x, + clip_min_y, + clip_max_x, + clip_max_y, + zoom_x, + zoom_y, + NULL); } IMB_display_buffer_release(cache_handle); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index dd1b4e10e60..9f18f6d1443 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -403,19 +403,19 @@ static void file_draw_preview(const SpaceFile *sfile, } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTexScaled(&state, - (float)xco, - (float)yco, - imb->x, - imb->y, - GPU_RGBA8, - true, - imb->rect, - scale, - scale, - 1.0f, - 1.0f, - col); + immDrawPixelsTexTiled_scaling(&state, + (float)xco, + (float)yco, + imb->x, + imb->y, + GPU_RGBA8, + true, + imb->rect, + scale, + scale, + 1.0f, + 1.0f, + col); GPU_blend(GPU_BLEND_ALPHA); diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index e9a385c525b..119b046f05f 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1169,17 +1169,17 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) GPU_blend(GPU_BLEND_ALPHA); IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex(&state, - draw_rect.xmin, - draw_rect.ymin, - preview->xsize, - preview->ysize, - GPU_RGBA8, - true, - preview->rect, - scale, - scale, - nullptr); + immDrawPixelsTexTiled(&state, + draw_rect.xmin, + draw_rect.ymin, + preview->xsize, + preview->ysize, + GPU_RGBA8, + true, + preview->rect, + scale, + scale, + nullptr); GPU_blend(GPU_BLEND_NONE); -- cgit v1.2.3