All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Klausmann <tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 02/11] mesa/main: add support for GL_ARB_cull_distance
Date: Sun, 24 May 2015 21:33:49 +0200	[thread overview]
Message-ID: <5562279D.8070009@mni.thm.de> (raw)
In-Reply-To: <CAKb7Uvj=Q38BPUqyaUAwFfptMC4BV2p3fXLrOGak1+kwD4LTBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



On 24.05.2015 20:11, Ilia Mirkin wrote:
> On Sun, May 24, 2015 at 1:58 PM, Tobias Klausmann
> <tobias.johannes.klausmann@mni.thm.de> wrote:
>> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
>> ---
>>   src/mesa/main/extensions.c           |  1 +
>>   src/mesa/main/get.c                  | 26 ++++++++++++++++++++++++++
>>   src/mesa/main/get_hash_params.py     |  4 ++++
>>   src/mesa/main/mtypes.h               | 22 +++++++++++++---------
>>   src/mesa/main/shaderapi.c            |  4 ++--
>>   src/mesa/main/tests/enum_strings.cpp |  2 ++
>>   6 files changed, 48 insertions(+), 11 deletions(-)
>>
>> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
>> index c82416a..2145502 100644
>> --- a/src/mesa/main/extensions.c
>> +++ b/src/mesa/main/extensions.c
>> @@ -99,6 +99,7 @@ static const struct extension extension_table[] = {
>>      { "GL_ARB_copy_buffer",                         o(dummy_true),                              GL,             2008 },
>>      { "GL_ARB_copy_image",                          o(ARB_copy_image),                          GL,             2012 },
>>      { "GL_ARB_conservative_depth",                  o(ARB_conservative_depth),                  GL,             2011 },
>> +   { "GL_ARB_cull_distance",                       o(ARB_cull_distance),                       GL,             2014 },
>>      { "GL_ARB_debug_output",                        o(dummy_true),                              GL,             2009 },
>>      { "GL_ARB_depth_buffer_float",                  o(ARB_depth_buffer_float),                  GL,             2008 },
>>      { "GL_ARB_depth_clamp",                         o(ARB_depth_clamp),                         GL,             2003 },
>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>> index 8a6c81a..1dcfcc9 100644
>> --- a/src/mesa/main/get.c
>> +++ b/src/mesa/main/get.c
>> @@ -143,6 +143,8 @@ enum value_extra {
>>      EXTRA_VALID_DRAW_BUFFER,
>>      EXTRA_VALID_TEXTURE_UNIT,
>>      EXTRA_VALID_CLIP_DISTANCE,
>> +   EXTRA_VALID_CULL_DISTANCE,
>> +   EXTRA_VALID_CULL_AND_CLIP_DISTANCE,
>>      EXTRA_FLUSH_CURRENT,
>>      EXTRA_GLSL_130,
>>      EXTRA_EXT_UBO_GS4,
>> @@ -267,6 +269,13 @@ static const int extra_valid_clip_distance[] = {
>>      EXTRA_END
>>   };
>>
>> +static const int extra_valid_clip_and_cull_distance[] = {
>> +   EXTRA_VALID_CLIP_DISTANCE,
>> +   EXTRA_VALID_CULL_DISTANCE,
>> +   EXTRA_VALID_CULL_AND_CLIP_DISTANCE,
>> +   EXTRA_END
>> +};
>> +
>>   static const int extra_flush_current_valid_texture_unit[] = {
>>      EXTRA_FLUSH_CURRENT,
>>      EXTRA_VALID_TEXTURE_UNIT,
>> @@ -393,6 +402,7 @@ EXTRA_EXT(INTEL_performance_query);
>>   EXTRA_EXT(ARB_explicit_uniform_location);
>>   EXTRA_EXT(ARB_clip_control);
>>   EXTRA_EXT(EXT_polygon_offset_clamp);
>> +EXTRA_EXT(ARB_cull_distance);
>>
>>   static const int
>>   extra_ARB_color_buffer_float_or_glcore[] = {
>> @@ -1116,6 +1126,22 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
>>              return GL_FALSE;
>>           }
>>           break;
>> +      case EXTRA_VALID_CULL_DISTANCE:
>> +        if (d->pname - GL_MAX_CULL_DISTANCES >= ctx->Const.MaxClipPlanes) {
>> +       _mesa_error(ctx, GL_INVALID_ENUM, "%s(cull distance %u)",
>> +                   func, d->pname - GL_MAX_CULL_DISTANCES);
>> +       return GL_FALSE;
>> +        }
>> +        break;
>> +      case EXTRA_VALID_CULL_AND_CLIP_DISTANCE:
>> +    if (d->pname - GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES >=
>> +             ctx->Const.MaxClipPlanes) {
>> +       _mesa_error(ctx, GL_INVALID_ENUM,
>> +                   "%s(combined clip and cull distance %u)", func,
>> +                   d->pname - GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES);
>> +       return GL_FALSE;
>> +    }
> huh?
>
> I guess you were copying EXTRA_VALID_CLIP_DISTANCE? That's for
> validating GL_CLIP_DISTANCE0..7 all in one go (and erroring out for
> ones that are too high). That doesn't seem to apply here.
>
> You don't appear to use extra_valid_clip_and_cull_distance either, so
> I guess that makes sense... should remove the whole lot.

will do!

>
>> +        break;
>>         case EXTRA_GLSL_130:
>>            api_check = GL_TRUE;
>>            if (ctx->Const.GLSLVersion >= 130)
>> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
>> index 41cb2c1..a63aba7 100644
>> --- a/src/mesa/main/get_hash_params.py
>> +++ b/src/mesa/main/get_hash_params.py
>> @@ -798,6 +798,10 @@ descriptor=[
>>     [ "MIN_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MinFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>>     [ "MAX_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MaxFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>>     [ "FRAGMENT_INTERPOLATION_OFFSET_BITS", "CONST(FRAGMENT_INTERPOLATION_OFFSET_BITS), extra_ARB_gpu_shader5" ],
>> +
>> +# GL_ARB_cull_distance
>> +  [ "MAX_CULL_DISTANCES", "CONTEXT_INT(Const.MaxClipPlanes), extra_ARB_cull_distance" ],
>> +  [ "MAX_COMBINED_CLIP_AND_CULL_DISTANCES", "CONTEXT_INT(Const.MaxClipPlanes), extra_ARB_cull_distance" ],
>>   ]},
>>
>>   # Enums restricted to OpenGL Core profile
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index 8342517..6425c06 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -236,6 +236,8 @@ typedef enum
>>      VARYING_SLOT_CLIP_VERTEX, /* Does not appear in FS */
>>      VARYING_SLOT_CLIP_DIST0,
>>      VARYING_SLOT_CLIP_DIST1,
>> +   VARYING_SLOT_CULL_DIST0,
>> +   VARYING_SLOT_CULL_DIST1,
>>      VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */
>>      VARYING_SLOT_LAYER, /* Appears as VS or GS output */
>>      VARYING_SLOT_VIEWPORT, /* Appears as VS or GS output */
>> @@ -272,6 +274,8 @@ typedef enum
>>   #define VARYING_BIT_CLIP_VERTEX BITFIELD64_BIT(VARYING_SLOT_CLIP_VERTEX)
>>   #define VARYING_BIT_CLIP_DIST0 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0)
>>   #define VARYING_BIT_CLIP_DIST1 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1)
>> +#define VARYING_BIT_CULL_DIST0 BITFIELD64_BIT(VARYING_SLOT_CULL_DIST0)
>> +#define VARYING_BIT_CULL_DIST1 BITFIELD64_BIT(VARYING_SLOT_CULL_DIST1)
>>   #define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID)
>>   #define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER)
>>   #define VARYING_BIT_VIEWPORT BITFIELD64_BIT(VARYING_SLOT_VIEWPORT)
>> @@ -2111,8 +2115,7 @@ struct gl_program
>>       * For vertex and geometry shaders, true if the program uses the
>>       * gl_ClipDistance output.  Ignored for fragment shaders.
>>       */
>> -   GLboolean UsesClipDistanceOut;
>> -
>> +   GLboolean UsesClipCullDistanceOut;
>>
>>      /** Named parameters, constants, etc. from program text */
>>      struct gl_program_parameter_list *Parameters;
>> @@ -2697,9 +2700,9 @@ struct gl_shader_program
>>          * True if gl_ClipDistance is written to.  Copied into
>>          * gl_geometry_program by _mesa_copy_linked_program_data().
>>          */
>> -      GLboolean UsesClipDistance;
>> -      GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
>> -                                         0 if not present. */
>> +      GLboolean UsesClipCullDistance;
>> +      GLuint ClipCullDistanceArraySize; /**< Size of the gl_ClipDistance array,
>> +                                             or 0 if not present. */
>>         bool UsesEndPrimitive;
>>         bool UsesStreams;
>>      } Geom;
>> @@ -2710,9 +2713,9 @@ struct gl_shader_program
>>          * True if gl_ClipDistance is written to.  Copied into gl_vertex_program
>>          * by _mesa_copy_linked_program_data().
>>          */
>> -      GLboolean UsesClipDistance;
>> -      GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
>> -                                         0 if not present. */
>> +      GLboolean UsesClipCullDistance;
>> +      GLuint ClipCullDistanceArraySize; /**< Size of the gl_ClipDistance array,
>> +                                             or 0 if not present. */
>>      } Vert;
>>
>>      /**
>> @@ -2744,7 +2747,7 @@ struct gl_shader_program
>>       * Size of the gl_ClipDistance array that is output from the last pipeline
>>       * stage before the fragment shader.
>>       */
>> -   unsigned LastClipDistanceArraySize;
>> +   unsigned LastClipCullDistanceArraySize;
>>
>>      unsigned NumUniformBlocks;
>>      struct gl_uniform_block *UniformBlocks;
>> @@ -3617,6 +3620,7 @@ struct gl_extensions
>>      GLboolean ARB_conditional_render_inverted;
>>      GLboolean ARB_conservative_depth;
>>      GLboolean ARB_copy_image;
>> +   GLboolean ARB_cull_distance;
>>      GLboolean ARB_depth_buffer_float;
>>      GLboolean ARB_depth_clamp;
>>      GLboolean ARB_depth_texture;
>> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
>> index a04b287..7b26173 100644
>> --- a/src/mesa/main/shaderapi.c
>> +++ b/src/mesa/main/shaderapi.c
>> @@ -1942,7 +1942,7 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
>>   {
>>      switch (type) {
>>      case MESA_SHADER_VERTEX:
>> -      dst->UsesClipDistanceOut = src->Vert.UsesClipDistance;
>> +      dst->UsesClipCullDistanceOut = src->Vert.UsesClipCullDistance;
>>         break;
>>      case MESA_SHADER_GEOMETRY: {
>>         struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst;
>> @@ -1951,7 +1951,7 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
>>         dst_gp->Invocations = src->Geom.Invocations;
>>         dst_gp->InputType = src->Geom.InputType;
>>         dst_gp->OutputType = src->Geom.OutputType;
>> -      dst->UsesClipDistanceOut = src->Geom.UsesClipDistance;
>> +      dst->UsesClipCullDistanceOut = src->Geom.UsesClipCullDistance;
>>         dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
>>         dst_gp->UsesStreams = src->Geom.UsesStreams;
>>      }
>> diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp
>> index dc5fe75..959db15 100644
>> --- a/src/mesa/main/tests/enum_strings.cpp
>> +++ b/src/mesa/main/tests/enum_strings.cpp
>> @@ -789,6 +789,8 @@ const struct enum_info everything[] = {
>>      { 0x8261, "GL_NO_RESET_NOTIFICATION_ARB" },
>>      { 0x826E, "GL_MAX_UNIFORM_LOCATIONS" },
>>      { 0x82DF, "GL_TEXTURE_IMMUTABLE_LEVELS" },
>> +   { 0x82F9, "GL_MAX_CULL_DISTANCES" },
>> +   { 0x82FA, "GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES" },
>>      { 0x8362, "GL_UNSIGNED_BYTE_2_3_3_REV" },
>>      { 0x8363, "GL_UNSIGNED_SHORT_5_6_5" },
>>      { 0x8364, "GL_UNSIGNED_SHORT_5_6_5_REV" },
>> --
>> 2.4.1
>>
>> _______________________________________________
>> Nouveau mailing list
>> Nouveau@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2015-05-24 19:33 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 17:57 [RFC PATCH 00/11] Implement ARB_cull_distance Tobias Klausmann
2015-05-24 17:58 ` [PATCH 03/11] mesa/prog: Add varyings for arb_cull_distance Tobias Klausmann
2015-05-24 17:58 ` [PATCH 04/11] mesa/st: add support for GL_ARB_cull_distance Tobias Klausmann
2015-05-24 18:12   ` Marek Olšák
     [not found]     ` <CAAxE2A5TdLJaNfeoHE7Rrf-R80KTRbj_dtVN-cTd3K-_BfcPGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-24 19:33       ` [Mesa-dev] " Tobias Klausmann
     [not found] ` <1432490289-29353-1-git-send-email-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-24 17:57   ` [PATCH 01/11] glapi: add GL_ARB_cull_distance Tobias Klausmann
2015-05-24 17:58   ` [PATCH 02/11] mesa/main: add support for GL_ARB_cull_distance Tobias Klausmann
2015-05-24 18:11     ` [Nouveau] " Ilia Mirkin
     [not found]       ` <CAKb7Uvj=Q38BPUqyaUAwFfptMC4BV2p3fXLrOGak1+kwD4LTBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-24 19:33         ` Tobias Klausmann [this message]
2015-05-24 17:58   ` [PATCH 05/11] glsl: Add a helper to see if an array was unsize in the shader Tobias Klausmann
2015-05-24 17:58   ` [PATCH 06/11] glsl: lower cull_distance into cull_distance_mesa Tobias Klausmann
2015-05-24 18:09     ` Marek Olšák
2015-05-24 17:58   ` [PATCH 07/11] glsl: Add arb_cull_distance support Tobias Klausmann
2015-05-24 22:34     ` Timothy Arceri
     [not found]       ` <1432506893.11443.2.camel-/E1597aS9LT0CCvOHzKKcA@public.gmane.org>
2015-05-24 22:46         ` [Mesa-dev] " Tobias Klausmann
2015-05-24 23:19           ` Timothy Arceri
2015-05-24 17:58   ` [PATCH 08/11] i965: rename UsesClipDistanceOut to UsesClipCullDistanceOut Tobias Klausmann
2015-05-24 17:58   ` [PATCH 10/11] nouveau/codegen: sort in galliums cull_distance semantic into the drivers bitmask Tobias Klausmann
2015-05-24 19:38     ` Ilia Mirkin
2015-05-24 17:58   ` [PATCH 11/11] nouveau/nvc0: implement cull_distance as a special form of clip distance Tobias Klausmann
2015-05-24 18:25   ` [RFC PATCH 00/11] Implement ARB_cull_distance Ilia Mirkin
     [not found]     ` <CAKb7UvjqEq9M639ZXhFeLqPjEVcP5Zfqc_Df7yjBA34ww70jMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-24 19:30       ` Tobias Klausmann
     [not found]         ` <556226F1.8020502-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-24 19:36           ` Ilia Mirkin
     [not found]             ` <CAKb7Uvgby-ycm5rQJWNJmC-4hkB2L9msgOiGh0YXNTBj+2-yaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-24 19:56               ` Tobias Klausmann
     [not found]                 ` <55622D00.4000308-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-24 22:11                   ` Marek Olšák
     [not found]                     ` <CAAxE2A4Zc3G+Rw9VcaAcXj24RJvZsBY1hW6RDA=Mt+aO6s2nKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-25  5:17                       ` Dave Airlie
     [not found]                         ` <CAPM=9tzeBhg-srEZgud4p3AUx59GAA7ogastm7Jy8erq1-0zzw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-25 13:40                           ` Tobias Klausmann
     [not found]                             ` <5563264B.4010008-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-25 15:07                               ` Ilia Mirkin
     [not found]                                 ` <CAKb7Uvj3CP3wBA1mWLhTdt-9RJRemHKYwqezOKD=GTw6zFOsbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-27 16:28                                   ` Marek Olšák
     [not found]                                     ` <CAAxE2A6=9rK3XuJTexcg-dj0F_NWXHisg9OMv99mMvZ-4E2nVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-27 19:05                                       ` Tobias Klausmann
     [not found]                                         ` <55661597.30809-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-27 22:51                                           ` Marek Olšák
     [not found]                                             ` <CAAxE2A78arFZdv1caKK_viR+AYydCyD45ENmTzw3M3cfLqLzhg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-27 23:02                                               ` Ilia Mirkin
2015-07-08 20:04                                   ` Tobias Klausmann
     [not found]                                     ` <559D823F.7070309-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-07-08 20:06                                       ` Ilia Mirkin
     [not found]                                         ` <CAKb7Uvj8qEKOZGap9H72cWMR8PwD_j15Fjxiew3MQR33ZsZ6Ww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-09  0:35                                           ` Marek Olšák
2015-05-24 17:58 ` [PATCH 09/11] gallium: add support for arb_cull_distance Tobias Klausmann
2015-05-25 18:36   ` Roland Scheidegger
2015-05-25 18:56     ` Tobias Klausmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5562279D.8070009@mni.thm.de \
    --to=tobias.johannes.klausmann-aqjdnwhu20eelga04laivw@public.gmane.org \
    --cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.