aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-12-29 22:02:28 -0500
committerMarek Olšák <[email protected]>2020-01-08 13:40:59 -0500
commitce648b913f83b968eb6ba1ad33fdcf86d5942fe5 (patch)
tree96f88ed059e9037a89c69b076efbe3b2b781c6a5 /src/gallium/auxiliary/cso_cache
parent472593e9cfcb8d5b49d2475ee677700584583812 (diff)
gallium: put u_vbuf_get_caps return values into u_vbuf_caps
Acked-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c13
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h4
2 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index d9e1309c5cc..ae98a5c89cc 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -287,15 +287,20 @@ sanitize_hash(struct cso_hash *hash, enum cso_cache_type type,
static void cso_init_vbuf(struct cso_context *cso, unsigned flags)
{
struct u_vbuf_caps caps;
+ bool uses_user_vertex_buffers = !(flags & CSO_NO_USER_VERTEX_BUFFERS);
- /* Install u_vbuf if there is anything unsupported. */
- if (u_vbuf_get_caps(cso->pipe->screen, &caps, flags)) {
+ u_vbuf_get_caps(cso->pipe->screen, &caps);
+
+ /* Enable u_vbuf if needed. */
+ if (caps.fallback_always ||
+ (uses_user_vertex_buffers &&
+ caps.fallback_only_for_user_vbuffers)) {
cso->vbuf = u_vbuf_create(cso->pipe, &caps);
}
}
struct cso_context *
-cso_create_context(struct pipe_context *pipe, unsigned u_vbuf_flags)
+cso_create_context(struct pipe_context *pipe, unsigned flags)
{
struct cso_context *ctx = CALLOC_STRUCT(cso_context);
if (!ctx)
@@ -311,7 +316,7 @@ cso_create_context(struct pipe_context *pipe, unsigned u_vbuf_flags)
ctx->pipe = pipe;
ctx->sample_mask = ~0;
- cso_init_vbuf(ctx, u_vbuf_flags);
+ cso_init_vbuf(ctx, flags);
/* Enable for testing: */
if (0) cso_set_maximum_cache_size( ctx->cache, 4 );
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index d3501fb92e9..de8c60fd2c1 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -41,8 +41,10 @@ extern "C" {
struct cso_context;
struct u_vbuf;
+#define CSO_NO_USER_VERTEX_BUFFERS (1 << 0)
+
struct cso_context *cso_create_context(struct pipe_context *pipe,
- unsigned u_vbuf_flags);
+ unsigned flags);
void cso_destroy_context( struct cso_context *cso );
struct pipe_context *cso_get_pipe_context(struct cso_context *cso);