[Mesa-dev] [PATCH 23/25] i965: replace brw_tess_{eval, ctrl}_program with brw_program
Timothy Arceri
timothy.arceri at collabora.com
Tue Oct 18 06:12:26 UTC 2016
---
src/mesa/drivers/dri/i965/brw_context.h | 26 -----------------------
src/mesa/drivers/dri/i965/brw_program.c | 24 ++-------------------
src/mesa/drivers/dri/i965/brw_tcs.c | 17 ++++++---------
src/mesa/drivers/dri/i965/brw_tcs_surface_state.c | 3 +--
src/mesa/drivers/dri/i965/brw_tes.c | 13 +++++-------
src/mesa/drivers/dri/i965/brw_tes_surface_state.c | 3 +--
src/mesa/drivers/dri/i965/gen7_ds_state.c | 3 +--
src/mesa/drivers/dri/i965/gen7_hs_state.c | 3 +--
8 files changed, 18 insertions(+), 74 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index e3aa5d7..0baab30 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -334,20 +334,6 @@ struct brw_program {
};
-/** Subclass of Mesa tessellation control program */
-struct brw_tess_ctrl_program {
- struct gl_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_program program;
- unsigned id; /**< serial no. to identify tess eval progs, never re-used */
-};
-
-
/** Subclass of Mesa fragment program */
struct brw_fragment_program {
struct gl_program program;
@@ -1704,18 +1690,6 @@ brw_program_const(const struct gl_program *p)
return (const struct brw_program *) p;
}
-static inline struct brw_tess_ctrl_program *
-brw_tess_ctrl_program(struct gl_program *p)
-{
- return (struct brw_tess_ctrl_program *) p;
-}
-
-static inline struct brw_tess_eval_program *
-brw_tess_eval_program(struct gl_program *p)
-{
- return (struct brw_tess_eval_program *) p;
-}
-
static inline struct brw_fragment_program *
brw_fragment_program(struct gl_program *p)
{
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 2829d6f..cf0b3a2 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -131,6 +131,8 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
switch (target) {
case GL_VERTEX_PROGRAM_ARB:
+ case GL_TESS_CONTROL_PROGRAM_NV:
+ case GL_TESS_EVALUATION_PROGRAM_NV:
case GL_GEOMETRY_PROGRAM_NV: {
struct brw_program *prog = CALLOC_STRUCT(brw_program);
if (prog) {
@@ -161,28 +163,6 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
return NULL;
}
- 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->screen);
-
- return _mesa_init_gl_program(&prog->program, 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->screen);
-
- return _mesa_init_gl_program(&prog->program, 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_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 0910d24..831f460 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -166,7 +166,7 @@ brw_tcs_debug_recompile(struct brw_context *brw,
static bool
brw_codegen_tcs_prog(struct brw_context *brw,
struct gl_shader_program *shader_prog,
- struct brw_tess_ctrl_program *tcp,
+ struct brw_program *tcp,
struct brw_tcs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
@@ -317,10 +317,8 @@ void
brw_tcs_populate_key(struct brw_context *brw,
struct brw_tcs_prog_key *key)
{
- struct brw_tess_ctrl_program *tcp =
- (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
- struct brw_tess_eval_program *tep =
- (struct brw_tess_eval_program *) brw->tess_eval_program;
+ struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+ struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
struct gl_program *tes_prog = &tep->program;
uint64_t per_vertex_slots = tes_prog->info.inputs_read;
@@ -364,10 +362,9 @@ brw_upload_tcs_prog(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tcs.base;
struct brw_tcs_prog_key key;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_tess_ctrl_program *tcp =
- (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
- MAYBE_UNUSED struct brw_tess_eval_program *tep =
- (struct brw_tess_eval_program *) brw->tess_eval_program;
+ struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+ MAYBE_UNUSED struct brw_program *tep =
+ (struct brw_program *) brw->tess_eval_program;
assert(tep);
if (!brw_state_dirty(brw,
@@ -401,7 +398,7 @@ brw_tcs_precompile(struct gl_context *ctx,
struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data;
bool success;
- struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(prog);
+ struct brw_program *btcp = brw_program(prog);
const struct gl_linked_shader *tes =
shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
index e91488f..83b5611 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -41,8 +41,7 @@ brw_upload_tcs_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tcs.base;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_tess_ctrl_program *tcp =
- (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
+ struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
if (!tcp)
return;
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 3992bb3..6060c76 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -79,7 +79,7 @@ brw_tes_debug_recompile(struct brw_context *brw,
static bool
brw_codegen_tes_prog(struct brw_context *brw,
struct gl_shader_program *shader_prog,
- struct brw_tess_eval_program *tep,
+ struct brw_program *tep,
struct brw_tes_prog_key *key)
{
const struct brw_compiler *compiler = brw->screen->compiler;
@@ -233,10 +233,8 @@ void
brw_tes_populate_key(struct brw_context *brw,
struct brw_tes_prog_key *key)
{
- struct brw_tess_ctrl_program *tcp =
- (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
- struct brw_tess_eval_program *tep =
- (struct brw_tess_eval_program *) brw->tess_eval_program;
+ struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+ struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
struct gl_program *prog = &tep->program;
uint64_t per_vertex_slots = prog->info.inputs_read;
@@ -275,8 +273,7 @@ brw_upload_tes_prog(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tes.base;
struct brw_tes_prog_key key;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_tess_eval_program *tep =
- (struct brw_tess_eval_program *) brw->tess_eval_program;
+ struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
if (!brw_state_dirty(brw,
_NEW_TEXTURE,
@@ -308,7 +305,7 @@ brw_tes_precompile(struct gl_context *ctx,
struct brw_stage_prog_data *old_prog_data = brw->tes.base.prog_data;
bool success;
- struct brw_tess_eval_program *btep = brw_tess_eval_program(prog);
+ struct brw_program *btep = brw_program(prog);
memset(&key, 0, sizeof(key));
diff --git a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
index 2a7d48a..53b39cd 100644
--- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
@@ -41,8 +41,7 @@ brw_upload_tes_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tes.base;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_tess_eval_program *dp =
- (struct brw_tess_eval_program *) brw->tess_eval_program;
+ struct brw_program *dp = (struct brw_program *) brw->tess_eval_program;
if (!dp)
return;
diff --git a/src/mesa/drivers/dri/i965/gen7_ds_state.c b/src/mesa/drivers/dri/i965/gen7_ds_state.c
index 23e03d7..9d7f531 100644
--- a/src/mesa/drivers/dri/i965/gen7_ds_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_ds_state.c
@@ -32,8 +32,7 @@ gen7_upload_tes_push_constants(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->tes.base;
/* BRW_NEW_TESS_PROGRAMS */
- const struct brw_tess_eval_program *tep =
- (struct brw_tess_eval_program *) brw->tess_eval_program;
+ const struct brw_program *tep = brw_program_const(brw->tess_eval_program);
if (tep) {
/* BRW_NEW_TES_PROG_DATA */
diff --git a/src/mesa/drivers/dri/i965/gen7_hs_state.c b/src/mesa/drivers/dri/i965/gen7_hs_state.c
index 290aea2..fadea23 100644
--- a/src/mesa/drivers/dri/i965/gen7_hs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_hs_state.c
@@ -32,8 +32,7 @@ gen7_upload_tcs_push_constants(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->tcs.base;
/* BRW_NEW_TESS_PROGRAMS */
- const struct brw_tess_ctrl_program *tcp =
- (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
+ const struct brw_program *tcp = brw_program_const(brw->tess_ctrl_program);
bool active = brw->tess_eval_program;
if (active) {
--
2.7.4
More information about the mesa-dev
mailing list