diff options
author | Fritz Koenig <[email protected]> | 2019-07-30 14:53:30 -0700 |
---|---|---|
committer | Fritz Koenig <[email protected]> | 2019-10-08 13:53:01 -0700 |
commit | 66937abe2b089ae897197f748bd358c018dc52f7 (patch) | |
tree | 9abd39ff4fd96f70953cdf275dba49e669d713b6 /src | |
parent | 9fb76392de4b3df558130df22ab483896a7fc257 (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')
-rw-r--r-- | src/mapi/glapi/gen/apiexec.py | 4 | ||||
-rw-r--r-- | src/mapi/glapi/gen/es_EXT.xml | 15 | ||||
-rw-r--r-- | src/mapi/glapi/gen/static_data.py | 2 | ||||
-rw-r--r-- | src/mesa/main/extensions_table.h | 2 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 59 | ||||
-rw-r--r-- | src/mesa/main/fbobject.h | 6 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 8 |
7 files changed, 83 insertions, 13 deletions
diff --git a/src/mapi/glapi/gen/apiexec.py b/src/mapi/glapi/gen/apiexec.py index 4f9229d5fcd..26adb00ae21 100644 --- a/src/mapi/glapi/gen/apiexec.py +++ b/src/mapi/glapi/gen/apiexec.py @@ -150,6 +150,10 @@ functions = { "FramebufferParameteri": exec_info(compatibility=30, core=31, es2=31), "GetFramebufferParameteriv": exec_info(compatibility=30, core=31, es2=31), + # OpenGL 4.3 / GL_MESA_framebuffer_flip_y. + "FramebufferParameteriMESA": exec_info(core=31, es2=30), + "GetFramebufferParameterivMESA": exec_info(core=31, es2=30), + # OpenGL 4.5 / GL_ARB_direct_state_access. Mesa can expose the extension # with core profile. "CreateTransformFeedbacks": exec_info(compatibility=31, core=31), diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml index be466e34ae8..e3cad15679d 100644 --- a/src/mapi/glapi/gen/es_EXT.xml +++ b/src/mapi/glapi/gen/es_EXT.xml @@ -1499,4 +1499,19 @@ </function> </category> +<!-- 302. GL_MESA_framebuffer_flip_y --> +<category name="GL_MESA_framebuffer_flip_y" number="302"> + <enum name="GL_FRAMEBUFFER_FLIP_Y_MESA" value="0x8BBB"/> + <function name="FramebufferParameteriMESA" es2="3.0"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint" /> + </function> + <function name="GetFramebufferParameterivMESA" es2="3.0"> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="params" type="GLint *" output="true" /> + </function> +</category> + </OpenGLAPI> diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index c1b3c6a5119..2f3e448750a 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1567,6 +1567,8 @@ offsets = { "GetCompressedMultiTexImageEXT": 1531, "GetMultiTexLevelParameterivEXT": 1532, "GetMultiTexLevelParameterfvEXT": 1533, + "FramebufferParameteriMESA": 1534, + "GetFramebufferParameterivMESA": 1535, } functions = [ 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 } }; |