nvc0: keep track of PGRAPH state in nvc0_screen
See identical commit for nv50. Destroying the current context and then creating a new one or switching to another existing context would cause the "current" state to not be properly initialized, so we save it off in the screen. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: mesa-stable@lists.freedesktop.org
This commit is contained in:
parent
f617029db3
commit
e9b1ea29bf
|
@ -139,8 +139,12 @@ nvc0_destroy(struct pipe_context *pipe)
|
|||
{
|
||||
struct nvc0_context *nvc0 = nvc0_context(pipe);
|
||||
|
||||
if (nvc0->screen->cur_ctx == nvc0)
|
||||
if (nvc0->screen->cur_ctx == nvc0) {
|
||||
nvc0->screen->cur_ctx = NULL;
|
||||
nvc0->screen->save_state = nvc0->state;
|
||||
nvc0->screen->save_state.tfb = NULL;
|
||||
}
|
||||
|
||||
/* Unset bufctx, we don't want to revalidate any resources after the flush.
|
||||
* Other contexts will always set their bufctx again on action calls.
|
||||
*/
|
||||
|
@ -303,6 +307,7 @@ nvc0_create(struct pipe_screen *pscreen, void *priv)
|
|||
pipe->get_sample_position = nvc0_context_get_sample_position;
|
||||
|
||||
if (!screen->cur_ctx) {
|
||||
nvc0->state = screen->save_state;
|
||||
screen->cur_ctx = nvc0;
|
||||
nouveau_pushbuf_bufctx(screen->base.pushbuf, nvc0->bufctx);
|
||||
}
|
||||
|
|
|
@ -113,29 +113,7 @@ struct nvc0_context {
|
|||
uint32_t dirty;
|
||||
uint32_t dirty_cp; /* dirty flags for compute state */
|
||||
|
||||
struct {
|
||||
boolean flushed;
|
||||
boolean rasterizer_discard;
|
||||
boolean early_z_forced;
|
||||
boolean prim_restart;
|
||||
uint32_t instance_elts; /* bitmask of per-instance elements */
|
||||
uint32_t instance_base;
|
||||
uint32_t constant_vbos;
|
||||
uint32_t constant_elts;
|
||||
int32_t index_bias;
|
||||
uint16_t scissor;
|
||||
uint8_t vbo_mode; /* 0 = normal, 1 = translate, 3 = translate, forced */
|
||||
uint8_t num_vtxbufs;
|
||||
uint8_t num_vtxelts;
|
||||
uint8_t num_textures[6];
|
||||
uint8_t num_samplers[6];
|
||||
uint8_t tls_required; /* bitmask of shader types using l[] */
|
||||
uint8_t c14_bound; /* whether immediate array constbuf is bound */
|
||||
uint8_t clip_enable;
|
||||
uint32_t clip_mode;
|
||||
uint32_t uniform_buffer_bound[5];
|
||||
struct nvc0_transform_feedback_state *tfb;
|
||||
} state;
|
||||
struct nvc0_graph_state state;
|
||||
|
||||
struct nvc0_blend_stateobj *blend;
|
||||
struct nvc0_rasterizer_stateobj *rast;
|
||||
|
|
|
@ -27,10 +27,35 @@ struct nvc0_context;
|
|||
|
||||
struct nvc0_blitter;
|
||||
|
||||
struct nvc0_graph_state {
|
||||
boolean flushed;
|
||||
boolean rasterizer_discard;
|
||||
boolean early_z_forced;
|
||||
boolean prim_restart;
|
||||
uint32_t instance_elts; /* bitmask of per-instance elements */
|
||||
uint32_t instance_base;
|
||||
uint32_t constant_vbos;
|
||||
uint32_t constant_elts;
|
||||
int32_t index_bias;
|
||||
uint16_t scissor;
|
||||
uint8_t vbo_mode; /* 0 = normal, 1 = translate, 3 = translate, forced */
|
||||
uint8_t num_vtxbufs;
|
||||
uint8_t num_vtxelts;
|
||||
uint8_t num_textures[6];
|
||||
uint8_t num_samplers[6];
|
||||
uint8_t tls_required; /* bitmask of shader types using l[] */
|
||||
uint8_t c14_bound; /* whether immediate array constbuf is bound */
|
||||
uint8_t clip_enable;
|
||||
uint32_t clip_mode;
|
||||
uint32_t uniform_buffer_bound[5];
|
||||
struct nvc0_transform_feedback_state *tfb;
|
||||
};
|
||||
|
||||
struct nvc0_screen {
|
||||
struct nouveau_screen base;
|
||||
|
||||
struct nvc0_context *cur_ctx;
|
||||
struct nvc0_graph_state save_state;
|
||||
|
||||
int num_occlusion_queries_active;
|
||||
|
||||
|
|
|
@ -543,6 +543,8 @@ nvc0_switch_pipe_context(struct nvc0_context *ctx_to)
|
|||
|
||||
if (ctx_from)
|
||||
ctx_to->state = ctx_from->state;
|
||||
else
|
||||
ctx_to->state = ctx_to->screen->save_state;
|
||||
|
||||
ctx_to->dirty = ~0;
|
||||
ctx_to->viewports_dirty = ~0;
|
||||
|
|
Loading…
Reference in New Issue