Re: [Mesa-dev] [PATCH v5 1/4] mesa: add support for nvidia conservative rasterization extensions
On 04/26/2018 04:33 PM, Rhys Perry wrote: For Brian Paul: Since you seemed to have looked over v3 of this patch, you were Cc'd. Compared to v3, it fixes the style problems (including the CLAMP() thing) and adds ALWAYS_INLINE to conservative_raster_parameter(). A few more nit-picks below. -Brian [Mesa-dev] [PATCH v5 1/4] mesa: add support for nvidia conservative rasterization extensions Rhys Perry pendingchaos02 at gmail.com Sat Apr 7 22:15:02 UTC 2018 Previous message (by thread): [Mesa-dev] [PATCH v5 0/4] Implement Various Conservative Rasterization Extensions Next message (by thread): [Mesa-dev] [PATCH v5 2/4] gallium: add initial support for conservative rasterization Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Although the specs are written against compatibility GL 4.3 and allows core profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+. Signed-off-by: Rhys Perry --- src/mapi/glapi/gen/gl_API.xml | 47 src/mapi/glapi/gen/gl_genexec.py| 1 + src/mesa/Makefile.sources | 2 + src/mesa/main/attrib.c | 60 --- src/mesa/main/conservativeraster.c | 127 src/mesa/main/conservativeraster.h | 48 src/mesa/main/context.c | 10 +++ src/mesa/main/dlist.c | 86 + src/mesa/main/enable.c | 14 src/mesa/main/extensions_table.h| 4 + src/mesa/main/get.c | 3 + src/mesa/main/get_hash_params.py| 13 src/mesa/main/mtypes.h | 28 ++- src/mesa/main/tests/dispatch_sanity.cpp | 27 +++ src/mesa/main/viewport.c| 57 ++ src/mesa/main/viewport.h| 6 ++ src/mesa/meson.build| 2 + 17 files changed, 524 insertions(+), 11 deletions(-) create mode 100644 src/mesa/main/conservativeraster.c create mode 100644 src/mesa/main/conservativeraster.h diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 38c1921047..db312370b1 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -12871,6 +12871,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://www.w3.org/2001/XInclude"/> diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index aaff9f230b..be8013b62b 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -62,6 +62,7 @@ header = """/** #include "main/colortab.h" #include "main/compute.h" #include "main/condrender.h" +#include "main/conservativeraster.h" #include "main/context.h" #include "main/convolve.h" #include "main/copyimage.h" diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 92565ef8f5..952949c737 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -49,6 +49,8 @@ MAIN_FILES = \ main/condrender.c \ main/condrender.h \ main/config.h \ + main/conservativeraster.c \ + main/conservativeraster.h \ main/context.c \ main/context.h \ main/convolve.c \ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 9c632ffb51..50be1fee7e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -138,6 +138,9 @@ struct gl_enable_attrib /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ GLboolean sRGBEnabled; + + /* GL_NV_conservative_raster */ + GLboolean ConservativeRasterization; }; @@ -178,6 +181,13 @@ struct texture_state }; +struct viewport_state +{ + struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; + GLuint SubpixelPrecisionBias[2]; +}; + + /** An unused GL_*_BIT value */ #define DUMMY_BIT 0x1000 @@ -394,6 +404,9 @@ _mesa_PushAttrib(GLbitfield mask) /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ attr->sRGBEnabled = ctx->Color.sRGBEnabled; + + /* GL_NV_conservative_raster */ + attr->ConservativeRasterization = ctx->ConservativeRasterization; } if (mask & GL_EVAL_BIT) { @@ -545,11 +558,23 @@ _mesa_PushAttrib(GLbitfield mask) } if (mask & GL_VIEWPORT_BIT) { - if (!push_attrib(ctx, , GL_VIEWPORT_BIT, - sizeof(struct gl_viewport_attrib) - * ctx->Const.MaxViewports, - (void*)>ViewportArray)) + struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state); + if (!viewstate) { + _mesa_err
[Mesa-dev] [PATCH v5 1/4] mesa: add support for nvidia conservative rasterization extensions
For Brian Paul: Since you seemed to have looked over v3 of this patch, you were Cc'd. Compared to v3, it fixes the style problems (including the CLAMP() thing) and adds ALWAYS_INLINE to conservative_raster_parameter(). ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v5 1/4] mesa: add support for nvidia conservative rasterization extensions
Although the specs are written against compatibility GL 4.3 and allows core profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+. Signed-off-by: Rhys Perry--- src/mapi/glapi/gen/gl_API.xml | 47 src/mapi/glapi/gen/gl_genexec.py| 1 + src/mesa/Makefile.sources | 2 + src/mesa/main/attrib.c | 60 --- src/mesa/main/conservativeraster.c | 127 src/mesa/main/conservativeraster.h | 48 src/mesa/main/context.c | 10 +++ src/mesa/main/dlist.c | 86 + src/mesa/main/enable.c | 14 src/mesa/main/extensions_table.h| 4 + src/mesa/main/get.c | 3 + src/mesa/main/get_hash_params.py| 13 src/mesa/main/mtypes.h | 28 ++- src/mesa/main/tests/dispatch_sanity.cpp | 27 +++ src/mesa/main/viewport.c| 57 ++ src/mesa/main/viewport.h| 6 ++ src/mesa/meson.build| 2 + 17 files changed, 524 insertions(+), 11 deletions(-) create mode 100644 src/mesa/main/conservativeraster.c create mode 100644 src/mesa/main/conservativeraster.h diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 38c1921047..db312370b1 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -12871,6 +12871,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://www.w3.org/2001/XInclude"/> diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index aaff9f230b..be8013b62b 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -62,6 +62,7 @@ header = """/** #include "main/colortab.h" #include "main/compute.h" #include "main/condrender.h" +#include "main/conservativeraster.h" #include "main/context.h" #include "main/convolve.h" #include "main/copyimage.h" diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 92565ef8f5..952949c737 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -49,6 +49,8 @@ MAIN_FILES = \ main/condrender.c \ main/condrender.h \ main/config.h \ + main/conservativeraster.c \ + main/conservativeraster.h \ main/context.c \ main/context.h \ main/convolve.c \ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 9c632ffb51..50be1fee7e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -138,6 +138,9 @@ struct gl_enable_attrib /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ GLboolean sRGBEnabled; + + /* GL_NV_conservative_raster */ + GLboolean ConservativeRasterization; }; @@ -178,6 +181,13 @@ struct texture_state }; +struct viewport_state +{ + struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; + GLuint SubpixelPrecisionBias[2]; +}; + + /** An unused GL_*_BIT value */ #define DUMMY_BIT 0x1000 @@ -394,6 +404,9 @@ _mesa_PushAttrib(GLbitfield mask) /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ attr->sRGBEnabled = ctx->Color.sRGBEnabled; + + /* GL_NV_conservative_raster */ + attr->ConservativeRasterization = ctx->ConservativeRasterization; } if (mask & GL_EVAL_BIT) { @@ -545,11 +558,23 @@ _mesa_PushAttrib(GLbitfield mask) } if (mask & GL_VIEWPORT_BIT) { - if (!push_attrib(ctx, , GL_VIEWPORT_BIT, - sizeof(struct gl_viewport_attrib) - * ctx->Const.MaxViewports, - (void*)>ViewportArray)) + struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state); + if (!viewstate) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)"); + goto end; + } + + if (!save_attrib_data(, GL_VIEWPORT_BIT, viewstate)) { + free(viewstate); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)"); goto end; + } + + memcpy(>ViewportArray, >ViewportArray, + sizeof(struct gl_viewport_attrib)*ctx->Const.MaxViewports); + + viewstate->SubpixelPrecisionBias[0] = ctx->SubpixelPrecisionBias[0]; + viewstate->SubpixelPrecisionBias[1] = ctx->SubpixelPrecisionBias[1]; } /* GL_ARB_multisample */ @@ -714,6 +739,13 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Color.sRGBEnabled, enable->sRGBEnabled, GL_FRAMEBUFFER_SRGB); + /* GL_NV_conservative_raster */ + if