Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-07-04 09:27:17 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-08-06 09:34:39 +0300
commit85c3e1204991d5ce1e89eb6201727d82eb32be50 (patch)
tree91b4c91b36a920c5f3fc412737317d167aa8dd9e /source/blender/draw/engines/workbench/workbench_private.h
parent0394f2ab30ba012fdc8f22ee817ef13a359ef6cf (diff)
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
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_private.h')
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 17144c4dc10..cb9a97878e2 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 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);