diff options
Diffstat (limited to 'source/blender/draw/engines/workbench')
6 files changed, 30 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl index 8d66cd7b26c..a0e04f252e2 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl @@ -46,7 +46,7 @@ vec3 get_view_space_from_depth(in vec2 uvcoords, in float depth) } } -/* forward declartion */ +/* forward declaration */ void ssao_factors(in float depth, in vec3 normal, in vec3 position, diff --git a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl index 1af786b648c..376b19cdd1b 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl @@ -58,7 +58,7 @@ void ssao_factors(in float depth, /* Handle Background case */ bool is_background = (depth_new == 1.0); - /* This trick provide good edge effect even if no neighboor is found. */ + /* This trick provide good edge effect even if no neighbor is found. */ vec3 pos_new = get_view_space_from_depth(uvcoords, (is_background) ? depth : depth_new); if (is_background) { diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 735a0dcf7a0..add49462de1 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -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; diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c index 88f1f30941a..06442060623 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_taa.c +++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c @@ -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); } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 17144c4dc10..255b036eebb 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -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 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); diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c index 575da1f9683..1beb02ea3a0 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.c +++ b/source/blender/draw/engines/workbench/workbench_volume.c @@ -161,7 +161,7 @@ void workbench_volume_cache_populate(WORKBENCH_Data *vedata, sds->slice_axis - 1; float dim[3]; BKE_object_dimensions_get(ob, dim); - /* 0.05f to acheive somewhat the same opacity as the full view. */ + /* 0.05f to achieve somewhat the same opacity as the full view. */ float step_length = max_ff(1e-16f, dim[axis] * 0.05f); grp = DRW_shgroup_create(sh, vedata->psl->volume_pass); |