aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-07-20 15:50:43 -0400
committerIlia Mirkin <[email protected]>2015-07-23 03:33:08 -0400
commitc8e5337a9a240befcc953695c8822b0749c7a042 (patch)
tree7409824ef98f6bbec724ce102c4d0a8fd9fb1f3a
parentd1ffdebce6d03497fa6c2e4c8eb754e9075e29f4 (diff)
nvc0: add handling for set_tess_state callback
Signed-off-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.h4
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state.c19
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c11
3 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index 92f33ee279d..f4499423a10 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -54,6 +54,7 @@
#define NVC0_NEW_IDXBUF (1 << 22)
#define NVC0_NEW_SURFACES (1 << 23)
#define NVC0_NEW_MIN_SAMPLES (1 << 24)
+#define NVC0_NEW_TESSFACTOR (1 << 25)
#define NVC0_NEW_CP_PROGRAM (1 << 0)
#define NVC0_NEW_CP_SURFACES (1 << 1)
@@ -164,6 +165,9 @@ struct nvc0_context {
unsigned sample_mask;
unsigned min_samples;
+ float default_tess_outer[4];
+ float default_tess_inner[2];
+
bool vbo_push_hint;
uint8_t tfbbuf_dirty;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index c39939c20b0..693b14fa15f 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -980,6 +980,18 @@ nvc0_set_viewport_states(struct pipe_context *pipe,
}
static void
+nvc0_set_tess_state(struct pipe_context *pipe,
+ const float default_tess_outer[4],
+ const float default_tess_inner[2])
+{
+ struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+ memcpy(nvc0->default_tess_outer, default_tess_outer, 4 * sizeof(float));
+ memcpy(nvc0->default_tess_inner, default_tess_inner, 2 * sizeof(float));
+ nvc0->dirty |= NVC0_NEW_TESSFACTOR;
+}
+
+static void
nvc0_set_vertex_buffers(struct pipe_context *pipe,
unsigned start_slot, unsigned count,
const struct pipe_vertex_buffer *vb)
@@ -1293,6 +1305,7 @@ nvc0_init_state_functions(struct nvc0_context *nvc0)
pipe->set_polygon_stipple = nvc0_set_polygon_stipple;
pipe->set_scissor_states = nvc0_set_scissor_states;
pipe->set_viewport_states = nvc0_set_viewport_states;
+ pipe->set_tess_state = nvc0_set_tess_state;
pipe->create_vertex_elements_state = nvc0_vertex_state_create;
pipe->delete_vertex_elements_state = nvc0_vertex_state_delete;
@@ -1311,4 +1324,10 @@ nvc0_init_state_functions(struct nvc0_context *nvc0)
nvc0->sample_mask = ~0;
nvc0->min_samples = 1;
+ nvc0->default_tess_outer[0] =
+ nvc0->default_tess_outer[1] =
+ nvc0->default_tess_outer[2] =
+ nvc0->default_tess_outer[3] = 1.0;
+ nvc0->default_tess_inner[0] =
+ nvc0->default_tess_inner[1] = 1.0;
}
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 82004e7ca31..945e2a6c9bd 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -555,6 +555,16 @@ nvc0_validate_derived_2(struct nvc0_context *nvc0)
}
static void
+nvc0_validate_tess_state(struct nvc0_context *nvc0)
+{
+ struct nouveau_pushbuf *push = nvc0->base.pushbuf;
+
+ BEGIN_NVC0(push, NVC0_3D(TESS_LEVEL_OUTER(0)), 6);
+ PUSH_DATAp(push, nvc0->default_tess_outer, 4);
+ PUSH_DATAp(push, nvc0->default_tess_inner, 2);
+}
+
+static void
nvc0_switch_pipe_context(struct nvc0_context *ctx_to)
{
struct nvc0_context *ctx_from = ctx_to->screen->cur_ctx;
@@ -612,6 +622,7 @@ static struct state_validate {
{ nvc0_vertprog_validate, NVC0_NEW_VERTPROG },
{ nvc0_tctlprog_validate, NVC0_NEW_TCTLPROG },
{ nvc0_tevlprog_validate, NVC0_NEW_TEVLPROG },
+ { nvc0_validate_tess_state, NVC0_NEW_TESSFACTOR },
{ nvc0_gmtyprog_validate, NVC0_NEW_GMTYPROG },
{ nvc0_fragprog_validate, NVC0_NEW_FRAGPROG },
{ nvc0_validate_derived_1, NVC0_NEW_FRAGPROG | NVC0_NEW_ZSA |