This can affect whether u_vbuf will be enabled or not.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
}
}
-static void cso_init_vbuf(struct cso_context *cso)
+static void cso_init_vbuf(struct cso_context *cso, unsigned flags)
{
struct u_vbuf_caps caps;
/* Install u_vbuf if there is anything unsupported. */
- if (u_vbuf_get_caps(cso->pipe->screen, &caps)) {
+ if (u_vbuf_get_caps(cso->pipe->screen, &caps, flags)) {
cso->vbuf = u_vbuf_create(cso->pipe, &caps,
cso->aux_vertex_buffer_index);
}
}
-struct cso_context *cso_create_context( struct pipe_context *pipe )
+struct cso_context *
+cso_create_context(struct pipe_context *pipe, unsigned u_vbuf_flags)
{
struct cso_context *ctx = CALLOC_STRUCT(cso_context);
if (!ctx)
ctx->aux_vertex_buffer_index = 0; /* 0 for now */
- cso_init_vbuf(ctx);
+ cso_init_vbuf(ctx, u_vbuf_flags);
/* Enable for testing: */
if (0) cso_set_maximum_cache_size( ctx->cache, 4 );
struct cso_context;
struct u_vbuf;
-struct cso_context *cso_create_context( struct pipe_context *pipe );
+struct cso_context *cso_create_context(struct pipe_context *pipe,
+ unsigned u_vbuf_flags);
void cso_destroy_context( struct cso_context *cso );
return;
}
- cso = cso_create_context(ctx);
+ cso = cso_create_context(ctx, 0);
cb = util_create_texture2d(ctx->screen, 256, 256,
PIPE_FORMAT_R8G8B8A8_UNORM);
util_set_common_states_and_clear(cso, ctx, cb);
return;
}
- cso = cso_create_context(ctx);
+ cso = cso_create_context(ctx, 0);
cb = util_create_texture2d(ctx->screen, 256, 256,
PIPE_FORMAT_R8G8B8A8_UNORM);
util_set_common_states_and_clear(cso, ctx, cb);
bool pass = true;
static const float zero[] = {0, 0, 0, 0};
- cso = cso_create_context(ctx);
+ cso = cso_create_context(ctx, 0);
cb = util_create_texture2d(ctx->screen, 256, 256,
PIPE_FORMAT_R8G8B8A8_UNORM);
util_set_common_states_and_clear(cso, ctx, cb);
struct pipe_query *query;
union pipe_query_result qresult;
- cso = cso_create_context(ctx);
+ cso = cso_create_context(ctx, 0);
cb = util_create_texture2d(ctx->screen, 256, 256,
PIPE_FORMAT_R8G8B8A8_UNORM);
util_set_common_states_and_clear(cso, ctx, cb);
{ PIPE_FORMAT_R8G8B8A8_SSCALED, PIPE_FORMAT_R32G32B32A32_FLOAT },
};
-boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
+boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps,
+ unsigned flags)
{
unsigned i;
boolean fallback = FALSE;
if (!caps->buffer_offset_unaligned ||
!caps->buffer_stride_unaligned ||
!caps->velem_src_offset_unaligned ||
- !caps->user_vertex_buffers) {
+ (!(flags & U_VBUF_FLAG_NO_USER_VBOS) && !caps->user_vertex_buffers)) {
fallback = TRUE;
}
struct cso_context;
struct u_vbuf;
+#define U_VBUF_FLAG_NO_USER_VBOS (1 << 0)
+
/* Hardware vertex fetcher limitations can be described by this structure. */
struct u_vbuf_caps {
enum pipe_format format_translation[PIPE_FORMAT_COUNT];
};
-boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps);
+boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps,
+ unsigned flags);
struct u_vbuf *
u_vbuf_create(struct pipe_context *pipe,
This->pipe_sw = This->screen_sw->context_create(This->screen_sw, NULL, 0);
if (!This->pipe_sw) { return E_OUTOFMEMORY; }
- This->context.cso = cso_create_context(This->context.pipe);
+ This->context.cso = cso_create_context(This->context.pipe, 0);
if (!This->context.cso) { return E_OUTOFMEMORY; } /* also a guess */
- This->cso_sw = cso_create_context(This->pipe_sw);
+ This->cso_sw = cso_create_context(This->pipe_sw, 0);
if (!This->cso_sw) { return E_OUTOFMEMORY; }
/* Create first, it messes up our state. */
ctx->xa = xa;
ctx->pipe = xa->screen->context_create(xa->screen, NULL, 0);
- ctx->cso = cso_create_context(ctx->pipe);
+ ctx->cso = cso_create_context(ctx->pipe, 0);
ctx->shaders = xa_shaders_create(ctx);
renderer_init_state(ctx);
/* create the pipe driver context and cso context */
p->pipe = p->screen->context_create(p->screen, NULL, 0);
- p->cso = cso_create_context(p->pipe);
+ p->cso = cso_create_context(p->pipe, 0);
/* set clear color */
p->clear_color.f[0] = 0.3;
/* create the pipe driver context and cso context */
p->pipe = p->screen->context_create(p->screen, NULL, 0);
- p->cso = cso_create_context(p->pipe);
+ p->cso = cso_create_context(p->pipe, 0);
/* set clear color */
p->clear_color.f[0] = 0.3;
st->has_user_constbuf =
screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS);
- st->cso_context = cso_create_context(pipe);
+ st->cso_context = cso_create_context(pipe, 0);
st_init_atoms( st );
st_init_clear(st);