[Mesa-dev] [RFC PATCH 13/56] mesa/main: Allow setting of patch parameters.
Chris Forbes
chrisf at ijw.co.nz
Sat Sep 20 18:40:53 PDT 2014
From: Fabian Bieler <fabianbieler at fastmail.fm>
---
src/mesa/main/shaderapi.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c11ad4f..cfad210 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1934,13 +1934,39 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
extern void GLAPIENTRY
_mesa_PatchParameteri(GLenum pname, GLint value)
{
- /* STUB */
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (pname != GL_PATCH_VERTICES) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPatchParameteri");
+ return;
+ }
+
+ if (value <= 0 || value > ctx->Const.MaxPatchVertices) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glPatchParameteri");
+ return;
+ }
+
+ ctx->TessCtrlProgram.patch_vertices = value;
}
extern void GLAPIENTRY
_mesa_PatchParameterfv(GLenum pname, const GLfloat *values)
{
- /* STUB */
+ GET_CURRENT_CONTEXT(ctx);
+
+ switch(pname) {
+ case GL_PATCH_DEFAULT_OUTER_LEVEL:
+ memcpy(ctx->TessCtrlProgram.patch_default_outer_level, values,
+ 4 * sizeof(GLfloat));
+ return;
+ case GL_PATCH_DEFAULT_INNER_LEVEL:
+ memcpy(ctx->TessCtrlProgram.patch_default_inner_level, values,
+ 2 * sizeof(GLfloat));
+ return;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPatchParameterfv");
+ return;
+ }
}
--
2.1.0
More information about the mesa-dev
mailing list