[Mesa-dev] [PATCH 1/3] mesa: add scaffolding for OES/EXT_primitive_bounding_box

Ilia Mirkin imirkin at alum.mit.edu
Mon May 30 18:00:19 UTC 2016


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/compiler/glsl/glsl_parser_extras.cpp |  2 ++
 src/compiler/glsl/glsl_parser_extras.h   |  4 +++
 src/mapi/glapi/gen/es_EXT.xml            | 49 ++++++++++++++++++++++++++++++++
 src/mapi/glapi/gen/gl_genexec.py         |  1 +
 src/mesa/Makefile.sources                |  2 ++
 src/mesa/main/bbox.c                     | 44 ++++++++++++++++++++++++++++
 src/mesa/main/bbox.h                     | 42 +++++++++++++++++++++++++++
 src/mesa/main/context.c                  |  2 ++
 src/mesa/main/extensions_table.h         |  2 ++
 src/mesa/main/mtypes.h                   |  1 +
 10 files changed, 149 insertions(+)
 create mode 100644 src/mesa/main/bbox.c
 create mode 100644 src/mesa/main/bbox.h

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index fc73a7e..7b2a150 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -625,6 +625,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(OES_geometry_point_size,        false, true,      OES_geometry_shader),
    EXT(OES_geometry_shader,            false, true,      OES_geometry_shader),
    EXT(OES_gpu_shader5,                false, true,      ARB_gpu_shader5),
+   EXT(OES_primitive_bounding_box,     false, true,      OES_primitive_bounding_box),
    EXT(OES_sample_variables,           false, true,      OES_sample_variables),
    EXT(OES_shader_image_atomic,        false, true,      ARB_shader_image_load_store),
    EXT(OES_shader_io_blocks,           false, true,      OES_shader_io_blocks),
@@ -645,6 +646,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(EXT_draw_buffers,               false,  true,     dummy_true),
    EXT(EXT_clip_cull_distance,         false, true,      ARB_cull_distance),
    EXT(EXT_gpu_shader5,                false, true,      ARB_gpu_shader5),
+   EXT(EXT_primitive_bounding_box,     false, true,      OES_primitive_bounding_box),
    EXT(EXT_separate_shader_objects,    false, true,      dummy_true),
    EXT(EXT_shader_integer_mix,         true,  true,      EXT_shader_integer_mix),
    EXT(EXT_shader_io_blocks,           false, true,      OES_shader_io_blocks),
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 8c43292..622a809 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -631,6 +631,8 @@ struct _mesa_glsl_parse_state {
    bool OES_geometry_shader_warn;
    bool OES_gpu_shader5_enable;
    bool OES_gpu_shader5_warn;
+   bool OES_primitive_bounding_box_enable;
+   bool OES_primitive_bounding_box_warn;
    bool OES_sample_variables_enable;
    bool OES_sample_variables_warn;
    bool OES_shader_image_atomic_enable;
@@ -668,6 +670,8 @@ struct _mesa_glsl_parse_state {
    bool EXT_draw_buffers_warn;
    bool EXT_gpu_shader5_enable;
    bool EXT_gpu_shader5_warn;
+   bool EXT_primitive_bounding_box_enable;
+   bool EXT_primitive_bounding_box_warn;
    bool EXT_separate_shader_objects_enable;
    bool EXT_separate_shader_objects_warn;
    bool EXT_shader_integer_mix_enable;
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index 6886dab..23f75c9 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -924,6 +924,21 @@
 
 </category>
 
+<category name="GL_EXT_primitive_bounding_box" number="187">
+
+    <function name="PrimitiveBoundingBoxEXT" es2="3.1" alias="PrimitiveBoundingBox">
+        <param name="minX" type="GLfloat"/>
+        <param name="minY" type="GLfloat"/>
+        <param name="minZ" type="GLfloat"/>
+        <param name="minW" type="GLfloat"/>
+        <param name="maxX" type="GLfloat"/>
+        <param name="maxY" type="GLfloat"/>
+        <param name="maxZ" type="GLfloat"/>
+        <param name="maxW" type="GLfloat"/>
+    </function>
+
+</category>
+
 <xi:include href="KHR_robustness_es.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <category name="GL_EXT_base_instance" number="203">
@@ -1079,6 +1094,21 @@
 
 </category>
 
+<category name="GL_EXT_primitive_bounding_box" number="212">
+
+    <function name="PrimitiveBoundingBoxOES" es2="3.1" alias="PrimitiveBoundingBox">
+        <param name="minX" type="GLfloat"/>
+        <param name="minY" type="GLfloat"/>
+        <param name="minZ" type="GLfloat"/>
+        <param name="minW" type="GLfloat"/>
+        <param name="maxX" type="GLfloat"/>
+        <param name="maxY" type="GLfloat"/>
+        <param name="maxZ" type="GLfloat"/>
+        <param name="maxW" type="GLfloat"/>
+    </function>
+
+</category>
+
 <category name="GL_OES_texture_buffer" number="216">
 
     <function name="TexBufferOES" es2="3.1" alias="TexBuffer">
@@ -1297,4 +1327,23 @@
 
 </category>
 
+<category name="ES3.2">
+
+    <!-- TODO: Move to GL 4.x when it is added to a GL version -->
+    <enum name="PRIMITIVE_BOUNDING_BOX_ARB" count="8" value="0x92BE">
+        <size name="Get" mode="get"/>
+    </enum>
+    <function name="PrimitiveBoundingBox" es2="3.2" desktop="false">
+        <param name="minX" type="GLfloat"/>
+        <param name="minY" type="GLfloat"/>
+        <param name="minZ" type="GLfloat"/>
+        <param name="minW" type="GLfloat"/>
+        <param name="maxX" type="GLfloat"/>
+        <param name="maxY" type="GLfloat"/>
+        <param name="maxZ" type="GLfloat"/>
+        <param name="maxW" type="GLfloat"/>
+    </function>
+
+</category>
+
 </OpenGLAPI>
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 72d7b6f..fe85e95 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -56,6 +56,7 @@ header = """/**
 #include "main/blit.h"
 #include "main/bufferobj.h"
 #include "main/arrayobj.h"
+#include "main/bbox.h"
 #include "main/buffers.h"
 #include "main/clear.h"
 #include "main/clip.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 5f7f46d..c9e55a1 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -24,6 +24,8 @@ MAIN_FILES = \
 	main/atifragshader.h \
 	main/attrib.c \
 	main/attrib.h \
+	main/bbox.c \
+	main/bbox.h \
 	main/blend.c \
 	main/blend.h \
 	main/blit.c \
diff --git a/src/mesa/main/bbox.c b/src/mesa/main/bbox.c
new file mode 100644
index 0000000..0ef5705
--- /dev/null
+++ b/src/mesa/main/bbox.c
@@ -0,0 +1,44 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2016 Ilia Mirkin.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file bbox.c
+ * glPrimitiveBoundingBox function
+ */
+
+#include "bbox.h"
+#include "context.h"
+
+void GLAPIENTRY
+_mesa_PrimitiveBoundingBox(
+      GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW,
+      GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW)
+{
+}
+
+void
+_mesa_init_bbox(struct gl_context *ctx)
+{
+}
diff --git a/src/mesa/main/bbox.h b/src/mesa/main/bbox.h
new file mode 100644
index 0000000..d00f87e
--- /dev/null
+++ b/src/mesa/main/bbox.h
@@ -0,0 +1,42 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef BBOX_H
+#define BBOX_H
+
+#include "glheader.h"
+
+struct gl_context;
+
+extern void GLAPIENTRY
+_mesa_PrimitiveBoundingBox(
+      GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW,
+      GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+
+extern void
+_mesa_init_bbox(struct gl_context *ctx);
+
+#endif
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 172c854..7700266 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -83,6 +83,7 @@
 #include "api_loopback.h"
 #include "arrayobj.h"
 #include "attrib.h"
+#include "bbox.h"
 #include "blend.h"
 #include "buffers.h"
 #include "bufferobj.h"
@@ -812,6 +813,7 @@ init_attrib_groups(struct gl_context *ctx)
    /* Attribute Groups */
    _mesa_init_accum( ctx );
    _mesa_init_attrib( ctx );
+   _mesa_init_bbox( ctx );
    _mesa_init_buffer_objects( ctx );
    _mesa_init_color( ctx );
    _mesa_init_current( ctx );
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index e3a99ec..e852835 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -221,6 +221,7 @@ EXT(EXT_pixel_buffer_object                 , EXT_pixel_buffer_object
 EXT(EXT_point_parameters                    , EXT_point_parameters                   , GLL,  x ,  x ,  x , 1997)
 EXT(EXT_polygon_offset                      , dummy_true                             , GLL,  x ,  x ,  x , 1995)
 EXT(EXT_polygon_offset_clamp                , EXT_polygon_offset_clamp               , GLL, GLC, ES1, ES2, 2014)
+EXT(EXT_primitive_bounding_box              , OES_primitive_bounding_box             ,  x ,  x ,  x ,  31, 2014)
 EXT(EXT_provoking_vertex                    , EXT_provoking_vertex                   , GLL, GLC,  x ,  x , 2009)
 EXT(EXT_read_format_bgra                    , dummy_true                             ,  x ,  x , ES1, ES2, 2009)
 EXT(EXT_rescale_normal                      , dummy_true                             , GLL,  x ,  x ,  x , 1997)
@@ -341,6 +342,7 @@ EXT(OES_mapbuffer                           , dummy_true
 EXT(OES_packed_depth_stencil                , dummy_true                             ,  x ,  x , ES1, ES2, 2007)
 EXT(OES_point_size_array                    , dummy_true                             ,  x ,  x , ES1,  x , 2004)
 EXT(OES_point_sprite                        , ARB_point_sprite                       ,  x ,  x , ES1,  x , 2004)
+EXT(OES_primitive_bounding_box              , OES_primitive_bounding_box             ,  x ,  x ,  x ,  31, 2014)
 EXT(OES_query_matrix                        , dummy_true                             ,  x ,  x , ES1,  x , 2003)
 EXT(OES_read_format                         , dummy_true                             , GLL, GLC, ES1,  x , 2003)
 EXT(OES_rgb8_rgba8                          , dummy_true                             ,  x ,  x , ES1, ES2, 2005)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c19df0e..4fd317d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3917,6 +3917,7 @@ struct gl_extensions
    GLboolean EXT_timer_query;
    GLboolean EXT_vertex_array_bgra;
    GLboolean OES_copy_image;
+   GLboolean OES_primitive_bounding_box;
    GLboolean OES_sample_variables;
    GLboolean OES_shader_io_blocks;
    GLboolean OES_standard_derivatives;
-- 
2.7.3



More information about the mesa-dev mailing list