Cleanup: GPUState: remove use of GPU_blend_set_func
This commit is contained in:
parent
969bcf0793
commit
10558d6973
|
@ -1595,7 +1595,7 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
|
|||
GPU_clear_color(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
GPU_clear(GPU_COLOR_BIT);
|
||||
/* Premult Alpha over black background. */
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
|
||||
GPU_blend(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1161,7 +1161,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
|
|||
}
|
||||
|
||||
if (scopes->ok && scopes->waveform_1 != NULL) {
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE);
|
||||
GPU_point_size(1.0);
|
||||
|
||||
/* LUMA (1 channel) */
|
||||
|
@ -1463,7 +1463,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
|
|||
/* pixel point cloud */
|
||||
const float col[3] = {alpha, alpha, alpha};
|
||||
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE);
|
||||
GPU_point_size(1.0);
|
||||
|
||||
GPU_matrix_push();
|
||||
|
|
|
@ -1595,7 +1595,7 @@ static void icon_draw_cache_flush_ex(bool only_full_caches)
|
|||
/* We need to flush widget base first to ensure correct ordering. */
|
||||
UI_widgetbase_draw_cache_flush();
|
||||
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
|
||||
|
||||
if (!only_full_caches || g_icon_draw_cache.normal.calls == ICON_DRAW_CACHE_SIZE) {
|
||||
icon_draw_cache_texture_flush_ex(icongltex.tex[0], &g_icon_draw_cache.normal);
|
||||
|
@ -1689,7 +1689,7 @@ static void icon_draw_texture(float x,
|
|||
/* We need to flush widget base first to ensure correct ordering. */
|
||||
UI_widgetbase_draw_cache_flush();
|
||||
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
|
||||
|
||||
float x1, x2, y1, y2;
|
||||
|
||||
|
|
|
@ -740,7 +740,7 @@ void ED_mask_draw_region(
|
|||
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
|
||||
/* More blending types could be supported in the future. */
|
||||
GPU_blend(true);
|
||||
GPU_blend_set_func(GPU_DST_COLOR, GPU_ZERO);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_MULTIPLY);
|
||||
}
|
||||
|
||||
GPU_matrix_push();
|
||||
|
|
|
@ -635,7 +635,7 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups,
|
|||
|
||||
/* Premultiplied alpha blending. */
|
||||
GPU_blend(true);
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
|
||||
|
@ -728,7 +728,7 @@ static bool paint_draw_cursor_overlay(
|
|||
uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
GPU_blend(true);
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
|
||||
|
|
|
@ -88,15 +88,6 @@ typedef enum eGPUStencilOp {
|
|||
GPU_STENCIL_OP_COUNT_DEPTH_FAIL,
|
||||
} eGPUStencilOp;
|
||||
|
||||
/* These map directly to the GL_ blend functions, to minimize API add as needed*/
|
||||
typedef enum eGPUBlendFunction {
|
||||
GPU_ONE,
|
||||
GPU_SRC_ALPHA,
|
||||
GPU_ONE_MINUS_SRC_ALPHA,
|
||||
GPU_DST_COLOR,
|
||||
GPU_ZERO,
|
||||
} eGPUBlendFunction;
|
||||
|
||||
typedef enum eGPUFaceCullTest {
|
||||
GPU_CULL_NONE = 0, /* Culling disabled. */
|
||||
GPU_CULL_FRONT,
|
||||
|
@ -115,7 +106,6 @@ typedef enum eGPUProvokingVertex {
|
|||
void GPU_state_init(void);
|
||||
|
||||
void GPU_blend(bool enable);
|
||||
void GPU_blend_set_func(eGPUBlendFunction sfactor, eGPUBlendFunction dfactor);
|
||||
void GPU_blend_set_func_separate(eGPUBlend blend);
|
||||
void GPU_face_culling(eGPUFaceCullTest culling);
|
||||
void GPU_front_facing(bool invert);
|
||||
|
|
|
@ -40,12 +40,6 @@
|
|||
|
||||
using namespace blender::gpu;
|
||||
|
||||
// /* This should replace GPU_blend, GPU_blend_set_func and GPU_blend_set_func_separate. */
|
||||
// void GPU_blend_set(eGPUBlend blend)
|
||||
// {
|
||||
// GLStateStack::set_blend(blend);
|
||||
// }
|
||||
|
||||
void GPU_blend(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
|
@ -56,25 +50,6 @@ void GPU_blend(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void GPU_blend_set_func(eGPUBlendFunction sfactor, eGPUBlendFunction dfactor)
|
||||
{
|
||||
if (sfactor == GPU_ONE && dfactor == GPU_ONE) {
|
||||
GLStateStack::set_blend(GPU_BLEND_ADDITIVE);
|
||||
}
|
||||
else if (sfactor == GPU_ONE && dfactor == GPU_ONE_MINUS_SRC_ALPHA) {
|
||||
GLStateStack::set_blend(GPU_BLEND_ALPHA_PREMULT);
|
||||
}
|
||||
else if (sfactor == GPU_SRC_ALPHA && dfactor == GPU_ONE_MINUS_SRC_ALPHA) {
|
||||
GLStateStack::set_blend(GPU_BLEND_ALPHA);
|
||||
}
|
||||
else if (sfactor == GPU_DST_COLOR && dfactor == GPU_ZERO) {
|
||||
GLStateStack::set_blend(GPU_BLEND_MULTIPLY);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_blend_set_func_separate(eGPUBlend blend)
|
||||
{
|
||||
GLStateStack::set_blend(blend);
|
||||
|
|
|
@ -578,7 +578,7 @@ void wm_draw_region_blend(ARegion *region, int view, bool blend)
|
|||
if (blend) {
|
||||
/* GL_ONE because regions drawn offscreen have premultiplied alpha. */
|
||||
GPU_blend(true);
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
|
||||
}
|
||||
|
||||
/* setup actual texture */
|
||||
|
|
|
@ -353,9 +353,8 @@ static void draw_filled_lasso(wmGesture *gt)
|
|||
draw_filled_lasso_px_cb,
|
||||
&lasso_fill_data);
|
||||
|
||||
/* Additive Blending */
|
||||
GPU_blend(true);
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE);
|
||||
GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE);
|
||||
|
||||
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
|
||||
GPU_shader_bind(state.shader);
|
||||
|
|
Loading…
Reference in New Issue