info->system_values_read = sh->Program->SystemValuesRead;
info->uses_texture_gather = sh->Program->UsesGather;
- switch (sh->Stage) {
- case MESA_SHADER_FRAGMENT: {
- struct gl_fragment_program *fp =
- (struct gl_fragment_program *)sh->Program;
-
- info->fs.early_fragment_tests = sh->info.EarlyFragmentTests;
- break;
- }
-
- default:
- break; /* No stage-specific info */
+ if (sh->Stage == MESA_SHADER_FRAGMENT) {
+ sh->Program->info.fs.early_fragment_tests = sh->info.EarlyFragmentTests;
}
}
if (ctx->Extensions.ARB_fragment_program) {
save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled;
- _mesa_reference_fragprog(ctx, &save->FragmentProgram,
- ctx->FragmentProgram.Current);
+ _mesa_reference_program(ctx, &save->FragmentProgram,
+ ctx->FragmentProgram.Current);
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE);
}
if (ctx->Extensions.ARB_fragment_program) {
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
save->FragmentProgramEnabled);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- save->FragmentProgram);
- _mesa_reference_fragprog(ctx, &save->FragmentProgram, NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current,
+ save->FragmentProgram);
+ _mesa_reference_program(ctx, &save->FragmentProgram, NULL);
}
if (ctx->Extensions.ATI_fragment_shader) {
GLboolean VertexProgramEnabled;
struct gl_program *VertexProgram;
GLboolean FragmentProgramEnabled;
- struct gl_fragment_program *FragmentProgram;
+ struct gl_program *FragmentProgram;
GLboolean ATIFragmentShaderEnabled;
struct gl_shader_program *Shader[MESA_SHADER_STAGES];
struct gl_shader_program *ActiveShader;
*/
struct i915_fragment_program
{
- struct gl_fragment_program FragProg;
+ struct gl_program FragProg;
bool translated;
bool params_uptodate;
static GLuint
src_vector(struct i915_fragment_program *p,
const struct prog_src_register *source,
- const struct gl_fragment_program *program)
+ const struct gl_program *program)
{
GLuint src;
unsigned unit;
case PROGRAM_STATE_VAR:
case PROGRAM_UNIFORM:
src = i915_emit_param4fv(p,
- &program->Base.Parameters->ParameterValues[source->Index][0].f);
+ &program->Parameters->ParameterValues[source->Index][0].f);
break;
default:
#define EMIT_TEX( OP ) \
do { \
GLuint dim = translate_tex_src_target( p, inst->TexSrcTarget ); \
- const struct gl_fragment_program *program = &p->FragProg; \
- GLuint unit = program->Base.SamplerUnits[inst->TexSrcUnit]; \
+ const struct gl_program *program = &p->FragProg; \
+ GLuint unit = program->SamplerUnits[inst->TexSrcUnit]; \
GLuint sampler = i915_emit_decl(p, REG_TYPE_S, \
unit, dim); \
GLuint coord = src_vector( p, &inst->SrcReg[0], program); \
*/
static bool calc_live_regs( struct i915_fragment_program *p )
{
- const struct gl_fragment_program *program = &p->FragProg;
+ const struct gl_program *program = &p->FragProg;
GLuint regsUsed = ~((1 << I915_MAX_TEMPORARY) - 1);
uint8_t live_components[I915_MAX_TEMPORARY] = { 0, };
GLint i;
- for (i = program->Base.NumInstructions - 1; i >= 0; i--) {
- struct prog_instruction *inst = &program->Base.Instructions[i];
+ for (i = program->NumInstructions - 1; i >= 0; i--) {
+ struct prog_instruction *inst = &program->Instructions[i];
int opArgs = _mesa_num_inst_src_regs(inst->Opcode);
int a;
static GLuint get_live_regs( struct i915_fragment_program *p,
const struct prog_instruction *inst )
{
- const struct gl_fragment_program *program = &p->FragProg;
- GLuint nr = inst - program->Base.Instructions;
+ const struct gl_program *program = &p->FragProg;
+ GLuint nr = inst - program->Instructions;
return p->usedRegs[nr];
}
static void
upload_program(struct i915_fragment_program *p)
{
- const struct gl_fragment_program *program = &p->FragProg;
- const struct prog_instruction *inst = program->Base.Instructions;
+ const struct gl_program *program = &p->FragProg;
+ const struct prog_instruction *inst = program->Instructions;
if (INTEL_DEBUG & DEBUG_WM)
- _mesa_print_program(&program->Base);
+ _mesa_print_program(program);
/* Is this a parse-failed program? Ensure a valid program is
* loaded, as the flagging of an error isn't sufficient to stop
return;
}
- if (program->Base.NumInstructions > I915_MAX_INSN) {
+ if (program->NumInstructions > I915_MAX_INSN) {
i915_program_error(p, "Exceeded max instructions (%d out of %d)",
- program->Base.NumInstructions, I915_MAX_INSN);
+ program->NumInstructions, I915_MAX_INSN);
return;
}
static void
check_texcoord_mapping(struct i915_fragment_program *p)
{
- GLbitfield64 inputs = p->FragProg.Base.InputsRead;
+ GLbitfield64 inputs = p->FragProg.InputsRead;
unsigned unit = 0;
for (unsigned i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
static void
check_wpos(struct i915_fragment_program *p)
{
- GLbitfield64 inputs = p->FragProg.Base.InputsRead;
+ GLbitfield64 inputs = p->FragProg.InputsRead;
GLint i;
unsigned unit = 0;
if (INTEL_DEBUG & DEBUG_WM) {
printf("fp:\n");
- _mesa_print_program(&p->FragProg.Base);
+ _mesa_print_program(&p->FragProg);
printf("\n");
}
GLint i;
if (p->nr_params)
- _mesa_load_state_parameters(p->ctx, p->FragProg.Base.Parameters);
+ _mesa_load_state_parameters(p->ctx, p->FragProg.Parameters);
for (i = 0; i < p->nr_params; i++) {
GLint reg = p->param[i].reg;
if (prog) {
i915_init_program(I915_CONTEXT(ctx), prog);
- return _mesa_init_gl_program(&prog->FragProg.Base, target, id);
+ return _mesa_init_gl_program(&prog->FragProg, target, id);
}
else
return NULL;
struct i915_fragment_program *p =
(struct i915_fragment_program *) ctx->FragmentProgram._Current;
- const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
+ const GLbitfield64 inputsRead = p->FragProg.InputsRead;
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
GLuint s2 = S2_TEXCOORD_NONE;
int i, offset = 0;
}
if (p->error) {
- p->FragProg.Base.NumNativeInstructions = 0;
- p->FragProg.Base.NumNativeAluInstructions = 0;
- p->FragProg.Base.NumNativeTexInstructions = 0;
- p->FragProg.Base.NumNativeTexIndirections = 0;
+ p->FragProg.NumNativeInstructions = 0;
+ p->FragProg.NumNativeAluInstructions = 0;
+ p->FragProg.NumNativeTexInstructions = 0;
+ p->FragProg.NumNativeTexIndirections = 0;
}
else {
- p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn +
+ p->FragProg.NumNativeInstructions = (p->nr_alu_insn +
p->nr_tex_insn +
p->nr_decl_insn);
- p->FragProg.Base.NumNativeAluInstructions = p->nr_alu_insn;
- p->FragProg.Base.NumNativeTexInstructions = p->nr_tex_insn;
- p->FragProg.Base.NumNativeTexIndirections = p->nr_tex_indirect;
+ p->FragProg.NumNativeAluInstructions = p->nr_alu_insn;
+ p->FragProg.NumNativeTexInstructions = p->nr_tex_insn;
+ p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect;
}
p->declarations[0] |= program_size + decl_size - 2;
/* _NEW_PROGRAM */
struct i915_fragment_program *p =
(struct i915_fragment_program *) ctx->FragmentProgram._Current;
- const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
+ const GLbitfield64 inputsRead = p->FragProg.InputsRead;
struct i915_context *i915 = i915_context(ctx);
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
GLuint coord_replace_bits = 0x0;
ctx->Polygon.OffsetFill) ? DD_TRI_OFFSET : 0) |
(ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0) |
(ctx->Point._Attenuated ? DD_POINT_ATTEN : 0);
- const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
- bool have_wpos = (fprog && (fprog->Base.InputsRead & VARYING_BIT_POS));
+ const struct gl_program *fprog = ctx->FragmentProgram._Current;
+ bool have_wpos = (fprog && (fprog->InputsRead & VARYING_BIT_POS));
GLuint index = 0;
if (INTEL_DEBUG & DEBUG_STATE)
/* Populate the key:
*/
- const struct gl_fragment_program *fprog = brw->fragment_program;
+ const struct gl_program *fprog = brw->fragment_program;
if (fprog) {
assert(brw->gen < 6);
struct gen4_fragment_program *p = (struct gen4_fragment_program *) fprog;
/* Resolve color buffers for non-coherent framebuffer fetch. */
if (!ctx->Extensions.MESA_shader_framebuffer_fetch &&
ctx->FragmentProgram._Current &&
- ctx->FragmentProgram._Current->Base.info.outputs_read) {
+ ctx->FragmentProgram._Current->info.outputs_read) {
const struct gl_framebuffer *fb = ctx->DrawBuffer;
for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
/** Subclass of Mesa fragment program */
struct brw_fragment_program {
- struct gl_fragment_program program;
+ struct gl_program program;
GLuint id; /**< serial no. to identify frag progs, never re-used */
};
const struct gl_program *geometry_program;
const struct gl_program *tess_ctrl_program;
const struct gl_program *tess_eval_program;
- const struct gl_fragment_program *fragment_program;
+ const struct gl_program *fragment_program;
const struct gl_program *compute_program;
/**
}
static inline struct brw_fragment_program *
-brw_fragment_program(struct gl_fragment_program *p)
+brw_fragment_program(struct gl_program *p)
{
return (struct brw_fragment_program *) p;
}
static inline const struct brw_fragment_program *
-brw_fragment_program_const(const struct gl_fragment_program *p)
+brw_fragment_program_const(const struct gl_program *p)
{
return (const struct brw_fragment_program *) p;
}
/* fragment shader constants */
if (brw->curbe.wm_size) {
- _mesa_load_state_parameters(ctx, brw->fragment_program->Base.Parameters);
+ _mesa_load_state_parameters(ctx, brw->fragment_program->Parameters);
/* BRW_NEW_CURBE_OFFSETS */
GLuint offset = brw->curbe.wm_start * 16;
* BRW_NEW_FRAGMENT_PROGRAM
*/
if (brw->gen == 4 && !brw->is_g4x &&
- (brw->fragment_program->Base.info.inputs_read & (1 << VARYING_SLOT_POS))) {
+ (brw->fragment_program->info.inputs_read & (1 << VARYING_SLOT_POS))) {
BEGIN_BATCH(2);
OUT_BATCH(_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP << 16 | (2 - 2));
OUT_BATCH(0);
* index.
*/
brw->wm.base.sampler_count =
- util_last_bit(ctx->FragmentProgram._Current->Base.SamplersUsed);
+ util_last_bit(ctx->FragmentProgram._Current->SamplersUsed);
brw->gs.base.sampler_count = ctx->GeometryProgram._Current ?
util_last_bit(ctx->GeometryProgram._Current->SamplersUsed) : 0;
brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ?
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;
switch (target) {
case GL_FRAGMENT_PROGRAM_ARB: {
- struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
- struct brw_fragment_program *newFP = brw_fragment_program(fprog);
+ struct brw_fragment_program *newFP = brw_fragment_program(prog);
const struct brw_fragment_program *curFP =
brw_fragment_program_const(brw->fragment_program);
if (key.do_point_sprite) {
key.point_sprite_coord_replace = ctx->Point.CoordReplace & 0xff;
}
- if (brw->fragment_program->Base.info.inputs_read &
+ if (brw->fragment_program->info.inputs_read &
BITFIELD64_BIT(VARYING_SLOT_PNTC)) {
key.do_point_coord = 1;
}
if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) != render_to_fbo)
key.sprite_origin_lower_left = true;
- const struct gl_fragment_program *fprog = brw->fragment_program;
+ const struct gl_program *fprog = brw->fragment_program;
if (fprog) {
assert(brw->gen < 6);
struct gen4_fragment_program *p = (struct gen4_fragment_program *) fprog;
if (!prog)
prog_data.base.use_alt_mode = true;
- assign_fs_binding_table_offsets(devinfo, prog,
- &fp->program.Base, key, &prog_data);
+ assign_fs_binding_table_offsets(devinfo, prog, &fp->program, key,
+ &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 = fp->program.Base.nir->num_uniforms / 4;
+ int param_count = fp->program.nir->num_uniforms / 4;
if (fs)
prog_data.base.nr_image_params = fs->base.NumImages;
/* The backend also sometimes adds params for texture size. */
prog_data.base.nr_params = param_count;
if (prog) {
- brw_nir_setup_glsl_uniforms(fp->program.Base.nir, prog, &fp->program.Base,
+ brw_nir_setup_glsl_uniforms(fp->program.nir, prog, &fp->program,
&prog_data.base, true);
} else {
- brw_nir_setup_arb_uniforms(fp->program.Base.nir, &fp->program.Base,
+ brw_nir_setup_arb_uniforms(fp->program.nir, &fp->program,
&prog_data.base);
}
}
if (unlikely(INTEL_DEBUG & DEBUG_WM))
- brw_dump_ir("fragment", prog, fs ? &fs->base : NULL, &fp->program.Base);
+ brw_dump_ir("fragment", prog, fs ? &fs->base : NULL, &fp->program);
int st_index8 = -1, st_index16 = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
- st_index8 = brw_get_shader_time_index(brw, prog, &fp->program.Base, ST_FS8);
- st_index16 = brw_get_shader_time_index(brw, prog, &fp->program.Base, ST_FS16);
+ st_index8 = brw_get_shader_time_index(brw, prog, &fp->program, ST_FS8);
+ st_index16 = brw_get_shader_time_index(brw, prog, &fp->program, ST_FS16);
}
char *error_str = NULL;
program = brw_compile_fs(brw->screen->compiler, brw, mem_ctx,
- key, &prog_data, fp->program.Base.nir,
- &fp->program.Base, st_index8, st_index16,
+ key, &prog_data, fp->program.nir,
+ &fp->program, st_index8, st_index16,
true, brw->use_rep_send, vue_map,
&program_size, &error_str);
struct brw_context *brw = brw_context(ctx);
struct brw_wm_prog_key key;
- struct gl_fragment_program *fp = (struct gl_fragment_program *) prog;
- struct brw_fragment_program *bfp = brw_fragment_program(fp);
+ struct brw_fragment_program *bfp = brw_fragment_program(prog);
memset(&key, 0, sizeof(key));
key.input_slots_valid = prog->info.inputs_read | VARYING_BIT_POS;
}
- brw_setup_tex_for_precompile(brw, &key.tex, &fp->Base);
+ brw_setup_tex_for_precompile(brw, &key.tex, prog);
key.nr_color_regions = _mesa_bitcount_64(outputs_written &
~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
{
struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
- const struct gl_program *fp = &brw->fragment_program->Base;
+ const struct gl_program *fp = brw->fragment_program;
unsigned i;
/* _NEW_BUFFERS */
const struct gen_device_info *devinfo = &brw->screen->devinfo;
struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
- const struct gl_program *fp = &brw->fragment_program->Base;
+ const struct gl_program *fp = brw->fragment_program;
/* BRW_NEW_FS_PROG_DATA */
const struct brw_wm_prog_data *prog_data =
brw_wm_prog_data(brw->wm.base.prog_data);
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_FRAGMENT);
/* _NEW_PROGRAM_CONSTANTS */
- brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &fp->program.Base,
+ brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &fp->program,
stage_state, prog_data);
}
/* BRW_NEW_FRAGMENT_PROGRAM */
if (!ctx->Extensions.MESA_shader_framebuffer_fetch &&
- brw->fragment_program && brw->fragment_program->Base.info.outputs_read) {
+ brw->fragment_program && brw->fragment_program->info.outputs_read) {
/* _NEW_BUFFERS */
const struct gl_framebuffer *fb = ctx->DrawBuffer;
* - VARYING_SLOT_{PSIZ,LAYER} and VARYING_SLOT_POS on gen6+
*/
- bool fs_needs_vue_header = brw->fragment_program->Base.info.inputs_read &
+ bool fs_needs_vue_header = brw->fragment_program->info.inputs_read &
(VARYING_BIT_LAYER | VARYING_BIT_VIEWPORT);
*urb_entry_read_offset = fs_needs_vue_header ? 0 : 1;
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_FRAGMENT);
- gen6_upload_push_constants(brw, &fp->program.Base, prog_data,
+ gen6_upload_push_constants(brw, &fp->program, prog_data,
stage_state, AUB_TRACE_WM_CONSTANTS);
if (brw->gen >= 7) {
/* prepare the active component dwords */
int input_index = 0;
for (int attr = 0; attr < VARYING_SLOT_MAX; attr++) {
- if (!(brw->fragment_program->Base.info.inputs_read &
+ if (!(brw->fragment_program->info.inputs_read &
BITFIELD64_BIT(attr))) {
continue;
}
return _mesa_init_gl_program(&vp->mesa_program, target, id);
}
case GL_FRAGMENT_PROGRAM_ARB: {
- struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
+ struct gl_program *prog = CALLOC_STRUCT(gl_program);
+ return _mesa_init_gl_program(prog, target, id);
}
default:
_mesa_problem(ctx, "Bad target in r200NewProgram");
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- curProg = &ctx->FragmentProgram.Current->Base;
+ curProg = ctx->FragmentProgram.Current;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramARB(target)");
if (target == GL_VERTEX_PROGRAM_ARB)
newProg = ctx->Shared->DefaultVertexProgram;
else
- newProg = &ctx->Shared->DefaultFragmentProgram->Base;
+ newProg = ctx->Shared->DefaultFragmentProgram;
}
else {
/* Bind a user program */
_mesa_reference_program(ctx, &ctx->VertexProgram.Current, newProg);
}
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- gl_fragment_program(newProg));
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, newProg);
}
/* Never null pointers */
break;
case GL_FRAGMENT_PROGRAM_ARB:
if (ctx->FragmentProgram.Current &&
- ctx->FragmentProgram.Current->Base.Id == ids[i]) {
+ ctx->FragmentProgram.Current->Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgramARB(prog->Target, 0);
}
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- prog = &(ctx->FragmentProgram.Current->Base);
+ prog = ctx->FragmentProgram.Current;
maxParams = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams;
}
else {
_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
const GLvoid *string)
{
- struct gl_program *base;
+ struct gl_program *prog;
bool failed;
GET_CURRENT_CONTEXT(ctx);
}
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
- struct gl_program *prog = ctx->VertexProgram.Current;
+ prog = ctx->VertexProgram.Current;
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
-
- base = prog;
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
+ prog = ctx->FragmentProgram.Current;
_mesa_parse_arb_fragment_program(ctx, target, string, len, prog);
-
- base = & prog->Base;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
if (!failed) {
/* finally, give the program to the driver for translation/checking */
- if (!ctx->Driver.ProgramStringNotify(ctx, target, base)) {
+ if (!ctx->Driver.ProgramStringNotify(ctx, target, prog)) {
failed = true;
_mesa_error(ctx, GL_INVALID_OPERATION,
"glProgramStringARB(rejected by driver");
target == GL_FRAGMENT_PROGRAM_ARB ? "fragment" : "vertex";
fprintf(stderr, "ARB_%s_program source for program %d:\n",
- shader_type, base->Id);
+ shader_type, prog->Id);
fprintf(stderr, "%s\n", (const char *) string);
if (failed) {
fprintf(stderr, "ARB_%s_program %d failed to compile.\n",
- shader_type, base->Id);
+ shader_type, prog->Id);
} else {
fprintf(stderr, "Mesa IR for ARB_%s_program %d:\n",
- shader_type, base->Id);
- _mesa_print_program(base);
+ shader_type, prog->Id);
+ _mesa_print_program(prog);
fprintf(stderr, "\n");
}
fflush(stderr);
target == GL_FRAGMENT_PROGRAM_ARB ? "fragment" : "vertex";
_mesa_snprintf(filename, sizeof(filename), "%s/%cp-%u.shader_test",
- capture_path, shader_type[0], base->Id);
+ capture_path, shader_type[0], prog->Id);
file = fopen(filename, "w");
if (file) {
fprintf(file,
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
- prog = &(ctx->FragmentProgram.Current->Base);
+ prog = ctx->FragmentProgram.Current;
limits = &ctx->Const.Program[MESA_SHADER_FRAGMENT];
}
else {
* The following apply to fragment programs only (at this time)
*/
if (target == GL_FRAGMENT_PROGRAM_ARB) {
- const struct gl_fragment_program *fp = ctx->FragmentProgram.Current;
+ const struct gl_program *fp = ctx->FragmentProgram.Current;
switch (pname) {
case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
- *params = fp->Base.NumNativeAluInstructions;
+ *params = fp->NumNativeAluInstructions;
return;
case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
- *params = fp->Base.NumAluInstructions;
+ *params = fp->NumAluInstructions;
return;
case GL_PROGRAM_TEX_INSTRUCTIONS_ARB:
- *params = fp->Base.NumTexInstructions;
+ *params = fp->NumTexInstructions;
return;
case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
- *params = fp->Base.NumNativeTexInstructions;
+ *params = fp->NumNativeTexInstructions;
return;
case GL_PROGRAM_TEX_INDIRECTIONS_ARB:
- *params = fp->Base.NumTexIndirections;
+ *params = fp->NumTexIndirections;
return;
case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
- *params = fp->Base.NumNativeTexIndirections;
+ *params = fp->NumNativeTexIndirections;
return;
case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
*params = limits->MaxAluInstructions;
prog = ctx->VertexProgram.Current;
}
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
- prog = &(ctx->FragmentProgram.Current->Base);
+ prog = ctx->FragmentProgram.Current;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(target)");
assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->VertexProgram._Current->OutputsWritten)));
assert(VARYING_SLOT_MAX <=
- (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
+ (8 * sizeof(ctx->FragmentProgram._Current->InputsRead)));
/* shader-related checks */
assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);
_mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
_mesa_reference_program(ctx, &ctx->GeometryProgram._Current, NULL);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current, NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
_mesa_reference_vao(ctx, &ctx->Array.VAO, NULL);
_mesa_reference_vao(ctx, &ctx->Array.DefaultVAO, NULL);
static void make_state_key( struct gl_context *ctx, struct state_key *key )
{
- const struct gl_fragment_program *fp;
+ const struct gl_program *fp = ctx->FragmentProgram._Current;
GLbitfield mask;
memset(key, 0, sizeof(struct state_key));
- fp = ctx->FragmentProgram._Current;
/* This now relies on texenvprogram.c being active:
*/
key->need_eye_coords = ctx->_NeedEyeCoords;
- key->fragprog_inputs_read = fp->Base.InputsRead;
+ key->fragprog_inputs_read = fp->InputsRead;
key->varying_vp_inputs = ctx->varying_vp_inputs;
if (ctx->RenderMode == GL_FEEDBACK) {
GLboolean UsesGather; /**< Does this program use gather4 at all? */
- /**
- * For vertex and geometry shaders, true if the program uses the
- * gl_ClipDistance output. Ignored for fragment shaders.
- */
+ /* Vertex and geometry shaders fields */
unsigned ClipDistanceArraySize;
unsigned CullDistanceArraySize;
+ /* Fragement shader only fields */
+ GLboolean OriginUpperLeft;
+ GLboolean PixelCenterInteger;
/** Named parameters, constants, etc. from program text */
struct gl_program_parameter_list *Parameters;
};
-/** Fragment program object */
-struct gl_fragment_program
-{
- struct gl_program Base; /**< base class */
- GLboolean UsesKill; /**< shader uses KIL instruction */
- GLboolean OriginUpperLeft;
- GLboolean PixelCenterInteger;
- enum gl_frag_depth_layout FragDepthLayout;
-
- /**
- * Bitfield indicating, for each fragment shader input, 1 if that input
- * uses sample interpolation, 0 otherwise. Unused inputs are 0.
- */
- GLbitfield64 IsSample;
-};
-
-
/**
* State common to vertex and fragment programs.
*/
{
GLboolean Enabled; /**< User-set fragment program enable flag */
GLboolean _Enabled; /**< Enabled and _valid_ user program? */
- struct gl_fragment_program *Current; /**< User-bound fragment program */
+ struct gl_program *Current; /**< User-bound fragment program */
/** Currently enabled and valid fragment program (including internal
* programs, user-defined fragment programs and GLSL fragment shaders).
* This is the program we must use when rendering.
*/
- struct gl_fragment_program *_Current;
+ struct gl_program *_Current;
GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
GLboolean _MaintainTexEnvProgram;
/** Program to emulate fixed-function texture env/combine (see above) */
- struct gl_fragment_program *_TexEnvProgram;
+ struct gl_program *_TexEnvProgram;
/** Cache of fixed-function programs */
struct gl_program_cache *Cache;
/*@{*/
struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */
struct gl_program *DefaultVertexProgram;
- struct gl_fragment_program *DefaultFragmentProgram;
+ struct gl_program *DefaultFragmentProgram;
/*@}*/
/* GL_ATI_fragment_shader */
shared->DefaultVertexProgram =
ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
shared->DefaultFragmentProgram =
- gl_fragment_program(ctx->Driver.NewProgram(ctx,
- GL_FRAGMENT_PROGRAM_ARB, 0));
+ ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
shared->ATIShaders = _mesa_NewHashTable();
shared->DefaultFragmentShader = _mesa_new_ati_fragment_shader(ctx, 0);
_mesa_DeleteHashTable(shared->Programs);
_mesa_reference_program(ctx, &shared->DefaultVertexProgram, NULL);
- _mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL);
+ _mesa_reference_program(ctx, &shared->DefaultFragmentProgram, NULL);
_mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx);
_mesa_DeleteHashTable(shared->ATIShaders);
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
&& ctx->VertexProgram.Current->Instructions;
ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
- && ctx->FragmentProgram.Current->Base.Instructions;
+ && ctx->FragmentProgram.Current->Instructions;
ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
&& ctx->ATIFragmentShader.Current->Instructions[0];
}
const struct gl_shader_program *csProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
const struct gl_program *prevVP = ctx->VertexProgram._Current;
- const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
+ const struct gl_program *prevFP = ctx->FragmentProgram._Current;
const struct gl_program *prevGP = ctx->GeometryProgram._Current;
const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
const struct gl_program *prevTEP = ctx->TessEvalProgram._Current;
_mesa_reference_shader_program(ctx,
&ctx->_Shader->_CurrentFragmentProgram,
fsProg);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- gl_fragment_program(fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program));
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
+ fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
else if (ctx->FragmentProgram._Enabled) {
/* Use user-defined fragment program */
_mesa_reference_shader_program(ctx,
&ctx->_Shader->_CurrentFragmentProgram,
NULL);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- ctx->FragmentProgram.Current);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
+ ctx->FragmentProgram.Current);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
else if (ctx->ATIFragmentShader._Enabled &&
ctx->ATIFragmentShader.Current->Program) {
_mesa_reference_shader_program(ctx,
&ctx->_Shader->_CurrentFragmentProgram,
NULL);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- gl_fragment_program(ctx->ATIFragmentShader.Current->Program));
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
+ ctx->ATIFragmentShader.Current->Program);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
/* Use fragment program generated from fixed-function state */
_mesa_reference_shader_program(ctx,
&ctx->_Shader->_CurrentFragmentProgram,
f);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- gl_fragment_program(f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program));
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
- gl_fragment_program(f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program));
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
+ f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
}
else {
/* No fragment program */
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current, NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
+ NULL);
}
if (gsProg && gsProg->LinkStatus
new_state |= _NEW_PROGRAM;
if (ctx->Driver.BindProgram) {
ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
- (struct gl_program *) ctx->FragmentProgram._Current);
+ ctx->FragmentProgram._Current);
}
}
if (ctx->FragmentProgram._Current) {
const struct gl_program_parameter_list *params =
- ctx->FragmentProgram._Current->Base.Parameters;
+ ctx->FragmentProgram._Current->Parameters;
if (params && params->StateFlags & ctx->NewState) {
new_state |= _NEW_PROGRAM_CONSTANTS;
}
if (ctx->FragmentProgram._Current &&
(ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
- (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL1))
+ (ctx->FragmentProgram._Current->InputsRead & VARYING_BIT_COL1))
return GL_TRUE;
return GL_FALSE;
prog[i] = ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]->Program;
} else {
if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled)
- prog[i] = &ctx->FragmentProgram.Current->Base;
+ prog[i] = ctx->FragmentProgram.Current;
else
prog[i] = NULL;
}
void
_mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
const GLvoid *str, GLsizei len,
- struct gl_fragment_program *program)
+ struct gl_program *program)
{
struct gl_program prog;
struct asm_parser_state state;
return;
}
- free(program->Base.String);
+ free(program->String);
/* Copy the relevant contents of the arb_program struct into the
* fragment_program struct.
*/
- program->Base.String = prog.String;
- program->Base.NumInstructions = prog.NumInstructions;
- program->Base.NumTemporaries = prog.NumTemporaries;
- program->Base.NumParameters = prog.NumParameters;
- program->Base.NumAttributes = prog.NumAttributes;
- program->Base.NumAddressRegs = prog.NumAddressRegs;
- program->Base.NumNativeInstructions = prog.NumNativeInstructions;
- program->Base.NumNativeTemporaries = prog.NumNativeTemporaries;
- program->Base.NumNativeParameters = prog.NumNativeParameters;
- program->Base.NumNativeAttributes = prog.NumNativeAttributes;
- program->Base.NumNativeAddressRegs = prog.NumNativeAddressRegs;
- program->Base.NumAluInstructions = prog.NumAluInstructions;
- program->Base.NumTexInstructions = prog.NumTexInstructions;
- program->Base.NumTexIndirections = prog.NumTexIndirections;
- program->Base.NumNativeAluInstructions = prog.NumAluInstructions;
- program->Base.NumNativeTexInstructions = prog.NumTexInstructions;
- program->Base.NumNativeTexIndirections = prog.NumTexIndirections;
- program->Base.InputsRead = prog.InputsRead;
- program->Base.OutputsWritten = prog.OutputsWritten;
- program->Base.IndirectRegisterFiles = prog.IndirectRegisterFiles;
+ program->String = prog.String;
+ program->NumInstructions = prog.NumInstructions;
+ program->NumTemporaries = prog.NumTemporaries;
+ program->NumParameters = prog.NumParameters;
+ program->NumAttributes = prog.NumAttributes;
+ program->NumAddressRegs = prog.NumAddressRegs;
+ program->NumNativeInstructions = prog.NumNativeInstructions;
+ program->NumNativeTemporaries = prog.NumNativeTemporaries;
+ program->NumNativeParameters = prog.NumNativeParameters;
+ program->NumNativeAttributes = prog.NumNativeAttributes;
+ program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
+ program->NumAluInstructions = prog.NumAluInstructions;
+ program->NumTexInstructions = prog.NumTexInstructions;
+ program->NumTexIndirections = prog.NumTexIndirections;
+ program->NumNativeAluInstructions = prog.NumAluInstructions;
+ program->NumNativeTexInstructions = prog.NumTexInstructions;
+ program->NumNativeTexIndirections = prog.NumTexIndirections;
+ program->InputsRead = prog.InputsRead;
+ program->OutputsWritten = prog.OutputsWritten;
+ program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) {
- program->Base.TexturesUsed[i] = prog.TexturesUsed[i];
+ program->TexturesUsed[i] = prog.TexturesUsed[i];
if (prog.TexturesUsed[i])
- program->Base.SamplersUsed |= (1 << i);
+ program->SamplersUsed |= (1 << i);
}
- program->Base.ShadowSamplers = prog.ShadowSamplers;
+ program->ShadowSamplers = prog.ShadowSamplers;
program->OriginUpperLeft = state.option.OriginUpperLeft;
program->PixelCenterInteger = state.option.PixelCenterInteger;
- program->Base.info.fs.uses_discard = state.fragment.UsesKill;
+ program->info.fs.uses_discard = state.fragment.UsesKill;
- free(program->Base.Instructions);
- program->Base.Instructions = prog.Instructions;
+ free(program->Instructions);
+ program->Instructions = prog.Instructions;
- if (program->Base.Parameters)
- _mesa_free_parameter_list(program->Base.Parameters);
- program->Base.Parameters = prog.Parameters;
+ if (program->Parameters)
+ _mesa_free_parameter_list(program->Parameters);
+ program->Parameters = prog.Parameters;
/* Append fog instructions now if the program has "OPTION ARB_fog_exp"
* or similar. We used to leave this up to drivers, but it appears
}
#if DEBUG_FP
- printf("____________Fragment program %u ________\n", program->Base.Id);
+ printf("____________Fragment program %u ________\n", program->Id);
_mesa_print_program(&program->Base);
#endif
}
#include "main/glheader.h"
struct gl_context;
-struct gl_fragment_program;
-struct gl_vertex_program;
+struct gl_program;
extern void
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
extern void
_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
const GLvoid *str, GLsizei len,
- struct gl_fragment_program *program);
+ struct gl_program *program);
#endif
ir_to_mesa_visitor::visit(ir_variable *ir)
{
if (strcmp(ir->name, "gl_FragCoord") == 0) {
- struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
-
- fp->OriginUpperLeft = ir->data.origin_upper_left;
- fp->PixelCenterInteger = ir->data.pixel_center_integer;
+ this->prog->OriginUpperLeft = ir->data.origin_upper_left;
+ this->prog->PixelCenterInteger = ir->data.pixel_center_integer;
}
if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
return;
case STATE_LOCAL:
- if (!ctx->FragmentProgram.Current->Base.LocalParams) {
- ctx->FragmentProgram.Current->Base.LocalParams =
+ if (!ctx->FragmentProgram.Current->LocalParams) {
+ ctx->FragmentProgram.Current->LocalParams =
calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
- if (!ctx->FragmentProgram.Current->Base.LocalParams)
+ if (!ctx->FragmentProgram.Current->LocalParams)
return;
}
- COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]);
+ COPY_4V(value, ctx->FragmentProgram.Current->LocalParams[idx]);
return;
default:
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
var->data.index = 0;
if (c->prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
- struct gl_fragment_program *fp =
- (struct gl_fragment_program *) c->prog;
-
if (i == VARYING_SLOT_POS) {
- var->data.origin_upper_left = fp->OriginUpperLeft;
- var->data.pixel_center_integer = fp->PixelCenterInteger;
+ var->data.origin_upper_left = c->prog->OriginUpperLeft;
+ var->data.pixel_center_integer = c->prog->PixelCenterInteger;
} else if (i == VARYING_SLOT_FOGC) {
/* fogcoord is defined as <f, 0.0, 0.0, 1.0>. Make the actual
* input variable a float, and create a local containing the
ctx->VertexProgram.Cache = _mesa_new_program_cache();
ctx->FragmentProgram.Enabled = GL_FALSE;
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
- ctx->Shared->DefaultFragmentProgram);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current,
+ ctx->Shared->DefaultFragmentProgram);
assert(ctx->FragmentProgram.Current);
ctx->FragmentProgram.Cache = _mesa_new_program_cache();
{
_mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL);
_mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, NULL);
_mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache);
/* XXX probably move this stuff */
ctx->Shared->DefaultVertexProgram);
assert(ctx->VertexProgram.Current);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
+ _mesa_reference_program(ctx, &ctx->FragmentProgram.Current,
ctx->Shared->DefaultFragmentProgram);
assert(ctx->FragmentProgram.Current);
_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
{
switch (target) {
- case GL_FRAGMENT_PROGRAM_ARB: {
- struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
- return _mesa_init_gl_program(&prog->Base, target, id);
- }
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_FRAGMENT_PROGRAM_ARB:
case GL_COMPUTE_PROGRAM_NV: {
struct gl_program *prog = CALLOC_STRUCT(gl_program);
return _mesa_init_gl_program(prog, target, id);
*/
GLint
_mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
- const struct gl_fragment_program *prog,
+ const struct gl_program *prog,
bool ignore_sample_qualifier)
{
/* From ARB_sample_shading specification:
* "Use of the "sample" qualifier on a fragment shader input
* forces per-sample shading"
*/
- if (prog->Base.info.fs.uses_sample_qualifier && !ignore_sample_qualifier)
+ if (prog->info.fs.uses_sample_qualifier && !ignore_sample_qualifier)
return MAX2(_mesa_geometric_samples(ctx->DrawBuffer), 1);
- if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
- SYSTEM_BIT_SAMPLE_POS))
+ if (prog->SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
+ SYSTEM_BIT_SAMPLE_POS))
return MAX2(_mesa_geometric_samples(ctx->DrawBuffer), 1);
else if (ctx->Multisample.SampleShading)
return MAX2(ceil(ctx->Multisample.MinSampleShadingValue *
_mesa_reference_program_(ctx, ptr, prog);
}
-static inline void
-_mesa_reference_fragprog(struct gl_context *ctx,
- struct gl_fragment_program **ptr,
- struct gl_fragment_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);
extern GLint
_mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
- const struct gl_fragment_program *prog,
+ const struct gl_program *prog,
bool ignore_sample_qualifier);
static inline GLuint
return GL_VERTEX_PROGRAM_ARB;
}
-
-static inline struct gl_fragment_program *
-gl_fragment_program(struct gl_program *prog)
-{
- return (struct gl_fragment_program *) prog;
-}
-
-static inline const struct gl_fragment_program *
-gl_fragment_program_const(const struct gl_program *prog)
-{
- return (const struct gl_fragment_program *) prog;
-}
-
#ifdef __cplusplus
} /* extern "C" */
#endif
* to vertex programs too.
*/
void
-_mesa_append_fog_code(struct gl_context *ctx,
- struct gl_fragment_program *fprog, GLenum fog_mode,
- GLboolean saturate)
+_mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
+ GLenum fog_mode, GLboolean saturate)
{
static const gl_state_index fogPStateOpt[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
static const gl_state_index fogColorState[STATE_LENGTH]
= { STATE_FOG_COLOR, 0, 0, 0, 0};
struct prog_instruction *newInst, *inst;
- const GLuint origLen = fprog->Base.NumInstructions;
+ const GLuint origLen = fprog->NumInstructions;
const GLuint newLen = origLen + 5;
GLuint i;
GLint fogPRefOpt, fogColorRef; /* state references */
return;
}
- if (!(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR))) {
+ if (!(fprog->OutputsWritten & (1 << FRAG_RESULT_COLOR))) {
/* program doesn't output color, so nothing to do */
return;
}
}
/* Copy orig instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, fprog->Base.Instructions, origLen);
+ _mesa_copy_instructions(newInst, fprog->Instructions, origLen);
/* PARAM fogParamsRefOpt = internal optimized fog params; */
fogPRefOpt
- = _mesa_add_state_reference(fprog->Base.Parameters, fogPStateOpt);
+ = _mesa_add_state_reference(fprog->Parameters, fogPStateOpt);
/* PARAM fogColorRef = state.fog.color; */
fogColorRef
- = _mesa_add_state_reference(fprog->Base.Parameters, fogColorState);
+ = _mesa_add_state_reference(fprog->Parameters, fogColorState);
/* TEMP colorTemp; */
- colorTemp = fprog->Base.NumTemporaries++;
+ colorTemp = fprog->NumTemporaries++;
/* TEMP fogFactorTemp; */
- fogFactorTemp = fprog->Base.NumTemporaries++;
+ fogFactorTemp = fprog->NumTemporaries++;
/* Scan program to find where result.color is written */
inst = newInst;
- for (i = 0; i < fprog->Base.NumInstructions; i++) {
+ for (i = 0; i < fprog->NumInstructions; i++) {
if (inst->Opcode == OPCODE_END)
break;
if (inst->DstReg.File == PROGRAM_OUTPUT &&
inst++;
/* free old instructions */
- _mesa_free_instructions(fprog->Base.Instructions, origLen);
+ _mesa_free_instructions(fprog->Instructions, origLen);
/* install new instructions */
- fprog->Base.Instructions = newInst;
- fprog->Base.NumInstructions = inst - newInst;
- fprog->Base.InputsRead |= VARYING_BIT_FOGC;
- assert(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR));
+ fprog->Instructions = newInst;
+ fprog->NumInstructions = inst - newInst;
+ fprog->InputsRead |= VARYING_BIT_FOGC;
+ assert(fprog->OutputsWritten & (1 << FRAG_RESULT_COLOR));
}
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog);
extern void
-_mesa_append_fog_code(struct gl_context *ctx,
- struct gl_fragment_program *fprog, GLenum fog_mode,
- GLboolean saturate);
+_mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
+ GLenum fog_mode, GLboolean saturate);
extern void
_mesa_count_texture_indirections(struct gl_program *prog);
struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;
struct gl_program *new_tep = ctx->TessEvalProgram._Current;
struct gl_program *new_gp = ctx->GeometryProgram._Current;
- struct gl_fragment_program *new_fp = ctx->FragmentProgram._Current;
+ struct gl_program *new_fp = ctx->FragmentProgram._Current;
uint64_t dirty = 0;
/* Flag states used by both new and old shaders to unbind shader resources
static void update_fs_constants(struct st_context *st )
{
struct st_fragment_program *fp = st->fp;
- struct gl_program_parameter_list *params = fp->Base.Base.Parameters;
+ struct gl_program_parameter_list *params = fp->Base.Parameters;
st_upload_constants( st, params, MESA_SHADER_FRAGMENT );
}
struct gl_context *ctx = st->ctx;
struct pipe_rasterizer_state *raster = &st->state.rasterizer;
const struct gl_program *vertProg = ctx->VertexProgram._Current;
- const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current;
+ const struct gl_program *fragProg = ctx->FragmentProgram._Current;
memset(raster, 0, sizeof(*raster));
raster->sprite_coord_enable = ctx->Point.CoordReplace &
((1u << MAX_TEXTURE_COORD_UNITS) - 1);
if (!st->needs_texcoord_semantic &&
- fragProg->Base.InputsRead & VARYING_BIT_PNTC) {
+ fragProg->InputsRead & VARYING_BIT_PNTC) {
raster->sprite_coord_enable |=
1 << st_get_generic_varying_index(st, VARYING_SLOT_PNTC);
}
update_shader_samplers(st,
PIPE_SHADER_FRAGMENT,
- &ctx->FragmentProgram._Current->Base,
+ ctx->FragmentProgram._Current,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_FRAGMENT],
&st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
assert(st->ctx->FragmentProgram._Current);
stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
- assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
+ assert(stfp->Base.Target == GL_FRAGMENT_PROGRAM_ARB);
memset(&key, 0, sizeof(key));
key.st = st->has_shareable_shaders ? NULL : st;
}
}
- key.external = st_get_external_sampler_key(st, &stfp->Base.Base);
+ key.external = st_get_external_sampler_key(st, &stfp->Base);
st->fp_variant = st_get_fp_variant(st, stfp, &key);
update_textures(st,
MESA_SHADER_FRAGMENT,
- &ctx->FragmentProgram._Current->Base,
+ ctx->FragmentProgram._Current,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
st->state.sampler_views[PIPE_SHADER_FRAGMENT],
&st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
GLfloat colorSave[4];
COPY_4V(colorSave, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color);
- st_upload_constants(st, st->fp->Base.Base.Parameters,
- MESA_SHADER_FRAGMENT);
+ st_upload_constants(st, st->fp->Base.Parameters, MESA_SHADER_FRAGMENT);
COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave);
}
struct dd_function_table;
struct st_context;
-struct gl_fragment_program;
+struct gl_program;
struct st_fragment_program;
extern void
/* compiling a new fragment shader variant added new state constants
* into the constant buffer, we need to update them
*/
- st_upload_constants(st, st->fp->Base.Base.Parameters,
- MESA_SHADER_FRAGMENT);
+ st_upload_constants(st, st->fp->Base.Parameters, MESA_SHADER_FRAGMENT);
}
/* Put glDrawPixels image into a texture */
/* compiling a new fragment shader variant added new state constants
* into the constant buffer, we need to update them
*/
- st_upload_constants(st, st->fp->Base.Base.Parameters,
- MESA_SHADER_FRAGMENT);
+ st_upload_constants(st, st->fp->Base.Parameters, MESA_SHADER_FRAGMENT);
}
else {
assert(type == GL_DEPTH);
st_validate_state(st, ST_PIPELINE_RENDER);
/* determine if we need vertex color */
- if (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL0)
+ if (ctx->FragmentProgram._Current->InputsRead & VARYING_BIT_COL0)
emitColor = GL_TRUE;
else
emitColor = GL_FALSE;
}
case GL_FRAGMENT_PROGRAM_ARB: {
struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
- return _mesa_init_gl_program(&prog->Base.Base, target, id);
+ return _mesa_init_gl_program(&prog->Base, target, id);
}
case GL_GEOMETRY_PROGRAM_NV: {
struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program);
ST_NEW_SAMPLERS |
ST_NEW_IMAGE_UNITS);
if (ctx->FragmentProgram._Current &&
- ctx->FragmentProgram._Current->Base.ExternalSamplersUsed) {
+ ctx->FragmentProgram._Current->ExternalSamplersUsed) {
st->dirty |= ST_NEW_FS_STATE;
}
}
_mesa_print_parameter_list(st->vp->Base.Parameters);
tgsi_dump(st->fp->tgsi.tokens, 0);
- if (st->fp->Base.Base.Parameters)
- _mesa_print_parameter_list(st->fp->Base.Base.Parameters);
+ if (st->fp->Base.Parameters)
+ _mesa_print_parameter_list(st->fp->Base.Parameters);
}
glsl_to_tgsi_visitor::visit(ir_variable *ir)
{
if (strcmp(ir->name, "gl_FragCoord") == 0) {
- struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
-
- fp->OriginUpperLeft = ir->data.origin_upper_left;
- fp->PixelCenterInteger = ir->data.pixel_center_integer;
+ this->prog->OriginUpperLeft = ir->data.origin_upper_left;
+ this->prog->PixelCenterInteger = ir->data.pixel_center_integer;
}
if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
struct ureg_program *ureg,
int wpos_transform_const)
{
- const struct gl_fragment_program *fp =
- (const struct gl_fragment_program *) program;
struct pipe_screen *pscreen = st->pipe->screen;
GLfloat adjX = 0.0f;
GLfloat adjY[2] = { 0.0f, 0.0f };
* u,i -> l,h: (99.0 + 0.5) * -1 + 100 = 0.5
* u,h -> l,i: (99.5 + 0.5) * -1 + 100 = 0
*/
- if (fp->OriginUpperLeft) {
+ if (program->OriginUpperLeft) {
/* Fragment shader wants origin in upper-left */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) {
/* the driver supports upper-left origin */
assert(0);
}
- if (fp->PixelCenterInteger) {
+ if (program->PixelCenterInteger) {
/* Fragment shader wants pixel center integer */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) {
/* the driver supports pixel center integer */
const struct gl_program *program,
struct ureg_program *ureg)
{
- const struct gl_fragment_program *fp =
- (const struct gl_fragment_program *) program;
struct pipe_screen *pscreen = st->pipe->screen;
GLfloat adjX = 0.0f;
GLfloat adjY[2] = { 0.0f, 0.0f };
* u,i -> l,h: (99.0 + 0.5) * -1 + 100 = 0.5
* u,h -> l,i: (99.5 + 0.5) * -1 + 100 = 0
*/
- if (fp->OriginUpperLeft) {
+ if (program->OriginUpperLeft) {
/* Fragment shader wants origin in upper-left */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) {
/* the driver supports upper-left origin */
assert(0);
}
- if (fp->PixelCenterInteger) {
+ if (program->PixelCenterInteger) {
/* Fragment shader wants pixel center integer */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) {
/* the driver supports pixel center integer */
/* Non-GLSL programs: */
if (!stfp->glsl_to_tgsi && !stfp->shader_program) {
- _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT);
+ _mesa_remove_output_reads(&stfp->Base, PROGRAM_OUTPUT);
if (st->ctx->Const.GLSLFragCoordIsSysVal)
- _mesa_program_fragment_position_to_sysval(&stfp->Base.Base);
+ _mesa_program_fragment_position_to_sysval(&stfp->Base);
/* This determines which states will be updated when the assembly
* shader is bound.
ST_NEW_RENDER_SAMPLERS;
} else {
/* ARB_fp */
- if (stfp->Base.Base.SamplersUsed)
+ if (stfp->Base.SamplersUsed)
stfp->affected_states |= ST_NEW_FS_SAMPLER_VIEWS |
ST_NEW_RENDER_SAMPLERS;
}
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/
- inputsRead = stfp->Base.Base.InputsRead;
+ inputsRead = stfp->Base.InputsRead;
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = fs_num_inputs++;
* Semantics and mapping for outputs
*/
{
- GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten;
+ GLbitfield64 outputsWritten = stfp->Base.OutputsWritten;
/* if z is written, emit that first */
if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
/* handle remaining outputs (color) */
for (attr = 0; attr < ARRAY_SIZE(outputMapping); attr++) {
const GLbitfield64 written = attr < FRAG_RESULT_MAX ? outputsWritten :
- stfp->Base.Base.SecondaryOutputsWritten;
+ stfp->Base.SecondaryOutputsWritten;
const unsigned loc = attr % FRAG_RESULT_MAX;
if (written & BITFIELD64_BIT(loc)) {
}
if (stfp->shader_program) {
- nir_shader *nir = st_glsl_to_nir(st, &stfp->Base.Base,
- stfp->shader_program,
+ nir_shader *nir = st_glsl_to_nir(st, &stfp->Base, stfp->shader_program,
MESA_SHADER_FRAGMENT);
stfp->tgsi.type = PIPE_SHADER_IR_NIR;
return false;
if (ST_DEBUG & DEBUG_MESA) {
- _mesa_print_program(&stfp->Base.Base);
- _mesa_print_program_parameters(st->ctx, &stfp->Base.Base);
+ _mesa_print_program(&stfp->Base);
+ _mesa_print_program_parameters(st->ctx, &stfp->Base);
debug_printf("\n");
}
if (write_all == GL_TRUE)
ureg_property(ureg, TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, 1);
- if (stfp->Base.Base.info.fs.depth_layout != FRAG_DEPTH_LAYOUT_NONE) {
- switch (stfp->Base.Base.info.fs.depth_layout) {
+ if (stfp->Base.info.fs.depth_layout != FRAG_DEPTH_LAYOUT_NONE) {
+ switch (stfp->Base.info.fs.depth_layout) {
case FRAG_DEPTH_LAYOUT_ANY:
ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT,
TGSI_FS_DEPTH_LAYOUT_ANY);
PIPE_SHADER_FRAGMENT,
ureg,
stfp->glsl_to_tgsi,
- &stfp->Base.Base,
+ &stfp->Base,
/* inputs */
fs_num_inputs,
inputMapping,
} else if (stfp->ati_fs)
st_translate_atifs_program(ureg,
stfp->ati_fs,
- &stfp->Base.Base,
+ &stfp->Base,
/* inputs */
fs_num_inputs,
inputMapping,
st_translate_mesa_program(st->ctx,
PIPE_SHADER_FRAGMENT,
ureg,
- &stfp->Base.Base,
+ &stfp->Base,
/* inputs */
fs_num_inputs,
inputMapping,
struct pipe_context *pipe = st->pipe;
struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant);
struct pipe_shader_state tgsi = {0};
- struct gl_program_parameter_list *params = stfp->Base.Base.Parameters;
+ struct gl_program_parameter_list *params = stfp->Base.Parameters;
static const gl_state_index texcoord_state[STATE_LENGTH] =
{ STATE_INTERNAL, STATE_CURRENT_ATTRIB, VERT_ATTRIB_TEX0 };
static const gl_state_index scale_state[STATE_LENGTH] =
if (key->bitmap) {
nir_lower_bitmap_options options = {0};
- variant->bitmap_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1;
+ variant->bitmap_sampler = ffs(~stfp->Base.SamplersUsed) - 1;
options.sampler = variant->bitmap_sampler;
options.swizzle_xxxx = (st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM);
/* glDrawPixels (color only) */
if (key->drawpixels) {
nir_lower_drawpixels_options options = {{0}};
- unsigned samplers_used = stfp->Base.Base.SamplersUsed;
+ unsigned samplers_used = stfp->Base.SamplersUsed;
/* Find the first unused slot. */
variant->drawpix_sampler = ffs(~samplers_used) - 1;
NIR_PASS_V(tgsi.ir.nir, nir_lower_tex, &options);
}
- st_finalize_nir(st, &stfp->Base.Base, tgsi.ir.nir);
+ st_finalize_nir(st, &stfp->Base, tgsi.ir.nir);
if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
/* This pass needs to happen *after* nir_lower_sampler */
NIR_PASS_V(tgsi.ir.nir, st_nir_lower_tex_src_plane,
- ~stfp->Base.Base.SamplersUsed,
+ ~stfp->Base.SamplersUsed,
key->external.lower_nv12,
key->external.lower_iyuv);
}
if (key->bitmap) {
const struct tgsi_token *tokens;
- variant->bitmap_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1;
+ variant->bitmap_sampler = ffs(~stfp->Base.SamplersUsed) - 1;
tokens = st_get_bitmap_shader(tgsi.tokens,
st->internal_target,
unsigned scale_const = 0, bias_const = 0, texcoord_const = 0;
/* Find the first unused slot. */
- variant->drawpix_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1;
+ variant->drawpix_sampler = ffs(~stfp->Base.SamplersUsed) - 1;
if (key->pixelMaps) {
- unsigned samplers_used = stfp->Base.Base.SamplersUsed |
+ unsigned samplers_used = stfp->Base.SamplersUsed |
(1 << variant->drawpix_sampler);
variant->pixelmap_sampler = ffs(~samplers_used) - 1;
assert(!(key->bitmap || key->drawpixels));
tokens = st_tgsi_lower_yuv(tgsi.tokens,
- ~stfp->Base.Base.SamplersUsed,
+ ~stfp->Base.SamplersUsed,
key->external.lower_nv12,
key->external.lower_iyuv);
if (tokens) {
/**
- * Derived from Mesa gl_fragment_program:
+ * Derived from Mesa gl_program:
*/
struct st_fragment_program
{
- struct gl_fragment_program Base;
+ struct gl_program Base;
struct pipe_shader_state tgsi;
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
struct ati_fragment_shader *ati_fs;
/**
- * Derived from Mesa gl_fragment_program:
+ * Derived from Mesa gl_program:
*/
struct st_vertex_program
{
static inline struct st_fragment_program *
-st_fragment_program( struct gl_fragment_program *fp )
+st_fragment_program( struct gl_program *fp )
{
return (struct st_fragment_program *)fp;
}
}
else {
GLboolean use_fprog = _swrast_use_fragment_program(ctx);
- const struct gl_fragment_program *fprog
- = ctx->FragmentProgram._Current;
- if (use_fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
+ const struct gl_program *fprog = ctx->FragmentProgram._Current;
+ if (use_fprog && (fprog->OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
/* Z comes from fragment program/shader */
swrast->_DeferredTexture = GL_FALSE;
}
- else if (use_fprog && fprog->Base.info.fs.uses_discard) {
+ else if (use_fprog && fprog->info.fs.uses_discard) {
swrast->_DeferredTexture = GL_FALSE;
}
else if (ctx->Query.CurrentOcclusionObject) {
_swrast_update_fog_state( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ const struct gl_program *fp = ctx->FragmentProgram._Current;
- assert(fp == NULL || fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB);
+ assert(fp == NULL || fp->Target == GL_FRAGMENT_PROGRAM_ARB);
(void) fp; /* silence unused var warning */
/* determine if fog is needed, and if so, which fog mode */
return;
_mesa_load_state_parameters(ctx,
- ctx->FragmentProgram._Current->Base.Parameters);
+ ctx->FragmentProgram._Current->Parameters);
}
*/
if (_swrast_use_fragment_program(ctx)) {
/* fragment program/shader */
- attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
+ attribsMask = ctx->FragmentProgram._Current->InputsRead;
attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */
}
else if (ctx->ATIFragmentShader._Enabled) {
GLboolean
_swrast_use_fragment_program(struct gl_context *ctx)
{
- struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ struct gl_program *fp = ctx->FragmentProgram._Current;
return fp && !(fp == ctx->FragmentProgram._TexEnvProgram
- && fp->Base.NumInstructions == 0);
+ && fp->NumInstructions == 0);
}
/**
*/
static void
init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
- const struct gl_fragment_program *program,
- const SWspan *span, GLuint col)
+ const struct gl_program *program, const SWspan *span, GLuint col)
{
GLfloat *wpos = span->array->attribs[VARYING_SLOT_POS][col];
machine->DerivY = (GLfloat (*)[4]) span->attrStepY;
machine->NumDeriv = VARYING_SLOT_MAX;
- machine->Samplers = program->Base.SamplerUnits;
+ machine->Samplers = program->SamplerUnits;
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]) {
run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
- const GLbitfield64 outputsWritten = program->Base.OutputsWritten;
+ const struct gl_program *program = ctx->FragmentProgram._Current;
+ const GLbitfield64 outputsWritten = program->OutputsWritten;
struct gl_program_machine *machine = &swrast->FragProgMachine;
GLuint i;
if (span->array->mask[i]) {
init_machine(ctx, machine, program, span, i);
- if (_mesa_execute_program(ctx, &program->Base, machine)) {
+ if (_mesa_execute_program(ctx, program, machine)) {
/* Store result color */
if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
void
_swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span )
{
- const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
+ const struct gl_program *program = ctx->FragmentProgram._Current;
/* incoming colors should be floats */
- if (program->Base.InputsRead & VARYING_BIT_COL0) {
+ if (program->InputsRead & VARYING_BIT_COL0) {
assert(span->array->ChanType == GL_FLOAT);
}
run_program(ctx, span, 0, span->end);
- if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
+ if (program->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
span->interpMask &= ~SPAN_RGBA;
span->arrayMask |= SPAN_RGBA;
}
- if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
+ if (program->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
span->interpMask &= ~SPAN_Z;
span->arrayMask |= SPAN_Z;
}
*/
{
const GLuint numBuffers = fb->_NumColorDrawBuffers;
- const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ const struct gl_program *fp = ctx->FragmentProgram._Current;
const GLboolean multiFragOutputs =
_swrast_use_fragment_program(ctx)
- && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0);
+ && fp->OutputsWritten >= (1 << FRAG_RESULT_DATA0);
/* Save srcColorType because convert_color_type() can change it */
const GLenum srcColorType = span->array->ChanType;
GLuint buf;
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
const struct gl_program *vp = ctx->VertexProgram._Current;
- const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ const struct gl_program *fp = ctx->FragmentProgram._Current;
GLuint i;
if (new_state & (_NEW_HINT | _NEW_PROGRAM)) {
*/
tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS);
- if (!fp || (fp->Base.InputsRead & VARYING_BIT_COL0)) {
+ if (!fp || (fp->InputsRead & VARYING_BIT_COL0)) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0);
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
- (fp && fp->Base.InputsRead & VARYING_BIT_TEX(i))) {
+ (fp && fp->InputsRead & VARYING_BIT_TEX(i))) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i));
}
}
if (ctx->Fog.Enabled
- || (fp != NULL && (fp->Base.InputsRead & VARYING_BIT_FOGC) != 0)) {
+ || (fp != NULL && (fp->InputsRead & VARYING_BIT_FOGC) != 0)) {
/* Either fixed-function fog or a fragment program needs fog coord.
*/
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG);