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:
authorClément Foucault <foucault.clem@gmail.com>2020-04-14 21:44:45 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-04-14 21:44:56 +0300
commit21c658b718b9bd0f79f435a6a8a8603c365264a5 (patch)
treebcaa239369d799368236d4303f33d674c3cb14f3 /source/blender/gpu/GPU_shader.h
parentbf49bb354fca4ad96f8f3e6802ecf733b29ac3e3 (diff)
GPUShader: Implement workaround for gizmo drawing on sRGB framebuffer
This solution involves adding a uniform to each fragment shader that is used by gizmo drawing and use the framebuffer state to set this uniform accordingly. This solution can also be carried to external shaders (addons). A single line of code would then be enough to fix the issue. The only trickery here is the dummy define: `#define srgb_to_framebuffer_space(a)` This is in order to avoid breaking other DRW shaders that use the same fragment shader code but do not need the tranformation. Related to T74139 Reviewed By: brecht, campbellbarton Differential Revision: https://developer.blender.org/D7261
Diffstat (limited to 'source/blender/gpu/GPU_shader.h')
-rw-r--r--source/blender/gpu/GPU_shader.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index bb26f5d41a3..1fb0b7c1f6b 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -31,6 +31,7 @@ extern "C" {
typedef struct GPUShader GPUShader;
struct GPUTexture;
struct GPUUniformBuffer;
+struct GPUShaderInterface;
/* GPU Shader
* - only for fragment shaders now
@@ -49,6 +50,11 @@ GPUShader *GPU_shader_create(const char *vertexcode,
const char *libcode,
const char *defines,
const char *shader_name);
+GPUShader *GPU_shader_create_from_python(const char *vertexcode,
+ const char *fragcode,
+ const char *geocode,
+ const char *libcode,
+ const char *defines);
GPUShader *GPU_shader_create_ex(const char *vertexcode,
const char *fragcode,
const char *geocode,
@@ -83,6 +89,8 @@ int GPU_shader_get_program(GPUShader *shader);
void *GPU_shader_get_interface(GPUShader *shader);
+void GPU_shader_set_srgb_uniform(const struct GPUShaderInterface *interface);
+
int GPU_shader_get_uniform(GPUShader *shader, const char *name);
int GPU_shader_get_uniform_ensure(GPUShader *shader, const char *name);
int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin);
@@ -101,6 +109,8 @@ int GPU_shader_get_attribute(GPUShader *shader, const char *name);
char *GPU_shader_get_binary(GPUShader *shader, uint *r_binary_format, int *r_binary_len);
+void GPU_shader_set_framebuffer_srgb_target(int use_srgb_to_linear);
+
/* Builtin/Non-generated shaders */
typedef enum eGPUBuiltinShader {
/* specialized drawing */