mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
asahi: optimize !robustness with soft fault
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
parent
d5ec115260
commit
db36ece9dd
1 changed files with 13 additions and 16 deletions
|
|
@ -187,25 +187,15 @@ pass(struct nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
||||||
|
|
||||||
/* Robustness is handled at the ID level */
|
/* Robustness is handled at the ID level */
|
||||||
nir_def *bounds = nir_load_attrib_clamp_agx(b, buf_handle);
|
nir_def *bounds = nir_load_attrib_clamp_agx(b, buf_handle);
|
||||||
|
|
||||||
/* For now, robustness is always applied. This gives GL robustness semantics.
|
|
||||||
* For robustBufferAccess2, we'll want to check for out-of-bounds access
|
|
||||||
* (where el > bounds), and replace base with the address of a zero sink.
|
|
||||||
* With soft fault and a large enough sink, we don't need to clamp the index,
|
|
||||||
* allowing that robustness behaviour to be implemented in 2 cmpsel
|
|
||||||
* before the load. That is faster than the 4 cmpsel required after the load,
|
|
||||||
* and it avoids waiting on the load which should help prolog performance.
|
|
||||||
*
|
|
||||||
* TODO: Optimize.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
nir_def *oob = nir_ult(b, bounds, el);
|
nir_def *oob = nir_ult(b, bounds, el);
|
||||||
|
|
||||||
/* TODO: We clamp to handle null descriptors. This should be optimized
|
/* We clamp to handle GL robustness. This should be optimized further.
|
||||||
* further. However, with the fix up after the load for D3D robustness, we
|
* However, with the fix up after the load for D3D robustness, we don't need
|
||||||
* don't need this clamp if we can ignore the fault.
|
* this clamp if we can ignore the fault.
|
||||||
*/
|
*/
|
||||||
if (!(ctx->rs.level >= AGX_ROBUSTNESS_D3D && ctx->rs.soft_fault)) {
|
if (ctx->rs.level >= AGX_ROBUSTNESS_GL &&
|
||||||
|
!(ctx->rs.level >= AGX_ROBUSTNESS_D3D && ctx->rs.soft_fault)) {
|
||||||
|
|
||||||
el = nir_bcsel(b, oob, nir_imm_int(b, 0), el);
|
el = nir_bcsel(b, oob, nir_imm_int(b, 0), el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,6 +310,13 @@ agx_nir_lower_vbo(nir_shader *shader, struct agx_attribute *attribs,
|
||||||
{
|
{
|
||||||
assert(shader->info.stage == MESA_SHADER_VERTEX);
|
assert(shader->info.stage == MESA_SHADER_VERTEX);
|
||||||
|
|
||||||
|
/* To implement null vertex buffer descriptors, we need either soft fault or
|
||||||
|
* GL robustness with a vertex buffer at 0x0.
|
||||||
|
*/
|
||||||
|
if (!robustness.soft_fault) {
|
||||||
|
robustness.level = MAX2(robustness.level, AGX_ROBUSTNESS_GL);
|
||||||
|
}
|
||||||
|
|
||||||
struct ctx ctx = {.attribs = attribs, .rs = robustness};
|
struct ctx ctx = {.attribs = attribs, .rs = robustness};
|
||||||
return nir_shader_intrinsics_pass(shader, pass, nir_metadata_control_flow,
|
return nir_shader_intrinsics_pass(shader, pass, nir_metadata_control_flow,
|
||||||
&ctx);
|
&ctx);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue