Fix T66100: WorkBench Banding Issues

Color banding issues can appear, as result of the 8 bitdepth RGBA that
is used in the viewport.

This change will use `GPU_RGBA16F` for final renderings and for drawing textures. This
allows displaying HDRI textures. Vertex Colors uses `GPU_RGBA16` to resolve
color banding issues. All other modes use `GPU_RGBA8` to reduce
bandwidth and gpu memory.

Reviewed By: fclem, brecht

Differential Revision: https://developer.blender.org/D5179
This commit is contained in:
Jeroen Bakker 2019-07-04 08:27:17 +02:00
parent 0394f2ab30
commit 85c3e12049
Notes: blender-bot 2023-02-14 08:42:53 +01:00
Referenced by issue #66100, Vertex color banding
4 changed files with 28 additions and 3 deletions

View File

@ -475,7 +475,7 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
const eGPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
const eGPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F :
GPU_R11F_G11F_B10F;
const eGPUTextureFormat col_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_RGBA8;
const eGPUTextureFormat col_tex_format = workbench_color_texture_format(wpd);
const eGPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
e_data.object_id_tx = NULL;

View File

@ -170,10 +170,10 @@ DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_bu
WORKBENCH_TextureList *txl = vedata->txl;
WORKBENCH_EffectInfo *effect_info = stl->effects;
WORKBENCH_FramebufferList *fbl = vedata->fbl;
const WORKBENCH_PrivateData *wpd = stl->g_data;
{
const eGPUTextureFormat hist_buffer_format = DRW_state_is_image_render() ? GPU_RGBA16F :
GPU_RGBA8;
const eGPUTextureFormat hist_buffer_format = workbench_color_texture_format(wpd);
DRW_texture_ensure_fullscreen_2d(&txl->history_buffer_tx, hist_buffer_format, 0);
DRW_texture_ensure_fullscreen_2d(&txl->depth_buffer_tx, GPU_DEPTH24_STENCIL8, 0);
}

View File

@ -381,6 +381,30 @@ BLI_INLINE bool workbench_is_matdata_pass_enabled(WORKBENCH_PrivateData *wpd)
workbench_is_in_texture_paint_mode();
}
/**
* Get the default texture format to be used by the color and history buffers.
*
* Use GPU_RGBA16F for final renderings and for drawing textures. This
* allows displaying HDRI textures. Vertex Colors uses GPU_RGBA16 to resolve
* color banding issues (T66100). All other modes use GPU_RGBA8 to reduce
* bandwidth and gpu memory.
*/
BLI_INLINE const eGPUTextureFormat workbench_color_texture_format(const WORKBENCH_PrivateData *wpd)
{
eGPUTextureFormat result;
if (DRW_state_is_image_render() || workbench_is_in_texture_paint_mode() ||
TEXTURE_DRAWING_ENABLED(wpd)) {
result = GPU_RGBA16F;
}
else if (VERTEX_COLORS_ENABLED(wpd)) {
result = GPU_RGBA16;
}
else {
result = GPU_RGBA8;
}
return result;
}
/* workbench_deferred.c */
void workbench_deferred_engine_init(WORKBENCH_Data *vedata);
void workbench_deferred_engine_free(void);

View File

@ -960,6 +960,7 @@ typedef enum eUserpref_UI_Flag2 {
USER_UIFLAG2_UNUSED_3 = (1 << 3), /* dirty */
} eUserpref_UI_Flag2;
/** #UserDef.gpu_flag */
typedef enum eUserpref_GPU_Flag {
USER_GPU_FLAG_NO_DEPT_PICK = (1 << 0),
USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE = (1 << 1),