mesa: enable ARB_direct_state_access in compat for GL3.1+
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 29 Aug 2018 02:40:12 +0000 (12:40 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 29 Aug 2018 21:57:38 +0000 (07:57 +1000)
We could enable it for lower versions of GL but this allows us
to just use the existing version/extension checks that are already
used by the core profile.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mapi/glapi/gen/apiexec.py
src/mesa/main/arrayobj.c
src/mesa/main/extensions_table.h
src/mesa/main/fbobject.c

index b163d88549ba937c29bb2833200e25a4676ed923..e2fc124be22aab544f55b284f5c92e3e641bbef4 100644 (file)
@@ -152,103 +152,103 @@ functions = {
 
     # OpenGL 4.5 / GL_ARB_direct_state_access.   Mesa can expose the extension
     # with core profile.
-    "CreateTransformFeedbacks": exec_info(compatibility=45, core=31),
-    "TransformFeedbackBufferBase": exec_info(compatibility=45, core=31),
-    "TransformFeedbackBufferRange": exec_info(compatibility=45, core=31),
-    "GetTransformFeedbackiv": exec_info(compatibility=45, core=31),
-    "GetTransformFeedbacki_v": exec_info(compatibility=45, core=31),
-    "GetTransformFeedbacki64_v": exec_info(compatibility=45, core=31),
-    "CreateBuffers": exec_info(compatibility=45, core=31),
-    "NamedBufferStorage": exec_info(compatibility=45, core=31),
-    "NamedBufferData": exec_info(compatibility=45, core=31),
-    "NamedBufferSubData": exec_info(compatibility=45, core=31),
-    "CopyNamedBufferSubData": exec_info(compatibility=45, core=31),
-    "ClearNamedBufferData": exec_info(compatibility=45, core=31),
-    "ClearNamedBufferSubData": exec_info(compatibility=45, core=31),
-    "MapNamedBuffer": exec_info(compatibility=45, core=31),
-    "MapNamedBufferRange": exec_info(compatibility=45, core=31),
-    "UnmapNamedBuffer": exec_info(compatibility=45, core=31),
-    "FlushMappedNamedBufferRange": exec_info(compatibility=45, core=31),
-    "GetNamedBufferParameteriv": exec_info(compatibility=45, core=31),
-    "GetNamedBufferParameteri64v": exec_info(compatibility=45, core=31),
-    "GetNamedBufferPointerv": exec_info(compatibility=45, core=31),
-    "GetNamedBufferSubData": exec_info(compatibility=45, core=31),
-    "CreateFramebuffers": exec_info(compatibility=45, core=31),
-    "NamedFramebufferRenderbuffer": exec_info(compatibility=45, core=31),
-    "NamedFramebufferParameteri": exec_info(compatibility=45, core=31),
-    "NamedFramebufferTexture": exec_info(compatibility=45, core=31),
-    "NamedFramebufferTextureLayer": exec_info(compatibility=45, core=31),
-    "NamedFramebufferDrawBuffer": exec_info(compatibility=45, core=31),
-    "NamedFramebufferDrawBuffers": exec_info(compatibility=45, core=31),
-    "NamedFramebufferReadBuffer": exec_info(compatibility=45, core=31),
-    "InvalidateNamedFramebufferData": exec_info(compatibility=45, core=31),
-    "InvalidateNamedFramebufferSubData": exec_info(compatibility=45, core=31),
-    "ClearNamedFramebufferiv": exec_info(compatibility=45, core=31),
-    "ClearNamedFramebufferuiv": exec_info(compatibility=45, core=31),
-    "ClearNamedFramebufferfv": exec_info(compatibility=45, core=31),
-    "ClearNamedFramebufferfi": exec_info(compatibility=45, core=31),
-    "BlitNamedFramebuffer": exec_info(compatibility=45, core=31),
-    "CheckNamedFramebufferStatus": exec_info(compatibility=45, core=31),
-    "GetNamedFramebufferParameteriv": exec_info(compatibility=45, core=31),
-    "GetNamedFramebufferAttachmentParameteriv": exec_info(compatibility=45, core=31),
-    "CreateRenderbuffers": exec_info(compatibility=45, core=31),
-    "NamedRenderbufferStorage": exec_info(compatibility=45, core=31),
-    "NamedRenderbufferStorageMultisample": exec_info(compatibility=45, core=31),
-    "GetNamedRenderbufferParameteriv": exec_info(compatibility=45, core=31),
-    "CreateTextures": exec_info(compatibility=45, core=31),
-    "TextureBuffer": exec_info(compatibility=45, core=31),
-    "TextureBufferRange": exec_info(compatibility=45, core=31),
-    "TextureStorage1D": exec_info(compatibility=45, core=31),
-    "TextureStorage2D": exec_info(compatibility=45, core=31),
-    "TextureStorage3D": exec_info(compatibility=45, core=31),
-    "TextureStorage2DMultisample": exec_info(compatibility=45, core=31),
-    "TextureStorage3DMultisample": exec_info(compatibility=45, core=31),
-    "TextureSubImage1D": exec_info(compatibility=45, core=31),
-    "TextureSubImage2D": exec_info(compatibility=45, core=31),
-    "TextureSubImage3D": exec_info(compatibility=45, core=31),
-    "CompressedTextureSubImage1D": exec_info(compatibility=45, core=31),
-    "CompressedTextureSubImage2D": exec_info(compatibility=45, core=31),
-    "CompressedTextureSubImage3D": exec_info(compatibility=45, core=31),
-    "CopyTextureSubImage1D": exec_info(compatibility=45, core=31),
-    "CopyTextureSubImage2D": exec_info(compatibility=45, core=31),
-    "CopyTextureSubImage3D": exec_info(compatibility=45, core=31),
-    "TextureParameterf": exec_info(compatibility=45, core=31),
-    "TextureParameterfv": exec_info(compatibility=45, core=31),
-    "TextureParameteri": exec_info(compatibility=45, core=31),
-    "TextureParameterIiv": exec_info(compatibility=45, core=31),
-    "TextureParameterIuiv": exec_info(compatibility=45, core=31),
-    "TextureParameteriv": exec_info(compatibility=45, core=31),
-    "GenerateTextureMipmap": exec_info(compatibility=45, core=31),
-    "BindTextureUnit": exec_info(compatibility=45, core=31),
-    "GetTextureImage": exec_info(compatibility=45, core=31),
-    "GetCompressedTextureImage": exec_info(compatibility=45, core=31),
-    "GetTextureLevelParameterfv": exec_info(compatibility=45, core=31),
-    "GetTextureLevelParameteriv": exec_info(compatibility=45, core=31),
-    "GetTextureParameterfv": exec_info(compatibility=45, core=31),
-    "GetTextureParameterIiv": exec_info(compatibility=45, core=31),
-    "GetTextureParameterIuiv": exec_info(compatibility=45, core=31),
-    "GetTextureParameteriv": exec_info(compatibility=45, core=31),
-    "CreateVertexArrays": exec_info(compatibility=45, core=31),
-    "DisableVertexArrayAttrib": exec_info(compatibility=45, core=31),
-    "EnableVertexArrayAttrib": exec_info(compatibility=45, core=31),
-    "VertexArrayElementBuffer": exec_info(compatibility=45, core=31),
-    "VertexArrayVertexBuffer": exec_info(compatibility=45, core=31),
-    "VertexArrayVertexBuffers": exec_info(compatibility=45, core=31),
-    "VertexArrayAttribFormat": exec_info(compatibility=45, core=31),
-    "VertexArrayAttribIFormat": exec_info(compatibility=45, core=31),
-    "VertexArrayAttribLFormat": exec_info(compatibility=45, core=31),
-    "VertexArrayAttribBinding": exec_info(compatibility=45, core=31),
-    "VertexArrayBindingDivisor": exec_info(compatibility=45, core=31),
-    "GetVertexArrayiv": exec_info(compatibility=45, core=31),
-    "GetVertexArrayIndexediv": exec_info(compatibility=45, core=31),
-    "GetVertexArrayIndexed64iv": exec_info(compatibility=45, core=31),
-    "CreateSamplers": exec_info(compatibility=45, core=31),
-    "CreateProgramPipelines": exec_info(compatibility=45, core=31),
-    "CreateQueries": exec_info(compatibility=45, core=31),
-    "GetQueryBufferObjectiv": exec_info(compatibility=45, core=31),
-    "GetQueryBufferObjectuiv": exec_info(compatibility=45, core=31),
-    "GetQueryBufferObjecti64v": exec_info(compatibility=45, core=31),
-    "GetQueryBufferObjectui64v": exec_info(compatibility=45, core=31),
+    "CreateTransformFeedbacks": exec_info(compatibility=31, core=31),
+    "TransformFeedbackBufferBase": exec_info(compatibility=31, core=31),
+    "TransformFeedbackBufferRange": exec_info(compatibility=31, core=31),
+    "GetTransformFeedbackiv": exec_info(compatibility=31, core=31),
+    "GetTransformFeedbacki_v": exec_info(compatibility=31, core=31),
+    "GetTransformFeedbacki64_v": exec_info(compatibility=31, core=31),
+    "CreateBuffers": exec_info(compatibility=31, core=31),
+    "NamedBufferStorage": exec_info(compatibility=31, core=31),
+    "NamedBufferData": exec_info(compatibility=31, core=31),
+    "NamedBufferSubData": exec_info(compatibility=31, core=31),
+    "CopyNamedBufferSubData": exec_info(compatibility=31, core=31),
+    "ClearNamedBufferData": exec_info(compatibility=31, core=31),
+    "ClearNamedBufferSubData": exec_info(compatibility=31, core=31),
+    "MapNamedBuffer": exec_info(compatibility=31, core=31),
+    "MapNamedBufferRange": exec_info(compatibility=31, core=31),
+    "UnmapNamedBuffer": exec_info(compatibility=31, core=31),
+    "FlushMappedNamedBufferRange": exec_info(compatibility=31, core=31),
+    "GetNamedBufferParameteriv": exec_info(compatibility=31, core=31),
+    "GetNamedBufferParameteri64v": exec_info(compatibility=31, core=31),
+    "GetNamedBufferPointerv": exec_info(compatibility=31, core=31),
+    "GetNamedBufferSubData": exec_info(compatibility=31, core=31),
+    "CreateFramebuffers": exec_info(compatibility=31, core=31),
+    "NamedFramebufferRenderbuffer": exec_info(compatibility=31, core=31),
+    "NamedFramebufferParameteri": exec_info(compatibility=31, core=31),
+    "NamedFramebufferTexture": exec_info(compatibility=31, core=31),
+    "NamedFramebufferTextureLayer": exec_info(compatibility=31, core=31),
+    "NamedFramebufferDrawBuffer": exec_info(compatibility=31, core=31),
+    "NamedFramebufferDrawBuffers": exec_info(compatibility=31, core=31),
+    "NamedFramebufferReadBuffer": exec_info(compatibility=31, core=31),
+    "InvalidateNamedFramebufferData": exec_info(compatibility=31, core=31),
+    "InvalidateNamedFramebufferSubData": exec_info(compatibility=31, core=31),
+    "ClearNamedFramebufferiv": exec_info(compatibility=31, core=31),
+    "ClearNamedFramebufferuiv": exec_info(compatibility=31, core=31),
+    "ClearNamedFramebufferfv": exec_info(compatibility=31, core=31),
+    "ClearNamedFramebufferfi": exec_info(compatibility=31, core=31),
+    "BlitNamedFramebuffer": exec_info(compatibility=31, core=31),
+    "CheckNamedFramebufferStatus": exec_info(compatibility=31, core=31),
+    "GetNamedFramebufferParameteriv": exec_info(compatibility=31, core=31),
+    "GetNamedFramebufferAttachmentParameteriv": exec_info(compatibility=31, core=31),
+    "CreateRenderbuffers": exec_info(compatibility=31, core=31),
+    "NamedRenderbufferStorage": exec_info(compatibility=31, core=31),
+    "NamedRenderbufferStorageMultisample": exec_info(compatibility=31, core=31),
+    "GetNamedRenderbufferParameteriv": exec_info(compatibility=31, core=31),
+    "CreateTextures": exec_info(compatibility=31, core=31),
+    "TextureBuffer": exec_info(compatibility=31, core=31),
+    "TextureBufferRange": exec_info(compatibility=31, core=31),
+    "TextureStorage1D": exec_info(compatibility=31, core=31),
+    "TextureStorage2D": exec_info(compatibility=31, core=31),
+    "TextureStorage3D": exec_info(compatibility=31, core=31),
+    "TextureStorage2DMultisample": exec_info(compatibility=31, core=31),
+    "TextureStorage3DMultisample": exec_info(compatibility=31, core=31),
+    "TextureSubImage1D": exec_info(compatibility=31, core=31),
+    "TextureSubImage2D": exec_info(compatibility=31, core=31),
+    "TextureSubImage3D": exec_info(compatibility=31, core=31),
+    "CompressedTextureSubImage1D": exec_info(compatibility=31, core=31),
+    "CompressedTextureSubImage2D": exec_info(compatibility=31, core=31),
+    "CompressedTextureSubImage3D": exec_info(compatibility=31, core=31),
+    "CopyTextureSubImage1D": exec_info(compatibility=31, core=31),
+    "CopyTextureSubImage2D": exec_info(compatibility=31, core=31),
+    "CopyTextureSubImage3D": exec_info(compatibility=31, core=31),
+    "TextureParameterf": exec_info(compatibility=31, core=31),
+    "TextureParameterfv": exec_info(compatibility=31, core=31),
+    "TextureParameteri": exec_info(compatibility=31, core=31),
+    "TextureParameterIiv": exec_info(compatibility=31, core=31),
+    "TextureParameterIuiv": exec_info(compatibility=31, core=31),
+    "TextureParameteriv": exec_info(compatibility=31, core=31),
+    "GenerateTextureMipmap": exec_info(compatibility=31, core=31),
+    "BindTextureUnit": exec_info(compatibility=31, core=31),
+    "GetTextureImage": exec_info(compatibility=31, core=31),
+    "GetCompressedTextureImage": exec_info(compatibility=31, core=31),
+    "GetTextureLevelParameterfv": exec_info(compatibility=31, core=31),
+    "GetTextureLevelParameteriv": exec_info(compatibility=31, core=31),
+    "GetTextureParameterfv": exec_info(compatibility=31, core=31),
+    "GetTextureParameterIiv": exec_info(compatibility=31, core=31),
+    "GetTextureParameterIuiv": exec_info(compatibility=31, core=31),
+    "GetTextureParameteriv": exec_info(compatibility=31, core=31),
+    "CreateVertexArrays": exec_info(compatibility=31, core=31),
+    "DisableVertexArrayAttrib": exec_info(compatibility=31, core=31),
+    "EnableVertexArrayAttrib": exec_info(compatibility=31, core=31),
+    "VertexArrayElementBuffer": exec_info(compatibility=31, core=31),
+    "VertexArrayVertexBuffer": exec_info(compatibility=31, core=31),
+    "VertexArrayVertexBuffers": exec_info(compatibility=31, core=31),
+    "VertexArrayAttribFormat": exec_info(compatibility=31, core=31),
+    "VertexArrayAttribIFormat": exec_info(compatibility=31, core=31),
+    "VertexArrayAttribLFormat": exec_info(compatibility=31, core=31),
+    "VertexArrayAttribBinding": exec_info(compatibility=31, core=31),
+    "VertexArrayBindingDivisor": exec_info(compatibility=31, core=31),
+    "GetVertexArrayiv": exec_info(compatibility=31, core=31),
+    "GetVertexArrayIndexediv": exec_info(compatibility=31, core=31),
+    "GetVertexArrayIndexed64iv": exec_info(compatibility=31, core=31),
+    "CreateSamplers": exec_info(compatibility=31, core=31),
+    "CreateProgramPipelines": exec_info(compatibility=31, core=31),
+    "CreateQueries": exec_info(compatibility=31, core=31),
+    "GetQueryBufferObjectiv": exec_info(compatibility=31, core=31),
+    "GetQueryBufferObjectuiv": exec_info(compatibility=31, core=31),
+    "GetQueryBufferObjecti64v": exec_info(compatibility=31, core=31),
+    "GetQueryBufferObjectui64v": exec_info(compatibility=31, core=31),
 
     # GL_ARB_gpu_shader_int64 - nominally requires OpenGL 4.0, and Mesa
     # only supports 4.0 in core profile.
index 5ee68cf9e94986bad404911de2309dd51562ee0a..a23031fe182637450c56dad273120f7caaaad079 100644 (file)
@@ -196,7 +196,16 @@ _mesa_vao_attribute_map[ATTRIBUTE_MAP_MODE_MAX][VERT_ATTRIB_MAX] =
 struct gl_vertex_array_object *
 _mesa_lookup_vao(struct gl_context *ctx, GLuint id)
 {
+   /* The ARB_direct_state_access specification says:
+    *
+    *    "<vaobj> is [compatibility profile:
+    *     zero, indicating the default vertex array object, or]
+    *     the name of the vertex array object."
+    */
    if (id == 0) {
+      if (ctx->API == API_OPENGL_COMPAT)
+         return ctx->Array.DefaultVAO;
+
       return NULL;
    } else {
       struct gl_vertex_array_object *vao;
index 013756455fde71c0d68fe1667d7aa0e8ec8b2763..3c8f126c368d8a51aad56450ba15d0dc2071886e 100644 (file)
@@ -59,7 +59,7 @@ EXT(ARB_depth_buffer_float                  , ARB_depth_buffer_float
 EXT(ARB_depth_clamp                         , ARB_depth_clamp                        , GLL, GLC,  x ,  x , 2003)
 EXT(ARB_depth_texture                       , ARB_depth_texture                      , GLL,  x ,  x ,  x , 2001)
 EXT(ARB_derivative_control                  , ARB_derivative_control                 , GLL, GLC,  x ,  x , 2014)
-EXT(ARB_direct_state_access                 , dummy_true                             ,  45, GLC,  x ,  x , 2014)
+EXT(ARB_direct_state_access                 , dummy_true                             ,  31, GLC,  x ,  x , 2014)
 EXT(ARB_draw_buffers                        , dummy_true                             , GLL, GLC,  x ,  x , 2002)
 EXT(ARB_draw_buffers_blend                  , ARB_draw_buffers_blend                 , GLL, GLC,  x ,  x , 2009)
 EXT(ARB_draw_elements_base_vertex           , ARB_draw_elements_base_vertex          , GLL, GLC,  x ,  x , 2009)
index 284990d7d003f29043caffe6ca08a26546b4ea83..51e137dce9b1bcfbc118d2bb44540da92bc6c8cb 100644 (file)
@@ -3292,13 +3292,14 @@ check_texture_target(struct gl_context *ctx, GLenum target,
    case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
       return true;
    case GL_TEXTURE_CUBE_MAP:
-      /* We don't need to check the extension (GL_ARB_direct_state_access) or
-       * GL version (4.5) for GL_TEXTURE_CUBE_MAP because DSA is always
-       * enabled in core profile.  This can be called from
-       * _mesa_FramebufferTextureLayer in compatibility profile (OpenGL 3.0),
-       * so we do have to check the profile.
+      /* GL_TEXTURE_CUBE_MAP is only allowed by OpenGL 4.5 here, which
+       * includes the DSA API.
+       *
+       * Because DSA is only enabled for GL 3.1+ and this can be called
+       * from _mesa_FramebufferTextureLayer in compatibility profile,
+       * we need to check the version.
        */
-      return ctx->API == API_OPENGL_CORE;
+      return _mesa_is_desktop_gl(ctx) && ctx->Version >= 31;
    }
 
    _mesa_error(ctx, GL_INVALID_OPERATION,