this->current_annotation = NULL;
this->c = c;
- this->vp = prog->VertexProgram;
+ this->vp = (struct gl_vertex_program *)
+ prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
this->prog_data = &c->prog_data;
this->variable_ht = hash_table_ctor(0,
{
struct brw_context *brw = brw_context(ctx);
struct brw_vs_prog_key key;
- struct gl_vertex_program *vp = prog->VertexProgram;
- struct brw_vertex_program *bvp = brw_vertex_program(vp);
uint32_t old_prog_offset = brw->vs.prog_offset;
struct brw_vs_prog_data *old_prog_data = brw->vs.prog_data;
bool success;
- if (!vp)
+ if (!prog->_LinkedShaders[MESA_SHADER_VERTEX])
return true;
+ struct gl_vertex_program *vp = (struct gl_vertex_program *)
+ prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
+ struct brw_vertex_program *bvp = brw_vertex_program(vp);
+
memset(&key, 0, sizeof(key));
key.program_string_id = bvp->id;
sh = shProg[i]->_LinkedShaders[i];
switch (sh->Type) {
case GL_VERTEX_SHADER:
- _mesa_append_uniforms_to_file(sh, &shProg[i]->VertexProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
case GL_GEOMETRY_SHADER_ARB:
const GLboolean vertexShader =
(ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus &&
- ctx->Shader.CurrentVertexProgram->VertexProgram);
+ ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]);
const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
GLbitfield fp_inputs = 0x0;
}
else {
/* calculate from vp->outputs */
- struct gl_vertex_program *vprog;
+ struct gl_program *vprog;
GLbitfield64 vp_outputs;
/* Choose GLSL vertex shader over ARB vertex program. Need this
* validation (see additional comments in state.c).
*/
if (vertexShader)
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
+ vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
else
- vprog = ctx->VertexProgram.Current;
+ vprog = &ctx->VertexProgram.Current->Base;
- vp_outputs = vprog->Base.OutputsWritten;
+ vp_outputs = vprog->OutputsWritten;
/* These get generated in the setup routine regardless of the
* vertex program:
} Vert;
/* post-link info: */
- struct gl_vertex_program *VertexProgram; /**< Linked vertex program */
struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
struct gl_geometry_program *GeometryProgram; /**< Linked geometry prog */
struct gl_uniform_list *Uniforms;
shProg->Shaders[i]->Name,
shProg->Shaders[i]->SourceChecksum);
}
- if (shProg->VertexProgram)
- printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+ 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->GeometryProgram)
validate_shader_program(const struct gl_shader_program *shProg,
char *errMsg)
{
- const struct gl_vertex_program *vp = shProg->VertexProgram;
+ const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
const struct gl_geometry_program *gp = shProg->GeometryProgram;
const struct gl_fragment_program *fp = shProg->FragmentProgram;
* Check: any two active samplers in the current program object are of
* different types, but refer to the same texture image unit,
*/
- if (vp && !validate_samplers(&vp->Base, errMsg)) {
+ if (vs && !validate_samplers(vs->Program, errMsg)) {
return GL_FALSE;
}
if (gp && !validate_samplers(&gp->Base, errMsg)) {
_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
_mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
_mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL);
* _mesa_get_fixed_func_vertex_program() needs to know active
* fragprog inputs.
*/
- if (vsProg && vsProg->LinkStatus && vsProg->VertexProgram) {
+ if (vsProg && vsProg->LinkStatus
+ && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* Use GLSL vertex shader */
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- vsProg->VertexProgram);
+ (struct gl_vertex_program *)
+ vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
}
else if (ctx->VertexProgram._Enabled) {
/* Use user-defined vertex program */
{
GLuint unit;
struct gl_fragment_program *fprog = NULL;
- struct gl_vertex_program *vprog = NULL;
+ struct gl_program *vprog = NULL;
GLbitfield enabledFragUnits = 0x0;
if (ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus) {
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
+ vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
} else if (ctx->VertexProgram._Enabled) {
/* XXX enable this if/when non-shader vertex programs get
* texture fetches:
- vprog = ctx->VertexProgram.Current;
+ vprog = &ctx->VertexProgram.Current->Base;
*/
}
* settle on the one with highest priority (see below).
*/
if (vprog) {
- enabledVertTargets |= vprog->Base.TexturesUsed[unit];
+ enabledVertTargets |= vprog->TexturesUsed[unit];
}
if (fprog) {
pos = shProg->Uniforms->Uniforms[index].VertPos;
if (pos >= 0) {
- prog = &shProg->VertexProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
}
else {
pos = shProg->Uniforms->Uniforms[index].FragPos;
/* A uniform var may be used by both a vertex shader and a fragment
* shader. We may need to update one or both shader's uniform here:
*/
- if (shProg->VertexProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* convert uniform location to program parameter index */
GLint index = uniform->VertPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->VertexProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
index, offset, type, count, elems, values);
}
}
uniform = &shProg->Uniforms->Uniforms[location];
- if (shProg->VertexProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* convert uniform location to program parameter index */
GLint index = uniform->VertPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
index, offset,
count, rows, cols, transpose, values);
}
case GL_VERTEX_SHADER:
((struct gl_vertex_program *)linked_prog)->UsesClipDistance
= prog->Vert.UsesClipDistance;
- _mesa_reference_vertprog(ctx, &prog->VertexProgram,
- (struct gl_vertex_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
linked_prog);
break;
}
}
- _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL);
_mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
_mesa_reference_geomprog(ctx, &prog->GeometryProgram, NULL);
switch (prog->_LinkedShaders[i]->Type) {
case GL_VERTEX_SHADER:
- _mesa_reference_vertprog(ctx, &prog->VertexProgram,
- (struct gl_vertex_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
linked_prog);
if (!ok) {
destroy_program_variants(st, shProg->Shaders[i]->Program);
}
- destroy_program_variants(st, (struct gl_program *)
- shProg->VertexProgram);
+ destroy_program_variants(st,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
destroy_program_variants(st, (struct gl_program *)
shProg->FragmentProgram);
destroy_program_variants(st, (struct gl_program *)