gallium: add a way to store query result into buffer
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
386a9ec77b
commit
40d7f02c67
|
@ -325,6 +325,11 @@ returned). Otherwise, if the ``wait`` parameter is FALSE, the call
|
||||||
will not block and the return value will be TRUE if the query has
|
will not block and the return value will be TRUE if the query has
|
||||||
completed or FALSE otherwise.
|
completed or FALSE otherwise.
|
||||||
|
|
||||||
|
``get_query_result_resource`` is used to store the result of a query into
|
||||||
|
a resource without synchronizing with the CPU. This write will optionally
|
||||||
|
wait for the query to complete, and will optionally write whether the value
|
||||||
|
is available instead of the value itself.
|
||||||
|
|
||||||
The interface currently includes the following types of queries:
|
The interface currently includes the following types of queries:
|
||||||
|
|
||||||
``PIPE_QUERY_OCCLUSION_COUNTER`` counts the number of fragments which
|
``PIPE_QUERY_OCCLUSION_COUNTER`` counts the number of fragments which
|
||||||
|
|
|
@ -150,6 +150,28 @@ struct pipe_context {
|
||||||
struct pipe_query *q,
|
struct pipe_query *q,
|
||||||
boolean wait,
|
boolean wait,
|
||||||
union pipe_query_result *result);
|
union pipe_query_result *result);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get results of a query, storing into resource. Note that this may not
|
||||||
|
* be used with batch queries.
|
||||||
|
*
|
||||||
|
* \param wait if true, this query will block until the result is ready
|
||||||
|
* \param result_type the type of the value being stored:
|
||||||
|
* \param index for queries that return multiple pieces of data, which
|
||||||
|
* item of that data to store (e.g. for
|
||||||
|
* PIPE_QUERY_PIPELINE_STATISTICS).
|
||||||
|
* When the index is -1, instead of the value of the query
|
||||||
|
* the driver should instead write a 1/0 to the appropriate
|
||||||
|
* location with 1 meaning that the query result is available.
|
||||||
|
*/
|
||||||
|
void (*get_query_result_resource)(struct pipe_context *pipe,
|
||||||
|
struct pipe_query *q,
|
||||||
|
boolean wait,
|
||||||
|
enum pipe_query_value_type result_type,
|
||||||
|
int index,
|
||||||
|
struct pipe_resource *resource,
|
||||||
|
unsigned offset);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -353,6 +353,7 @@ enum pipe_flush_flags
|
||||||
*/
|
*/
|
||||||
#define PIPE_BARRIER_MAPPED_BUFFER (1 << 0)
|
#define PIPE_BARRIER_MAPPED_BUFFER (1 << 0)
|
||||||
#define PIPE_BARRIER_SHADER_BUFFER (1 << 1)
|
#define PIPE_BARRIER_SHADER_BUFFER (1 << 1)
|
||||||
|
#define PIPE_BARRIER_QUERY_BUFFER (1 << 2)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resource binding flags -- state tracker must specify in advance all
|
* Resource binding flags -- state tracker must specify in advance all
|
||||||
|
@ -376,6 +377,7 @@ enum pipe_flush_flags
|
||||||
#define PIPE_BIND_SHADER_IMAGE (1 << 15) /* set_shader_images */
|
#define PIPE_BIND_SHADER_IMAGE (1 << 15) /* set_shader_images */
|
||||||
#define PIPE_BIND_COMPUTE_RESOURCE (1 << 16) /* set_compute_resources */
|
#define PIPE_BIND_COMPUTE_RESOURCE (1 << 16) /* set_compute_resources */
|
||||||
#define PIPE_BIND_COMMAND_ARGS_BUFFER (1 << 17) /* pipe_draw_info.indirect */
|
#define PIPE_BIND_COMMAND_ARGS_BUFFER (1 << 17) /* pipe_draw_info.indirect */
|
||||||
|
#define PIPE_BIND_QUERY_BUFFER (1 << 18) /* get_query_result_resource */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The first two flags above were previously part of the amorphous
|
* The first two flags above were previously part of the amorphous
|
||||||
|
@ -840,6 +842,14 @@ union pipe_query_result
|
||||||
union pipe_numeric_type_union batch[1];
|
union pipe_numeric_type_union batch[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum pipe_query_value_type
|
||||||
|
{
|
||||||
|
PIPE_QUERY_TYPE_I32,
|
||||||
|
PIPE_QUERY_TYPE_U32,
|
||||||
|
PIPE_QUERY_TYPE_I64,
|
||||||
|
PIPE_QUERY_TYPE_U64,
|
||||||
|
};
|
||||||
|
|
||||||
union pipe_color_union
|
union pipe_color_union
|
||||||
{
|
{
|
||||||
float f[4];
|
float f[4];
|
||||||
|
|
Loading…
Reference in New Issue