anv: enable ray queries

Only on platforms that support it.

v3: Split out code setting up ray query shadow buffer (Caio)
    Don't forget to setup ray query globals even when no shadow buffer
    is used (Lionel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13719>
This commit is contained in:
Lionel Landwerlin
2021-06-08 16:24:54 +03:00
committed by Marge Bot
parent c78be5da30
commit 5d3e419378
8 changed files with 208 additions and 10 deletions

View File

@@ -1210,6 +1210,21 @@ struct anv_device {
struct anv_scratch_pool scratch_pool;
struct anv_bo *rt_scratch_bos[16];
/** Shadow ray query BO
*
* The ray_query_bo only holds the current ray being traced. When using
* more than 1 ray query per thread, we cannot fit all the queries in
* there, so we need a another buffer to hold query data that is not
* currently being used by the HW for tracing, similar to a scratch space.
*
* The size of the shadow buffer depends on the number of queries per
* shader.
*/
struct anv_bo *ray_query_shadow_bos[16];
/** Ray query buffer used to communicated with HW unit.
*/
struct anv_bo *ray_query_bo;
struct anv_shader_bin *rt_trampoline;
struct anv_shader_bin *rt_trivial_return;
@@ -2618,8 +2633,8 @@ struct anv_push_constants {
/* Robust access pushed registers. */
uint64_t push_reg_mask[MESA_SHADER_STAGES];
/** Pad out to a multiple of 32 bytes */
uint32_t pad[2];
/** Ray query globals (RT_DISPATCH_GLOBALS) */
uint64_t ray_query_globals;
/* Base addresses for descriptor sets */
uint64_t desc_sets[MAX_SETS];
@@ -3105,6 +3120,11 @@ struct anv_cmd_state {
struct anv_state null_surface_state;
struct anv_dynamic_render_pass dynamic_render_pass;
/**
* A buffer used for spill/fill of ray queries.
*/
struct anv_bo * ray_query_shadow_bo;
};
struct anv_cmd_pool {
@@ -3463,6 +3483,8 @@ struct anv_pipeline {
enum anv_pipeline_type type;
VkPipelineCreateFlags flags;
uint32_t ray_queries;
struct util_dynarray executables;
const struct intel_l3_config * l3_config;