summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorFritz Koenig <[email protected]>2019-07-30 14:53:30 -0700
committerFritz Koenig <[email protected]>2019-10-08 13:53:01 -0700
commit66937abe2b089ae897197f748bd358c018dc52f7 (patch)
tree9abd39ff4fd96f70953cdf275dba49e669d713b6 /src/mesa
parent9fb76392de4b3df558130df22ab483896a7fc257 (diff)
mesa: Allow MESA_framebuffer_flip_y for GLES 3
Implement glFramebufferParameteriMESA on GLES 3 so that the extension is not dependant on GLES 3.1 Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/extensions_table.h2
-rw-r--r--src/mesa/main/fbobject.c59
-rw-r--r--src/mesa/main/fbobject.h6
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp8
4 files changed, 62 insertions, 13 deletions
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 41d066174e6..991adfc9098 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -356,7 +356,7 @@ EXT(KHR_texture_compression_astc_hdr , KHR_texture_compression_astc_hdr
EXT(KHR_texture_compression_astc_ldr , KHR_texture_compression_astc_ldr , GLL, GLC, x , ES2, 2012)
EXT(KHR_texture_compression_astc_sliced_3d , KHR_texture_compression_astc_sliced_3d , GLL, GLC, x , ES2, 2015)
-EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y , 43, 43, x , 31, 2018)
+EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y , 43, 43, x , 30, 2018)
EXT(MESA_pack_invert , MESA_pack_invert , GLL, GLC, x , x , 2002)
EXT(MESA_shader_integer_functions , MESA_shader_integer_functions , GLL, GLC, x , 30, 2016)
EXT(MESA_texture_signed_rgba , EXT_texture_snorm , GLL, GLC, x , x , 2009)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 088b45aa732..bc4f69c149e 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1625,18 +1625,46 @@ invalid_pname_enum:
_mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
}
+static bool
+validate_framebuffer_parameter_extensions(GLenum pname, const char *func)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->Extensions.ARB_framebuffer_no_attachments &&
+ !ctx->Extensions.ARB_sample_locations &&
+ !ctx->Extensions.MESA_framebuffer_flip_y) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s not supported "
+ "(none of ARB_framebuffer_no_attachments,"
+ " ARB_sample_locations, or"
+ " MESA_framebuffer_flip_y extensions are available)",
+ func);
+ return false;
+ }
+
+ /*
+ * If only the MESA_framebuffer_flip_y extension is enabled
+ * pname can only be GL_FRAMEBUFFER_FLIP_Y_MESA
+ */
+ if (ctx->Extensions.MESA_framebuffer_flip_y &&
+ pname != GL_FRAMEBUFFER_FLIP_Y_MESA &&
+ !(ctx->Extensions.ARB_framebuffer_no_attachments ||
+ ctx->Extensions.ARB_sample_locations)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
+ return false;
+ }
+
+ return true;
+}
+
void GLAPIENTRY
_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
- if (!ctx->Extensions.ARB_framebuffer_no_attachments &&
- !ctx->Extensions.ARB_sample_locations) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glFramebufferParameteriv not supported "
- "(neither ARB_framebuffer_no_attachments nor ARB_sample_locations"
- " is available)");
+ if (!validate_framebuffer_parameter_extensions(pname,
+ "glFramebufferParameteri")) {
return;
}
@@ -1650,6 +1678,12 @@ _mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param)
framebuffer_parameteri(ctx, fb, pname, param, "glFramebufferParameteri");
}
+void GLAPIENTRY
+_mesa_FramebufferParameteriMESA(GLenum target, GLenum pname, GLint param)
+{
+ _mesa_FramebufferParameteri(target, pname, param);
+}
+
static bool
validate_get_framebuffer_parameteriv_pname(struct gl_context *ctx,
struct gl_framebuffer *fb,
@@ -1779,12 +1813,8 @@ _mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
- if (!ctx->Extensions.ARB_framebuffer_no_attachments &&
- !ctx->Extensions.ARB_sample_locations) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetFramebufferParameteriv not supported "
- "(neither ARB_framebuffer_no_attachments nor ARB_sample_locations"
- " is available)");
+ if (!validate_framebuffer_parameter_extensions(pname,
+ "glGetFramebufferParameteriv")) {
return;
}
@@ -1799,6 +1829,11 @@ _mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
"glGetFramebufferParameteriv");
}
+void GLAPIENTRY
+_mesa_GetFramebufferParameterivMESA(GLenum target, GLenum pname, GLint *params)
+{
+ _mesa_GetFramebufferParameteriv(target, pname, params);
+}
/**
* Remove the specified renderbuffer or texture from any attachment point in
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index dcbff85eccf..e44373e7dd3 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -405,9 +405,15 @@ extern void GLAPIENTRY
_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param);
extern void GLAPIENTRY
+_mesa_FramebufferParameteriMESA(GLenum target, GLenum pname, GLint param);
+
+extern void GLAPIENTRY
_mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
extern void GLAPIENTRY
+_mesa_GetFramebufferParameterivMESA(GLenum target, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
_mesa_FramebufferSampleLocationsfvARB(GLenum target, GLuint start,
GLsizei count, const GLfloat *v);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 6ba5180592e..c3ac7beb73e 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1412,6 +1412,10 @@ const struct function common_desktop_functions_possible[] = {
/* GL_EXT_shader_image_load_store */
{ "glBindImageTextureEXT", 30, -1 },
+ /* GL_MESA_framebuffer_flip_y */
+ { "glFramebufferParameteriMESA", 43, -1 },
+ { "glGetFramebufferParameterivMESA", 43, -1 },
+
{ NULL, 0, -1 }
};
@@ -2653,6 +2657,10 @@ const struct function gles3_functions_possible[] = {
{ "glRenderbufferStorageMultisampleAdvancedAMD", 11, -1 },
{ "glNamedRenderbufferStorageMultisampleAdvancedAMD", 11, -1 },
+ /* GL_MESA_framebuffer_flip_y */
+ { "glFramebufferParameteriMESA", 30, -1 },
+ { "glGetFramebufferParameterivMESA", 30, -1 },
+
{ NULL, 0, -1 }
};