Re: [Mesa-dev] [PATCH 1/4] mesa: add support for nvidia conservative rasterization extensions

2018-03-21 Thread Pending Chaos
The indentation error shall be fixed.

no_error="true" does mean there's a separate no-error variant of the
function. I create such variants for consistency with other functions
in viewport.c

On Wed, Mar 21, 2018 at 11:40 PM, Ilia Mirkin  wrote:
> On Wed, Mar 21, 2018 at 7:11 PM, pendingchaos  
> wrote:
>> Although the specs write it against compatibility GL 4.3 and allows core
>> profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.
>> ---
>>  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  | 138 
>> 
>>  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  |  29 ++-
>>  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, 535 insertions(+), 12 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..0098e6e425 100644
>> --- a/src/mapi/glapi/gen/gl_API.xml
>> +++ b/src/mapi/glapi/gen/gl_API.xml
>> @@ -12871,6 +12871,53 @@
>>
>>  
>>
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +
>> +> no_error="true">
>> +
>> +
>
> Indent, both here and below (i.e. param should be indented by 1).
>
> Not 100% sure I remember what no_error="true" means, but IIRC it means
> there's separate dispatch in a no-error context. Doesn't seem
> worthwhile here (and I don't think you added the _no_error variants of
> the functions).
>
>   -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: add support for nvidia conservative rasterization extensions

2018-03-21 Thread Ilia Mirkin
On Wed, Mar 21, 2018 at 7:11 PM, pendingchaos  wrote:
> Although the specs write it against compatibility GL 4.3 and allows core
> profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.
> ---
>  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  | 138 
> 
>  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  |  29 ++-
>  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, 535 insertions(+), 12 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..0098e6e425 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -12871,6 +12871,53 @@
>
>  
>
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> + no_error="true">
> +
> +

Indent, both here and below (i.e. param should be indented by 1).

Not 100% sure I remember what no_error="true" means, but IIRC it means
there's separate dispatch in a no-error context. Doesn't seem
worthwhile here (and I don't think you added the _no_error variants of
the functions).

  -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] mesa: add support for nvidia conservative rasterization extensions

2018-03-21 Thread pendingchaos
Although the specs write it against compatibility GL 4.3 and allows core
profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.
---
 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  | 138 
 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  |  29 ++-
 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, 535 insertions(+), 12 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..0098e6e425 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 0446078136..43ec55f580 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 9d3aa728a1..4790bbc036 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 (ctx->Extensions.NV_conservative_raster) {
+  TEST_AND_UPDATE(ctx->ConservativeRasterization,
+