Fix T94900: Fix drawing artifacts sequencer+node editor.

The VSE and node editor only uses an overlay buffer to draw to the screen. The
GPUViewport assumes that platforms clears all textures during creation, but
they do not on selected platforms. What would lead to drawing from
uncleared memory.

This patch fixes this by clearing all viewport textures during creation.
This commit is contained in:
Jeroen Bakker 2022-01-26 14:40:56 +01:00
parent 5b299e5999
commit 6738ecb64e
Notes: blender-bot 2023-02-14 07:25:46 +01:00
Referenced by issue #97272, Regression: Blender 3.1 UI editor resize /border dragging performance
Referenced by issue #95428, Regression: 3.1 & 3.2 Image/UV Editor poor performance (Byte textures, window dragging, maximizing area)
Referenced by issue #95219, VSE, visual glitches over sequensors
Referenced by issue #94900, Sequencer Window background is shows green
1 changed files with 6 additions and 0 deletions

View File

@ -137,19 +137,25 @@ struct DRWData **GPU_viewport_data_get(GPUViewport *viewport)
static void gpu_viewport_textures_create(GPUViewport *viewport)
{
int *size = viewport->size;
float empty_pixel_fl[4] = {0.0f, 0.0f, 0.0f, 0.0f};
uchar empty_pixel_u[4] = {0, 0, 0, 0};
if (viewport->color_render_tx[0] == NULL) {
viewport->color_render_tx[0] = GPU_texture_create_2d(
"dtxl_color", UNPACK2(size), 1, GPU_RGBA16F, NULL);
GPU_texture_clear(viewport->color_render_tx[0], GPU_DATA_FLOAT, empty_pixel_fl);
viewport->color_overlay_tx[0] = GPU_texture_create_2d(
"dtxl_color_overlay", UNPACK2(size), 1, GPU_SRGB8_A8, NULL);
GPU_texture_clear(viewport->color_overlay_tx[0], GPU_DATA_UBYTE, empty_pixel_u);
}
if ((viewport->flag & GPU_VIEWPORT_STEREO) != 0 && viewport->color_render_tx[1] == NULL) {
viewport->color_render_tx[1] = GPU_texture_create_2d(
"dtxl_color_stereo", UNPACK2(size), 1, GPU_RGBA16F, NULL);
GPU_texture_clear(viewport->color_render_tx[1], GPU_DATA_FLOAT, empty_pixel_fl);
viewport->color_overlay_tx[1] = GPU_texture_create_2d(
"dtxl_color_overlay_stereo", UNPACK2(size), 1, GPU_SRGB8_A8, NULL);
GPU_texture_clear(viewport->color_overlay_tx[1], GPU_DATA_UBYTE, empty_pixel_u);
}
/* Can be shared with GPUOffscreen. */