{
struct brw_context *brw = brw_context(ctx);
struct brw_wm_prog_key key;
- struct gl_fragment_program *fp = prog->FragmentProgram;
- struct brw_fragment_program *bfp = brw_fragment_program(fp);
- if (!fp)
+ if (!prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
return true;
+ struct gl_fragment_program *fp = (struct gl_fragment_program *)
+ prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
+ struct brw_fragment_program *bfp = brw_fragment_program(fp);
+
memset(&key, 0, sizeof(key));
if (fp->UsesKill)
this->c = c;
this->p = &c->func;
this->brw = p->brw;
- this->fp = prog->FragmentProgram;
+ this->fp = (struct gl_fragment_program *)
+ prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
this->prog = prog;
this->intel = &brw->intel;
this->ctx = &intel->ctx;
brw_init_compile(brw, &c->func, c);
- if (prog && prog->FragmentProgram) {
+ if (prog && prog->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
if (!brw_wm_fs_emit(brw, c, prog))
return false;
} else {
break;
case GL_FRAGMENT_SHADER:
- _mesa_append_uniforms_to_file(sh,
- &shProg[i]->FragmentProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
}
}
} Vert;
/* post-link info: */
- struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
struct gl_uniform_list *Uniforms;
struct gl_program_parameter_list *Varying;
GLboolean LinkStatus; /**< GL_LINK_STATUS */
if (shProg->_LinkedShaders[MESA_SHADER_VERTEX])
printf(" vert prog %u\n",
shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program->Id);
- if (shProg->FragmentProgram)
- printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT])
+ printf(" frag prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program->Id);
if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY])
printf(" geom prog %u\n",
shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id);
{
const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
const struct gl_shader *gs = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY];
- const struct gl_fragment_program *fp = shProg->FragmentProgram;
+ const struct gl_shader *fs = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
if (!shProg->LinkStatus) {
return GL_FALSE;
if (gs && !validate_samplers(gs->Program, errMsg)) {
return GL_FALSE;
}
- if (fp && !validate_samplers(&fp->Base, errMsg)) {
+ if (fs && !validate_samplers(fs->Program, errMsg)) {
return GL_FALSE;
}
_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
-
if (shProg->Uniforms) {
_mesa_free_uniform_list(shProg->Uniforms);
shProg->Uniforms = NULL;
* come up, or matter.
*/
- if (fsProg && fsProg->LinkStatus && fsProg->FragmentProgram) {
+ if (fsProg && fsProg->LinkStatus
+ && fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* Use GLSL fragment shader */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- fsProg->FragmentProgram);
+ (struct gl_fragment_program *)
+ fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
}
else if (ctx->FragmentProgram._Enabled) {
/* Use user-defined fragment program */
update_texture_state( struct gl_context *ctx )
{
GLuint unit;
- struct gl_fragment_program *fprog = NULL;
+ struct gl_program *fprog = NULL;
struct gl_program *vprog = NULL;
GLbitfield enabledFragUnits = 0x0;
if (ctx->Shader.CurrentFragmentProgram &&
ctx->Shader.CurrentFragmentProgram->LinkStatus) {
- fprog = ctx->Shader.CurrentFragmentProgram->FragmentProgram;
+ fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else if (ctx->FragmentProgram._Enabled) {
- fprog = ctx->FragmentProgram.Current;
+ fprog = &ctx->FragmentProgram.Current->Base;
}
/* FINISHME: Geometry shader texture accesses should also be considered
}
if (fprog) {
- enabledFragTargets |= fprog->Base.TexturesUsed[unit];
+ enabledFragTargets |= fprog->TexturesUsed[unit];
}
else {
/* fixed-function fragment program */
if (fprog) {
const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
ctx->Texture._EnabledCoordUnits
- = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
+ = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
}
else {
ctx->Texture._EnabledCoordUnits = enabledFragUnits;
else {
pos = shProg->Uniforms->Uniforms[index].FragPos;
if (pos >= 0) {
- prog = &shProg->FragmentProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else {
pos = shProg->Uniforms->Uniforms[index].GeomPos;
}
}
- if (shProg->FragmentProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* convert uniform location to program parameter index */
GLint index = uniform->FragPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->FragmentProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
index, offset, type, count, elems, values);
}
}
}
}
- if (shProg->FragmentProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* convert uniform location to program parameter index */
GLint index = uniform->FragPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
index, offset,
count, rows, cols, transpose, values);
}
linked_prog);
break;
case GL_FRAGMENT_SHADER:
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram,
- (struct gl_fragment_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
linked_prog);
break;
}
}
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
-
if (prog->LinkStatus) {
link_shaders(ctx, prog);
}
}
break;
case GL_FRAGMENT_SHADER:
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram,
- (struct gl_fragment_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
linked_prog);
if (!ok) {
destroy_program_variants(st,
shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
- destroy_program_variants(st, (struct gl_program *)
- shProg->FragmentProgram);
+ destroy_program_variants(st,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
destroy_program_variants(st,
shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
}