[Mesa-dev] [PATCH 14/20] mesa: reduce the size of gl_viewport_attrib

Marek Olšák maraeo at gmail.com
Tue Nov 21 18:01:56 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

All drivers convert these to float, so there is no reason to use double.

This makes piglit/arb_viewport_array/viewport-indices fail, because
glDepthRange accepts double and piglit expects glGetDoublei_v(GL_DEPTH_RANGE)
to return the same value, but this patch rounds it to float.

If people are OK with this, we can modify the test to allow some margin of
error to make it pass.

gl_context::ViewportArray: 512 -> 384 bytes
---
 src/mesa/drivers/common/meta.h | 2 +-
 src/mesa/main/mtypes.h         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 976cea2..b163452 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -151,21 +151,21 @@ struct save_state
    /** mask of TEXTURE_2D_BIT, etc */
    GLbitfield TexEnabled[MAX_TEXTURE_UNITS];
    GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
    GLuint EnvMode;  /* unit[0] only */
 
    /** MESA_META_VERTEX */
    struct gl_vertex_array_object *VAO;
 
    /** MESA_META_VIEWPORT */
    GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
-   GLclampd DepthNear, DepthFar;
+   GLclampf DepthNear, DepthFar;
 
    /** MESA_META_CLAMP_FRAGMENT_COLOR */
    GLenum ClampFragmentColor;
 
    /** MESA_META_CLAMP_VERTEX_COLOR */
    GLenum ClampVertexColor;
 
    /** MESA_META_CONDITIONAL_RENDER */
    struct gl_query_object *CondRenderQuery;
    GLenum CondRenderMode;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d0bb3ee..9f3df70 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1361,21 +1361,21 @@ struct gl_transform_attrib
 };
 
 
 /**
  * Viewport attribute group (GL_VIEWPORT_BIT).
  */
 struct gl_viewport_attrib
 {
    GLfloat X, Y;		/**< position */
    GLfloat Width, Height;	/**< size */
-   GLdouble Near, Far;		/**< Depth buffer range */
+   GLfloat Near, Far;		/**< Depth buffer range */
 };
 
 
 typedef enum {
    MAP_USER,
    MAP_INTERNAL,
 
    MAP_COUNT
 } gl_map_buffer_index;
 
-- 
2.7.4



More information about the mesa-dev mailing list