summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2015-05-10 20:48:11 +0200
committerFredrik Höglund <[email protected]>2015-05-14 15:48:17 +0200
commit6ad0b7e07a0445e9e0f368e079c4f7b8a6757bb3 (patch)
tree2731fe750e7319b56c712baff1ae0f468d77a756 /src/mesa/main/fbobject.c
parent339ed0984d4f54fca91235a1df2ce3a850f6123f (diff)
mesa: Add ARB_direct_state_access checks in FBO functions
Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index c2bc081cf1a..65e194cb749 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2454,6 +2454,12 @@ create_framebuffers(GLsizei n, GLuint *framebuffers, bool dsa)
const char *func = dsa ? "glCreateFramebuffers" : "glGenFramebuffers";
+ if (dsa && !ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(GL_ARB_direct_state_access is not supported)", func);
+ return;
+ }
+
if (n < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
return;
@@ -2552,6 +2558,13 @@ _mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
struct gl_framebuffer *fb;
GET_CURRENT_CONTEXT(ctx);
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCheckNamedFramebufferStatus(GL_ARB_direct_state_access "
+ "is not supported)");
+ return 0;
+ }
+
/* Validate the target (for conformance's sake) and grab a reference to the
* default framebuffer in case framebuffer = 0.
* Section 9.4 Framebuffer Completeness of the OpenGL 4.5 core spec
@@ -3097,6 +3110,12 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment,
const char *func = "glNamedFramebufferTextureLayer";
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(GL_ARB_direct_state_access is not supported)", func);
+ return;
+ }
+
/* Get the framebuffer object */
fb = _mesa_lookup_framebuffer_err(ctx, framebuffer, func);
if (!fb)
@@ -3182,6 +3201,12 @@ _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
const char *func = "glNamedFramebufferTexture";
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(GL_ARB_direct_state_access is not supported)", func);
+ return;
+ }
+
if (!_mesa_has_geometry_shaders(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"unsupported function (glNamedFramebufferTexture) called");
@@ -3307,6 +3332,13 @@ _mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment,
struct gl_renderbuffer *rb;
GET_CURRENT_CONTEXT(ctx);
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glNamedFramebufferRenderbuffer(GL_ARB_direct_state_access "
+ "is not supported)");
+ return;
+ }
+
fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
"glNamedFramebufferRenderbuffer");
@@ -3639,6 +3671,13 @@ _mesa_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *buffer;
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetNamedFramebufferAttachmentParameteriv("
+ "GL_ARB_direct_state_access is not supported)");
+ return;
+ }
+
if (framebuffer) {
buffer = _mesa_lookup_framebuffer_err(ctx, framebuffer,
"glGetNamedFramebufferAttachmentParameteriv");
@@ -3671,6 +3710,13 @@ _mesa_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname,
(void) pname;
(void) param;
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glNamedFramebufferParameteri("
+ "GL_ARB_direct_state_access is not supported)");
+ return;
+ }
+
_mesa_error(ctx, GL_INVALID_OPERATION,
"glNamedFramebufferParameteri not supported "
"(ARB_framebuffer_no_attachments not implemented)");
@@ -3687,6 +3733,13 @@ _mesa_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname,
(void) pname;
(void) param;
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glNamedFramebufferParameteriv("
+ "GL_ARB_direct_state_access is not supported)");
+ return;
+ }
+
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetNamedFramebufferParameteriv not supported "
"(ARB_framebuffer_no_attachments not implemented)");
@@ -3855,6 +3908,13 @@ _mesa_InvalidateNamedFramebufferSubData(GLuint framebuffer,
struct gl_framebuffer *fb;
GET_CURRENT_CONTEXT(ctx);
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glInvalidateNamedFramebufferSubData("
+ "GL_ARB_direct_state_access is not supported)");
+ return;
+ }
+
/* 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."
@@ -3916,6 +3976,13 @@ _mesa_InvalidateNamedFramebufferData(GLuint framebuffer,
struct gl_framebuffer *fb;
GET_CURRENT_CONTEXT(ctx);
+ if (!ctx->Extensions.ARB_direct_state_access) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glInvalidateNamedFramebufferData("
+ "GL_ARB_direct_state_access is not supported)");
+ return;
+ }
+
/* 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."