diff options
author | Alejandro PiƱeiro <[email protected]> | 2018-10-22 18:30:39 +0200 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-01-22 10:42:56 -0600 |
commit | 5649a0a6e897c98f93cd9301638f05cb6c7d55a4 (patch) | |
tree | 9e120308543354ac779f0c22eff1ade279f37436 /src/compiler | |
parent | 4f99ac9144abda9b4e7d0891571eb1691b853c25 (diff) |
nir/xfb: don't assert when xfb_buffer/stride is present but not xfb_offset
In order to allow nir_gather_xfb_info to be used on OpenGL,
specifically ARB_gl_spirv.
So, from OpenGL 4.6 spec, section 11.1.2.1, "Output Variables":
"outputs specifying both an *XfbBuffer* and an *Offset* are
captured, while outputs not specifying both of these are not
captured. Values are captured each time the shader writes to such
a decorated object."
This implies that are captured if both are present, and not if one of
those are lacking. Technically, it doesn't explicitly point that
having just one or the other is a mistake. In some cases, glslang is
adding some extra XfbBuffer without XfbOffset around, and mentioning
that technically that is not a bug (see issue#1526)
And for the case of Vulkan, as the same glslang issue mentions, it is
not clear if that should be a mistake or not. But even if it is a
mistake, it is not really needed to be checked on the driver, and we
can let the validation layers to check that.
v2: simplify explicit_xfb_buffer and explicit_offset checks (Jason).
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_gather_xfb_info.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c index 7e441adc07c..9ae4ec740e5 100644 --- a/src/compiler/nir/nir_gather_xfb_info.c +++ b/src/compiler/nir/nir_gather_xfb_info.c @@ -107,11 +107,9 @@ nir_gather_xfb_info(const nir_shader *shader, void *mem_ctx) */ unsigned num_outputs = 0; nir_foreach_variable(var, &shader->outputs) { - if (var->data.explicit_xfb_buffer || - var->data.explicit_xfb_stride) { - assert(var->data.explicit_xfb_buffer && - var->data.explicit_xfb_stride && - var->data.explicit_offset); + if (var->data.explicit_xfb_buffer && + var->data.explicit_offset) { + num_outputs += glsl_count_attribute_slots(var->type, false); } } @@ -122,8 +120,9 @@ nir_gather_xfb_info(const nir_shader *shader, void *mem_ctx) /* Walk the list of outputs and add them to the array */ nir_foreach_variable(var, &shader->outputs) { - if (var->data.explicit_xfb_buffer || - var->data.explicit_xfb_stride) { + if (var->data.explicit_xfb_buffer && + var->data.explicit_offset) { + unsigned location = var->data.location; unsigned offset = var->data.offset; add_var_xfb_outputs(xfb, var, &location, &offset, var->type); |