return ctx == NULL || ctx->Extensions.ARB_vertex_shader;
case GL_GEOMETRY_SHADER_ARB:
return ctx == NULL || _mesa_has_geometry_shaders(ctx);
+ case GL_TESS_CONTROL_SHADER:
+ case GL_TESS_EVALUATION_SHADER:
+ return ctx == NULL || _mesa_has_tessellation(ctx);
case GL_COMPUTE_SHADER:
return ctx == NULL || ctx->Extensions.ARB_compute_shader;
default:
/* sanity check - make sure the new list's entries are sensible */
for (j = 0; j < shProg->NumShaders; j++) {
assert(shProg->Shaders[j]->Type == GL_VERTEX_SHADER ||
+ shProg->Shaders[j]->Type == GL_TESS_CONTROL_SHADER ||
+ shProg->Shaders[j]->Type == GL_TESS_EVALUATION_SHADER ||
shProg->Shaders[j]->Type == GL_GEOMETRY_SHADER ||
shProg->Shaders[j]->Type == GL_FRAGMENT_SHADER);
assert(shProg->Shaders[j]->RefCount > 0);
if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY])
printf(" geom prog %u\n",
shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL])
+ printf(" tesc prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program->Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL])
+ printf(" tese prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->Id);
}
case MESA_SHADER_VERTEX:
dst->UsesClipDistanceOut = src->Vert.UsesClipDistance;
break;
+ case MESA_SHADER_TESS_CTRL: {
+ struct gl_tess_ctrl_program *dst_tcp =
+ (struct gl_tess_ctrl_program *) dst;
+ dst_tcp->VerticesOut = src->TessCtrl.VerticesOut;
+ break;
+ }
+ case MESA_SHADER_TESS_EVAL: {
+ struct gl_tess_eval_program *dst_tep =
+ (struct gl_tess_eval_program *) dst;
+ dst_tep->PrimitiveMode = src->TessEval.PrimitiveMode;
+ dst_tep->Spacing = src->TessEval.Spacing;
+ dst_tep->VertexOrder = src->TessEval.VertexOrder;
+ dst_tep->PointMode = src->TessEval.PointMode;
+ break;
+ }
case MESA_SHADER_GEOMETRY: {
struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst;
dst_gp->VerticesIn = src->Geom.VerticesIn;
/**
- * Update the ctx->Vertex/Geometry/FragmentProgram._Current pointers to point
- * to the current/active programs. Then call ctx->Driver.BindProgram() to
+ * Update the ctx->*Program._Current pointers to point to the
+ * current/active programs. Then call ctx->Driver.BindProgram() to
* tell the driver which programs to use.
*
* Programs may come from 3 sources: GLSL shaders, ARB/NV_vertex/fragment
{
const struct gl_shader_program *vsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
+ const struct gl_shader_program *tcsProg =
+ ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
+ const struct gl_shader_program *tesProg =
+ ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
const struct gl_shader_program *gsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
struct gl_shader_program *fsProg =
const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current;
+ const struct gl_tess_ctrl_program *prevTCP = ctx->TessCtrlProgram._Current;
+ const struct gl_tess_eval_program *prevTEP = ctx->TessEvalProgram._Current;
const struct gl_compute_program *prevCP = ctx->ComputeProgram._Current;
GLbitfield new_state = 0x0;
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
}
+ 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));
+ }
+ else {
+ /* No tessellation evaluation program */
+ _mesa_reference_tesseprog(ctx, &ctx->TessEvalProgram._Current, NULL);
+ }
+
+ if (tcsProg && tcsProg->LinkStatus
+ && tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]) {
+ /* Use GLSL tessellation control shader */
+ _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._Current,
+ gl_tess_ctrl_program(
+ tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program));
+ }
+ else {
+ /* No tessellation control program */
+ _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._Current, NULL);
+ }
+
/* Examine vertex program after fragment program as
* _mesa_get_fixed_func_vertex_program() needs to know active
* fragprog inputs.
}
}
+ if (ctx->TessEvalProgram._Current != prevTEP) {
+ new_state |= _NEW_PROGRAM;
+ if (ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_TESS_EVALUATION_PROGRAM_NV,
+ (struct gl_program *) ctx->TessEvalProgram._Current);
+ }
+ }
+
+ if (ctx->TessCtrlProgram._Current != prevTCP) {
+ new_state |= _NEW_PROGRAM;
+ if (ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_TESS_CONTROL_PROGRAM_NV,
+ (struct gl_program *) ctx->TessCtrlProgram._Current);
+ }
+ }
+
if (ctx->VertexProgram._Current != prevVP) {
new_state |= _NEW_PROGRAM;
if (ctx->Driver.BindProgram) {
}
}
- /* Don't handle geometry shaders here. They don't use any state
- * constants.
+ /* Don't handle tessellation and geometry shaders here. They don't use
+ * any state constants.
*/
if (ctx->VertexProgram._Current) {