diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 01:52:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 13:03:52 +0300 |
commit | 5ec0250df9d8cf44d099e5b6fffca99bf9cf0c46 (patch) | |
tree | 58fe122fc78c66513c2426d2cd2ff754ea707ea9 /source/blender | |
parent | ccf476f8afa5dbc9467c21e1e86b9240400ee588 (diff) |
EEVEE: Volumetric: Fix Mesa Compiler error
The compiler does not seems to understand the `const` in the
function declaration and complains about non constant indexing
of unsized array.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 1629584e841..d67ce0be310 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -686,7 +686,7 @@ static char *code_generate_vertex(GPUNodeGraph *graph, BLI_dynstr_append(ds, "#define USE_ATTR\n\n"); BLI_dynstr_append(ds, vert_code); - BLI_dynstr_append(ds, "\n"); + BLI_dynstr_append(ds, "\n\n"); BLI_dynstr_append(ds, "void pass_attr(vec3 position, mat3 normalmat, mat4 modelmatinv) {\n"); @@ -755,15 +755,16 @@ static char *code_generate_geometry(GPUNodeGraph *graph, /* Generate varying assignments. */ BLI_dynstr_append(ds, "#define USE_ATTR\n"); - BLI_dynstr_append(ds, "void pass_attr(const int vert) {\n"); + /* This needs to be a define. Some drivers don't like variable vert index inside dataAttrIn. */ + BLI_dynstr_append(ds, "#define pass_attr(vert) {\\\n"); if (builtins & GPU_BARYCENTRIC_TEXCO) { - BLI_dynstr_append(ds, " dataAttrOut.barycentricTexCo = calc_barycentric_co(vert);\n"); + BLI_dynstr_append(ds, "dataAttrOut.barycentricTexCo = calc_barycentric_co(vert);\\\n"); } LISTBASE_FOREACH (GPUMaterialAttribute *, attr, &graph->attributes) { /* TODO let shader choose what to do depending on what the attribute is. */ - BLI_dynstr_appendf(ds, " dataAttrOut.var%d = dataAttrIn[vert].var%d;\n", attr->id, attr->id); + BLI_dynstr_appendf(ds, "dataAttrOut.var%d = dataAttrIn[vert].var%d;\\\n", attr->id, attr->id); } BLI_dynstr_append(ds, "}\n\n"); |