mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-14 19:30:31 +01:00
intel/nir/rt: change scratch check validation
It's very unfortunate that we have the RT scratch being conflated with the usual scratch. In our implementation those are 2 different buffers. The usual scratch access are done through the scratch surface state (delivered through thread payload), while RT scratch (which outlives thread dispatch with shader calls) is its own buffer. So checking the NIR scratch size makes no sense as we can have normal scratch accesses completely unrelated to RT scratch accesses. This change switches the validation by looking at whether the scratch base pointer intrinsic is being used (which is what we use/abuse to implement RT scratch). Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes:c78be5da30("intel/fs: lower ray query intrinsics") Reviewed-by: Ivan Briano <ivan.briano@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17396> (cherry picked from commitf7fab09a07)
This commit is contained in:
parent
318020df2b
commit
87f6095557
2 changed files with 24 additions and 2 deletions
|
|
@ -1039,7 +1039,7 @@
|
|||
"description": "intel/nir/rt: change scratch check validation",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "c78be5da300ae386a12b91a22efb064335e2043a"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,6 +25,28 @@
|
|||
#include "brw_nir_rt_builder.h"
|
||||
#include "nir_phi_builder.h"
|
||||
|
||||
UNUSED static bool
|
||||
no_load_scratch_base_ptr_intrinsic(nir_shader *shader)
|
||||
{
|
||||
nir_foreach_function(func, shader) {
|
||||
if (!func->impl)
|
||||
continue;
|
||||
|
||||
nir_foreach_block(block, func->impl) {
|
||||
nir_foreach_instr(instr, block) {
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
|
||||
if (intrin->intrinsic == nir_intrinsic_load_scratch_base_ptr)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Insert the appropriate return instruction at the end of the shader */
|
||||
void
|
||||
brw_nir_lower_shader_returns(nir_shader *shader)
|
||||
|
|
@ -46,7 +68,7 @@ brw_nir_lower_shader_returns(nir_shader *shader)
|
|||
* This isn't needed for ray-gen shaders because they end the thread and
|
||||
* never return to the calling trampoline shader.
|
||||
*/
|
||||
assert(shader->scratch_size == 0);
|
||||
assert(no_load_scratch_base_ptr_intrinsic(shader));
|
||||
if (shader->info.stage != MESA_SHADER_RAYGEN)
|
||||
shader->scratch_size = BRW_BTD_STACK_CALLEE_DATA_SIZE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue