summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-05-28 20:57:37 +1000
committerTimothy Arceri <[email protected]>2018-05-30 09:37:35 +1000
commit1f7a3a11025b18d46d46f7e3f5c45eda9e825dcd (patch)
tree82edce56546f79a09d429a7278f7c853a49078c0 /src
parentd3ff4787322c5855aad1e9ee0ee0aa141f7d6420 (diff)
mesa: add display list support for glPatchParameter{i,fv}()
This is required for tessellation shader Compat profile support. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/dlist.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 8be223559ab..4fc451000b5 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -365,6 +365,11 @@ typedef enum
OPCODE_UNIFORM_3UIV,
OPCODE_UNIFORM_4UIV,
+ /* OpenGL 4.0 / GL_ARB_tessellation_shader */
+ OPCODE_PATCH_PARAMETER_I,
+ OPCODE_PATCH_PARAMETER_FV_INNER,
+ OPCODE_PATCH_PARAMETER_FV_OUTER,
+
/* OpenGL 4.2 / GL_ARB_separate_shader_objects */
OPCODE_USE_PROGRAM_STAGES,
OPCODE_PROGRAM_UNIFORM_1F,
@@ -3272,6 +3277,54 @@ save_Ortho(GLdouble left, GLdouble right,
static void GLAPIENTRY
+save_PatchParameteri(GLenum pname, const GLint value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
+ if (n) {
+ n[1].e = pname;
+ n[2].i = value;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_PatchParameteri(ctx->Exec, (pname, value));
+ }
+}
+
+
+static void GLAPIENTRY
+save_PatchParameterfv(GLenum pname, const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
+ n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
+ } else {
+ assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
+ n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
+ }
+ if (n) {
+ n[1].e = pname;
+ if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
+ n[2].f = params[0];
+ n[3].f = params[1];
+ n[4].f = params[2];
+ n[5].f = params[3];
+ } else {
+ n[2].f = params[0];
+ n[3].f = params[1];
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_PatchParameterfv(ctx->Exec, (pname, params));
+ }
+}
+
+
+static void GLAPIENTRY
save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
{
GET_CURRENT_CONTEXT(ctx);
@@ -8401,6 +8454,27 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_PASSTHROUGH:
CALL_PassThrough(ctx->Exec, (n[1].f));
break;
+ case OPCODE_PATCH_PARAMETER_I:
+ CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
+ break;
+ case OPCODE_PATCH_PARAMETER_FV_INNER:
+ {
+ GLfloat params[2];
+ params[0] = n[2].f;
+ params[1] = n[3].f;
+ CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
+ }
+ break;
+ case OPCODE_PATCH_PARAMETER_FV_OUTER:
+ {
+ GLfloat params[4];
+ params[0] = n[2].f;
+ params[1] = n[3].f;
+ params[2] = n[4].f;
+ params[3] = n[5].f;
+ CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
+ }
+ break;
case OPCODE_PIXEL_MAP:
CALL_PixelMapfv(ctx->Exec,
(n[1].e, n[2].i, get_pointer(&n[3])));
@@ -9847,6 +9921,10 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_PointParameterf(table, save_PointParameterfEXT);
SET_PointParameterfv(table, save_PointParameterfvEXT);
+ /* 91. GL_ARB_tessellation_shader */
+ SET_PatchParameteri(table, save_PatchParameteri);
+ SET_PatchParameterfv(table, save_PatchParameterfv);
+
/* 173. GL_EXT_blend_func_separate */
SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);