]> git.cworth.org Git - vogl/commitdiff
- regression test now works on AMD
authorRich Geldreich <richgel99@gmail.com>
Sat, 15 Mar 2014 03:29:41 +0000 (20:29 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 1 Apr 2014 19:37:29 +0000 (12:37 -0700)
(cherry picked from commit 680e3b47a57ac959bea89e55d54925cf24c7e17c)

src/voglcommon/vogl_context_info.cpp
src/voglcommon/vogl_context_info.h
src/voglcommon/vogl_general_context_state.cpp
src/voglcommon/vogl_texture_state.cpp
src/voglcore/vogl_ktx_texture.cpp
src/vogltrace/vogl_intercept.cpp

index d5c607cd94eb0271cdf04e6304d5371c46207b3a..2632bb007febb3dd69ca41f384ebabb3bcbddb10 100644 (file)
@@ -399,15 +399,30 @@ void vogl_context_info::init_context_limits()
     VOGL_CHECK_GL_ERROR;
 
     m_max_vertex_attribs = vogl_get_gl_integer(GL_MAX_VERTEX_ATTRIBS);
     VOGL_CHECK_GL_ERROR;
 
     m_max_vertex_attribs = vogl_get_gl_integer(GL_MAX_VERTEX_ATTRIBS);
-    m_max_texture_coords = vogl_get_gl_integer(GL_MAX_TEXTURE_COORDS);
-    m_max_texture_units = vogl_get_gl_integer(GL_MAX_TEXTURE_UNITS);
+    VOGL_CHECK_GL_ERROR;
+
+    m_max_texture_coords = is_core_profile() ? 0 : vogl_get_gl_integer(GL_MAX_TEXTURE_COORDS);
+    VOGL_CHECK_GL_ERROR;
+
+    m_max_texture_units = is_core_profile() ? 0 : vogl_get_gl_integer(GL_MAX_TEXTURE_UNITS);
+    VOGL_CHECK_GL_ERROR;
+
     m_max_texture_image_units = vogl_get_gl_integer(GL_MAX_TEXTURE_IMAGE_UNITS);
     m_max_texture_image_units = vogl_get_gl_integer(GL_MAX_TEXTURE_IMAGE_UNITS);
+    VOGL_CHECK_GL_ERROR;
+
     m_max_combined_texture_coords = vogl_get_gl_integer(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
     m_max_combined_texture_coords = vogl_get_gl_integer(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+    VOGL_CHECK_GL_ERROR;
+
     m_max_draw_buffers = (get_version() >= VOGL_GL_VERSION_2_0) ? vogl_get_gl_integer(GL_MAX_DRAW_BUFFERS) : 0;
     m_max_draw_buffers = (get_version() >= VOGL_GL_VERSION_2_0) ? vogl_get_gl_integer(GL_MAX_DRAW_BUFFERS) : 0;
+    VOGL_CHECK_GL_ERROR;
+
     m_max_lights = is_core_profile() ? 0 : vogl_get_gl_integer(GL_MAX_LIGHTS);
     m_max_lights = is_core_profile() ? 0 : vogl_get_gl_integer(GL_MAX_LIGHTS);
+    VOGL_CHECK_GL_ERROR;
+
     m_max_uniform_buffer_bindings = vogl_get_gl_integer(GL_MAX_UNIFORM_BUFFER_BINDINGS);
     m_max_uniform_buffer_bindings = vogl_get_gl_integer(GL_MAX_UNIFORM_BUFFER_BINDINGS);
-    m_max_transform_feedback_separate_attribs = (get_version() >= VOGL_GL_VERSION_3_0) ? vogl_get_gl_integer(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS) : 0;
+    VOGL_CHECK_GL_ERROR;
 
 
+    m_max_transform_feedback_separate_attribs = (get_version() >= VOGL_GL_VERSION_3_0) ? vogl_get_gl_integer(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS) : 0;
     VOGL_CHECK_GL_ERROR;
 
     if (!is_core_profile() && supports_extension("GL_ARB_vertex_program") && GL_ENTRYPOINT(glGetProgramivARB))
     VOGL_CHECK_GL_ERROR;
 
     if (!is_core_profile() && supports_extension("GL_ARB_vertex_program") && GL_ENTRYPOINT(glGetProgramivARB))
index fabad658a3118131c754f163688d7583c39ae522..95525e8205b7e33287cdd3984e80f928c56b0091 100644 (file)
@@ -335,10 +335,13 @@ public:
     {
         return m_max_vertex_attribs;
     }
     {
         return m_max_vertex_attribs;
     }
+
+    // compat only - will be 0 in core
     uint get_max_texture_coords() const
     {
         return m_max_texture_coords;
     }
     uint get_max_texture_coords() const
     {
         return m_max_texture_coords;
     }
+    // compat only - will be 0 in core
     uint get_max_texture_units() const
     {
         return m_max_texture_units;
     uint get_max_texture_units() const
     {
         return m_max_texture_units;
index a6637daf3350dec7252d8f4f3f231bd80ecda3e5..ef3db73a4716964dee083e4cbf8c06ab360c7230 100644 (file)
@@ -278,10 +278,13 @@ public:
         m_can_use_glGetPointerv = (GL_ENTRYPOINT(glGetPointerv) != NULL) && !context_info.is_core_profile();
 
         m_max_texture_units = 0;
         m_can_use_glGetPointerv = (GL_ENTRYPOINT(glGetPointerv) != NULL) && !context_info.is_core_profile();
 
         m_max_texture_units = 0;
-        GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_TEXTURE_UNITS, &m_max_texture_units);
-
         m_max_texture_coords = 0;
         m_max_texture_coords = 0;
-        GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_TEXTURE_COORDS, &m_max_texture_coords);
+
+        if (!context_info.is_core_profile())
+        {
+            GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_TEXTURE_UNITS, &m_max_texture_units);
+            GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_TEXTURE_COORDS, &m_max_texture_coords);
+        }
 
         m_max_combined_texture_coords = 0;
         GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &m_max_combined_texture_coords);
 
         m_max_combined_texture_coords = 0;
         GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &m_max_combined_texture_coords);
@@ -294,6 +297,8 @@ public:
 
         m_max_vertex_attribs = 0;
         GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_VERTEX_ATTRIBS, &m_max_vertex_attribs);
 
         m_max_vertex_attribs = 0;
         GL_ENTRYPOINT(glGetIntegerv)(GL_MAX_VERTEX_ATTRIBS, &m_max_vertex_attribs);
+
+        VOGL_CHECK_GL_ERROR;
     }
 
     bool m_can_use_glGetBooleani_v;
     }
 
     bool m_can_use_glGetBooleani_v;
@@ -941,7 +946,10 @@ bool vogl_general_context_state::restore(const vogl_context_info &context_info,
 #endif
 
     GLint prev_client_active_texture = 0;
 #endif
 
     GLint prev_client_active_texture = 0;
-    GL_ENTRYPOINT(glGetIntegerv)(GL_CLIENT_ACTIVE_TEXTURE, &prev_client_active_texture);
+    if (!context_info.is_core_profile())
+    {
+        GL_ENTRYPOINT(glGetIntegerv)(GL_CLIENT_ACTIVE_TEXTURE, &prev_client_active_texture);
+    }
 
     GLint prev_active_texture = 0;
     GL_ENTRYPOINT(glGetIntegerv)(GL_ACTIVE_TEXTURE, &prev_active_texture);
 
     GLint prev_active_texture = 0;
     GL_ENTRYPOINT(glGetIntegerv)(GL_ACTIVE_TEXTURE, &prev_active_texture);
index fbf84d1832c8e0ba4126f8bd89c1e4f7e7a50429..b3b536394b859e8e06d9803a1364cb1eb7b94218 100644 (file)
@@ -381,6 +381,22 @@ bool vogl_texture_state::snapshot(const vogl_context_info &context_info, vogl_ha
     GLenum image_fmt = pInternal_tex_fmt->m_optimum_get_image_fmt;
     GLenum image_type = pInternal_tex_fmt->m_optimum_get_image_type;
 
     GLenum image_fmt = pInternal_tex_fmt->m_optimum_get_image_fmt;
     GLenum image_type = pInternal_tex_fmt->m_optimum_get_image_type;
 
+#if 0
+    // OK, I can't retrive the default framebuffer's depth/stencil buffer on AMD - all I get is INVALID_OPERATION. Crap. This works fine on NV though.
+    // This workaround didn't work.
+    if (internal_fmt == GL_DEPTH_STENCIL)
+    {
+        if (GL_ENTRYPOINT(glGetInternalformativ) && context_info.supports_extension("GL_ARB_internalformat_query"))
+        {
+            GL_ENTRYPOINT(glGetInternalformativ)(GL_TEXTURE_2D, internal_fmt, GL_GET_TEXTURE_IMAGE_FORMAT, sizeof(image_fmt), (GLint *)&image_fmt);
+            VOGL_CHECK_GL_ERROR;
+
+            GL_ENTRYPOINT(glGetInternalformativ)(GL_TEXTURE_2D, internal_fmt, GL_GET_TEXTURE_IMAGE_TYPE, sizeof(image_type), (GLint *)&image_type);
+            VOGL_CHECK_GL_ERROR;
+        }
+    }
+#endif
+
     uint num_faces = 1;
 
     GLenum ktx_image_fmt = GL_NONE, ktx_image_type = GL_NONE;
     uint num_faces = 1;
 
     GLenum ktx_image_fmt = GL_NONE, ktx_image_type = GL_NONE;
@@ -768,7 +784,7 @@ bool vogl_texture_state::snapshot(const vogl_context_info &context_info, vogl_ha
                 {
                     VOGL_ASSERT(!size_in_bytes);
 
                 {
                     VOGL_ASSERT(!size_in_bytes);
 
-                    size_t size_in_bytes64 = vogl_get_image_size(pInternal_tex_fmt->m_optimum_get_image_fmt, pInternal_tex_fmt->m_optimum_get_image_type, level_width, level_height, level_depth);
+                    size_t size_in_bytes64 = vogl_get_image_size(image_fmt, image_type, level_width, level_height, level_depth);
                     if (!size_in_bytes64)
                     {
                         vogl_error_printf("%s: Failed computing image size of face %u level %u, texture %" PRIu64 " target %s\n", VOGL_METHOD_NAME, face, level, (uint64_t)handle, g_gl_enums.find_gl_name(m_target));
                     if (!size_in_bytes64)
                     {
                         vogl_error_printf("%s: Failed computing image size of face %u level %u, texture %" PRIu64 " target %s\n", VOGL_METHOD_NAME, face, level, (uint64_t)handle, g_gl_enums.find_gl_name(m_target));
@@ -827,7 +843,7 @@ bool vogl_texture_state::snapshot(const vogl_context_info &context_info, vogl_ha
                     }
                     else
                     {
                     }
                     else
                     {
-                        GL_ENTRYPOINT(glGetTexImage)(get_target, level, pInternal_tex_fmt->m_optimum_get_image_fmt, pInternal_tex_fmt->m_optimum_get_image_type, temp_img.get_ptr());
+                        GL_ENTRYPOINT(glGetTexImage)(get_target, level, image_fmt, image_type, temp_img.get_ptr());
                     }
 
                     if (vogl_check_gl_error())
                     }
 
                     if (vogl_check_gl_error())
index 8e753d2e6b84158e336cfb31590ab3846a16d6c1..037e2e4ad8206b01812dacaa1d0c94ac98fa7b29 100644 (file)
@@ -962,12 +962,14 @@ namespace vogl
         if ((get_num_faces() == 6) && ((m_header.m_pixelDepth) || (!m_header.m_pixelHeight)))
             return false;
 
         if ((get_num_faces() == 6) && ((m_header.m_pixelDepth) || (!m_header.m_pixelHeight)))
             return false;
 
+#if 0
         if (m_header.m_numberOfMipmapLevels)
         {
             const uint max_mipmap_dimension = 1U << (m_header.m_numberOfMipmapLevels - 1U);
             if (max_mipmap_dimension > (VOGL_MAX(VOGL_MAX(m_header.m_pixelWidth, m_header.m_pixelHeight), m_header.m_pixelDepth)))
                 return false;
         }
         if (m_header.m_numberOfMipmapLevels)
         {
             const uint max_mipmap_dimension = 1U << (m_header.m_numberOfMipmapLevels - 1U);
             if (max_mipmap_dimension > (VOGL_MAX(VOGL_MAX(m_header.m_pixelWidth, m_header.m_pixelHeight), m_header.m_pixelDepth)))
                 return false;
         }
+#endif
 
         return true;
     }
 
         return true;
     }
index 51f01654f60d073be2ced3bb19a0fd6e22245170..e8c81210e1bb57d2bdd40c10dbb3cdd0a8708b40 100644 (file)
@@ -1243,6 +1243,8 @@ public:
     {
         return m_context_info.get_max_texture_coords();
     }
     {
         return m_context_info.get_max_texture_coords();
     }
+
+    // compat only - will be 0 in core
     inline GLuint get_max_texture_units() const
     {
         return m_context_info.get_max_texture_units();
     inline GLuint get_max_texture_units() const
     {
         return m_context_info.get_max_texture_units();