[Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

Courtney Goeltzenleuchter courtney at lunarg.com
Wed Nov 20 14:59:31 PST 2013


Define API connections to extension entry points added in previous
commits. Update entry points to use floating point arguments as
required by the extension.
Add get tokens for ARB_viewport_array state.

Signed-off-by: Courtney Goeltzenleuchter <courtney at LunarG.com>
---
 src/mapi/glapi/gen/ARB_viewport_array.xml | 79 +++++++++++++++++++++++++++++++
 src/mapi/glapi/gen/Makefile.am            |  1 +
 src/mapi/glapi/gen/gl_API.xml             |  2 +-
 src/mesa/main/get_hash_params.py          | 11 ++++-
 src/mesa/main/viewport.c                  |  8 ++--
 src/mesa/main/viewport.h                  |  4 +-
 6 files changed, 95 insertions(+), 10 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_viewport_array.xml

diff --git a/src/mapi/glapi/gen/ARB_viewport_array.xml b/src/mapi/glapi/gen/ARB_viewport_array.xml
new file mode 100644
index 0000000..3fb17fd
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_viewport_array.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+<OpenGLAPI>
+
+<category name="GL_ARB_viewport_array" number="100">
+
+    <enum name="MAX_VIEWPORTS" value="0x825B"/>
+    <enum name="VIEWPORT_SUBPIXEL_BITS" value="0x825C"/>
+    <enum name="VIEWPORT_BOUNDS_RANGE" value="0x825D"/>
+    <enum name="LAYER_PROVOKING_VERTEX" value="0x825E"/>
+    <enum name="VIEWPORT_INDEX_PROVOKING_VERTEX" value="0x825F"/>
+    <enum name="SCISSOR_BOX" value="0x0C10"/>
+    <enum name="VIEWPORT" value="0x0BA2"/>
+    <enum name="DEPTH_RANGE" value="0x0B70"/>
+    <enum name="SCISSOR_TEST" value="0x0C11"/>
+    <enum name="FIRST_VERTEX_CONVENTION" value="0x0C10"/>
+    <enum name="LAST_VERTEX_CONVENTION" value="0x8E4E"/>
+    <enum name="UNDEFINED_VERTEX" value="0x8E4F"/>
+    <enum name="SCISSOR_BOX" value="0x8260"/>
+
+    <function name="ViewportArrayv" offset="assign">
+        <param name="first" type="GLuint"/>
+        <param name="count" type="GLsizei"/>
+        <param name="v" type="const GLfloat *"/>
+    </function>
+    <function name="ViewportIndexedf" offset="assign">
+        <param name="index" type="GLuint"/>
+        <param name="x" type="GLfloat"/>
+        <param name="y" type="GLfloat"/>
+        <param name="w" type="GLfloat"/>
+        <param name="h" type="GLfloat"/>
+    </function>
+    <function name="ViewportIndexedfv" offset="assign">
+        <param name="index" type="GLuint"/>
+        <param name="v" type="const GLfloat *"/>
+    </function>
+    <function name="ScissorArrayv" offset="assign">
+        <param name="first" type="GLuint"/>
+        <param name="count" type="GLsizei"/>
+        <param name="v" type="const int *"/>
+    </function>
+    <function name="ScissorIndexed" offset="assign">
+        <param name="index" type="GLuint"/>
+        <param name="left" type="GLint"/>
+        <param name="bottom" type="GLint"/>
+        <param name="width" type="GLsizei"/>
+        <param name="height" type="GLsizei"/>
+    </function>
+    <function name="ScissorIndexedv" offset="assign">
+        <param name="index" type="GLuint"/>
+        <param name="v" type="const GLint *"/>
+    </function>
+    <function name="DepthRangeArrayv" offset="assign">
+        <param name="first" type="GLuint"/>
+        <param name="count" type="GLsizei"/>
+        <param name="v" type="const GLclampd *"/>
+    </function>
+    <function name="DepthRangeIndexed" offset="assign">
+        <param name="index" type="GLuint"/>
+        <param name="n" type="GLclampd"/>
+        <param name="f" type="GLclampd"/>
+    </function>
+    <function name="GetFloati_v" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="index" type="GLuint"/>
+        <param name="data" type="GLfloat *"/>
+    </function>
+    <function name="GetDoublei_v" offset="assign">
+        <param name="target" type="GLenum"/>
+        <param name="index" type="GLuint"/>
+        <param name="data" type="GLdouble *"/>
+    </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index 476d943..ba702ba 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -126,6 +126,7 @@ API_XML = \
 	ARB_texture_storage.xml \
 	ARB_vertex_array_object.xml \
 	ARB_vertex_attrib_binding.xml \
+	ARB_viewport_array.xml \
 	AMD_draw_buffers_blend.xml \
 	AMD_performance_monitor.xml \
 	ARB_vertex_type_2_10_10_10_rev.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index a2d914a..fdb3439 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -9916,7 +9916,7 @@
 </category>
 
 <!-- Extension number 99 is not listed in the extension registry. -->
-<!-- Extension number 100 is a GLU extension. -->
+<xi:include href="ARB_viewport_array.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <!-- Shouldn't this be EXT_fragment_lighting? -->
 <category name="GL_SGIX_fragment_lighting" number="102">
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 1081ff0..3efaef8 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -22,7 +22,7 @@ descriptor=[
   [ "MAX_ELEMENTS_VERTICES", "CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA" ],
   [ "MAX_ELEMENTS_INDICES", "CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA" ],
   [ "MAX_TEXTURE_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA" ],
-  [ "MAX_VIEWPORT_DIMS", "CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA" ],
+  [ "MAX_VIEWPORT_DIMS", "CONTEXT_FLOAT2(Const.MaxViewportWidth), NO_EXTRA" ],
   [ "PACK_ALIGNMENT", "CONTEXT_INT(Pack.Alignment), NO_EXTRA" ],
   [ "ALIASED_POINT_SIZE_RANGE", "CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA" ],
   [ "POLYGON_OFFSET_FACTOR", "CONTEXT_FLOAT(Polygon.OffsetFactor ), NO_EXTRA" ],
@@ -44,7 +44,7 @@ descriptor=[
   [ "SUBPIXEL_BITS", "CONTEXT_INT(Const.SubPixelBits), NO_EXTRA" ],
   [ "TEXTURE_BINDING_2D", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA" ],
   [ "UNPACK_ALIGNMENT", "CONTEXT_INT(Unpack.Alignment), NO_EXTRA" ],
-  [ "VIEWPORT", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ],
+  [ "VIEWPORT", "LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA" ],
 
 # GL_ARB_multitexture
   [ "ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
@@ -741,6 +741,13 @@ descriptor=[
 # GL_ARB_vertex_attrib_binding
   [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
   [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
+
+# GL_ARB_viewport_array
+  [ "MAX_VIEWPORTS", "CONTEXT_INT(Const.MaxViewports), extra_ARB_viewport_array" ],
+  [ "VIEWPORT_SUBPIXEL_BITS", "CONTEXT_INT(Const.ViewportSubpixelBits), extra_ARB_viewport_array" ],
+  [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), extra_ARB_viewport_array" ],
+  [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ],
+  [ "VIEWPORT_INDEX_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ],
 ]},
 
 # Enums restricted to OpenGL Core profile
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index e191923..e3d64b8 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -182,8 +182,8 @@ _mesa_ViewportIndexedfv(GLuint index, const GLfloat * v)
  */
 void
 _mesa_set_viewporti(struct gl_context *ctx, GLuint index,
-                    GLint x, GLint y,
-                    GLsizei width, GLsizei height)
+                    GLfloat x, GLfloat y,
+                    GLfloat width, GLfloat height)
 {
    /* clamp width and height to the implementation dependent range */
    width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
@@ -325,9 +325,7 @@ _mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd * v)
    }
 
    for (i = 0; i < count; i++) {
-      _mesa_set_depthrangei(ctx, i + first,
-                            (GLdouble) CLAMP(p[i].Near, 0.0, 1.0),
-                            (GLdouble) CLAMP(p[i].Far, 0.0, 1.0));
+      _mesa_set_depthrangei(ctx, i + first, p[i].Near, p[i].Far);
    }
 }
 
diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h
index 8f99e69..c0eeea0 100644
--- a/src/mesa/main/viewport.h
+++ b/src/mesa/main/viewport.h
@@ -46,8 +46,8 @@ _mesa_ViewportIndexedfv(GLuint index, const GLfloat * v);
 
 extern void 
 _mesa_set_viewporti(struct gl_context *ctx, GLuint index,
-                    GLint x, GLint y,
-                    GLsizei width, GLsizei height);
+                    GLfloat x, GLfloat y,
+                    GLfloat width, GLfloat height);
 
 extern void
 _mesa_set_depthrangei(struct gl_context *ctx, GLuint index,
-- 
1.8.1.2



More information about the mesa-dev mailing list