main: Add entry points for InvalidateNamedFramebuffer[Sub]Data.
authorLaura Ekstrand <laura@jlekstrand.net>
Wed, 4 Feb 2015 22:21:48 +0000 (14:21 -0800)
committerFredrik Höglund <fredrik@kde.org>
Thu, 14 May 2015 13:48:14 +0000 (15:48 +0200)
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mesa/main/fbobject.c
src/mesa/main/fbobject.h
src/mesa/main/tests/dispatch_sanity.cpp

index 7ee2000d86ea1904221a499a9c3df54d463458da..de7742088e15f259a635d1c5026cf49e351c8da2 100644 (file)
       <param name="layer" type="GLint" />
    </function>
 
+   <function name="InvalidateNamedFramebufferData" offset="assign">
+      <param name="framebuffer" type="GLuint" />
+      <param name="numAttachments" type="GLsizei" />
+      <param name="attachments" type="const GLenum *" />
+   </function>
+
+   <function name="InvalidateNamedFramebufferSubData" offset="assign">
+      <param name="framebuffer" type="GLuint" />
+      <param name="numAttachments" type="GLsizei" />
+      <param name="attachments" type="const GLenum *" />
+      <param name="x" type="GLint" />
+      <param name="y" type="GLint" />
+      <param name="width" type="GLsizei" />
+      <param name="height" type="GLsizei" />
+   </function>
+
    <function name="BlitNamedFramebuffer" offset="assign">
       <param name="readFramebuffer" type="GLuint" />
       <param name="drawFramebuffer" type="GLuint" />
index 4a32f1f568bbf475809993d35a1e935528105dd1..dc1e1a67321bf3509b0d4475805b8d02673bee5d 100644 (file)
@@ -3787,6 +3787,35 @@ _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
 }
 
 
+void GLAPIENTRY
+_mesa_InvalidateNamedFramebufferSubData(GLuint framebuffer,
+                                        GLsizei numAttachments,
+                                        const GLenum *attachments,
+                                        GLint x, GLint y,
+                                        GLsizei width, GLsizei height)
+{
+   struct gl_framebuffer *fb;
+   GET_CURRENT_CONTEXT(ctx);
+
+   /* The OpenGL 4.5 core spec (02.02.2015) says (in Section 17.4 Whole
+    * Framebuffer Operations, PDF page 522): "If framebuffer is zero, the
+    * default draw framebuffer is affected."
+    */
+   if (framebuffer) {
+      fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
+                                        "glInvalidateNamedFramebufferSubData");
+      if (!fb)
+         return;
+   }
+   else
+      fb = ctx->WinSysDrawBuffer;
+
+   invalidate_framebuffer_storage(ctx, fb, numAttachments, attachments,
+                                  x, y, width, height,
+                                  "glInvalidateNamedFramebufferSubData");
+}
+
+
 void GLAPIENTRY
 _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
                             const GLenum *attachments)
@@ -3821,6 +3850,46 @@ _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
 }
 
 
+void GLAPIENTRY
+_mesa_InvalidateNamedFramebufferData(GLuint framebuffer,
+                                     GLsizei numAttachments,
+                                     const GLenum *attachments)
+{
+   struct gl_framebuffer *fb;
+   GET_CURRENT_CONTEXT(ctx);
+
+   /* The OpenGL 4.5 core spec (02.02.2015) says (in Section 17.4 Whole
+    * Framebuffer Operations, PDF page 522): "If framebuffer is zero, the
+    * default draw framebuffer is affected."
+    */
+   if (framebuffer) {
+      fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
+                                        "glInvalidateNamedFramebufferData");
+      if (!fb)
+         return;
+   }
+   else
+      fb = ctx->WinSysDrawBuffer;
+
+   /* The GL_ARB_invalidate_subdata spec says:
+    *
+    *     "The command
+    *
+    *        void InvalidateFramebuffer(enum target,
+    *                                   sizei numAttachments,
+    *                                   const enum *attachments);
+    *
+    *     is equivalent to the command InvalidateSubFramebuffer with <x>, <y>,
+    *     <width>, <height> equal to 0, 0, <MAX_VIEWPORT_DIMS[0]>,
+    *     <MAX_VIEWPORT_DIMS[1]> respectively."
+    */
+   invalidate_framebuffer_storage(ctx, fb, numAttachments, attachments,
+                                  0, 0,
+                                  MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT,
+                                  "glInvalidateNamedFramebufferData");
+}
+
+
 void GLAPIENTRY
 _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
                             const GLenum *attachments)
index 7139203711988af8c3cf9f30a89fb00e1e412724..22cb139ec9aeaa18547ddf890dc6e0e6ea810c28 100644 (file)
@@ -260,10 +260,22 @@ _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
                                const GLenum *attachments, GLint x, GLint y,
                                GLsizei width, GLsizei height);
 
+extern void GLAPIENTRY
+_mesa_InvalidateNamedFramebufferSubData(GLuint framebuffer,
+                                        GLsizei numAttachments,
+                                        const GLenum *attachments,
+                                        GLint x, GLint y,
+                                        GLsizei width, GLsizei height);
+
 extern void GLAPIENTRY
 _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
                             const GLenum *attachments);
 
+extern void GLAPIENTRY
+_mesa_InvalidateNamedFramebufferData(GLuint framebuffer,
+                                     GLsizei numAttachments,
+                                     const GLenum *attachments);
+
 extern void GLAPIENTRY
 _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
                             const GLenum *attachments);
index ec3c99271625f56fd6801f49f8847187f37d5e06..e375260ff1f5c5774a577f902b48ec7f3242cd78 100644 (file)
@@ -984,6 +984,8 @@ const struct function gl_core_functions_possible[] = {
    { "glNamedFramebufferRenderbuffer", 45, -1 },
    { "glNamedFramebufferTexture", 45, -1 },
    { "glNamedFramebufferTextureLayer", 45, -1 },
+   { "glInvalidateNamedFramebufferSubData", 45, -1 },
+   { "glInvalidateNamedFramebufferData", 45, -1 },
    { "glBlitNamedFramebuffer", 45, -1 },
    { "glCheckNamedFramebufferStatus", 45, -1 },
    { "glGetNamedFramebufferAttachmentParameteriv", 45, -1 },