[Mesa-dev] [PATCH] mesa: Remove unused variables left over from 107ae27e57d.

2015-04-05 Thread Mathias . Froehlich
From: Mathias Froehlich 

David,
You mean the below.
Ok to push?
Greetings and Thanks!
Mathias

Signed-off-by: Mathias Froehlich 
---
 src/mesa/main/viewport.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 3f5ca79..b270630 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -40,8 +40,6 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
GLfloat x, GLfloat y,
GLfloat width, GLfloat height)
 {
-   double scale[3], translate[3];
-
/* clamp width and height to the implementation dependent range */
width  = MIN2(width, (GLfloat) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLfloat) ctx->Const.MaxViewportHeight);
@@ -236,8 +234,6 @@ static void
 set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
   GLclampd nearval, GLclampd farval)
 {
-   double scale[3], translate[3];
-
if (ctx->ViewportArray[idx].Near == nearval &&
ctx->ViewportArray[idx].Far == farval)
   return;
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH] mesa: Remove unused variables left over from 107ae27e57d.

2015-04-05 Thread Dave Airlie
On 5 April 2015 at 17:32,   wrote:
> From: Mathias Froehlich 
>
> David,
> You mean the below.
> Ok to push?

looks good,

Reviewed-by: Dave Airlie 

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


Re: [Mesa-dev] [PATCH] mesa: Remove unused variables left over from 107ae27e57d.

2015-04-05 Thread Mathias Fröhlich

David,

On Sunday, April 05, 2015 17:37:17 Dave Airlie wrote:
> looks good,
> 
> Reviewed-by: Dave Airlie 
Thanks and pushed.

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


Re: [Mesa-dev] [PATCH 3/3] i965: Make sure GS output streams 1-3 aren't rasterized on Haswell+.

2015-04-05 Thread Pohjolainen, Topi
On Sat, Apr 04, 2015 at 03:46:33AM -0700, Kenneth Graunke wrote:
> Presumably no one has noticed this breakage because
> ARB_transform_feedback3 isn't exposed on Haswell due to the ongoing
> command streamer shenanigans, and ARB_gpu_shader5 isn't exposed on
> Broadwell because we keep forgetting about it.
> 
> Fixes 3 Piglit tests:
> - spec/arb_gpu_shader5/emitstreamvertex_nodraw
> - spec/arb_gpu_shader5/xfb-streams
> - spec/arb_transform_feedback3/ext_interleaved_two_bufs_gs_max
> 
> Signed-off-by: Kenneth Graunke 
> Cc: mesa-sta...@lists.freedesktop.org
> ---
>  src/mesa/drivers/dri/i965/gen7_sol_state.c | 21 +
>  src/mesa/drivers/dri/i965/gen8_sol_state.c | 20 
>  2 files changed, 41 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c 
> b/src/mesa/drivers/dri/i965/gen7_sol_state.c
> index 7e9b285..50aff14 100644
> --- a/src/mesa/drivers/dri/i965/gen7_sol_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c
> @@ -223,6 +223,24 @@ upload_3dstate_streamout(struct brw_context *brw, bool 
> active,
> uint32_t dw1 = 0, dw2 = 0;
> int i;
>  
> +   /* On Haswell, enable the stream out function if the geometry shader uses
> +* multiple streams, even if transform feedback is inactive.  This is
> +* required to prevent streams 1-3 from being rasterized.
> +*
> +* From the Haswell PRM, "Command Reference: Instructions", Page 797
> +* (3DSTATE_STREAMOUT DWord 1 bits 28:27 "Render Stream Select"):
> +*
> +* "[DevHSW+] SO Function Enable must also be ENABLED in order for this
> +*  field to select a stream for rendering.  When SO Function Enable is
> +*  DISABLED and Render Disable is cleared (i.e., rendering is enabled),
> +*  StreamID is ignored downstream of the SO stage, allowing any stream
> +*  to be rendered."
> +*
> +* BRW_NEW_GEOMETRY_PROGRAM
> +*/
> +   if (brw->is_haswell && brw->geometry_program && 
> brw->geometry_program->UsesStreams)

Just caught my eye, this is overflowing 80 columns in case you haven't
pushed yet.

> +  dw1 |= SO_FUNCTION_ENABLE;
> +
> if (active) {
>int urb_entry_read_offset = 0;
>int urb_entry_read_length = (vue_map->num_slots + 1) / 2 -
> @@ -282,6 +300,8 @@ upload_sol_state(struct brw_context *brw)
>  * the nonpipelined SOL state (3DSTATE_SO_BUFFER, 3DSTATE_SO_DECL_LIST) or
>  * MMIO register updates (current performed by the kernel at each batch
>  * emit).
> +*
> +* BRW_NEW_GEOMETRY_PROGRAM
>  */
> upload_3dstate_streamout(brw, active, &brw->vue_map_geom_out);
>  }
> @@ -290,6 +310,7 @@ const struct brw_tracked_state gen7_sol_state = {
> .dirty = {
>.mesa  = _NEW_LIGHT,
>.brw   = BRW_NEW_BATCH |
> +   BRW_NEW_GEOMETRY_PROGRAM |
> BRW_NEW_VUE_MAP_GEOM_OUT |
> BRW_NEW_TRANSFORM_FEEDBACK,
> },
> diff --git a/src/mesa/drivers/dri/i965/gen8_sol_state.c 
> b/src/mesa/drivers/dri/i965/gen8_sol_state.c
> index d98a226..4b2f377 100644
> --- a/src/mesa/drivers/dri/i965/gen8_sol_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_sol_state.c
> @@ -109,6 +109,24 @@ gen8_upload_3dstate_streamout(struct brw_context *brw, 
> bool active,
>&xfb_obj->shader_program->LinkedTransformFeedback;
> uint32_t dw1 = 0, dw2 = 0, dw3 = 0, dw4 = 0;
>  
> +   /* Enable the stream out function if the geometry shader uses multiple
> +* streams, even if transform feedback is inactive.  This is required
> +* to prevent streams 1-3 from being rasterized.
> +*
> +* From the Haswell PRM, "Command Reference: Instructions", Page 797
> +* (3DSTATE_STREAMOUT DWord 1 bits 28:27 "Render Stream Select"):
> +*
> +* "[DevHSW+] SO Function Enable must also be ENABLED in order for this
> +*  field to select a stream for rendering.  When SO Function Enable is
> +*  DISABLED and Render Disable is cleared (i.e., rendering is enabled),
> +*  StreamID is ignored downstream of the SO stage, allowing any stream
> +*  to be rendered."
> +*
> +* BRW_NEW_GEOMETRY_PROGRAM
> +*/
> +   if (brw->geometry_program && brw->geometry_program->UsesStreams)
> +  dw1 |= SO_FUNCTION_ENABLE;
> +
> if (active) {
>int urb_entry_read_offset = 0;
>int urb_entry_read_length = (vue_map->num_slots + 1) / 2 -
> @@ -170,6 +188,7 @@ upload_sol_state(struct brw_context *brw)
>gen7_upload_3dstate_so_decl_list(brw, &brw->vue_map_geom_out);
> }
>  
> +   /* BRW_NEW_GEOMETRY_PROGRAM */
> gen8_upload_3dstate_streamout(brw, active, &brw->vue_map_geom_out);
>  }
>  
> @@ -177,6 +196,7 @@ const struct brw_tracked_state gen8_sol_state = {
> .dirty = {
>.mesa  = _NEW_LIGHT,
>.brw   = BRW_NEW_BATCH |
> +   BRW_NEW_GEOMETRY_PROGRAM |
> BRW_NEW_TRANSFORM_FEEDBACK |
> BRW_NEW_VUE_MAP_GEOM_OUT,
> },
> -- 
> 2.3.4
> 
> 

Re: [Mesa-dev] [PATCH 2/3] i965: Add forgotten multi-stream code to Gen8 SOL state.

2015-04-05 Thread Pohjolainen, Topi
On Sat, Apr 04, 2015 at 03:46:32AM -0700, Kenneth Graunke wrote:
> Fixes Piglit's arb_gpu_shader5-xfb-streams-without-invocations.
> 
> Signed-off-by: Kenneth Graunke 
> Cc: mesa-sta...@lists.freedesktop.org
> ---
>  src/mesa/drivers/dri/i965/gen8_sol_state.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen8_sol_state.c 
> b/src/mesa/drivers/dri/i965/gen8_sol_state.c
> index 1f122ec..d98a226 100644
> --- a/src/mesa/drivers/dri/i965/gen8_sol_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_sol_state.c
> @@ -128,6 +128,15 @@ gen8_upload_3dstate_streamout(struct brw_context *brw, 
> bool active,
>dw2 |= urb_entry_read_offset << SO_STREAM_0_VERTEX_READ_OFFSET_SHIFT;
>dw2 |= (urb_entry_read_length - 1) << 
> SO_STREAM_0_VERTEX_READ_LENGTH_SHIFT;
>  
> +  dw2 |= urb_entry_read_offset << SO_STREAM_1_VERTEX_READ_OFFSET_SHIFT;

Can we use SET_FIELD() instead? I know the original code isn't using it
either but I thought we aimed in some point moving to using it instead:

 dw2 |= SET_FIELD(urb_entry_read_offset, 
SO_STREAM_0_VERTEX_READ_OFFSET);

> +  dw2 |= (urb_entry_read_length - 1) << 
> SO_STREAM_1_VERTEX_READ_LENGTH_SHIFT;
> +
> +  dw2 |= urb_entry_read_offset << SO_STREAM_2_VERTEX_READ_OFFSET_SHIFT;
> +  dw2 |= (urb_entry_read_length - 1) << 
> SO_STREAM_2_VERTEX_READ_LENGTH_SHIFT;
> +
> +  dw2 |= urb_entry_read_offset << SO_STREAM_3_VERTEX_READ_OFFSET_SHIFT;
> +  dw2 |= (urb_entry_read_length - 1) << 
> SO_STREAM_3_VERTEX_READ_LENGTH_SHIFT;
> +
>/* Set buffer pitches; 0 means unbound. */
>if (xfb_obj->Buffers[0])
>   dw3 |= linked_xfb_info->BufferStride[0] * 4;
> -- 
> 2.3.4
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] st/mesa: improve ARB_texture_stencil8 support

2015-04-05 Thread Marek Olšák
From: Marek Olšák 

1) Try selecting X24S8 and S8X24 first.
2) Make sure depth-stencil formats are always renderable.

r600g and radeonsi don't support S8 for rendering. Actually, they don't even
support X24S8 and S8X24, but we can fix that later.
---
 src/mesa/state_tracker/st_format.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 72dbf3b..26c7da4 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -1167,8 +1167,8 @@ static const struct format_mapping format_map[] = {
   { GL_STENCIL_INDEX, GL_STENCIL_INDEX1_EXT, GL_STENCIL_INDEX4_EXT,
 GL_STENCIL_INDEX8_EXT, GL_STENCIL_INDEX16_EXT, 0 },
   {
- PIPE_FORMAT_S8_UINT, PIPE_FORMAT_Z24_UNORM_S8_UINT,
- PIPE_FORMAT_S8_UINT_Z24_UNORM, 0
+ PIPE_FORMAT_S8_UINT, PIPE_FORMAT_X24S8_UINT, PIPE_FORMAT_S8X24_UINT,
+ PIPE_FORMAT_Z24_UNORM_S8_UINT, PIPE_FORMAT_S8_UINT_Z24_UNORM, 0
   }
},
 
@@ -1942,11 +1942,6 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum 
target,
GLint internalFormat,
GLenum format, GLenum type)
 {
-   const boolean want_renderable =
-  internalFormat == 3 || internalFormat == 4 ||
-  internalFormat == GL_RGB || internalFormat == GL_RGBA ||
-  internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
-  internalFormat == GL_BGRA;
struct st_context *st = st_context(ctx);
enum pipe_format pFormat;
unsigned bindings;
@@ -1962,15 +1957,17 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum 
target,
}
 
/* GL textures may wind up being render targets, but we don't know
-* that in advance.  Specify potential render target flags now.
+* that in advance.  Specify potential render target flags for formats
+* that we know should always be renderable.
 */
bindings = PIPE_BIND_SAMPLER_VIEW;
-   if (want_renderable) {
-  if (_mesa_is_depth_or_stencil_format(internalFormat))
-bindings |= PIPE_BIND_DEPTH_STENCIL;
-  else
-bindings |= PIPE_BIND_RENDER_TARGET;
-   }
+   if (_mesa_is_depth_or_stencil_format(internalFormat))
+  bindings |= PIPE_BIND_DEPTH_STENCIL;
+   else if (internalFormat == 3 || internalFormat == 4 ||
+internalFormat == GL_RGB || internalFormat == GL_RGBA ||
+internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+internalFormat == GL_BGRA)
+  bindings |= PIPE_BIND_RENDER_TARGET;
 
/* GLES allows the driver to choose any format which matches
 * the format+type combo, because GLES only supports unsized internal
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 4/4] docs: mark off texture_stencil8

2015-04-05 Thread Marek Olšák
This is always enabled when ARB_stencil_texturing is enabled, so I
think the ARB_stencil_texturing driver support list should be copied.

Other than that, the series is:

Reviewed-by: Marek Olšák 

I've sent an additional patch which improves some bits.

Marek

On Sun, Apr 5, 2015 at 8:48 AM, Dave Airlie  wrote:
> add it to the GL3.txt, I've only enabled
> it for r600, but I think it should be fine on
> radeonsi, nv50, nvc0 and I think i965 enabling
> should only be a line or two.
>
> Signed-off-by: Dave Airlie 
> ---
>  docs/GL3.txt  | 2 +-
>  docs/relnotes/10.6.0.html | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/docs/GL3.txt b/docs/GL3.txt
> index 456d76b..74fe952 100644
> --- a/docs/GL3.txt
> +++ b/docs/GL3.txt
> @@ -182,7 +182,7 @@ GL 4.4, GLSL 4.40:
>GL_ARB_multi_bindDONE (all drivers)
>GL_ARB_query_buffer_object   not started
>GL_ARB_texture_mirror_clamp_to_edge  DONE (i965, nv50, 
> nvc0, r600, radeonsi, llvmpipe, softpipe)
> -  GL_ARB_texture_stencil8  not started
> +  GL_ARB_texture_stencil8  DONE (r600)
>GL_ARB_vertex_type_10f_11f_11f_rev   DONE (i965, nv50, 
> nvc0, r600, radeonsi, llvmpipe, softpipe)
>
>  GL 4.5, GLSL 4.50:
> diff --git a/docs/relnotes/10.6.0.html b/docs/relnotes/10.6.0.html
> index 2378e3d..1500792 100644
> --- a/docs/relnotes/10.6.0.html
> +++ b/docs/relnotes/10.6.0.html
> @@ -52,6 +52,7 @@ Note: some of the new features are only available with 
> certain drivers.
>  GL_ARB_pipeline_statistics_query on i965, nv50, nvc0, r600, radeonsi, 
> softpipe
>  GL_EXT_draw_buffers2 on freedreno
>  GL_ARB_clip_control on i965
> +GL_ARB_texture_stencil8 on r600
>  
>
>  Bug fixes
> --
> 1.9.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa/teximage: use correct extension for accept stencil texture.

2015-04-05 Thread Ilia Mirkin
While this change is correct, the Intel guys will yell at you, because
they're somehow misusing this in meta for Broadwell, s.t. this will
cause crashes when blitting stencil. IMHO that's a problem that should
be fixed in their driver and this can go on, but... it's also not my
driver that's crashing -- they might feel differently :)

Reviewed-by: Ilia Mirkin 

On Sun, Apr 5, 2015 at 2:48 AM, Dave Airlie  wrote:
> This was using the wrong extension, ARB_stencil_texturing
> doesn't mention any changes in this area.
>
> Signed-off-by: Dave Airlie 
> ---
>  src/mesa/main/teximage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 8d9d7cf..36e0b56 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -222,7 +222,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint 
> internalFormat )
>}
> }
>
> -   if (ctx->Extensions.ARB_stencil_texturing) {
> +   if (ctx->Extensions.ARB_texture_stencil8) {
>switch (internalFormat) {
>case GL_STENCIL_INDEX:
>case GL_STENCIL_INDEX1:
> --
> 1.9.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] st/mesa: add ARB_texture_stencil8 enable

2015-04-05 Thread Ilia Mirkin
On Sun, Apr 5, 2015 at 2:48 AM, Dave Airlie  wrote:
> if we support stencil texturing, enable texture_stencil8
> there is no requirement to support native S8 for this,
> the texture can be converted to x24s8 fine.
>
> Signed-off-by: Dave Airlie 
> ---
>  src/mesa/state_tracker/st_extensions.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c 
> b/src/mesa/state_tracker/st_extensions.c
> index bc20f73..1867bf3 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -502,6 +502,8 @@ void st_init_extensions(struct pipe_screen *screen,
>{ { o(ARB_depth_buffer_float) },
>  { PIPE_FORMAT_Z32_FLOAT,
>PIPE_FORMAT_Z32_FLOAT_S8X24_UINT } },
> +  { { o(ARB_texture_stencil8) },
> +{ PIPE_FORMAT_S8_UINT } },
> };
>
> /* Required: sampler support */
> @@ -558,7 +560,8 @@ void st_init_extensions(struct pipe_screen *screen,
>
>{ { o(ARB_stencil_texturing) },
>  { PIPE_FORMAT_X24S8_UINT,
> -  PIPE_FORMAT_S8X24_UINT },
> +  PIPE_FORMAT_S8X24_UINT,
> +  PIPE_FORMAT_S8_UINT },

S8_UINT has nothing to do with ARB_stencil_texturing -- that's just
about packed depth stencil.

>  GL_TRUE }, /* at least one format must be supported */
> };
>
> @@ -650,6 +653,9 @@ void st_init_extensions(struct pipe_screen *screen,
>ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
>PIPE_BIND_VERTEX_BUFFER);
>
> +   if (extensions->ARB_stencil_texturing)
> +  extensions->ARB_texture_stencil8 = GL_TRUE;

Where do you set texobj->StencilTexturing = true to support this?

> +
> /* Figure out GLSL support. */
> glsl_feature_level = screen->get_param(screen, 
> PIPE_CAP_GLSL_FEATURE_LEVEL);
>
> --
> 1.9.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] st/mesa: add ARB_texture_stencil8 enable

2015-04-05 Thread Ilia Mirkin
On Sun, Apr 5, 2015 at 8:52 AM, Ilia Mirkin  wrote:
> On Sun, Apr 5, 2015 at 2:48 AM, Dave Airlie  wrote:
>> if we support stencil texturing, enable texture_stencil8
>> there is no requirement to support native S8 for this,
>> the texture can be converted to x24s8 fine.
>>
>> Signed-off-by: Dave Airlie 
>> ---
>>  src/mesa/state_tracker/st_extensions.c | 8 +++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/state_tracker/st_extensions.c 
>> b/src/mesa/state_tracker/st_extensions.c
>> index bc20f73..1867bf3 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -502,6 +502,8 @@ void st_init_extensions(struct pipe_screen *screen,
>>{ { o(ARB_depth_buffer_float) },
>>  { PIPE_FORMAT_Z32_FLOAT,
>>PIPE_FORMAT_Z32_FLOAT_S8X24_UINT } },
>> +  { { o(ARB_texture_stencil8) },
>> +{ PIPE_FORMAT_S8_UINT } },
>> };
>>
>> /* Required: sampler support */
>> @@ -558,7 +560,8 @@ void st_init_extensions(struct pipe_screen *screen,
>>
>>{ { o(ARB_stencil_texturing) },
>>  { PIPE_FORMAT_X24S8_UINT,
>> -  PIPE_FORMAT_S8X24_UINT },
>> +  PIPE_FORMAT_S8X24_UINT,
>> +  PIPE_FORMAT_S8_UINT },
>
> S8_UINT has nothing to do with ARB_stencil_texturing -- that's just
> about packed depth stencil.
>
>>  GL_TRUE }, /* at least one format must be supported */
>> };
>>
>> @@ -650,6 +653,9 @@ void st_init_extensions(struct pipe_screen *screen,
>>ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
>>PIPE_BIND_VERTEX_BUFFER);
>>
>> +   if (extensions->ARB_stencil_texturing)
>> +  extensions->ARB_texture_stencil8 = GL_TRUE;
>
> Where do you set texobj->StencilTexturing = true to support this?

Also don't you need to manually disable e.g. the depth test, since
gallium will be receiving a Z24S8 texture.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89905] scons build broken on 10.5.2 due to activated vega st

2015-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89905

--- Comment #4 from Emil Velikov  ---
Using autotools for Haiku should not be that hard/messy nowadays. Do give it a
shot and let me know if there are any problems.

On the scons question - looking at the way things are going, it seems unlikely
for scons to become the main one.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa/teximage: use correct extension for accept stencil texture.

2015-04-05 Thread Pohjolainen, Topi
On Sun, Apr 05, 2015 at 08:46:16AM -0400, Ilia Mirkin wrote:
> While this change is correct, the Intel guys will yell at you, because
> they're somehow misusing this in meta for Broadwell, s.t. this will
> cause crashes when blitting stencil. IMHO that's a problem that should
> be fixed in their driver and this can go on, but... it's also not my
> driver that's crashing -- they might feel differently :)

As far as I can tell we only do:

   _mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
   GL_STENCIL_INDEX);

which suppose to be the right thing to do - we select the stencil to be
sampled instead of depth. And this won't hit the path below. I made the
change locally and I'm now running piglit on broadwell.

I noticed that _mesa_base_tex_format() is in turn used in

src/mesa/drivers/common/meta_blit.c

but we shouldn't go there with intel driver ever. On hardware older than
broadwell we don't use meta and the one used on broadwell and newer
is found in:

src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c

But lets see what piglit says.

> 
> Reviewed-by: Ilia Mirkin 
> 
> On Sun, Apr 5, 2015 at 2:48 AM, Dave Airlie  wrote:
> > This was using the wrong extension, ARB_stencil_texturing
> > doesn't mention any changes in this area.
> >
> > Signed-off-by: Dave Airlie 
> > ---
> >  src/mesa/main/teximage.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> > index 8d9d7cf..36e0b56 100644
> > --- a/src/mesa/main/teximage.c
> > +++ b/src/mesa/main/teximage.c
> > @@ -222,7 +222,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint 
> > internalFormat )
> >}
> > }
> >
> > -   if (ctx->Extensions.ARB_stencil_texturing) {
> > +   if (ctx->Extensions.ARB_texture_stencil8) {
> >switch (internalFormat) {
> >case GL_STENCIL_INDEX:
> >case GL_STENCIL_INDEX1:
> > --
> > 1.9.3
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89905] scons build broken on 10.5.2 due to activated vega st

2015-04-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89905

--- Comment #5 from Emil Velikov  ---
Alexander, can you give this [1] tarball a try. Would love to have a release
that one can use under Haiku ;-)

[1] http://people.freedesktop.org/~evelikov/fdo89905/mesa-10.5.2.tar.gz

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa/teximage: use correct extension for accept stencil texture.

2015-04-05 Thread Pohjolainen, Topi
On Sun, Apr 05, 2015 at 08:06:50PM +0300, Pohjolainen, Topi wrote:
> On Sun, Apr 05, 2015 at 08:46:16AM -0400, Ilia Mirkin wrote:
> > While this change is correct, the Intel guys will yell at you, because
> > they're somehow misusing this in meta for Broadwell, s.t. this will
> > cause crashes when blitting stencil. IMHO that's a problem that should
> > be fixed in their driver and this can go on, but... it's also not my
> > driver that's crashing -- they might feel differently :)
> 
> As far as I can tell we only do:
> 
>_mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
>GL_STENCIL_INDEX);
> 
> which suppose to be the right thing to do - we select the stencil to be
> sampled instead of depth. And this won't hit the path below. I made the
> change locally and I'm now running piglit on broadwell.
> 
> I noticed that _mesa_base_tex_format() is in turn used in
> 
> src/mesa/drivers/common/meta_blit.c
> 
> but we shouldn't go there with intel driver ever. On hardware older than
> broadwell we don't use meta and the one used on broadwell and newer
> is found in:
> 
> src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
> 
> But lets see what piglit says.

Right you are. This is more subtle, we will hit it when we actually create
a temporary texture out of the given read renderbuffer. It seems that this
was hit first time when formats where adjusted and then Jason added the
conditional using ARB_stencil_texturing (which is not right either).

Really sorry that this is hindering your work now. I'll try to take a look
at this tomorrow.

> 
> > 
> > Reviewed-by: Ilia Mirkin 
> > 
> > On Sun, Apr 5, 2015 at 2:48 AM, Dave Airlie  wrote:
> > > This was using the wrong extension, ARB_stencil_texturing
> > > doesn't mention any changes in this area.
> > >
> > > Signed-off-by: Dave Airlie 
> > > ---
> > >  src/mesa/main/teximage.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> > > index 8d9d7cf..36e0b56 100644
> > > --- a/src/mesa/main/teximage.c
> > > +++ b/src/mesa/main/teximage.c
> > > @@ -222,7 +222,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint 
> > > internalFormat )
> > >}
> > > }
> > >
> > > -   if (ctx->Extensions.ARB_stencil_texturing) {
> > > +   if (ctx->Extensions.ARB_texture_stencil8) {
> > >switch (internalFormat) {
> > >case GL_STENCIL_INDEX:
> > >case GL_STENCIL_INDEX1:
> > > --
> > > 1.9.3
> > >
> > > ___
> > > mesa-dev mailing list
> > > mesa-dev@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] nv50, nvc0: limit the y-tiling of 3d textures to the first level's tiling

2015-04-05 Thread Ilia Mirkin
For some reason we limit y-tiling to 0x20 when depth is involved.
However the function is run for each miplevel, and it appears that you
can't have higher tiling for a smaller miplevel than a larger miplevel.
So when we detect the condtion, limit the height passed to the tiling
function appropriately.

Fixes:
  texelFetch fs sampler3D 98x129x1-98x129x9

Signed-off-by: Ilia Mirkin 
---

This still needs a full piglit run, both on nvc0 and nv50. An
alternative solution is not to limit y-tiling, but presumably it was
done for a reason. joi points out it was added in 040e1d008 -- perhaps
there was no good reason.

 src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 5 -
 src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c 
b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
index 2e41091..0837698 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
@@ -304,7 +304,10 @@ nv50_miptree_init_layout_tiled(struct nv50_miptree *mt)
 
   lvl->offset = mt->total_size;
 
-  lvl->tile_mode = nv50_tex_choose_tile_dims(nbx, nby, d);
+  if (mt->layout_3d && d == 1 && l > 0 && pt->depth0 > 1)
+ lvl->tile_mode = nv50_tex_choose_tile_dims(nbx, MIN2(nby, 16), d);
+  else
+ lvl->tile_mode = nv50_tex_choose_tile_dims(nbx, nby, d);
 
   tsx = NV50_TILE_SIZE_X(lvl->tile_mode); /* x is tile row pitch in bytes 
*/
   tsy = NV50_TILE_SIZE_Y(lvl->tile_mode);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
index 1beda7d..25ce6bd 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -211,7 +211,10 @@ nvc0_miptree_init_layout_tiled(struct nv50_miptree *mt)
 
   lvl->offset = mt->total_size;
 
-  lvl->tile_mode = nvc0_tex_choose_tile_dims(nbx, nby, d);
+  if (mt->layout_3d && d == 1 && l > 0 && pt->depth0 > 1)
+ lvl->tile_mode = nvc0_tex_choose_tile_dims(nbx, MIN2(nby, 32), d);
+  else
+ lvl->tile_mode = nvc0_tex_choose_tile_dims(nbx, nby, d);
 
   tsx = NVC0_TILE_SIZE_X(lvl->tile_mode); /* x is tile row pitch in bytes 
*/
   tsy = NVC0_TILE_SIZE_Y(lvl->tile_mode);
-- 
2.0.5

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


[Mesa-dev] [PATCH v2] nv50, nvc0: limit the y-tiling of 3d textures to the first level's tiling

2015-04-05 Thread Ilia Mirkin
We limit y-tiling to 0x20 when depth is involved. However the function is
run for each miplevel, and the hardware expects miplevel 0 to have the
highest tiling settings. Perform the y-tiling limit on all levels of a
3d texture, not just the ones that have depth.

Fixes:
  texelFetch fs sampler3D 98x129x1-98x129x9

Signed-off-by: Ilia Mirkin 
---

v2: rework to make the dims calculation take an extra argument
instead. This will change the tiling for depth==1 3d textures, but I
can't bring myself to care.

 src/gallium/drivers/nouveau/nv50/nv50_miptree.c  | 14 --
 src/gallium/drivers/nouveau/nv50/nv50_resource.h |  3 ++-
 src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c  |  6 +++---
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c 
b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
index 2e41091..744a3a5 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
@@ -29,7 +29,8 @@
 #include "nv50/nv50_resource.h"
 
 uint32_t
-nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz)
+nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz,
+ boolean is_3d)
 {
uint32_t tile_mode = 0x000;
 
@@ -41,7 +42,7 @@ nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, 
unsigned nz)
else
if (ny >  8) tile_mode = 0x010; /* height 16 tiles */
 
-   if (nz == 1)
+   if (!is_3d)
   return tile_mode;
else
   if (tile_mode > 0x020)
@@ -52,14 +53,15 @@ nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, 
unsigned nz)
if (nz > 8) return tile_mode | 0x400; /* depth 16 tiles */
if (nz > 4) return tile_mode | 0x300; /* depth 8 tiles */
if (nz > 2) return tile_mode | 0x200; /* depth 4 tiles */
+   if (nz > 1) return tile_mode | 0x100; /* depth 2 tiles */
 
-   return tile_mode | 0x100;
+   return tile_mode;
 }
 
 static uint32_t
-nv50_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
+nv50_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz, boolean is_3d)
 {
-   return nv50_tex_choose_tile_dims_helper(nx, ny * 2, nz);
+   return nv50_tex_choose_tile_dims_helper(nx, ny * 2, nz, is_3d);
 }
 
 static uint32_t
@@ -304,7 +306,7 @@ nv50_miptree_init_layout_tiled(struct nv50_miptree *mt)
 
   lvl->offset = mt->total_size;
 
-  lvl->tile_mode = nv50_tex_choose_tile_dims(nbx, nby, d);
+  lvl->tile_mode = nv50_tex_choose_tile_dims(nbx, nby, d, mt->layout_3d);
 
   tsx = NV50_TILE_SIZE_X(lvl->tile_mode); /* x is tile row pitch in bytes 
*/
   tsy = NV50_TILE_SIZE_Y(lvl->tile_mode);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.h 
b/src/gallium/drivers/nouveau/nv50/nv50_resource.h
index c06daa3..36d70d8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_resource.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.h
@@ -34,7 +34,8 @@ nv50_screen_init_resource_functions(struct pipe_screen 
*pscreen);
 #endif /* __NVC0_RESOURCE_H__ */
 
 uint32_t
-nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz);
+nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz,
+ boolean is_3d);
 
 struct nv50_miptree_level {
uint32_t offset;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
index 1beda7d..fc75fc6 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -29,9 +29,9 @@
 #include "nvc0/nvc0_resource.h"
 
 static uint32_t
-nvc0_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
+nvc0_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz, boolean is_3d)
 {
-   return nv50_tex_choose_tile_dims_helper(nx, ny, nz);
+   return nv50_tex_choose_tile_dims_helper(nx, ny, nz, is_3d);
 }
 
 static uint32_t
@@ -211,7 +211,7 @@ nvc0_miptree_init_layout_tiled(struct nv50_miptree *mt)
 
   lvl->offset = mt->total_size;
 
-  lvl->tile_mode = nvc0_tex_choose_tile_dims(nbx, nby, d);
+  lvl->tile_mode = nvc0_tex_choose_tile_dims(nbx, nby, d, mt->layout_3d);
 
   tsx = NVC0_TILE_SIZE_X(lvl->tile_mode); /* x is tile row pitch in bytes 
*/
   tsy = NVC0_TILE_SIZE_Y(lvl->tile_mode);
-- 
2.0.5

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


Re: [Mesa-dev] [PATCH] st/mesa: improve ARB_texture_stencil8 support

2015-04-05 Thread Dave Airlie
On 5 April 2015 at 21:42, Marek Olšák  wrote:
> From: Marek Olšák 
>
> 1) Try selecting X24S8 and S8X24 first.
> 2) Make sure depth-stencil formats are always renderable.

Does any hw support S8 for rendering at all do you know? (anyone else)

I'd assume you'd want to use S8 if you had texture and render for it
since it would take up less memory, but I suppose we can cross that
bridge when we get to it.

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


[Mesa-dev] [PATCH 4/4] docs: mark off texture_stencil8 (v2)

2015-04-05 Thread Dave Airlie
copy drivers from the stencil_texturing list,
softpipe is definitely broken for stencil texturing
since it uses float, but I'll look at that later.

Signed-off-by: Dave Airlie 
---
 docs/GL3.txt  | 2 +-
 docs/relnotes/10.6.0.html | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 456d76b..4e672f1 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -182,7 +182,7 @@ GL 4.4, GLSL 4.40:
   GL_ARB_multi_bindDONE (all drivers)
   GL_ARB_query_buffer_object   not started
   GL_ARB_texture_mirror_clamp_to_edge  DONE (i965, nv50, nvc0, 
r600, radeonsi, llvmpipe, softpipe)
-  GL_ARB_texture_stencil8  not started
+  GL_ARB_texture_stencil8  DONE (nv50, nvc0, r600, 
radeonsi, llvmpipe, softpipe)
   GL_ARB_vertex_type_10f_11f_11f_rev   DONE (i965, nv50, nvc0, 
r600, radeonsi, llvmpipe, softpipe)
 
 GL 4.5, GLSL 4.50:
diff --git a/docs/relnotes/10.6.0.html b/docs/relnotes/10.6.0.html
index f69266a..beee166 100644
--- a/docs/relnotes/10.6.0.html
+++ b/docs/relnotes/10.6.0.html
@@ -53,6 +53,7 @@ Note: some of the new features are only available with 
certain drivers.
 GL_ARB_uniform_buffer_object on freedreno
 GL_EXT_draw_buffers2 on freedreno
 GL_ARB_clip_control on i965
+GL_ARB_texture_stencil8 on r600
 
 
 Bug fixes
-- 
2.3.4

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


[Mesa-dev] [PATCH 3/4] st/mesa: add ARB_texture_stencil8 support (v2)

2015-04-05 Thread Dave Airlie
if we support stencil texturing, enable texture_stencil8
there is no requirement to support native S8 for this,
the texture can be converted to x24s8 fine.

v2: fold fixes from Marek in:
   a) put S8 last in the list
   b) fix renderable to always test for d/s renderable
fixup the texture case to use a stencil only format
for picking the format for the texture view.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_atom_texture.c | 14 ++
 src/mesa/state_tracker/st_extensions.c   |  3 +++
 src/mesa/state_tracker/st_format.c   | 23 ++-
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_texture.c 
b/src/mesa/state_tracker/st_atom_texture.c
index eff28fc..04ba864 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -287,16 +287,22 @@ st_get_texture_sampler_view_from_stobj(struct st_context 
*st,
   enum pipe_format format)
 {
struct pipe_sampler_view **sv;
-
+   const struct st_texture_image *firstImage;
if (!stObj || !stObj->pt) {
   return NULL;
}
 
sv = st_texture_get_sampler_view(st, stObj);
 
-   if (stObj->base.StencilSampling &&
-   util_format_is_depth_and_stencil(format))
-  format = util_format_stencil_only(format);
+   if (util_format_is_depth_and_stencil(format)) {
+  if (stObj->base.StencilSampling)
+ format = util_format_stencil_only(format);
+  else {
+ firstImage = 
st_texture_image_const(_mesa_base_tex_image(&stObj->base));
+ if (firstImage->base._BaseFormat == GL_STENCIL_INDEX)
+format = util_format_stencil_only(format);
+  }
+   }
 
/* if sampler view has changed dereference it */
if (*sv) {
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index bc20f73..25932dd 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -650,6 +650,9 @@ void st_init_extensions(struct pipe_screen *screen,
   ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
   PIPE_BIND_VERTEX_BUFFER);
 
+   if (extensions->ARB_stencil_texturing)
+  extensions->ARB_texture_stencil8 = GL_TRUE;
+
/* Figure out GLSL support. */
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
 
diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 72dbf3b..b9afb91 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -1167,8 +1167,8 @@ static const struct format_mapping format_map[] = {
   { GL_STENCIL_INDEX, GL_STENCIL_INDEX1_EXT, GL_STENCIL_INDEX4_EXT,
 GL_STENCIL_INDEX8_EXT, GL_STENCIL_INDEX16_EXT, 0 },
   {
- PIPE_FORMAT_S8_UINT, PIPE_FORMAT_Z24_UNORM_S8_UINT,
- PIPE_FORMAT_S8_UINT_Z24_UNORM, 0
+ PIPE_FORMAT_Z24_UNORM_S8_UINT,
+ PIPE_FORMAT_S8_UINT_Z24_UNORM, PIPE_FORMAT_S8_UINT, 0
   }
},
 
@@ -1942,11 +1942,6 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum 
target,
GLint internalFormat,
GLenum format, GLenum type)
 {
-   const boolean want_renderable =
-  internalFormat == 3 || internalFormat == 4 ||
-  internalFormat == GL_RGB || internalFormat == GL_RGBA ||
-  internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
-  internalFormat == GL_BGRA;
struct st_context *st = st_context(ctx);
enum pipe_format pFormat;
unsigned bindings;
@@ -1962,15 +1957,17 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum 
target,
}
 
/* GL textures may wind up being render targets, but we don't know
-* that in advance.  Specify potential render target flags now.
+* that in advance.  Specify potential render target flags now for formats
+* that we know should always be renderable.
 */
bindings = PIPE_BIND_SAMPLER_VIEW;
-   if (want_renderable) {
-  if (_mesa_is_depth_or_stencil_format(internalFormat))
-bindings |= PIPE_BIND_DEPTH_STENCIL;
-  else
+   if (_mesa_is_depth_or_stencil_format(internalFormat))
+  bindings |= PIPE_BIND_DEPTH_STENCIL;
+   else if (internalFormat == 3 || internalFormat == 4 ||
+internalFormat == GL_RGB || internalFormat == GL_RGBA ||
+internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+internalFormat == GL_BGRA)
 bindings |= PIPE_BIND_RENDER_TARGET;
-   }
 
/* GLES allows the driver to choose any format which matches
 * the format+type combo, because GLES only supports unsized internal
-- 
2.3.4

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


[Mesa-dev] [PATCH 1/4] mesa/teximage: use correct extension for accept stencil texture.

2015-04-05 Thread Dave Airlie
This was using the wrong extension, ARB_stencil_texturing
doesn't mention any changes in this area.

Signed-off-by: Dave Airlie 
---
 src/mesa/main/teximage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 8d9d7cf..36e0b56 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -222,7 +222,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint 
internalFormat )
   }
}
 
-   if (ctx->Extensions.ARB_stencil_texturing) {
+   if (ctx->Extensions.ARB_texture_stencil8) {
   switch (internalFormat) {
   case GL_STENCIL_INDEX:
   case GL_STENCIL_INDEX1:
-- 
2.3.4

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


[Mesa-dev] [PATCH 2/4] mesa: finish implementing ARB_texture_stencil8 (v2)

2015-04-05 Thread Dave Airlie
Parts of this were implemented previously, so finish it off.

v2: fix getteximage falling into the integer check
add fixes for the FBO paths, (fbo-stencil8 test).

Signed-off-by: Dave Airlie 
---
 src/mesa/main/extensions.c  | 1 +
 src/mesa/main/fbobject.c| 9 ++---
 src/mesa/main/texgetimage.c | 2 +-
 src/mesa/main/teximage.c| 3 ++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index f212015..eea1ade 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -185,6 +185,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_rectangle",   o(NV_texture_rectangle),
GL, 2004 },
{ "GL_ARB_texture_rgb10_a2ui",  o(ARB_texture_rgb10_a2ui),  
GL, 2009 },
{ "GL_ARB_texture_rg",  o(ARB_texture_rg),  
GL, 2008 },
+   { "GL_ARB_texture_stencil8",o(ARB_texture_stencil8),
GL, 2013 },
{ "GL_ARB_texture_storage", o(dummy_true),  
GL, 2011 },
{ "GL_ARB_texture_storage_multisample", o(ARB_texture_multisample), 
GL, 2012 },
{ "GL_ARB_texture_view",o(ARB_texture_view),
GL, 2012 },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8032585..27cf97f 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -813,8 +813,10 @@ test_attachment_completeness(const struct gl_context *ctx, 
GLenum format,
  if (ctx->Extensions.ARB_depth_texture &&
  baseFormat == GL_DEPTH_STENCIL) {
 /* OK */
- }
- else {
+ } else if (ctx->Extensions.ARB_texture_stencil8 &&
+baseFormat == GL_STENCIL_INDEX) {
+/* OK */
+ } else {
 /* no such thing as stencil-only textures */
 att_incomplete("illegal stencil texture");
 att->Complete = GL_FALSE;
@@ -978,7 +980,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
 
  if (!is_format_color_renderable(ctx, attFormat,
  texImg->InternalFormat) &&
- !is_legal_depth_format(ctx, f)) {
+ !is_legal_depth_format(ctx, f) &&
+ f != GL_STENCIL_INDEX) {
 fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 fbo_incomplete(ctx, "texture attachment incomplete", -1);
 return;
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 255d365..c93c1a2 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -879,7 +879,7 @@ getteximage_error_check(struct gl_context *ctx,
   "glGetTex%sImage(format mismatch)", suffix);
   return GL_TRUE;
}
-   else if (_mesa_is_enum_format_integer(format) !=
+   else if (!_mesa_is_stencil_format(format) && 
_mesa_is_enum_format_integer(format) !=
 _mesa_is_format_integer(texImage->TexFormat)) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
   "glGetTex%sImage(format mismatch)", suffix);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 36e0b56..faca801 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1997,7 +1997,8 @@ _mesa_legal_texture_base_format_for_target(struct 
gl_context *ctx,
const char *caller)
 {
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
-   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
+   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL
+   || _mesa_base_tex_format(ctx, internalFormat) == GL_STENCIL_INDEX) {
   /* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core
* Profile spec says:
*
-- 
2.3.4

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


Re: [Mesa-dev] [PATCH 4/4] i965: Implement SIMD16 texturing on Gen4.

2015-04-05 Thread Kenneth Graunke
On Saturday, April 04, 2015 04:28:49 PM Jordan Justen wrote:
> On 2015-04-04 01:23:28, Kenneth Graunke wrote:
> > This allows SIMD16 mode to work for a lot more programs.  Texturing is
> > also more efficient in SIMD16 mode than SIMD8.  Several messages don't
> > actually exist in SIMD8 mode, so we did SIMD16 messages and threw away
> > half of the data.  Now we compute real data in both halves.
> > 
> > Also, the SIMD16 "sample" message doesn't require all three coordinate
> > components to exist (like the SIMD8 one), so we can shorten the message
> > lengths, cutting register usage a bit.
> > 
> > I chose to implement the visitor functionality in a separate function,
> > since mixing true SIMD16 with SIMD8 code that uses SIMD16 fallbacks
> > seemed like a mess.  The new code bails on a few cases where we'd
> > have to do two SIMD8 messages - we just fall back to SIMD8 for now.
> > 
> > Improves performance in "Shadowrun: Dragonfall - Director's Cut" by
> > about 20% on GM45 (measured with LIBGL_SHOW_FPS=1 while standing around
> > in the first mission).
> > 
> > Signed-off-by: Kenneth Graunke 
> > ---
> >  src/mesa/drivers/dri/i965/brw_fs.h |  4 ++
> >  src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 28 ---
> >  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 68 
> > +-
> >  3 files changed, 90 insertions(+), 10 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
> > b/src/mesa/drivers/dri/i965/brw_fs.h
> > index 278a8ee..cfdbf55 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs.h
> > +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> > @@ -271,6 +271,10 @@ public:
> >fs_reg shadow_comp,
> >fs_reg lod, fs_reg lod2, int grad_components,
> >uint32_t sampler);
> > +   fs_inst *emit_texture_gen4_simd16(ir_texture_opcode op, fs_reg dst,
> > + fs_reg coordinate, int 
> > vector_elements,
> > + fs_reg shadow_c, fs_reg lod,
> > + uint32_t sampler);
> > fs_inst *emit_texture_gen5(ir_texture_opcode op, fs_reg dst,
> >fs_reg coordinate, int coord_components,
> >fs_reg shadow_comp,
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
> > b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> > index 40e51aa..2743297 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> > @@ -622,16 +622,26 @@ fs_generator::generate_tex(fs_inst *inst, struct 
> > brw_reg dst, struct brw_reg src
> >  /* Note that G45 and older determines shadow compare and dispatch 
> > width
> >   * from message length for most messages.
> >   */
> > -assert(dispatch_width == 8);
> > -msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE;
> > -if (inst->shadow_compare) {
> > -   assert(inst->mlen == 6);
> > -} else {
> > -   assert(inst->mlen <= 4);
> > -}
> > + if (dispatch_width == 8) {
> > +msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE;
> > +if (inst->shadow_compare) {
> > +   assert(inst->mlen == 6);
> > +} else {
> > +   assert(inst->mlen <= 4);
> > +}
> > + } else {
> > +if (inst->shadow_compare) {
> > +   msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE;
> > +   assert(inst->mlen == 9);
> > +} else {
> > +   msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE;
> > +   assert(inst->mlen <= 7 && inst->mlen % 2 == 1);
> > +}
> > + }
> >  break;
> >case FS_OPCODE_TXB:
> >  if (inst->shadow_compare) {
> > +assert(dispatch_width == 8);
> > assert(inst->mlen == 6);
> > msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_COMPARE;
> >  } else {
> > @@ -642,6 +652,7 @@ fs_generator::generate_tex(fs_inst *inst, struct 
> > brw_reg dst, struct brw_reg src
> >  break;
> >case SHADER_OPCODE_TXL:
> >  if (inst->shadow_compare) {
> > +assert(dispatch_width == 8);
> > assert(inst->mlen == 6);
> > msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_LOD_COMPARE;
> >  } else {
> > @@ -652,11 +663,12 @@ fs_generator::generate_tex(fs_inst *inst, struct 
> > brw_reg dst, struct brw_reg src
> >  break;
> >case SHADER_OPCODE_TXD:
> >  /* There is no sample_d_c message; comparisons are done manually */
> > + assert(dispatch_width == 8);
> >  assert(inst->mlen == 7 || inst->mlen == 10);
> >  msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS;
> >  break;
> >case SHADER_OPCODE_TXF:
> > -assert(inst->mlen == 9);
> > + assert(inst

Re: [Mesa-dev] [PATCH] st/mesa: improve ARB_texture_stencil8 support

2015-04-05 Thread Ilia Mirkin
On Sun, Apr 5, 2015 at 11:00 PM, Dave Airlie  wrote:
> On 5 April 2015 at 21:42, Marek Olšák  wrote:
>> From: Marek Olšák 
>>
>> 1) Try selecting X24S8 and S8X24 first.
>> 2) Make sure depth-stencil formats are always renderable.
>
> Does any hw support S8 for rendering at all do you know? (anyone else)
>
> I'd assume you'd want to use S8 if you had texture and render for it
> since it would take up less memory, but I suppose we can cross that
> bridge when we get to it.

FWIW I think that Adreno 3xx and 4xx should be able to do S8-only
rendering. I haven't tried it, but it does keep the stencil totally
separate for Z32 + S8 though (separate pointers to diff gmem locations
and all that).

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


Re: [Mesa-dev] [PATCH 2/4] mesa: finish implementing ARB_texture_stencil8

2015-04-05 Thread Kenneth Graunke
On Sunday, April 05, 2015 04:48:48 PM Dave Airlie wrote:
> Parts of this were implemented previously, so finish it off.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/mesa/main/extensions.c | 1 +
>  src/mesa/main/teximage.c   | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index f212015..eea1ade 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -185,6 +185,7 @@ static const struct extension extension_table[] = {
> { "GL_ARB_texture_rectangle",   o(NV_texture_rectangle),  
>   GL, 2004 },
> { "GL_ARB_texture_rgb10_a2ui",  
> o(ARB_texture_rgb10_a2ui),  GL, 2009 },
> { "GL_ARB_texture_rg",  o(ARB_texture_rg),
>   GL, 2008 },
> +   { "GL_ARB_texture_stencil8",o(ARB_texture_stencil8),  
>   GL, 2013 },
> { "GL_ARB_texture_storage", o(dummy_true),
>   GL, 2011 },
> { "GL_ARB_texture_storage_multisample", 
> o(ARB_texture_multisample), GL, 2012 },
> { "GL_ARB_texture_view",o(ARB_texture_view),  
>   GL, 2012 },
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 36e0b56..faca801 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1997,7 +1997,8 @@ _mesa_legal_texture_base_format_for_target(struct 
> gl_context *ctx,
> const char *caller)

You should update the comment above this function.

>  {
> if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
> -   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
> +   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL
> +   || _mesa_base_tex_format(ctx, internalFormat) == GL_STENCIL_INDEX) {
>/* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core
> * Profile spec says:
> *
> 

This seems insufficient to me.  It think at minimum need to add code to
the following places:

- test_attachment_completeness
- _mesa_choose_tex_format
- _mesa_base_tex_format

At least, that's what I did in my earlier attempt:

http://cgit.freedesktop.org/~kwg/mesa/commit/?h=stencil-texture&id=131e0f1bc70fa286df67f1ede8c4671bd6c88053
http://cgit.freedesktop.org/~kwg/mesa/commit/?h=stencil-texture&id=7fc34cd005e9059a9876c2d37ed90cef056adf92

The reason I abandoned the effort was because the extension introduces a
zillion new places you can use stencil textures - or places that use
textures and now hit stencil textures - and doing a proper job meant
writing Piglit tests for a lot of those.

For example...GetTexImage?  FBO stencil attachments?  GenerateMipmaps?
Multisampled stencil textures?  (Yes, that's a thing now!  Hooray :/)

I'm sure nobody's driver gets any of that wrong...

--Ken


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] mesa: finish implementing ARB_texture_stencil8

2015-04-05 Thread Kenneth Graunke
On Sunday, April 05, 2015 08:31:55 PM Kenneth Graunke wrote:
> On Sunday, April 05, 2015 04:48:48 PM Dave Airlie wrote:
> > Parts of this were implemented previously, so finish it off.
> > 
> > Signed-off-by: Dave Airlie 
> > ---
> >  src/mesa/main/extensions.c | 1 +
> >  src/mesa/main/teximage.c   | 3 ++-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> > index f212015..eea1ade 100644
> > --- a/src/mesa/main/extensions.c
> > +++ b/src/mesa/main/extensions.c
> > @@ -185,6 +185,7 @@ static const struct extension extension_table[] = {
> > { "GL_ARB_texture_rectangle",   
> > o(NV_texture_rectangle),GL, 2004 },
> > { "GL_ARB_texture_rgb10_a2ui",  
> > o(ARB_texture_rgb10_a2ui),  GL, 2009 },
> > { "GL_ARB_texture_rg",  o(ARB_texture_rg),  
> > GL, 2008 },
> > +   { "GL_ARB_texture_stencil8",
> > o(ARB_texture_stencil8),GL, 2013 },
> > { "GL_ARB_texture_storage", o(dummy_true),  
> > GL, 2011 },
> > { "GL_ARB_texture_storage_multisample", 
> > o(ARB_texture_multisample), GL, 2012 },
> > { "GL_ARB_texture_view",o(ARB_texture_view),
> > GL, 2012 },
> > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> > index 36e0b56..faca801 100644
> > --- a/src/mesa/main/teximage.c
> > +++ b/src/mesa/main/teximage.c
> > @@ -1997,7 +1997,8 @@ _mesa_legal_texture_base_format_for_target(struct 
> > gl_context *ctx,
> > const char *caller)
> 
> You should update the comment above this function.
> 
> >  {
> > if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
> > -   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
> > +   || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL
> > +   || _mesa_base_tex_format(ctx, internalFormat) == GL_STENCIL_INDEX) {
> >/* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core
> > * Profile spec says:
> > *
> > 
> 
> This seems insufficient to me.  It think at minimum need to add code to
> the following places:
> 
> - test_attachment_completeness
> - _mesa_choose_tex_format
> - _mesa_base_tex_format
> 
> At least, that's what I did in my earlier attempt:
> 
> http://cgit.freedesktop.org/~kwg/mesa/commit/?h=stencil-texture&id=131e0f1bc70fa286df67f1ede8c4671bd6c88053
> http://cgit.freedesktop.org/~kwg/mesa/commit/?h=stencil-texture&id=7fc34cd005e9059a9876c2d37ed90cef056adf92
> 
> The reason I abandoned the effort was because the extension introduces a
> zillion new places you can use stencil textures - or places that use
> textures and now hit stencil textures - and doing a proper job meant
> writing Piglit tests for a lot of those.
> 
> For example...GetTexImage?  FBO stencil attachments?  GenerateMipmaps?
> Multisampled stencil textures?  (Yes, that's a thing now!  Hooray :/)
> 
> I'm sure nobody's driver gets any of that wrong...
> 
> --Ken

I just noticed that you did send Piglit tests for a bunch of these.
Thanks! :)


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev