GPUState: Fix scissor state being overwritten when changing scissor bounds

Fix T79899 viewport artifacts when sculpting
This commit is contained in:
Clément Foucault 2020-08-24 12:28:54 +02:00
parent 4883cc5728
commit cb8da6efce
Notes: blender-bot 2023-02-14 03:29:37 +01:00
Referenced by issue #79957, Viewport freeze or glitch, when using Transform tools in Sculpt Mode
Referenced by issue #79899, viewport artifacts when sculpting with AA
1 changed files with 2 additions and 1 deletions

View File

@ -201,7 +201,8 @@ void GPU_scissor(int x, int y, int width, int height)
{
GPUStateManager *stack = GPU_context_active_get()->state_manager;
auto &state = stack->mutable_state;
int scissor_rect[4] = {x, y, width, height};
bool enabled = state.scissor_rect[2] > 0;
int scissor_rect[4] = {x, y, enabled ? width : -width, height};
copy_v4_v4_int(state.scissor_rect, scissor_rect);
}