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-01-17 18:05:19 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-17 18:29:20 +0300
commit6eaf51ef3e5b7d37170473449bcda60bad025e67 (patch)
tree4dff167f66b8d2befe0303fff168573ad943379c /source/blender/gpu/intern/gpu_codegen.c
parent9410e5dc97c4f21e19865ca8a9e1e185fcf5a1d4 (diff)
DRW: Use USHORT for vertex color and upload them in linear color to the GPU
This way we remove the need for the srgb boolean uniform and a lot of code complexity. However, mesh update is going to be a bit slower. I did not benchmark the performance impact. This also fix a typo in draw_cache_impl_particles.c and fix hair not using vertex color in workbench. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6610
Diffstat (limited to 'source/blender/gpu/intern/gpu_codegen.c')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 5a5c3ace552..a7dd34a5f96 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1042,12 +1042,6 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
input->attr_id,
attr_prefix_get(input->attr_type),
attr_safe_name);
- /* Auto attribute can be vertex color byte buffer.
- * We need to know and convert them to linear space in VS. */
- if (input->attr_type == CD_AUTO_FROM_NAME) {
- BLI_dynstr_appendf(ds, "uniform bool ba%s;\n", attr_safe_name);
- BLI_dynstr_appendf(ds, "#define att%d_is_srgb ba%s\n", input->attr_id, attr_safe_name);
- }
}
BLI_dynstr_appendf(ds,
"out %s var%d%s;\n",
@@ -1101,24 +1095,6 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
BLI_dynstr_append(ds, use_geom ? "RESOURCE_ID_VARYING_GEOM\n" : "RESOURCE_ID_VARYING\n");
- BLI_dynstr_append(ds,
- "#define USE_ATTR\n"
- "vec3 srgb_to_linear_attr(vec3 c) {\n"
- "\tc = max(c, vec3(0.0));\n"
- "\tvec3 c1 = c * (1.0 / 12.92);\n"
- "\tvec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));\n"
- "\treturn mix(c1, c2, step(vec3(0.04045), c));\n"
- "}\n\n");
-
- BLI_dynstr_append(ds,
- "vec4 srgba_to_linear_attr(vec4 c) {\n"
- "\tc = max(c, vec4(0.0));\n"
- "\tvec4 c1 = c * (1.0 / 12.92);\n"
- "\tvec4 c2 = pow((c + 0.055) * (1.0 / 1.055), vec4(2.4));\n"
- "\tvec4 final = mix(c1, c2, step(vec4(0.04045), c));"
- "\treturn vec4(final.xyz, c.a);\n"
- "}\n\n");
-
/* Prototype because defined later. */
BLI_dynstr_append(ds,
"vec2 hair_get_customdata_vec2(const samplerBuffer);\n"
@@ -1224,22 +1200,6 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
input->attr_id,
use_geom ? "g" : "");
}
- else if (input->attr_type == CD_MCOL) {
- BLI_dynstr_appendf(ds,
- "\tvar%d%s = srgba_to_linear_attr(att%d);\n",
- input->attr_id,
- use_geom ? "g" : "",
- input->attr_id);
- }
- else if (input->attr_type == CD_AUTO_FROM_NAME) {
- BLI_dynstr_appendf(ds,
- "\tvar%d%s = (att%d_is_srgb) ? srgb_to_linear_attr(att%d) : att%d;\n",
- input->attr_id,
- use_geom ? "g" : "",
- input->attr_id,
- input->attr_id,
- input->attr_id);
- }
else {
BLI_dynstr_appendf(
ds, "\tvar%d%s = att%d;\n", input->attr_id, use_geom ? "g" : "", input->attr_id);