mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
etnaviv: make use of a fixed size array to track of all acc query provider
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>
This commit is contained in:
parent
6963fcd81f
commit
e5b0eed0f5
1 changed files with 16 additions and 17 deletions
|
|
@ -119,6 +119,11 @@ static const struct etna_acc_sample_provider occlusion_provider = {
|
||||||
.result = occlusion_result,
|
.result = occlusion_result,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct etna_acc_sample_provider *acc_sample_provider[] =
|
||||||
|
{
|
||||||
|
&occlusion_provider,
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
realloc_query_bo(struct etna_context *ctx, struct etna_acc_query *aq)
|
realloc_query_bo(struct etna_context *ctx, struct etna_acc_query *aq)
|
||||||
{
|
{
|
||||||
|
|
@ -224,29 +229,23 @@ static const struct etna_query_funcs acc_query_funcs = {
|
||||||
.get_query_result = etna_acc_get_query_result,
|
.get_query_result = etna_acc_get_query_result,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline const struct etna_acc_sample_provider *
|
|
||||||
query_sample_provider(unsigned query_type)
|
|
||||||
{
|
|
||||||
switch (query_type) {
|
|
||||||
case PIPE_QUERY_OCCLUSION_COUNTER:
|
|
||||||
/* fallthrough */
|
|
||||||
case PIPE_QUERY_OCCLUSION_PREDICATE:
|
|
||||||
/* fallthrough */
|
|
||||||
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
|
|
||||||
return &occlusion_provider;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct etna_query *
|
struct etna_query *
|
||||||
etna_acc_create_query(struct etna_context *ctx, unsigned query_type)
|
etna_acc_create_query(struct etna_context *ctx, unsigned query_type)
|
||||||
{
|
{
|
||||||
|
const struct etna_acc_sample_provider *p = NULL;
|
||||||
struct etna_acc_query *aq;
|
struct etna_acc_query *aq;
|
||||||
struct etna_query *q;
|
struct etna_query *q;
|
||||||
const struct etna_acc_sample_provider *p;
|
|
||||||
|
|
||||||
p = query_sample_provider(query_type);
|
/* find a sample provide for the requested query type */
|
||||||
|
for (unsigned i = 0; i < ARRAY_SIZE(acc_sample_provider); i++) {
|
||||||
|
p = acc_sample_provider[i];
|
||||||
|
|
||||||
|
if (p->supports(query_type))
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue