[Mesa-dev] [PATCH 10/38] main: Add entry points for glNamedFramebufferTexture[Layer].

Laura Ekstrand laura at jlekstrand.net
Tue Mar 3 17:32:02 PST 2015


---
 src/mapi/glapi/gen/ARB_direct_state_access.xml | 15 +++++++
 src/mesa/main/fbobject.c                       | 62 ++++++++++++++++++++++++++
 src/mesa/main/fbobject.h                       |  8 ++++
 src/mesa/main/tests/dispatch_sanity.cpp        |  2 +
 4 files changed, 87 insertions(+)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index b954343..19d029d 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -125,6 +125,21 @@
       <param name="renderbuffer" type="GLuint" />
    </function>
 
+   <function name="NamedFramebufferTexture" offset="assign">
+      <param name="framebuffer" type="GLuint" />
+      <param name="attachment" type="GLenum" />
+      <param name="texture" type="GLuint" />
+      <param name="level" type="GLint" />
+   </function>
+
+   <function name="NamedFramebufferTextureLayer" offset="assign">
+      <param name="framebuffer" type="GLuint" />
+      <param name="attachment" type="GLenum" />
+      <param name="texture" type="GLuint" />
+      <param name="level" type="GLint" />
+      <param name="layer" type="GLint" />
+   </function>
+
    <!-- Texture object functions -->
 
    <function name="CreateTextures" offset="assign">
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 2ac9903..f634aed 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2832,6 +2832,35 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
                              layer, layered, "glFramebufferTextureLayer");
 }
 
+void GLAPIENTRY
+_mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment,
+                                   GLuint texture, GLint level, GLint layer)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_framebuffer *fb;
+   struct gl_texture_object *texObj;
+   GLboolean layered = GL_FALSE;
+
+   /* Get the framebuffer object */
+   fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
+                                     "glNamedFramebufferTextureLayer");
+   if (!fb)
+      return;
+
+   /* Get the texture object */
+   if (!get_texture_for_framebuffer(ctx, texture, 0, level, layer,
+                                    &layered,
+                                    "glNamedFramebufferTextureLayer",
+                                    &texObj)) {
+      /* Error already recorded */
+      return;
+   }
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level,
+                             layer, layered,
+                             "glNamedFramebufferTextureLayer");
+}
+
 
 void GLAPIENTRY
 _mesa_FramebufferTexture(GLenum target, GLenum attachment,
@@ -2869,6 +2898,39 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment,
                              0, layered, "glFramebufferTexture");
 }
 
+void GLAPIENTRY
+_mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
+                              GLuint texture, GLint level)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_framebuffer *fb;
+   struct gl_texture_object *texObj;
+   GLboolean layered = GL_TRUE;
+
+   if (!_mesa_has_geometry_shaders(ctx)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "unsupported function (glNamedFramebufferTexture) called");
+      return;
+   }
+
+   /* Get the framebuffer object */
+   fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
+                                     "glNamedFramebufferTexture");
+   if (!fb)
+      return;
+
+   /* Get the texture object */
+   if (!get_texture_for_framebuffer(ctx, texture, 0, level, 0,
+                                    &layered, "glNamedFramebufferTexture",
+                                    &texObj)) {
+      /* Error already recorded */
+      return;
+   }
+
+   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level,
+                             0, layered, "glNamedFramebufferTexture");
+}
+
 
 void
 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 4304215..7487f02 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -197,10 +197,18 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
                                  GLuint texture, GLint level, GLint layer);
 
 extern void GLAPIENTRY
+_mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment,
+                                   GLuint texture, GLint level, GLint layer);
+
+extern void GLAPIENTRY
 _mesa_FramebufferTexture(GLenum target, GLenum attachment,
                          GLuint texture, GLint level);
 
 extern void GLAPIENTRY
+_mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
+                              GLuint texture, GLint level);
+
+extern void GLAPIENTRY
 _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
                                  GLenum renderbuffertarget,
                                  GLuint renderbuffer);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index c370a80..d72a04c 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -972,6 +972,8 @@ const struct function gl_core_functions_possible[] = {
    { "glGetNamedBufferSubData", 45, -1 },
    { "glCreateFramebuffers", 45, -1 },
    { "glNamedFramebufferRenderbuffer", 45, -1 },
+   { "glNamedFramebufferTexture", 45, -1 },
+   { "glNamedFramebufferTextureLayer", 45, -1 },
    { "glCreateTextures", 45, -1 },
    { "glTextureStorage1D", 45, -1 },
    { "glTextureStorage2D", 45, -1 },
-- 
2.1.0



More information about the mesa-dev mailing list