mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
main: Add glCreateFramebuffers.
[Fredrik: Whitespace fixes] Reviewed-by: Fredrik Höglund <fredrik@kde.org> Signed-off-by: Fredrik Höglund <fredrik@kde.org>
This commit is contained in:
parent
6d8eff4af7
commit
f868de7d6b
4 changed files with 48 additions and 5 deletions
|
|
@ -152,6 +152,13 @@
|
|||
<param name="data" type="GLvoid *" />
|
||||
</function>
|
||||
|
||||
<!-- Framebuffer object functions -->
|
||||
|
||||
<function name="CreateFramebuffers" offset="assign">
|
||||
<param name="n" type="GLsizei" />
|
||||
<param name="framebuffers" type="GLuint *" />
|
||||
</function>
|
||||
|
||||
<!-- Renderbuffer object functions -->
|
||||
|
||||
<function name="CreateRenderbuffers" offset="assign">
|
||||
|
|
|
|||
|
|
@ -2417,15 +2417,23 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
|
|||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
/**
|
||||
* This is the implementation for glGenFramebuffers and glCreateFramebuffers.
|
||||
* It is not exposed to the rest of Mesa to encourage the use of
|
||||
* nameless buffers in driver internals.
|
||||
*/
|
||||
static void
|
||||
create_framebuffers(GLsizei n, GLuint *framebuffers, bool dsa)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint first;
|
||||
GLint i;
|
||||
struct gl_framebuffer *fb;
|
||||
|
||||
const char *func = dsa ? "glCreateFramebuffers" : "glGenFramebuffers";
|
||||
|
||||
if (n < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGenFramebuffersEXT(n)");
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2437,14 +2445,38 @@ _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
|
|||
for (i = 0; i < n; i++) {
|
||||
GLuint name = first + i;
|
||||
framebuffers[i] = name;
|
||||
/* insert dummy placeholder into hash table */
|
||||
|
||||
if (dsa) {
|
||||
fb = ctx->Driver.NewFramebuffer(ctx, framebuffers[i]);
|
||||
if (!fb) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
fb = &DummyFramebuffer;
|
||||
|
||||
mtx_lock(&ctx->Shared->Mutex);
|
||||
_mesa_HashInsert(ctx->Shared->FrameBuffers, name, &DummyFramebuffer);
|
||||
_mesa_HashInsert(ctx->Shared->FrameBuffers, name, fb);
|
||||
mtx_unlock(&ctx->Shared->Mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
{
|
||||
create_framebuffers(n, framebuffers, false);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
{
|
||||
create_framebuffers(n, framebuffers, true);
|
||||
}
|
||||
|
||||
|
||||
GLenum GLAPIENTRY
|
||||
_mesa_CheckFramebufferStatus(GLenum target)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -169,6 +169,9 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
|
|||
extern void GLAPIENTRY
|
||||
_mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers);
|
||||
|
||||
extern GLenum GLAPIENTRY
|
||||
_mesa_CheckFramebufferStatus(GLenum target);
|
||||
|
||||
|
|
|
|||
|
|
@ -980,6 +980,7 @@ const struct function gl_core_functions_possible[] = {
|
|||
{ "glGetNamedBufferParameteri64v", 45, -1 },
|
||||
{ "glGetNamedBufferPointerv", 45, -1 },
|
||||
{ "glGetNamedBufferSubData", 45, -1 },
|
||||
{ "glCreateFramebuffers", 45, -1 },
|
||||
{ "glCreateRenderbuffers", 45, -1 },
|
||||
{ "glNamedRenderbufferStorage", 45, -1 },
|
||||
{ "glNamedRenderbufferStorageMultisample", 45, -1 },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue