/** Subclass of Mesa compute program */
struct brw_compute_program {
- struct gl_compute_program program;
+ struct gl_program program;
unsigned id; /**< serial no. to identify compute progs, never re-used */
};
const struct gl_program *tess_ctrl_program;
const struct gl_program *tess_eval_program;
const struct gl_fragment_program *fragment_program;
- const struct gl_compute_program *compute_program;
+ const struct gl_program *compute_program;
/**
* Number of samples in ctx->DrawBuffer, updated by BRW_NEW_NUM_SAMPLES so
}
static inline struct brw_compute_program *
-brw_compute_program(struct gl_compute_program *p)
+brw_compute_program(struct gl_program *p)
{
return (struct brw_compute_program *) p;
}
prog_data.base.total_shared = prog->Comp.SharedSize;
}
- assign_cs_binding_table_offsets(devinfo, prog,
- &cp->program.Base, &prog_data);
+ assign_cs_binding_table_offsets(devinfo, prog, &cp->program, &prog_data);
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
*/
- int param_count = cp->program.Base.nir->num_uniforms / 4;
+ int param_count = cp->program.nir->num_uniforms / 4;
/* The backend also sometimes add a param for the thread local id. */
prog_data.thread_local_id_index = param_count++;
prog_data.base.nr_params = param_count;
prog_data.base.nr_image_params = cs->base.NumImages;
- brw_nir_setup_glsl_uniforms(cp->program.Base.nir, prog, &cp->program.Base,
+ brw_nir_setup_glsl_uniforms(cp->program.nir, prog, &cp->program,
&prog_data.base, true);
if (unlikely(brw->perf_debug)) {
}
if (unlikely(INTEL_DEBUG & DEBUG_CS))
- brw_dump_ir("compute", prog, &cs->base, &cp->program.Base);
+ brw_dump_ir("compute", prog, &cs->base, &cp->program);
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &cp->program.Base, ST_CS);
+ st_index = brw_get_shader_time_index(brw, prog, &cp->program, ST_CS);
char *error_str;
- program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx,
- key, &prog_data, cp->program.Base.nir,
- st_index, &program_size, &error_str);
+ program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx, key,
+ &prog_data, cp->program.nir, st_index,
+ &program_size, &error_str);
if (program == NULL) {
prog->LinkStatus = false;
ralloc_strcat(&prog->InfoLog, error_str);
return;
brw->cs.base.sampler_count =
- util_last_bit(ctx->ComputeProgram._Current->Base.SamplersUsed);
+ util_last_bit(ctx->ComputeProgram._Current->SamplersUsed);
brw_cs_populate_key(brw, &key);
struct brw_context *brw = brw_context(ctx);
struct brw_cs_prog_key key;
- struct gl_compute_program *cp = (struct gl_compute_program *) prog;
- struct brw_compute_program *bcp = brw_compute_program(cp);
+ struct brw_compute_program *bcp = brw_compute_program(prog);
memset(&key, 0, sizeof(key));
key.program_string_id = bcp->id;
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;
}
brw_cs_prog_data(brw->cs.base.prog_data);
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_COMPUTE);
- brw_upload_cs_push_constants(brw, &cp->program.Base, cs_prog_data,
+ brw_upload_cs_push_constants(brw, &cp->program, cs_prog_data,
stage_state, AUB_TRACE_WM_CONSTANTS);
}
}
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_COMPUTE);
/* _NEW_PROGRAM_CONSTANTS */
- brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &cp->program.Base,
+ brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &cp->program,
stage_state, prog_data);
}
};
-/** Compute program object */
-struct gl_compute_program
-{
- struct gl_program Base; /**< base class */
-
- /**
- * Size specified using local_size_{x,y,z}.
- */
- unsigned LocalSize[3];
-
- /**
- * Size of shared variables accessed by the compute shader.
- */
- unsigned SharedSize;
-};
-
-
/**
* State common to vertex and fragment programs.
*/
/** Currently enabled and valid program (including internal programs
* and compiled shader programs).
*/
- struct gl_compute_program *_Current;
+ struct gl_program *_Current;
};
} Vert;
/**
- * Compute shader state - copied into gl_compute_program by
+ * Compute shader state - copied into gl_program by
* _mesa_copy_linked_program_data().
*/
struct {
const struct gl_program *prevGP = ctx->GeometryProgram._Current;
const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
const struct gl_program *prevTEP = ctx->TessEvalProgram._Current;
- const struct gl_compute_program *prevCP = ctx->ComputeProgram._Current;
+ const struct gl_program *prevCP = ctx->ComputeProgram._Current;
GLbitfield new_state = 0x0;
/*
if (csProg && csProg->LinkStatus
&& csProg->_LinkedShaders[MESA_SHADER_COMPUTE]) {
/* Use GLSL compute shader */
- _mesa_reference_compprog(ctx, &ctx->ComputeProgram._Current,
- gl_compute_program(csProg->_LinkedShaders[MESA_SHADER_COMPUTE]->Program));
+ _mesa_reference_program(ctx, &ctx->ComputeProgram._Current,
+ csProg->_LinkedShaders[MESA_SHADER_COMPUTE]->Program);
} else {
/* no compute program */
- _mesa_reference_compprog(ctx, &ctx->ComputeProgram._Current, NULL);
+ _mesa_reference_program(ctx, &ctx->ComputeProgram._Current, NULL);
}
/* Let the driver know what's happening:
new_state |= _NEW_PROGRAM;
if (ctx->Driver.BindProgram) {
ctx->Driver.BindProgram(ctx, GL_COMPUTE_PROGRAM_NV,
- (struct gl_program *) ctx->ComputeProgram._Current);
+ ctx->ComputeProgram._Current);
}
}
case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
case GL_GEOMETRY_PROGRAM_NV:
case GL_TESS_CONTROL_PROGRAM_NV:
- case GL_TESS_EVALUATION_PROGRAM_NV: {
+ case GL_TESS_EVALUATION_PROGRAM_NV:
+ case GL_COMPUTE_PROGRAM_NV: {
struct gl_program *prog = CALLOC_STRUCT(gl_program);
return _mesa_init_gl_program(prog, 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);
- }
default:
_mesa_problem(ctx, "bad target in _mesa_new_program");
return NULL;
(struct gl_program *) prog);
}
-static inline void
-_mesa_reference_compprog(struct gl_context *ctx,
- struct gl_compute_program **ptr,
- struct gl_compute_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_fragment_program *) prog;
}
-static inline struct gl_compute_program *
-gl_compute_program(struct gl_program *prog)
-{
- return (struct gl_compute_program *) prog;
-}
-
-static inline const struct gl_compute_program *
-gl_compute_program_const(const struct gl_program *prog)
-{
- return (const struct gl_compute_program *) prog;
-}
-
#ifdef __cplusplus
} /* extern "C" */
#endif
case ST_PIPELINE_COMPUTE: {
struct st_compute_program *old_cp = st->cp;
- struct gl_compute_program *new_cp = ctx->ComputeProgram._Current;
+ struct gl_program *new_cp = ctx->ComputeProgram._Current;
if (new_cp != &old_cp->Base) {
if (old_cp)
struct gl_program_parameter_list *params;
if (cp) {
- params = cp->Base.Base.Parameters;
+ params = cp->Base.Parameters;
st_upload_constants( st, params, MESA_SHADER_COMPUTE );
}
}
if (ctx->ComputeProgram._Current) {
update_shader_samplers(st,
PIPE_SHADER_COMPUTE,
- &ctx->ComputeProgram._Current->Base,
+ ctx->ComputeProgram._Current,
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_COMPUTE],
&st->state.num_samplers[PIPE_SHADER_COMPUTE]);
}
stcp = st_compute_program(st->ctx->ComputeProgram._Current);
- assert(stcp->Base.Base.Target == GL_COMPUTE_PROGRAM_NV);
+ assert(stcp->Base.Target == GL_COMPUTE_PROGRAM_NV);
st->cp_variant = st_get_cp_variant(st, &stcp->tgsi, &stcp->variants);
if (ctx->ComputeProgram._Current) {
update_textures(st,
MESA_SHADER_COMPUTE,
- &ctx->ComputeProgram._Current->Base,
+ ctx->ComputeProgram._Current,
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
st->state.sampler_views[PIPE_SHADER_COMPUTE],
&st->state.num_sampler_views[PIPE_SHADER_COMPUTE]);
}
case GL_COMPUTE_PROGRAM_NV: {
struct st_compute_program *prog = ST_CALLOC_STRUCT(st_compute_program);
- return _mesa_init_gl_program(&prog->Base.Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id);
}
default:
assert(0);
for (v = *variants; v; ) {
struct st_basic_variant *next = v->next;
- delete_basic_variant(st, v, stcp->Base.Base.Target);
+ delete_basic_variant(st, v, stcp->Base.Target);
v = next;
}
if (ureg == NULL)
return false;
- st_translate_program_common(st, &stcp->Base.Base, stcp->glsl_to_tgsi, ureg,
+ st_translate_program_common(st, &stcp->Base, stcp->glsl_to_tgsi, ureg,
PIPE_SHADER_COMPUTE, &prog);
stcp->tgsi.ir_type = PIPE_SHADER_IR_TGSI;
stcp->tgsi.prog = prog.tokens;
- stcp->tgsi.req_local_mem = stcp->Base.Base.info.cs.shared_size;
+ stcp->tgsi.req_local_mem = stcp->Base.info.cs.shared_size;
stcp->tgsi.req_private_mem = 0;
stcp->tgsi.req_input_mem = 0;
/**
- * Derived from Mesa gl_compute_program:
+ * Derived from Mesa gl_program:
*/
struct st_compute_program
{
- struct gl_compute_program Base; /**< The Mesa compute program */
+ struct gl_program Base; /**< The Mesa compute program */
struct pipe_compute_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_compute_program *
-st_compute_program( struct gl_compute_program *cp )
+st_compute_program( struct gl_program *cp )
{
return (struct st_compute_program *)cp;
}