summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2014-09-09 21:25:00 +1200
committerKenneth Graunke <kenneth@whitecape.org>2015-11-04 10:18:56 -0800
commit4e2c845d068716d2de31ae5ee180775a8bc24369 (patch)
tree29162cbcd154d34bcb2d1881592c3d649498a6da
parent0f0304f023554f2efa9c48aee5b573dcf7c8e20a (diff)
i965: Add backend structures for tess stages
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
-rw-r--r--src/mesa/drivers/dri/i965/brw_compiler.h16
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h44
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c22
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c8
6 files changed, 96 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index 91eabaf778..c804902256 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -511,6 +511,22 @@ struct brw_vs_prog_data {
bool uses_instanceid;
};
+struct brw_hs_prog_data
+{
+ struct brw_vue_prog_data base;
+
+ /** Number vertices in output patch */
+ int instances;
+
+ bool uses_barrier_function;
+};
+
+
+struct brw_ds_prog_data
+{
+ struct brw_vue_prog_data base;
+};
+
struct brw_gs_prog_data
{
struct brw_vue_prog_data base;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index e6b78daed8..26bf67244e 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -796,6 +796,8 @@ brwCreateContext(gl_api api,
brw->has_swizzling = screen->hw_has_swizzling;
brw->vs.base.stage = MESA_SHADER_VERTEX;
+ brw->hs.base.stage = MESA_SHADER_TESS_CTRL;
+ brw->ds.base.stage = MESA_SHADER_TESS_EVAL;
brw->gs.base.stage = MESA_SHADER_GEOMETRY;
brw->wm.base.stage = MESA_SHADER_FRAGMENT;
if (brw->gen >= 8) {
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 270080727c..6f62e26829 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -116,6 +116,12 @@ extern "C" {
* enabled, it first passes them to a VS thread which is a good place
* for the driver to implement any active vertex shader.
*
+ * HS - Hull Shader (Tessellation Control Shader)
+ *
+ * TE - Tessellation Engine (Tessellation Primitive Generation)
+ *
+ * DS - Domain Shader (Tessellation Evaluation Shader)
+ *
* GS - Geometry Shader. This corresponds to a new DX10 concept. If
* enabled, incoming strips etc are passed to GS threads in individual
* line/triangle/point units. The GS thread may perform arbitary
@@ -314,6 +320,20 @@ struct brw_vertex_program {
};
+/** Subclass of Mesa tessellation control program */
+struct brw_tess_ctrl_program {
+ struct gl_tess_ctrl_program program;
+ unsigned id; /**< serial no. to identify tess ctrl progs, never re-used */
+};
+
+
+/** Subclass of Mesa tessellation evaluation program */
+struct brw_tess_eval_program {
+ struct gl_tess_eval_program program;
+ unsigned id; /**< serial no. to identify tess eval progs, never re-used */
+};
+
+
/** Subclass of Mesa geometry program */
struct brw_geometry_program {
struct gl_geometry_program program;
@@ -946,6 +966,8 @@ struct brw_context
*/
const struct gl_vertex_program *vertex_program;
const struct gl_geometry_program *geometry_program;
+ const struct gl_tess_ctrl_program *tess_ctrl_program;
+ const struct gl_tess_eval_program *tess_eval_program;
const struct gl_fragment_program *fragment_program;
const struct gl_compute_program *compute_program;
@@ -1037,6 +1059,28 @@ struct brw_context
struct {
struct brw_stage_state base;
+ struct brw_hs_prog_data *prog_data;
+
+ /**
+ * True if the 3DSTATE_HS command most recently emitted to the 3D
+ * pipeline enabled the HS; false otherwise.
+ */
+ bool enabled;
+ } hs;
+
+ struct {
+ struct brw_stage_state base;
+ struct brw_ds_prog_data *prog_data;
+
+ /**
+ * True if the 3DSTATE_DS command most recently emitted to the 3D
+ * pipeline enabled the DS; false otherwise.
+ */
+ bool enabled;
+ } ds;
+
+ struct {
+ struct brw_stage_state base;
struct brw_gs_prog_data *prog_data;
/**
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index bff484f09d..a0a3cebf0c 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -426,6 +426,10 @@ brw_try_draw_prims(struct gl_context *ctx,
_mesa_fls(ctx->FragmentProgram._Current->Base.SamplersUsed);
brw->gs.base.sampler_count = ctx->GeometryProgram._Current ?
_mesa_fls(ctx->GeometryProgram._Current->Base.SamplersUsed) : 0;
+ brw->ds.base.sampler_count = ctx->TessEvalProgram._Current ?
+ _mesa_fls(ctx->TessEvalProgram._Current->Base.SamplersUsed) : 0;
+ brw->hs.base.sampler_count = ctx->TessCtrlProgram._Current ?
+ _mesa_fls(ctx->TessCtrlProgram._Current->Base.SamplersUsed) : 0;
brw->vs.base.sampler_count =
_mesa_fls(ctx->VertexProgram._Current->Base.SamplersUsed);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 1ccfa1b6a1..f016987498 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -97,6 +97,28 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
}
}
+ case GL_TESS_CONTROL_PROGRAM_NV: {
+ struct brw_tess_ctrl_program *prog = CALLOC_STRUCT(brw_tess_ctrl_program);
+ if (prog) {
+ prog->id = get_new_program_id(brw->intelScreen);
+
+ return _mesa_init_gl_program(&prog->program.Base, target, id);
+ } else {
+ return NULL;
+ }
+ }
+
+ case GL_TESS_EVALUATION_PROGRAM_NV: {
+ struct brw_tess_eval_program *prog = CALLOC_STRUCT(brw_tess_eval_program);
+ if (prog) {
+ prog->id = get_new_program_id(brw->intelScreen);
+
+ return _mesa_init_gl_program(&prog->program.Base, target, id);
+ } else {
+ return NULL;
+ }
+ }
+
case GL_COMPUTE_PROGRAM_NV: {
struct brw_compute_program *prog = CALLOC_STRUCT(brw_compute_program);
if (prog) {
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 0344b8a7fb..f70ba797c8 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -719,6 +719,14 @@ brw_upload_pipeline_state(struct brw_context *brw,
brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
}
+ if (brw->tess_eval_program != ctx->TessEvalProgram._Current) {
+ brw->tess_eval_program = ctx->TessEvalProgram._Current;
+ }
+
+ if (brw->tess_ctrl_program != ctx->TessCtrlProgram._Current) {
+ brw->tess_ctrl_program = ctx->TessCtrlProgram._Current;
+ }
+
if (brw->geometry_program != ctx->GeometryProgram._Current) {
brw->geometry_program = ctx->GeometryProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_GEOMETRY_PROGRAM;