On Mon, May 2, 2011 at 3:47 PM, Brian Paul <bri...@vmware.com> wrote:
> On 05/02/2011 07:03 AM, Marek Olšák wrote:
>>
>> Otherwise there would be no way to know whether the state has been
>> changed.
>> ---
>>  src/mesa/main/enable.c |    1 +
>>  src/mesa/main/mtypes.h |    1 +
>>  2 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
>> index 2ec19c8..dbc6d21 100644
>> --- a/src/mesa/main/enable.c
>> +++ b/src/mesa/main/enable.c
>> @@ -886,6 +886,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap,
>> GLboolean state)
>>        case GL_TEXTURE_CUBE_MAP_SEAMLESS:
>>         CHECK_EXTENSION(ARB_seamless_cube_map, cap);
>>         ctx->Texture.CubeMapSeamless = state;
>> +        FLUSH_VERTICES(ctx, _NEW_SEAMLESS_CUBE_MAP);
>>         break;
>
> The flush call needs to be made before the state is changed.

OK, please see the attached patch (replaces [PATCH 1/6]).

The second attached patch fixes the same problem in the place where I
got that from.

The third attached patch just renames _NEW_SEAMLESS_CUBE_MAP to
_NEW_TEXTURE in st/mesa (replaces [PATCH 2/6]).

Please review.

>
>
>>  #if FEATURE_EXT_transform_feedback
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index fba65e8..8665353 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -2994,6 +2994,7 @@ struct gl_matrix_stack
>>  #define _NEW_PROGRAM_CONSTANTS (1<<  27)
>>  #define _NEW_BUFFER_OBJECT     (1<<  28)
>>  #define _NEW_FRAG_CLAMP        (1<<  29)
>> +#define _NEW_SEAMLESS_CUBE_MAP  (1<<  30)
>
> I'd probably just use the _NEW_TEXTURE flag here.

I didn't want to cause needless validation of pipe_rasterizer_state,
but I guess it's the kind of state that doesn't change often.

Marek
From ca76d3acf971b353c1adefb6580136e74e8463be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <mar...@gmail.com>
Date: Mon, 2 May 2011 02:36:42 +0200
Subject: [PATCH 1/3] mesa: make _NEW_TEXTURE dirty when changing GL_TEXTURE_CUBE_MAP_SEAMLESS

Otherwise there would be no way to know whether the state has been changed.
---
 src/mesa/main/enable.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 2ec19c8..6bc045d 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -885,7 +885,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
 
       case GL_TEXTURE_CUBE_MAP_SEAMLESS:
 	 CHECK_EXTENSION(ARB_seamless_cube_map, cap);
-	 ctx->Texture.CubeMapSeamless = state;
+	 if (ctx->Texture.CubeMapSeamless != state) {
+	    FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+	    ctx->Texture.CubeMapSeamless = state;
+	 }
 	 break;
 
 #if FEATURE_EXT_transform_feedback
-- 
1.7.4.1

From 82ec724351829d0830daeba09c1683f6fc1bdbda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <mar...@gmail.com>
Date: Mon, 2 May 2011 17:13:59 +0200
Subject: [PATCH 2/3] mesa: flush vertices before changing GL_RASTERIZER_DISCARD state, not after

---
 src/mesa/main/enable.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 6bc045d..aac8b9c 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -895,8 +895,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
       case GL_RASTERIZER_DISCARD:
 	 CHECK_EXTENSION(EXT_transform_feedback, cap);
          if (ctx->TransformFeedback.RasterDiscard != state) {
-            ctx->TransformFeedback.RasterDiscard = state;
             FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+            ctx->TransformFeedback.RasterDiscard = state;
          }
          break;
 #endif
-- 
1.7.4.1

From ac74cc7dfe7ad6902ef41602c43c1123647a208d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <mar...@gmail.com>
Date: Mon, 2 May 2011 02:37:46 +0200
Subject: [PATCH 3/3] gallium: implement ARB_seamless_cube_map

---
 src/gallium/include/pipe/p_defines.h        |    1 +
 src/gallium/include/pipe/p_state.h          |    1 +
 src/mesa/state_tracker/st_atom_rasterizer.c |    6 +++++-
 src/mesa/state_tracker/st_extensions.c      |    4 ++++
 4 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 431a7fb..176fee9 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -465,6 +465,7 @@ enum pipe_cap {
    PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR = 44,
    PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL = 45,
    PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46,
+   PIPE_CAP_SEAMLESS_CUBE_MAP = 47
 };
 
 /* Shader caps not specific to any single stage */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 0c1f509..26e8a8e 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -101,6 +101,7 @@ struct pipe_rasterizer_state
    unsigned line_smooth:1;
    unsigned line_stipple_enable:1;
    unsigned line_last_pixel:1;
+   unsigned seamless_cube_map:1;
 
    /**
     * Use the first vertex of a primitive as the provoking vertex for
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 250cbb2..2394b33 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -257,6 +257,9 @@ static void update_raster_state( struct st_context *st )
    /* _NEW_FRAG_CLAMP */
    raster->clamp_fragment_color = ctx->Color._ClampFragmentColor;
 
+   /* _NEW_SEAMLESS_CUBE_MAP */
+   raster->seamless_cube_map = ctx->Texture.CubeMapSeamless;
+
    raster->gl_rasterization_rules = 1;
 
    cso_set_rasterizer(st->cso_context, raster);
@@ -273,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = {
        _NEW_POLYGON |
        _NEW_PROGRAM |
        _NEW_SCISSOR |
-       _NEW_FRAG_CLAMP),      /* mesa state dependencies*/
+       _NEW_FRAG_CLAMP |
+       _NEW_TEXTURE),  /* mesa state dependencies */
       ST_NEW_VERTEX_PROGRAM,  /* state tracker dependencies */
    },
    update_raster_state     /* update function */
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 030bbc7..8bdf89c 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -595,4 +595,8 @@ void st_init_extensions(struct st_context *st)
                                    PIPE_BIND_SAMPLER_VIEW)) {
       ctx->Extensions.EXT_packed_float = GL_TRUE;
    }
+
+   if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP)) {
+      ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
+   }
 }
-- 
1.7.4.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to