We now get all the tes metadata from shader_info.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
/** Subclass of Mesa tessellation evaluation program */
struct brw_tess_eval_program {
- struct gl_tess_eval_program program;
+ struct gl_program program;
unsigned id; /**< serial no. to identify tess eval progs, never re-used */
};
const struct gl_vertex_program *vertex_program;
const struct gl_geometry_program *geometry_program;
const struct gl_program *tess_ctrl_program;
- const struct gl_tess_eval_program *tess_eval_program;
+ const struct gl_program *tess_eval_program;
const struct gl_fragment_program *fragment_program;
const struct gl_compute_program *compute_program;
}
static inline struct brw_tess_eval_program *
-brw_tess_eval_program(struct gl_tess_eval_program *p)
+brw_tess_eval_program(struct gl_program *p)
{
return (struct brw_tess_eval_program *) p;
}
brw->gs.base.sampler_count = ctx->GeometryProgram._Current ?
util_last_bit(ctx->GeometryProgram._Current->Base.SamplersUsed) : 0;
brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ?
- util_last_bit(ctx->TessEvalProgram._Current->Base.SamplersUsed) : 0;
+ util_last_bit(ctx->TessEvalProgram._Current->SamplersUsed) : 0;
brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
util_last_bit(ctx->TessCtrlProgram._Current->SamplersUsed) : 0;
brw->vs.base.sampler_count =
if (prog) {
prog->id = get_new_program_id(brw->screen);
- return _mesa_init_gl_program(&prog->program.Base, target, id);
+ return _mesa_init_gl_program(&prog->program, target, id);
} else {
return NULL;
}
(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 gl_program *tes_prog = &tep->program.Base;
+ struct gl_program *tes_prog = &tep->program;
uint64_t per_vertex_slots = tes_prog->info.inputs_read;
uint32_t per_patch_slots = tes_prog->info.patch_inputs_read;
/* We need to specialize our code generation for tessellation levels
* based on the domain the DS is expecting to tessellate.
*/
- key->tes_primitive_mode = tep->program.Base.info.tes.primitive_mode;
+ key->tes_primitive_mode = tep->program.info.tes.primitive_mode;
key->quads_workaround = brw->gen < 9 &&
- tep->program.Base.info.tes.primitive_mode == GL_QUADS &&
- tep->program.Base.info.tes.spacing == GL_EQUAL;
+ tep->program.info.tes.primitive_mode == GL_QUADS &&
+ tep->program.info.tes.spacing == GL_EQUAL;
if (tcp) {
key->program_string_id = tcp->id;
const struct brw_compiler *compiler = brw->screen->compiler;
const struct gen_device_info *devinfo = &brw->screen->devinfo;
struct brw_stage_state *stage_state = &brw->tes.base;
- nir_shader *nir = tep->program.Base.nir;
+ nir_shader *nir = tep->program.nir;
struct brw_tes_prog_data prog_data;
bool start_busy = false;
double start_time = 0;
memset(&prog_data, 0, sizeof(prog_data));
brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_EVAL, devinfo,
- shader_prog, &tep->program.Base,
+ shader_prog, &tep->program,
&prog_data.base.base, 0);
- switch (tep->program.Base.info.tes.spacing) {
+ switch (tep->program.info.tes.spacing) {
case GL_EQUAL:
prog_data.partitioning = BRW_TESS_PARTITIONING_INTEGER;
break;
unreachable("invalid domain shader spacing");
}
- switch (tep->program.Base.info.tes.primitive_mode) {
+ switch (tep->program.info.tes.primitive_mode) {
case GL_QUADS:
prog_data.domain = BRW_TESS_DOMAIN_QUAD;
break;
unreachable("invalid domain shader primitive mode");
}
- if (tep->program.Base.info.tes.point_mode) {
+ if (tep->program.info.tes.point_mode) {
prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_POINT;
- } else if (tep->program.Base.info.tes.primitive_mode == GL_ISOLINES) {
+ } else if (tep->program.info.tes.primitive_mode == GL_ISOLINES) {
prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE;
} else {
/* Hardware winding order is backwards from OpenGL */
- switch (tep->program.Base.info.tes.vertex_order) {
+ switch (tep->program.info.tes.vertex_order) {
case GL_CCW:
prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW;
break;
prog_data.base.base.nr_image_params = tes->NumImages;
prog_data.base.cull_distance_mask =
- ((1 << tep->program.Base.CullDistanceArraySize) - 1) <<
- tep->program.Base.ClipDistanceArraySize;
+ ((1 << tep->program.CullDistanceArraySize) - 1) <<
+ tep->program.ClipDistanceArraySize;
- brw_nir_setup_glsl_uniforms(nir, shader_prog, &tep->program.Base,
+ brw_nir_setup_glsl_uniforms(nir, shader_prog, &tep->program,
&prog_data.base.base,
compiler->scalar_stage[MESA_SHADER_TESS_EVAL]);
(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 gl_program *prog = &tep->program.Base;
+ struct gl_program *prog = &tep->program;
uint64_t per_vertex_slots = prog->info.inputs_read;
uint32_t per_patch_slots = prog->info.patch_inputs_read;
struct brw_stage_prog_data *old_prog_data = brw->tes.base.prog_data;
bool success;
- struct gl_tess_eval_program *tep = (struct gl_tess_eval_program *)prog;
- struct brw_tess_eval_program *btep = brw_tess_eval_program(tep);
+ struct brw_tess_eval_program *btep = brw_tess_eval_program(prog);
memset(&key, 0, sizeof(key));
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_TESS_EVAL);
/* _NEW_PROGRAM_CONSTANTS */
- brw_upload_pull_constants(brw, BRW_NEW_TES_CONSTBUF, &dp->program.Base,
+ brw_upload_pull_constants(brw, BRW_NEW_TES_CONSTBUF, &dp->program,
stage_state, prog_data);
}
/* BRW_NEW_TES_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->tes.base.prog_data;
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_TESS_EVAL);
- gen6_upload_push_constants(brw, &tep->program.Base, prog_data,
- stage_state, AUB_TRACE_VS_CONSTANTS);
+ gen6_upload_push_constants(brw, &tep->program, prog_data, stage_state,
+ AUB_TRACE_VS_CONSTANTS);
}
gen7_upload_constant_state(brw, stage_state, tep, _3DSTATE_CONSTANT_DS);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL);
_mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, NULL);
- _mesa_reference_tesseprog(ctx, &ctx->TessEvalProgram._Current, NULL);
+ _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
};
-/** Tessellation evaluation program object */
-struct gl_tess_eval_program
-{
- struct gl_program Base; /**< base class */
-
- /* input layout */
- GLenum PrimitiveMode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
- GLenum Spacing; /* GL_EQUAL, GL_FRACTIONAL_EVEN, GL_FRACTIONAL_ODD */
- GLenum VertexOrder; /* GL_CW or GL_CCW */
- bool PointMode;
-};
-
-
/** Geometry program object */
struct gl_geometry_program
{
struct gl_tess_eval_program_state
{
/** Currently bound and valid shader. */
- struct gl_tess_eval_program *_Current;
+ struct gl_program *_Current;
};
/**
struct {
/**
* True if gl_ClipDistance is written to. Copied into
- * gl_tess_eval_program by _mesa_copy_linked_program_data().
+ * gl_program by _mesa_copy_linked_program_data().
*/
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current;
const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
- const struct gl_tess_eval_program *prevTEP = ctx->TessEvalProgram._Current;
+ const struct gl_program *prevTEP = ctx->TessEvalProgram._Current;
const struct gl_compute_program *prevCP = ctx->ComputeProgram._Current;
GLbitfield new_state = 0x0;
if (tesProg && tesProg->LinkStatus
&& tesProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]) {
/* Use GLSL tessellation evaluation shader */
- _mesa_reference_tesseprog(ctx, &ctx->TessEvalProgram._Current,
- gl_tess_eval_program(
- tesProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program));
+ _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current,
+ tesProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program);
}
else {
/* No tessellation evaluation program */
- _mesa_reference_tesseprog(ctx, &ctx->TessEvalProgram._Current, NULL);
+ _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
}
if (tcsProg && tcsProg->LinkStatus
new_state |= _NEW_PROGRAM;
if (ctx->Driver.BindProgram) {
ctx->Driver.BindProgram(ctx, GL_TESS_EVALUATION_PROGRAM_NV,
- (struct gl_program *) ctx->TessEvalProgram._Current);
+ ctx->TessEvalProgram._Current);
}
}
struct gl_geometry_program *prog = CALLOC_STRUCT(gl_geometry_program);
return _mesa_init_gl_program(&prog->Base, target, id);
}
- case GL_TESS_CONTROL_PROGRAM_NV: {
+ case GL_TESS_CONTROL_PROGRAM_NV:
+ case GL_TESS_EVALUATION_PROGRAM_NV: {
struct gl_program *prog = CALLOC_STRUCT(gl_program);
return _mesa_init_gl_program(prog, target, id);
}
- case GL_TESS_EVALUATION_PROGRAM_NV: {
- struct gl_tess_eval_program *prog = CALLOC_STRUCT(gl_tess_eval_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
- }
case GL_COMPUTE_PROGRAM_NV: {
struct gl_compute_program *prog = CALLOC_STRUCT(gl_compute_program);
return _mesa_init_gl_program(&prog->Base, target, id);
(struct gl_program *) prog);
}
-static inline void
-_mesa_reference_tesseprog(struct gl_context *ctx,
- struct gl_tess_eval_program **ptr,
- struct gl_tess_eval_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
extern GLboolean
_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count);
return (const struct gl_compute_program *) prog;
}
-static inline struct gl_tess_eval_program *
-gl_tess_eval_program(struct gl_program *prog)
-{
- return (struct gl_tess_eval_program *) prog;
-}
-
-static inline const struct gl_tess_eval_program *
-gl_tess_eval_program_const(const struct gl_program *prog)
-{
- return (const struct gl_tess_eval_program *) prog;
-}
-
-
#ifdef __cplusplus
} /* extern "C" */
#endif
struct gl_vertex_program *new_vp = ctx->VertexProgram._Current;
struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;
- struct gl_tess_eval_program *new_tep = ctx->TessEvalProgram._Current;
+ struct gl_program *new_tep = ctx->TessEvalProgram._Current;
struct gl_geometry_program *new_gp = ctx->GeometryProgram._Current;
struct gl_fragment_program *new_fp = ctx->FragmentProgram._Current;
uint64_t dirty = 0;
struct gl_program_parameter_list *params;
if (tep) {
- params = tep->Base.Base.Parameters;
+ params = tep->Base.Parameters;
st_upload_constants( st, params, MESA_SHADER_TESS_EVAL );
}
}
if (ctx->GeometryProgram._Current)
last = &ctx->GeometryProgram._Current->Base;
else if (ctx->TessEvalProgram._Current)
- last = &ctx->TessEvalProgram._Current->Base;
+ last = ctx->TessEvalProgram._Current;
else if (ctx->VertexProgram._Current)
last = &ctx->VertexProgram._Current->Base;
if (last)
if (ctx->TessEvalProgram._Current) {
update_shader_samplers(st,
PIPE_SHADER_TESS_EVAL,
- &ctx->TessEvalProgram._Current->Base,
+ ctx->TessEvalProgram._Current,
ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_TESS_EVAL],
&st->state.num_samplers[PIPE_SHADER_TESS_EVAL]);
}
sttep = st_tesseval_program(st->ctx->TessEvalProgram._Current);
- assert(sttep->Base.Base.Target == GL_TESS_EVALUATION_PROGRAM_NV);
+ assert(sttep->Base.Target == GL_TESS_EVALUATION_PROGRAM_NV);
st->tep_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL,
&sttep->tgsi, &sttep->variants);
if (ctx->TessEvalProgram._Current) {
update_textures(st,
MESA_SHADER_TESS_EVAL,
- &ctx->TessEvalProgram._Current->Base,
+ ctx->TessEvalProgram._Current,
ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
st->state.sampler_views[PIPE_SHADER_TESS_EVAL],
&st->state.num_sampler_views[PIPE_SHADER_TESS_EVAL]);
}
case GL_TESS_EVALUATION_PROGRAM_NV: {
struct st_tesseval_program *prog = ST_CALLOC_STRUCT(st_tesseval_program);
- return _mesa_init_gl_program(&prog->Base.Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_COMPUTE_PROGRAM_NV: {
struct st_compute_program *prog = ST_CALLOC_STRUCT(st_compute_program);
struct st_tesseval_program *sttep =
(struct st_tesseval_program *) prog;
- st_release_basic_variants(st, sttep->Base.Base.Target,
+ st_release_basic_variants(st, sttep->Base.Target,
&sttep->variants, &sttep->tgsi);
if (sttep->glsl_to_tgsi)
struct st_tesseval_program *sttep =
(struct st_tesseval_program *) prog;
- st_release_basic_variants(st, sttep->Base.Base.Target,
- &sttep->variants, &sttep->tgsi);
+ st_release_basic_variants(st, sttep->Base.Target, &sttep->variants,
+ &sttep->tgsi);
if (!st_translate_tesseval_program(st, sttep))
return false;
if (ureg == NULL)
return false;
- if (sttep->Base.Base.info.tes.primitive_mode == GL_ISOLINES)
+ if (sttep->Base.info.tes.primitive_mode == GL_ISOLINES)
ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE, GL_LINES);
else
ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE,
- sttep->Base.Base.info.tes.primitive_mode);
+ sttep->Base.info.tes.primitive_mode);
- switch (sttep->Base.Base.info.tes.spacing) {
+ switch (sttep->Base.info.tes.spacing) {
case GL_EQUAL:
ureg_property(ureg, TGSI_PROPERTY_TES_SPACING, PIPE_TESS_SPACING_EQUAL);
break;
}
ureg_property(ureg, TGSI_PROPERTY_TES_VERTEX_ORDER_CW,
- sttep->Base.Base.info.tes.vertex_order == GL_CW);
+ sttep->Base.info.tes.vertex_order == GL_CW);
ureg_property(ureg, TGSI_PROPERTY_TES_POINT_MODE,
- sttep->Base.Base.info.tes.point_mode);
+ sttep->Base.info.tes.point_mode);
- st_translate_program_common(st, &sttep->Base.Base, sttep->glsl_to_tgsi,
+ st_translate_program_common(st, &sttep->Base, sttep->glsl_to_tgsi,
ureg, PIPE_SHADER_TESS_EVAL, &sttep->tgsi);
free_glsl_to_tgsi_visitor(sttep->glsl_to_tgsi);
/**
- * Derived from Mesa gl_tess_eval_program:
+ * Derived from Mesa gl_program:
*/
struct st_tesseval_program
{
- struct gl_tess_eval_program Base; /**< The Mesa tess eval program */
+ struct gl_program Base; /**< The Mesa tess eval program */
struct pipe_shader_state tgsi;
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
}
static inline struct st_tesseval_program *
-st_tesseval_program( struct gl_tess_eval_program *tep )
+st_tesseval_program( struct gl_program *tep )
{
return (struct st_tesseval_program *)tep;
}