Re: [Mesa-dev] [Mesa-stable] [PATCH] Suppress any "libGL:..." warnings when LIBGL_DEBUG == "quiet"

2014-09-08 Thread Courtney Goeltzenleuchter
Looks good to me. Matches what ErrorMessageF is doing.

Reviewed-by: Courtney Goeltzenleuchter 

On Tue, Aug 26, 2014 at 2:47 PM, Johannes Obermayr 
wrote:

> From: Stefan Dirsch 
>
> Let's handle LIBGL_DEBUG env. variable in Mesa in a consistent way.
>
> Fixes: https://bugzilla.novell.com/show_bug.cgi?id=892896
> ---
> To: mesa-dev@lists.freedesktop.org
> Cc: "10.3" 
> openSUSE maintainers: Why can't you forward your applied u_* patches to
> upstream
>   to get them included in final/next release?
> ---
>  src/mesa/drivers/dri/common/xmlconfig.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/common/xmlconfig.c
> b/src/mesa/drivers/dri/common/xmlconfig.c
> index ce37647..8e48522 100644
> --- a/src/mesa/drivers/dri/common/xmlconfig.c
> +++ b/src/mesa/drivers/dri/common/xmlconfig.c
> @@ -429,8 +429,10 @@ static void
>  __driUtilMessage(const char *f, ...)
>  {
>  va_list args;
> +const char *libgl_debug;
>
> -if (getenv("LIBGL_DEBUG")) {
> +libgl_debug=getenv("LIBGL_DEBUG");
> +if (libgl_debug && !strstr(libgl_debug, "quiet")) {
>  fprintf(stderr, "libGL: ");
>  va_start(args, f);
>  vfprintf(stderr, f, args);
> --
> 2.0.4
>
> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
>



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


Re: [Mesa-dev] [PATCH] i965: Make glGetTex to PBO path use blorp to handle swizzled formats

2014-06-26 Thread Courtney Goeltzenleuchter
intel_miptree_blit(brw,
> -   intelImage->mt, texImage->Level,
> texImage->Face,
> -   0, 0, false,
> +   brw_blorp_blit_miptrees(brw,
> +   intelImage->mt,  texImage->Level,
> texImage->Face,
> pbo_mt, 0, 0,
> -   0, 0, dst_flip,
> -       texImage->Width, texImage->Height, GL_COPY))
> -  return false;
> +   0, 0, texImage->Width, texImage->Height,
> +   0, 0, texImage->Width, texImage->Height,
> +   GL_NEAREST, dst_flip, false);
>
> intel_miptree_release(&pbo_mt);
>
> --
> 1.8.1.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

Reviewed-by: Courtney Goeltzenleuchter 

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


Re: [Mesa-dev] [PATCH 12/15] mesa: Add a gles3 error condition for sized internalformat in glCopyTexImage*()

2014-06-11 Thread Courtney Goeltzenleuchter
Very good. I thought there might be something limiting the inputs but
wasn't immediately obvious.


On Wed, Jun 11, 2014 at 12:09 PM, Anuj Phogat  wrote:

> Adding mesa-dev to the conversation.
>
> On Wed, Jun 11, 2014 at 10:52 AM, Anuj Phogat 
> wrote:
> >
> > On Wed, Jun 11, 2014 at 10:28 AM, Courtney Goeltzenleuchter
> >  wrote:
> >>
> >> On Fri, Jun 6, 2014 at 5:57 PM, Anuj Phogat 
> wrote:
> >>>
> >>> Fixes many failures in gles3 Khronos CTS test: packed_pixels
> >>>
> >>> Cc: 
> >>> Signed-off-by: Anuj Phogat 
> >>> ---
> >>>  src/mesa/main/teximage.c | 43
> >>> +++
> >>>  1 file changed, 43 insertions(+)
> >>>
> >>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> >>> index 6474dba..c926a2f 100644
> >>> --- a/src/mesa/main/teximage.c
> >>> +++ b/src/mesa/main/teximage.c
> >>> @@ -3582,6 +3582,25 @@ copytexsubimage_by_slice(struct gl_context *ctx,
> >>> }
> >>>  }
> >>>
> >>> +static GLboolean
> >>> +formats_differ_in_component_sizes (mesa_format f1,
> >>> +   mesa_format f2)
> >>> +{
> >>> +   GLint f1_r_bits = _mesa_get_format_bits(f1, GL_RED_BITS);
> >>> +   GLint f1_g_bits = _mesa_get_format_bits(f1, GL_GREEN_BITS);
> >>> +   GLint f1_b_bits = _mesa_get_format_bits(f1, GL_BLUE_BITS);
> >>> +
> >>> +   GLint f2_r_bits = _mesa_get_format_bits(f2, GL_RED_BITS);
> >>> +   GLint f2_g_bits = _mesa_get_format_bits(f2, GL_GREEN_BITS);
> >>> +   GLint f2_b_bits = _mesa_get_format_bits(f2, GL_BLUE_BITS);
> >>> +
> >>> +   if ((f1_r_bits && f2_r_bits && f1_r_bits != f2_r_bits)
> >>
> >>
> >> I'm curious, why wouldn't a format with f1_r_bits = 0 and f2_r_bits != 0
> >> and everything else the same, not be considered different formats?
> >
> > If we include that condition, it will be equivalent using:
> > if(f1_r_bits != f2_r_bits || f1_g_bits != f2_g_bits || f1_b_bits !=
> > f2_b_bits)
> >
> > This won't work because gles allows dropping the components in internal
> > formats but doesn't allow adding new components. This check in
> > copytexture_error_check() takes care of this case when one component is
> > missing:
> >
> > [snip]
> > if (_mesa_base_format_component_count(baseFormat) >
> >   _mesa_base_format_component_count(rb_base_format)) {
> >  valid = false;
> >   }
> >  [snip]
> >>
> >>
> >>>
> >>> +   || (f1_g_bits && f2_g_bits && f1_g_bits != f2_g_bits)
> >>> +   || (f1_b_bits && f2_b_bits && f1_b_bits != f2_b_bits))
> >>> +  return GL_TRUE;
> >>> +
> >>> +   return GL_FALSE;
> >>> +}
> >>>
> >>>  /**
> >>>   * Implement the glCopyTexImage1/2D() functions.
> >>> @@ -3595,6 +3614,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
> >>> struct gl_texture_image *texImage;
> >>> const GLuint face = _mesa_tex_target_to_face(target);
> >>> mesa_format texFormat;
> >>> +   struct gl_renderbuffer *rb;
> >>>
> >>> FLUSH_VERTICES(ctx, 0);
> >>>
> >>> @@ -3624,6 +3644,29 @@ copyteximage(struct gl_context *ctx, GLuint
> dims,
> >>>
> >>> texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
> >>> internalFormat, GL_NONE,
> >>> GL_NONE);
> >>> +
> >>> +   rb = _mesa_get_read_renderbuffer_for_format(ctx, internalFormat);
> >>> +
> >>> +   /* From Page 139 of OpenGL ES 3.0 spec:
> >>> +*"If internalformat is sized, the internal format of the new
> >>> texel
> >>> +*array is internalformat, and this is also the new texel
> array’s
> >>> +*effective internal format. If the component sizes of
> >>> internalformat
> >>> +*do not exactly match the corresponding component sizes of the
> >>> source
> >>> +*buffer’s effective internal format, described below, an
> >>> +*INVALID_OPERATION error is generated. If internalformat is
> >>> unsized,
> >>> +*the inte

[Mesa-dev] [PATCH] mesa: glx: Reduce error log level

2014-06-10 Thread Courtney Goeltzenleuchter
The code that parses LIBGL_DRIVERS_PATH was printing an
error for every attempted dlopen. It's not an error to
have to check multiple items in the path, only an error if
no suitable library is found. Reduced the load error to
a warning to match behavior of dynamic linker.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/glx/dri_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 8bf4705..63c8de3 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -140,7 +140,7 @@ driOpenDriver(const char *driverName)
   if (handle != NULL)
  break;
   else
- ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
+ InfoMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
}
 
if (!handle)
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH] mesa: Fix substitution of large shaders

2014-06-10 Thread Courtney Goeltzenleuchter
t; >
>> http://lists.freedesktop.org/__mailman/listinfo/mesa-dev
>> <https://urldefense.proofpoint.com/v1/url?u=http:/
>> /lists.freedesktop.org/mailman/listinfo/mesa-dev&k=
>> oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%
>> 2BTLs8wadB%2BiIj9xpBY%3D%0A&m=BQB5tezP6JJarG3K6deQKB%2FgjK%
>> 2FGhKQvd8LRF8usgCs%3D%0A&s=6d587c1f9718375e59390ea001cad3
>> ee836a3597c86c77596f02292c818b3051>
>>
>>
>>
>>
>>
>> --
>>   Cody Northrop
>>   Graphics Software Engineer
>>   LunarG, Inc.- 3D Driver Innovations
>>   Email: c...@lunarg.com <mailto:c...@lunarg.com>
>>   Website: http://www.lunarg.com
>> <https://urldefense.proofpoint.com/v1/url?u=http:/
>> /www.lunarg.com/&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=
>> lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=
>> BQB5tezP6JJarG3K6deQKB%2FgjK%2FGhKQvd8LRF8usgCs%3D%0A&s=
>> e4c25bb2e76d3a5cbff56061766e2be646a3106ae813979beea26ede2680e7ec>
>>
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



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


Re: [Mesa-dev] [Mesa-stable] [PATCH 2/4] meta: Drop unnecessary early returns in _mesa_meta_BlitFramebuffer.

2014-05-19 Thread Courtney Goeltzenleuchter
Looks good.

Reviewed-by: Courtney Goeltzenleuchter 


On Mon, May 19, 2014 at 12:12 AM, Kenneth Graunke wrote:

> These aren't necessary - all of the following code is predicated on mask
> being non-zero, so no code will get executed anyway.
>
> Signed-off-by: Kenneth Graunke 
> Cc: "10.2" 
> ---
>  src/mesa/drivers/common/meta_blit.c | 8 
>  1 file changed, 8 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta_blit.c
> b/src/mesa/drivers/common/meta_blit.c
> index beb1ea5..bd6118b 100644
> --- a/src/mesa/drivers/common/meta_blit.c
> +++ b/src/mesa/drivers/common/meta_blit.c
> @@ -705,10 +705,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
>filter, dstFlipX, dstFlipY,
>use_glsl_version, false)) {
>   mask &= ~GL_COLOR_BUFFER_BIT;
> - if (mask == 0x0) {
> -_mesa_meta_end(ctx);
> -return;
> - }
>}
> }
>
> @@ -718,10 +714,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
>filter, dstFlipX, dstFlipY,
>use_glsl_version, true)) {
>   mask &= ~GL_DEPTH_BUFFER_BIT;
> - if (mask == 0x0) {
> -_mesa_meta_end(ctx);
> -return;
> - }
>}
> }
>
> --
> 1.9.2
>
> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
>



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


Re: [Mesa-dev] [Mesa-stable] Mesa 10.1.1 is imminent

2014-04-16 Thread Courtney Goeltzenleuchter
We've been testing with Eric's patch as well and it resolves the memory
corruption we were seeing.

Concur with Ken, on going discussion is really about what long term fix /
strategy should be for issues like this.

So, please include in 10.1 stable.

Thanks,
Courtney


On Wed, Apr 16, 2014 at 1:25 AM, Eric Anholt  wrote:

> Kenneth Graunke  writes:
>
> > On 04/15/2014 05:59 PM, Carl Worth wrote:
> >> Hi folks,
> >>
> >> I've been through all of my email backlog to the mesa-stable@ list and
> >> just pushed out a few additional fixes to the 10.1 branch, (perhaps with
> >> a bit less testing than I would normally do before pushing).
> >>
> >> I'll give this some additional, real testing and let it sit overnight
> >> for anyone else to look at, and then make a release tomorrow.
> >>
> >> The outstanding bug of "Fix buffer overruns in MSAA MCS buffer clearing"
> >> seems like it would be a great fix to have, but it sounds like things
> >> are still settling on that issue. I'll defer to group consensus on
> >> whether it makes sense to try to get a fix in for that. (My feeling is
> >> that 10.1.1 is late already and we can do a 10.1.2 quickly if needed,
> >> but I could be persuaded otherwise).
> >>
> >> -Carl
> >
> > That's landed in master and I've been running with it for a day now; it
> > definitely fixes my continual system instability and rendering
> > corruption problems.
> >
> > The discussion we're having on the list is mostly about how to avoid
> > this sort of problem in the future.  Nobody disputed that Eric's patch
> > was a good idea as is.
> >
> > So, I'd be happy to have it cherry-picked to 10.1.
>
> Yeah, that's my conclusion, too.
>
> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
>
>


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


Re: [Mesa-dev] [Mesa-stable] [PATCH] i965: Fix buffer overruns in MSAA MCS buffer clearing.

2014-04-15 Thread Courtney Goeltzenleuchter
On Tue, Apr 15, 2014 at 2:16 PM, Eric Anholt  wrote:

> Courtney Goeltzenleuchter  writes:
>
> > On Tue, Apr 15, 2014 at 1:18 PM, Eric Anholt  wrote:
> >
> >> Kenneth Graunke  writes:
> >>
> >> > On 04/14/2014 05:33 PM, Eric Anholt wrote:
> >> >> This manifested as rendering failures or sometimes GPU hangs in
> >> >> compositors when they accidentally got MSAA visuals due to a bug in
> the
> >> X
> >> >> Server.  Today we decided that the problem in compositors was
> equivalent
> >> >> to a corruption bug we'd noticed recently in resizing MSAA-visual
> >> >> glxgears, and debugging got a lot easier.
> >> >>
> >> >> When we allocate our MCS MT, libdrm takes the size we request,
> aligns it
> >> >> to Y tile size (blowing it up from 300x300=90 bytes to
> >> 384*320=122880
> >> >> bytes, 30 pages), then puts it into a power-of-two-sized BO (131072
> >> bytes,
> >> >> 32 pages).  Because it's Y tiled, we attach a 384-byte-stride fence
> to
> >> it.
> >> >> When we memset by the BO size in Mesa, between bytes 122880 and
> 131072
> >> the
> >> >> data gets stored to the first 20 or so scanlines of each of the 3
> tiled
> >> >> pages in that row, even though only 2 of those pages were allocated
> by
> >> >> libdrm.
> >> >
> >> > What?
> >> >
> >> > I get that drm_intel_bo_alloc/drm_intel_bo_alloc_tiled might return a
> >> > drm_intel_bo where bo->size is larger than what you asked for, due to
> >> > the BO cache.  But...what you're saying is, it doesn't actually
> allocate
> >> > enough pages to back the whole bo->size it gives you?  So, if you
> write
> >> > bytes 0..(bo->size - 1), you'll randomly clobber memory in a way
> that's
> >> > really difficult to detect?
> >>
> >> You have that many pages, really.  But you've attached a fence to it, so
> >> your allocated pages are structured as:
> >>
> >> +---+---+---+
> >> |   |   |   |
> >> +---+---+---+
> >> |   |   |   |
> >> +---+---+---+
> >> |   |   |   |
> >> +---+---+---+
> >> |   |   |
> >> +---+---+
> >>
> >> (except taller in this specific example).  If you hit the pixels in
> >> those quads, you'll be fine.
> >>
> >> >
> >> > There are other places where we memset an entire BO using bo->size.
>  For
> >> > example, your INTEL_DEBUG=shader_time code does exactly that (though
> it
> >> > isn't tiled).
> >> >
> >> > Could we change libdrm to set bo->size to the actual usable size of
> the
> >> > buffer, rather than the bucket size?
> >>
> >> The pages containing pixels you asked for go to 122880, and the BO is
> >> 131072, but the pixels you asked for have a maximum linear address of
> >> 384*320=115200.  Which value are you thinking is the "actual usable
> >> size"?  We certainly shouldn't have been memsetting more pixels than
> >> 115200.
> >>
> >
> > Why not? I understand that it's not useful to touch pixels beyond 115200,
> > but from the data structure, we were given 131072 bytes to work with. Why
> > shouldn't memsetting the entire allocated space be a safe operation?
>
> If you drm_intel_bo_map() and write 131072, you'd be fine.  If you
> drm_intel_bo_map_gtt() on the tiled buffer and your fence readdresses
> your writes beyond 131072, you're not fine.
>

I'm curious, what would it have cost to reserve the pages necessary to
cover both cases?

The issue caused by this particular overwrite was hard to pin down. In our
test case the failure was intermittent. We could see that memory was
getting corrupted but nothing else had run between the last time we checked
and things were good and when they went bad (building the dlist in
glxgears).

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


Re: [Mesa-dev] [Mesa-stable] [PATCH] i965: Fix buffer overruns in MSAA MCS buffer clearing.

2014-04-15 Thread Courtney Goeltzenleuchter
On Tue, Apr 15, 2014 at 1:18 PM, Eric Anholt  wrote:

> Kenneth Graunke  writes:
>
> > On 04/14/2014 05:33 PM, Eric Anholt wrote:
> >> This manifested as rendering failures or sometimes GPU hangs in
> >> compositors when they accidentally got MSAA visuals due to a bug in the
> X
> >> Server.  Today we decided that the problem in compositors was equivalent
> >> to a corruption bug we'd noticed recently in resizing MSAA-visual
> >> glxgears, and debugging got a lot easier.
> >>
> >> When we allocate our MCS MT, libdrm takes the size we request, aligns it
> >> to Y tile size (blowing it up from 300x300=90 bytes to
> 384*320=122880
> >> bytes, 30 pages), then puts it into a power-of-two-sized BO (131072
> bytes,
> >> 32 pages).  Because it's Y tiled, we attach a 384-byte-stride fence to
> it.
> >> When we memset by the BO size in Mesa, between bytes 122880 and 131072
> the
> >> data gets stored to the first 20 or so scanlines of each of the 3 tiled
> >> pages in that row, even though only 2 of those pages were allocated by
> >> libdrm.
> >
> > What?
> >
> > I get that drm_intel_bo_alloc/drm_intel_bo_alloc_tiled might return a
> > drm_intel_bo where bo->size is larger than what you asked for, due to
> > the BO cache.  But...what you're saying is, it doesn't actually allocate
> > enough pages to back the whole bo->size it gives you?  So, if you write
> > bytes 0..(bo->size - 1), you'll randomly clobber memory in a way that's
> > really difficult to detect?
>
> You have that many pages, really.  But you've attached a fence to it, so
> your allocated pages are structured as:
>
> +---+---+---+
> |   |   |   |
> +---+---+---+
> |   |   |   |
> +---+---+---+
> |   |   |   |
> +---+---+---+
> |   |   |
> +---+---+
>
> (except taller in this specific example).  If you hit the pixels in
> those quads, you'll be fine.
>
> >
> > There are other places where we memset an entire BO using bo->size.  For
> > example, your INTEL_DEBUG=shader_time code does exactly that (though it
> > isn't tiled).
> >
> > Could we change libdrm to set bo->size to the actual usable size of the
> > buffer, rather than the bucket size?
>
> The pages containing pixels you asked for go to 122880, and the BO is
> 131072, but the pixels you asked for have a maximum linear address of
> 384*320=115200.  Which value are you thinking is the "actual usable
> size"?  We certainly shouldn't have been memsetting more pixels than
> 115200.
>

Why not? I understand that it's not useful to touch pixels beyond 115200,
but from the data structure, we were given 131072 bytes to work with. Why
shouldn't memsetting the entire allocated space be a safe operation?


> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
>
>


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


Re: [Mesa-dev] [Mesa-stable] [PATCH] i965: Fix buffer overruns in MSAA MCS buffer clearing.

2014-04-15 Thread Courtney Goeltzenleuchter
, as well as the glxgears problem.
>
> I agree this is the correct amount of data to memset, and even if we
> make the libdrm change I suggested, this seems worth doing.  bo->size
> may have been rounded up beyond what we need, and memsetting that extra
> space is wasteful (even if it did work).
>
> Reviewed-by: Kenneth Graunke 
>
> Thanks a ton for your help on this, Eric.  I was really stumped.
>
>
> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
>
>


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


[Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-04-08 Thread Courtney Goeltzenleuchter
Decompressing ETC2 textures was causing intermitent segfault
by copying resulting 4x4 texel block to the destination texture
regardless of the size of the destination texture. Issue found
via application crash in GLBenchmark 3.0's Manhattan test.

v2: add more detail comment. Compute limit outside inner loops.
v3: add bugzilla reference
v4: Correct cc syntax in commit log
v5: really grab the right patch

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74988
Cc: "9.2 10.0 10.1" 
---
 src/mesa/main/texcompress_etc.c | 78 -
 1 file changed, 54 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index a06d29f..080b790 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -679,14 +679,25 @@ etc2_unpack_rgb8(uint8_t *dst_row,
 
for (y = 0; y < height; y += bh) {
   const uint8_t *src = src_row;
+  /*
+   * Destination texture may not be a multiple of four texels in
+   * height. Compute a safe height to avoid writing outside the texture.
+   */
+  const unsigned h = MIN2(bh, height - y);
 
   for (x = 0; x < width; x+= bw) {
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ /*
+  * Destination texture may not be a multiple of four texels in
+  * width. Compute a safe width to avoid writing outside the texture.
+  */
+ const unsigned w = MIN2(bw, width - x);
+
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
dst[3] = 255;
@@ -716,14 +727,17 @@ etc2_unpack_srgb8(uint8_t *dst_row,
 
for (y = 0; y < height; y += bh) {
   const uint8_t *src = src_row;
+  const unsigned h = MIN2(bh, height - y);
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_SARGB8 */
@@ -760,13 +774,15 @@ etc2_unpack_rgba8(uint8_t *dst_row,
 
for (y = 0; y < height; y += bh) {
   const uint8_t *src = src_row;
+  const unsigned h = MIN2(bh, height - y);
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
 }
@@ -796,14 +812,16 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
uint8_t tmp;
 
for (y = 0; y < height; y += bh) {
+  const unsigned h = MIN2(bh, height - y);
   const uint8_t *src = src_row;
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
 
/* Convert to MESA_FORMAT_SARGB8 */
@@ -838,14 +856,16 @@ etc2_unpack_r11(uint8_t *dst_row,
unsigned x, y, i, j;
 
for (y = 0; y < height; y += bh) {
+  const unsigned h = MIN2(bh, height - y);
   const uint8_t *src = src_row;
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * 
comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -873,16 +893,18 @@ etc2_unpack_rg11(uint8_t *dst_row,
unsigned x, y, i, j;
 
for (y = 0; y < height; y += bh) {
+  const unsigned h = MIN2(bh, height - y);
   const uint8_t *src = src_row;
 
   for (x = 0; x < width;

Re: [Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-04-08 Thread Courtney Goeltzenleuchter
Apologies folks, I had made those changes and somehow grabbed the wrong
patch when I went to add the bug reference. Ugh.

This time for sure! I'll follow this with the -- real -- patch.

Courtney


On Tue, Apr 8, 2014 at 1:28 AM, Kenneth Graunke wrote:

> On 04/07/2014 09:20 PM, Courtney Goeltzenleuchter wrote:
> > Decompressing ETC2 textures was causing intermitent segfault
> > by copying resulting 4x4 texel block to the destination texture
> > regardless of the size of the destination texture. Issue found
> > via application crash in GLBenchmark 3.0's Manhattan test.
> >
> > v2: add more explanatory comments
> > v3: add bugzilla reference
> > v4: Correct cc syntax in commit log
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74988
> > Cc: "9.2 10.0 10.1" 
> > ---
> >  src/mesa/main/texcompress_etc.c | 49
> +
> >  1 file changed, 25 insertions(+), 24 deletions(-)
> >
> > diff --git a/src/mesa/main/texcompress_etc.c
> b/src/mesa/main/texcompress_etc.c
> > index cbda689..39775e2 100644
> > --- a/src/mesa/main/texcompress_etc.c
> > +++ b/src/mesa/main/texcompress_etc.c
> > @@ -683,9 +683,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
> >   etc2_rgb8_parse_block(&block, src,
> > false /* punchthrough_alpha */);
> >
> > - for (j = 0; j < bh; j++) {
> > + /* be sure to stay within the bounds of the texture */
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgb8_fetch_texel(&block, i, j, dst,
> >   false /* punchthrough_alpha */);
> > dst[3] = 255;
> > @@ -720,9 +721,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
> >   etc2_rgb8_parse_block(&block, src,
> > false /* punchthrough_alpha */);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgb8_fetch_texel(&block, i, j, dst,
> >   false /* punchthrough_alpha */);
> > /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
> > @@ -763,9 +764,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
> >for (x = 0; x < width; x+= bw) {
> >   etc2_rgba8_parse_block(&block, src);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgba8_fetch_texel(&block, i, j, dst);
> > dst += comps;
> >  }
> > @@ -800,9 +801,9 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
> >for (x = 0; x < width; x+= bw) {
> >   etc2_rgba8_parse_block(&block, src);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgba8_fetch_texel(&block, i, j, dst);
> >
> > /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
> > @@ -842,9 +843,9 @@ etc2_unpack_r11(uint8_t *dst_row,
> >for (x = 0; x < width; x+= bw) {
> >   etc2_r11_parse_block(&block, src);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps *
> comp_size;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_r11_fetch_texel(&block, i, j, dst);
> > dst += comps * comp_size;
> >  }
> > @@ -878,10 +879,10 @@ etc2_unpack_rg11(uint8

[Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-04-07 Thread Courtney Goeltzenleuchter
Decompressing ETC2 textures was causing intermitent segfault
by copying resulting 4x4 texel block to the destination texture
regardless of the size of the destination texture. Issue found
via application crash in GLBenchmark 3.0's Manhattan test.

v2: add more explanatory comments
v3: add bugzilla reference
v4: Correct cc syntax in commit log

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74988
Cc: "9.2 10.0 10.1" 
---
 src/mesa/main/texcompress_etc.c | 49 +
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index cbda689..39775e2 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -683,9 +683,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ /* be sure to stay within the bounds of the texture */
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
dst[3] = 255;
@@ -720,9 +721,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -763,9 +764,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
 }
@@ -800,9 +801,9 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
 
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -842,9 +843,9 @@ etc2_unpack_r11(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * 
comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -878,10 +879,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
  /* red component */
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -889,10 +890,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
  /* green component */
  etc2_r11_parse_block(&block, src + 8);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
 }
@@ -925,10 +926,10 @@ etc2_unpack_signed_r11(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_

Re: [Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-04-07 Thread Courtney Goeltzenleuchter
Thanks Emil, I've got it sorted out I think. The format of the cc: was
incorrect, it shouldn't have the  piece. Should look like: Cc:
"9.2 10.0 10.1" 

I'll send out updated patch.

Courtney


On Mon, Apr 7, 2014 at 6:28 PM, Emil Velikov wrote:

> On 08/04/14 01:18, Courtney Goeltzenleuchter wrote:
> > Hi Ian,
> >
> > I didn't think this even got out. I was getting a weird error from
> > git-send-mail when it tried to send to the gmail server and I got
> > distracted with other things.
> >
> > Here's log:
> > Send this email? ([y]es|[n]o|[q]uit|[a]ll): y
> > Password for 'smtp://court...@lunarg.com@smtp.gmail.com:587':
> > OK. Log says:
> > Server: smtp.gmail.com
> > MAIL FROM:
> > RCPT TO:
> > From: Courtney Goeltzenleuchter 
> > To: mesa-dev@lists.freedesktop.org
> > Subject: [PATCH] mesa: add bounds checking to eliminate buffer overrun
> > Date: Mon,  7 Apr 2014 13:19:17 -0600
> > Message-Id: <1396898358-14649-1-git-send-email-court...@lunarg.com>
> > X-Mailer: git-send-email 1.8.3.2
> > In-Reply-To:  > fp_a3ng2rkclqh2q-suuz...@mail.gmail.com>
> > References:  > fp_a3ng2rkclqh2q-suuz...@mail.gmail.com>
> >
> > Result: 250 2.0.0 OK 1396898380 on9sm125685igb.11 - gsmtp
> >
> > In git 1.7.0, the default has changed to --no-chain-reply-to
> > Set sendemail.chainreplyto configuration variable to true if
> > you want to keep --chain-reply-to as your default.
> > (mbox) Adding cc: Courtney Goeltzenleuchter  from
> line
> > 'From: Courtney Goeltzenleuchter '
> > (body) Adding cc: "9.2 10.0 10.1"  > line 'Cc: "9.2 10.0 10.1"^^
> I could be day dreaming but it seems like you've missed the closing arrow
> bracket. That's when git starts being helpful and things go bonkers :)
>
> -Emil
>
>


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


[Mesa-dev] [PATCH 1/2] mesa: add bounds checking to eliminate buffer overrun

2014-04-07 Thread Courtney Goeltzenleuchter
Decompressing ETC2 textures was causing intermitent segfault
by copying resulting 4x4 texel block to the destination texture
regardless of the size of the destination texture. Issue found
via application crash in GLBenchmark 3.0's Manhattan test.

v2: add more explanatory comments
v3: add bugzilla reference

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74988
Cc: "9.2 10.0 10.1" mailto:mesa-sta...@lists.freedesktop.org>>
---
 src/mesa/main/texcompress_etc.c | 49 +
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index 28203f4..d025488 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -685,9 +685,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ /* be sure to stay within the bounds of the texture */
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
dst[3] = 255;
@@ -722,9 +723,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_SARGB8 */
@@ -765,9 +766,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
 }
@@ -802,9 +803,9 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
 
/* Convert to MESA_FORMAT_SARGB8 */
@@ -844,9 +845,9 @@ etc2_unpack_r11(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * 
comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -880,10 +881,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
  /* red component */
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -891,10 +892,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
  /* green component */
  etc2_r11_parse_block(&block, src + 8);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
 }
@@ -927,10 +928,10 @@ etc2_unpack_signed_r11(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +

Re: [Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-04-07 Thread Courtney Goeltzenleuchter
Hi Ian,

I didn't think this even got out. I was getting a weird error from
git-send-mail when it tried to send to the gmail server and I got
distracted with other things.

Here's log:
Send this email? ([y]es|[n]o|[q]uit|[a]ll): y
Password for 'smtp://court...@lunarg.com@smtp.gmail.com:587':
OK. Log says:
Server: smtp.gmail.com
MAIL FROM:
RCPT TO:
From: Courtney Goeltzenleuchter 
To: mesa-dev@lists.freedesktop.org
Subject: [PATCH] mesa: add bounds checking to eliminate buffer overrun
Date: Mon,  7 Apr 2014 13:19:17 -0600
Message-Id: <1396898358-14649-1-git-send-email-court...@lunarg.com>
X-Mailer: git-send-email 1.8.3.2
In-Reply-To: 
References: 

Result: 250 2.0.0 OK 1396898380 on9sm125685igb.11 - gsmtp

In git 1.7.0, the default has changed to --no-chain-reply-to
Set sendemail.chainreplyto configuration variable to true if
you want to keep --chain-reply-to as your default.
(mbox) Adding cc: Courtney Goeltzenleuchter  from line
'From: Courtney Goeltzenleuchter '
(body) Adding cc: "9.2 10.0 10.1" mailto:mesa-sta...@lists.freedesktop.org>>

I'll give it another try.


On Mon, Apr 7, 2014 at 2:06 PM, Ian Romanick  wrote:

> On 04/07/2014 12:19 PM, Courtney Goeltzenleuchter wrote:
> > Updated patch to include reference to bug that it resolves.
>
> Where?
>
> The proper way to do this is to send the path with git-send-mail, and
> include extra verbage in the commit message like:
>
> v3: Updated patch to include reference to bug that it resolves.
>
> Unless, of course, that update is just to add a Bugzilla: line to the
> commit message.  I don't know if that's the change because... :)
>
> > Since this fixes a buffer overrun in the driver (found running
> GLBenchmark's Manhattan test) I think it would be a good candidate for the
> stable branch.
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>


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


[Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-04-07 Thread Courtney Goeltzenleuchter
Updated patch to include reference to bug that it resolves.

Since this fixes a buffer overrun in the driver (found running GLBenchmark's 
Manhattan test) I think it would be a good candidate for the stable branch.

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


Re: [Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-02-28 Thread Courtney Goeltzenleuchter
No, I do not believe this commit has made it.

Courtney


On Wed, Feb 26, 2014 at 11:44 AM, Ian Romanick  wrote:

> On 02/17/2014 09:43 AM, Courtney Goeltzenleuchter wrote:
>
>> Thanks for the feedback.
>>
>> I've updated the patch to integrate Ian's comments.
>>
>
> Did the updated patch ever land?
>
>  Courtney
>>
>>
>> On Fri, Feb 14, 2014 at 2:00 PM, Ian Romanick > <mailto:i...@freedesktop.org>> wrote:
>>
>> On 02/14/2014 07:52 AM, Courtney Goeltzenleuchter wrote:
>>  > Decompressing ETC2 textures was causing intermitent segfault
>>  > by copying resulting 4x4 texel block to the destination texture
>>  > regardless of the size of the destination texture. Issue found
>>  > via application crash in GLBenchmark 3.0's Manhattan test.
>>
>> So... the problem is that every ETC texture is (physically) a multiple
>> of 4 width, but we may have allocated a decompression buffer that was
>> the logical width of the texture.  I think the code needs more of a
>> comment explaining that.  Otherwise, when someone comes back to it in
>> a
>> year (or uses it as a model for some other texture compression code),
>> they won't understand why the code is the way it is.
>>
>> With that, this patch is
>>
>> Reviewed-by: Ian Romanick > <mailto:ian.d.roman...@intel.com>>
>>
>>
>> One additional suggestion below that you can take or leave.
>>
>>  > Signed-off-by: Courtney Goeltzenleuchter 
>>
>> Also add:
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74988
>> Cc: "9.2 10.0 10.1" > <mailto:mesa-sta...@lists.freedesktop.org>>
>>
>>
>>  > ---
>>  >  src/mesa/main/texcompress_etc.c | 49
>> +
>>  >  1 file changed, 25 insertions(+), 24 deletions(-)
>>  >
>>  > diff --git a/src/mesa/main/texcompress_etc.c
>> b/src/mesa/main/texcompress_etc.c
>>  > index e3862be..f9234b0 100644
>>  > --- a/src/mesa/main/texcompress_etc.c
>>  > +++ b/src/mesa/main/texcompress_etc.c
>>  > @@ -684,9 +684,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
>>  >   etc2_rgb8_parse_block(&block, src,
>>  > false /* punchthrough_alpha */);
>>  >
>>
>> Alternately, the code below could be:
>>
>>  const unsigned h = MIN2(bh, height - y);
>>  const unsigned w = MIN2(bw, width - x);
>>
>>  ...
>>
>>  for (j = 0; j < h; j++) {
>>
>>  ...
>>
>> for (i = 0; i < w; i++) {
>>
>>
>>  > - for (j = 0; j < bh; j++) {
>>  > + /* be sure to stay within the bounds of the texture */
>>  > + for (j = 0; j < bh && (j+y) < height; j++) {
>>  >  uint8_t *dst = dst_row + (y + j) * dst_stride + x *
>> comps;
>>  > -for (i = 0; i < bw; i++) {
>>  > +for (i = 0; i < bw && (i+x) < width; i++) {
>>  > etc2_rgb8_fetch_texel(&block, i, j, dst,
>>  >   false /* punchthrough_alpha
>> */);
>>  > dst[3] = 255;
>>  > @@ -721,9 +722,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
>>  >   etc2_rgb8_parse_block(&block, src,
>>  > false /* punchthrough_alpha */);
>>  >
>>  > - for (j = 0; j < bh; j++) {
>>  > + for (j = 0; j < bh && (j+y) < height; j++) {
>>  >  uint8_t *dst = dst_row + (y + j) * dst_stride + x *
>> comps;
>>  > -for (i = 0; i < bw; i++) {
>>  > +for (i = 0; i < bw && (i+x) < width; i++) {
>>  > etc2_rgb8_fetch_texel(&block, i, j, dst,
>>  >   false /* punchthrough_alpha
>> */);
>>  > /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
>>  > @@ -764,9 +765,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
>>  >for (x = 0; x < width; x+= bw) {
>>  >   etc2_rgba8_parse_block(&block, src);
>>  >
>>  > - for (j = 0; j < bh; j++) {
>&g

[Mesa-dev] [PATCH] mesa: Remove unnecessary condition

2014-02-21 Thread Courtney Goeltzenleuchter
Identified by Valgrind memory check. Initialized block-opaque
in a different patch.
This test seems unnecessary.
If opaque must be true, just set to true.
Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/texcompress_etc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index 97adc86..e22f2fc 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -430,8 +430,7 @@ etc2_rgb8_parse_block(struct etc2_block *block,
   block->is_planar_mode = true;
 
   /* opaque bit must be set in planar mode */
-  if (!block->opaque)
- block->opaque = true;
+  block->opaque = true;
 
   for (i = 0; i < 3; i++) {
  block->base_colors[0][i] = etc2_base_color_o_planar(src, i);
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH] mesa: Fix valgrind uninitialized variable warning

2014-02-17 Thread Courtney Goeltzenleuchter
I've updated the patch to set the flipped flag as well.

I verified that all the flags were being set. As for the data in the rest
of the structure that is filled in from the compressed data using whatever
technique was coded in the compressed data. I don't think it's necessary to
zero out the full structure, just the flags.

Courtney


On Fri, Feb 14, 2014 at 1:51 PM, Ian Romanick  wrote:

> On 02/14/2014 08:05 AM, Courtney Goeltzenleuchter wrote:
> > Initialize field to eliminate valgrind warning.
>
> There are a couple other fields that aren't set it all paths (e.g.,
> flipped).  I want to suggest just memseting the whole structure, but
> it's not obvious to me how it's used throughout the code.
>
> I suspect the code was more clear before ETC2 support was added...
>
> > Signed-off-by: Courtney Goeltzenleuchter 
> > ---
> >  src/mesa/main/texcompress_etc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/src/mesa/main/texcompress_etc.c
> b/src/mesa/main/texcompress_etc.c
> > index f9234b0..97adc86 100644
> > --- a/src/mesa/main/texcompress_etc.c
> > +++ b/src/mesa/main/texcompress_etc.c
> > @@ -350,6 +350,7 @@ etc2_rgb8_parse_block(struct etc2_block *block,
> > block->is_t_mode = false;
> > block->is_h_mode = false;
> > block->is_planar_mode = false;
> > +   block->opaque = false;
> >
> > if (punchthrough_alpha)
> >block->opaque = src[3] & 0x2;
> >
>
>


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


Re: [Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-02-17 Thread Courtney Goeltzenleuchter
Thanks for the feedback.

I've updated the patch to integrate Ian's comments.

Courtney


On Fri, Feb 14, 2014 at 2:00 PM, Ian Romanick  wrote:

> On 02/14/2014 07:52 AM, Courtney Goeltzenleuchter wrote:
> > Decompressing ETC2 textures was causing intermitent segfault
> > by copying resulting 4x4 texel block to the destination texture
> > regardless of the size of the destination texture. Issue found
> > via application crash in GLBenchmark 3.0's Manhattan test.
>
> So... the problem is that every ETC texture is (physically) a multiple
> of 4 width, but we may have allocated a decompression buffer that was
> the logical width of the texture.  I think the code needs more of a
> comment explaining that.  Otherwise, when someone comes back to it in a
> year (or uses it as a model for some other texture compression code),
> they won't understand why the code is the way it is.
>
> With that, this patch is
>
> Reviewed-by: Ian Romanick 
>
> One additional suggestion below that you can take or leave.
>
> > Signed-off-by: Courtney Goeltzenleuchter 
>
> Also add:
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74988
> Cc: "9.2 10.0 10.1" 
>
> > ---
> >  src/mesa/main/texcompress_etc.c | 49
> +
> >  1 file changed, 25 insertions(+), 24 deletions(-)
> >
> > diff --git a/src/mesa/main/texcompress_etc.c
> b/src/mesa/main/texcompress_etc.c
> > index e3862be..f9234b0 100644
> > --- a/src/mesa/main/texcompress_etc.c
> > +++ b/src/mesa/main/texcompress_etc.c
> > @@ -684,9 +684,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
> >   etc2_rgb8_parse_block(&block, src,
> > false /* punchthrough_alpha */);
> >
>
> Alternately, the code below could be:
>
> const unsigned h = MIN2(bh, height - y);
> const unsigned w = MIN2(bw, width - x);
>
> ...
>
> for (j = 0; j < h; j++) {
>
> ...
>
>for (i = 0; i < w; i++) {
>
>
> > - for (j = 0; j < bh; j++) {
> > + /* be sure to stay within the bounds of the texture */
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgb8_fetch_texel(&block, i, j, dst,
> >   false /* punchthrough_alpha */);
> > dst[3] = 255;
> > @@ -721,9 +722,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
> >   etc2_rgb8_parse_block(&block, src,
> > false /* punchthrough_alpha */);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgb8_fetch_texel(&block, i, j, dst,
> >   false /* punchthrough_alpha */);
> > /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
> > @@ -764,9 +765,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
> >for (x = 0; x < width; x+= bw) {
> >   etc2_rgba8_parse_block(&block, src);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgba8_fetch_texel(&block, i, j, dst);
> > dst += comps;
> >  }
> > @@ -801,9 +802,9 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
> >for (x = 0; x < width; x+= bw) {
> >   etc2_rgba8_parse_block(&block, src);
> >
> > - for (j = 0; j < bh; j++) {
> > + for (j = 0; j < bh && (j+y) < height; j++) {
> >  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> > -for (i = 0; i < bw; i++) {
> > +for (i = 0; i < bw && (i+x) < width; i++) {
> > etc2_rgba8_fetch_texel(&block, i, j, dst);
> >
> > /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
> > @@ -843,9 +844,9 @@ etc2_unpack_r11(uint8_

[Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-02-17 Thread Courtney Goeltzenleuchter
Decompressing ETC2 textures was causing intermitent segfault
by copying resulting 4x4 texel block to the destination texture
regardless of the size of the destination texture. Issue found
via application crash in GLBenchmark 3.0's Manhattan test.

v2: add more detail comment. Compute limit outside inner loops.
---
 src/mesa/main/texcompress_etc.c | 78 -
 1 file changed, 54 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index e3862be..c0a4191 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -679,14 +679,25 @@ etc2_unpack_rgb8(uint8_t *dst_row,
 
for (y = 0; y < height; y += bh) {
   const uint8_t *src = src_row;
+  /*
+   * Destination texture may not be a multiple of four texels in
+   * height. Compute a safe height to avoid writing outside the texture.
+   */
+  const unsigned h = MIN2(bh, height - y);
 
   for (x = 0; x < width; x+= bw) {
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ /*
+  * Destination texture may not be a multiple of four texels in
+  * width. Compute a safe width to avoid writing outside the texture.
+  */
+ const unsigned w = MIN2(bw, width - x);
+
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
dst[3] = 255;
@@ -716,14 +727,17 @@ etc2_unpack_srgb8(uint8_t *dst_row,
 
for (y = 0; y < height; y += bh) {
   const uint8_t *src = src_row;
+  const unsigned h = MIN2(bh, height - y);
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -760,13 +774,15 @@ etc2_unpack_rgba8(uint8_t *dst_row,
 
for (y = 0; y < height; y += bh) {
   const uint8_t *src = src_row;
+  const unsigned h = MIN2(bh, height - y);
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
 }
@@ -796,14 +812,16 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
uint8_t tmp;
 
for (y = 0; y < height; y += bh) {
+  const unsigned h = MIN2(bh, height - y);
   const uint8_t *src = src_row;
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
 
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -838,14 +856,16 @@ etc2_unpack_r11(uint8_t *dst_row,
unsigned x, y, i, j;
 
for (y = 0; y < height; y += bh) {
+  const unsigned h = MIN2(bh, height - y);
   const uint8_t *src = src_row;
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * 
comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -873,16 +893,18 @@ etc2_unpack_rg11(uint8_t *dst_row,
unsigned x, y, i, j;
 
for (y = 0; y < height; y += bh) {
+  const unsigned h = MIN2(bh, height - y);
   const uint8_t *src = src_row;
 
   for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
  /* red component */
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < 

[Mesa-dev] [PATCH] mesa: Fix valgrind uninitialized variable warning

2014-02-14 Thread Courtney Goeltzenleuchter
Initialize field to eliminate valgrind warning.
Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/texcompress_etc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index f9234b0..97adc86 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -350,6 +350,7 @@ etc2_rgb8_parse_block(struct etc2_block *block,
block->is_t_mode = false;
block->is_h_mode = false;
block->is_planar_mode = false;
+   block->opaque = false;
 
if (punchthrough_alpha)
   block->opaque = src[3] & 0x2;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH] mesa: Fix valgrind uninitialized variable warning

2014-02-14 Thread Courtney Goeltzenleuchter
Initialize field to eliminate valgrind warning.
Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/texcompress_etc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index f9234b0..97adc86 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -350,6 +350,7 @@ etc2_rgb8_parse_block(struct etc2_block *block,
block->is_t_mode = false;
block->is_h_mode = false;
block->is_planar_mode = false;
+   block->opaque = false;
 
if (punchthrough_alpha)
   block->opaque = src[3] & 0x2;
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-02-14 Thread Courtney Goeltzenleuchter
Forgot to mention. This patch addresses bug
#74988<https://bugs.freedesktop.org/show_bug.cgi?id=74988>
.

No piglit regressions.

Courtney


On Fri, Feb 14, 2014 at 8:52 AM, Courtney Goeltzenleuchter <
court...@lunarg.com> wrote:

> Decompressing ETC2 textures was causing intermitent segfault
> by copying resulting 4x4 texel block to the destination texture
> regardless of the size of the destination texture. Issue found
> via application crash in GLBenchmark 3.0's Manhattan test.
>
> Signed-off-by: Courtney Goeltzenleuchter 
> ---
>  src/mesa/main/texcompress_etc.c | 49
> +
>  1 file changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/src/mesa/main/texcompress_etc.c
> b/src/mesa/main/texcompress_etc.c
> index e3862be..f9234b0 100644
> --- a/src/mesa/main/texcompress_etc.c
> +++ b/src/mesa/main/texcompress_etc.c
> @@ -684,9 +684,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
>   etc2_rgb8_parse_block(&block, src,
> false /* punchthrough_alpha */);
>
> - for (j = 0; j < bh; j++) {
> + /* be sure to stay within the bounds of the texture */
> + for (j = 0; j < bh && (j+y) < height; j++) {
>  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> -for (i = 0; i < bw; i++) {
> +for (i = 0; i < bw && (i+x) < width; i++) {
> etc2_rgb8_fetch_texel(&block, i, j, dst,
>   false /* punchthrough_alpha */);
> dst[3] = 255;
> @@ -721,9 +722,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
>   etc2_rgb8_parse_block(&block, src,
> false /* punchthrough_alpha */);
>
> - for (j = 0; j < bh; j++) {
> + for (j = 0; j < bh && (j+y) < height; j++) {
>  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> -for (i = 0; i < bw; i++) {
> +for (i = 0; i < bw && (i+x) < width; i++) {
> etc2_rgb8_fetch_texel(&block, i, j, dst,
>   false /* punchthrough_alpha */);
> /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
> @@ -764,9 +765,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
>for (x = 0; x < width; x+= bw) {
>   etc2_rgba8_parse_block(&block, src);
>
> - for (j = 0; j < bh; j++) {
> + for (j = 0; j < bh && (j+y) < height; j++) {
>  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> -for (i = 0; i < bw; i++) {
> +for (i = 0; i < bw && (i+x) < width; i++) {
> etc2_rgba8_fetch_texel(&block, i, j, dst);
> dst += comps;
>  }
> @@ -801,9 +802,9 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
>for (x = 0; x < width; x+= bw) {
>   etc2_rgba8_parse_block(&block, src);
>
> - for (j = 0; j < bh; j++) {
> + for (j = 0; j < bh && (j+y) < height; j++) {
>  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> -for (i = 0; i < bw; i++) {
> +for (i = 0; i < bw && (i+x) < width; i++) {
> etc2_rgba8_fetch_texel(&block, i, j, dst);
>
> /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
> @@ -843,9 +844,9 @@ etc2_unpack_r11(uint8_t *dst_row,
>for (x = 0; x < width; x+= bw) {
>   etc2_r11_parse_block(&block, src);
>
> - for (j = 0; j < bh; j++) {
> + for (j = 0; j < bh && (j+y) < height; j++) {
>  uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps *
> comp_size;
> -for (i = 0; i < bw; i++) {
> +for (i = 0; i < bw && (i+x) < width; i++) {
> etc2_r11_fetch_texel(&block, i, j, dst);
> dst += comps * comp_size;
>  }
> @@ -879,10 +880,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
>   /* red component */
>   etc2_r11_parse_block(&block, src);
>
> - for (j = 0; j < bh; j++) {
> + for (j = 0; j < bh && (j+y) < height; j++) {
>  uint8_t *dst = dst_row + (y + j) * dst_stride +
> x * comps * comp_size;
> -for (i = 0; i < bw; i++) {
> +for (i = 0; i < bw && (i+x) < width; i++) {
> etc2_r11_fetch_texel(&block, i, j, dst);
> dst += comps * comp_size;
>  }
> @@ -890,10 +891,

[Mesa-dev] [PATCH] mesa: add bounds checking to eliminate buffer overrun

2014-02-14 Thread Courtney Goeltzenleuchter
Decompressing ETC2 textures was causing intermitent segfault
by copying resulting 4x4 texel block to the destination texture
regardless of the size of the destination texture. Issue found
via application crash in GLBenchmark 3.0's Manhattan test.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/texcompress_etc.c | 49 +
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index e3862be..f9234b0 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -684,9 +684,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ /* be sure to stay within the bounds of the texture */
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
dst[3] = 255;
@@ -721,9 +722,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,
  etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
  false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -764,9 +765,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
 }
@@ -801,9 +802,9 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_rgba8_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
 
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -843,9 +844,9 @@ etc2_unpack_r11(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * 
comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -879,10 +880,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
  /* red component */
  etc2_r11_parse_block(&block, src);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
 }
@@ -890,10 +891,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
  /* green component */
  etc2_r11_parse_block(&block, src + 8);
 
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < bh && (j+y) < height; j++) {
 uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
-for (i = 0; i < bw; i++) {
+for (i = 0; i < bw && (i+x) < width; i++) {
etc2_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
 }
@@ -926,10 +927,10 @@ etc2_unpack_signed_r11(uint8_t *dst_row,
   for (x = 0; x < width; x+= bw) {
  etc2_r1

[Mesa-dev] [PATCH] mesa: Return after error detected.

2014-01-23 Thread Courtney Goeltzenleuchter
Fix ScissorArrayv and ScissorIndexed to return after detecting
parameter error.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/scissor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 14c8e8a..83f39e2 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -145,6 +145,7 @@ _mesa_ScissorArrayv(GLuint first, GLsizei count, const 
GLint *v)
  _mesa_error(ctx, GL_INVALID_VALUE,
  "glScissorArrayv: index (%d) width or height < 0 (%d, 
%d)",
  i, p[i].Width, p[i].Height);
+ return;
   }
}
 
@@ -187,6 +188,7 @@ ScissorIndexed(GLuint index, GLint left, GLint bottom,
   _mesa_error(ctx, GL_INVALID_VALUE,
   "%s: index (%d) width or height < 0 (%d, %d)",
   function, index, width, height);
+  return;
}
 
set_scissor_no_notify(ctx, index, left, bottom, width, height);
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 15/15] i965/blorp: Account for nonzero MinLayer in layered clears.

2014-01-21 Thread Courtney Goeltzenleuchter
I don't see any patch that sets ctx->Extensions.ARB_texture_view = true;

Something like attached.

Courtney


On Tue, Jan 21, 2014 at 3:34 AM, Chris Forbes  wrote:

> Signed-off-by: Chris Forbes 
> ---
>  src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
> b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
> index 72ce653..26190db 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
> @@ -581,7 +581,7 @@ brw_blorp_clear_color(struct brw_context *brw, struct
> gl_framebuffer *fb,
>   unsigned num_layers = irb->layer_count;
>   for (unsigned layer = 0; layer < num_layers; layer++) {
>  if (!do_single_blorp_clear(brw, fb, rb, buf, partial_clear,
> -   layer * layer_multiplier)) {
> +   irb->mt_layer + layer *
> layer_multiplier)) {
> return false;
>  }
>   }
> --
> 1.8.5.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 
Courtney Goeltzenleuchter
LunarG
From 49172888c05ffdf7058be475219142d5f0c19f4a Mon Sep 17 00:00:00 2001
From: Courtney Goeltzenleuchter 
Date: Tue, 21 Jan 2014 13:12:54 -0700
Subject: [PATCH] i965: Enable arb_texture_view for Intel driver.

---
 src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index ab73434..457899b 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -198,6 +198,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_texture_non_power_of_two = true;
ctx->Extensions.ARB_texture_rg = true;
ctx->Extensions.ARB_texture_rgb10_a2ui = true;
+   ctx->Extensions.ARB_texture_view = true;
ctx->Extensions.ARB_vertex_program = true;
ctx->Extensions.ARB_vertex_shader = true;
ctx->Extensions.ARB_vertex_type_2_10_10_10_rev = true;
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 0/2 v3] i965: Extend fast texture upload

2013-12-30 Thread Courtney Goeltzenleuchter
Awesome! Thanks Chad.

Courtney


On Mon, Dec 30, 2013 at 4:02 PM, Chad Versace
wrote:

> The patches look good to me, and I verified that this caused no Piglit
> regressions on Ivybridge when applied to master-8ab47b4.
>
> Reviewed-by: Chad Versace 
>
> I committed them to master.
>



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


[Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels

2013-12-13 Thread Courtney Goeltzenleuchter
Support all levels of a supported texture format.

Using 1024x1024, RGBA  source, mipmap
internal-format Before (MB/sec) mipmap (MB/sec)
GL_RGBA 627.15  615.90
GL_RGB  456.35  611.53
512x512
GL_RGBA 597.00  619.95
GL_RGB  440.62  611.28
256x256
GL_RGBA 487.80  587.42
GL_RGB  376.63  585.00

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index c12cf94..1642f3c 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -549,7 +549,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
uint32_t cpp;
mem_copy_fn mem_copy = NULL;
 
-   /* This fastpath is restricted to specific texture types: level 0 of
+   /* This fastpath is restricted to specific texture types:
 * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to support
 * more types.
 *
@@ -561,7 +561,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
if (!brw->has_llc ||
type != GL_UNSIGNED_BYTE ||
texImage->TexObject->Target != GL_TEXTURE_2D ||
-   texImage->Level != 0 ||
pixels == NULL ||
_mesa_is_bufferobj(packing->BufferObj) ||
packing->Alignment > 4 ||
@@ -637,6 +636,10 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Alignment, packing->RowLength, packing->SkipPixels,
packing->SkipRows, for_glTexImage);
 
+   /* Adjust x and y offset based on miplevel */
+   xoffset += image->mt->level[texImage->Level].level_x;
+   yoffset += image->mt->level[texImage->Level].level_y;
+
linear_to_tiled(
   xoffset * cpp, (xoffset + width) * cpp,
   yoffset, yoffset + height,
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 1/2] i965: add XRGB to tiled_memcpy

2013-12-13 Thread Courtney Goeltzenleuchter
MESA_FORMAT_XRGB is equivalent to MESA_FORMAT_ARGB in terms
of storage on the device, so okay to use this optimized copy routine.

This series builds on work from Frank Henigman to optimize the
process of uploading a texture to the GPU. This series adds support for
MESA_XRGB_ and full miptrees where were found to be common activities
in the Smokin' Guns game. The issue was found while profiling the app
but that part is not benchmarked. Smokin-Guns uses mipmap textures with
an internal format of GL_RGB (MESA_XRGB_ in the driver).

These changes need a performance tool to run against to show how they
improve execution performance for specific texture formats. Using this
benchmark I've measured the following improvement on my Ivybridge
Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.

1024x1024 texture size
internal-format Before (MB/sec) XRGB (MB/sec)
GL_RGBA 628.15  627.15
GL_RGB  265.95  456.35

512x512 texture size
internal-format Before (MB/sec) XRGB (MB/sec)
GL_RGBA 600.23  597.00
GL_RGB  255.50  440.62

256x256 texture size
internal-format Before (MB/sec) XRGB (MB/sec)
GL_RGBA 489.08  487.80
GL_RGB  229.03  376.63

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index a72d313..c12cf94 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -577,7 +577,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
(texImage->TexFormat == MESA_FORMAT_A8 && format == GL_ALPHA)) {
   cpp = 1;
   mem_copy = memcpy;
-   } else if (texImage->TexFormat == MESA_FORMAT_ARGB) {
+   } else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
+ || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
   cpp = 4;
   if (format == GL_BGRA) {
  mem_copy = memcpy;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 0/2 v3] i965: Extend fast texture upload

2013-12-13 Thread Courtney Goeltzenleuchter
This series builds on work from Frank Henigman to optimize the
process of uploading a texture to the GPU. This series adds support for
MESA_XRGB_ and full miptrees where were found to be common activities
in the Smokin' Guns game. The issue was found while profiling the app
but that part is not benchmarked. Smokin-Guns uses mipmap textures with
an internal format of GL_RGB (MESA_XRGB_ in the driver).

These changes need a performance tool to run against to show how they
improve execution performance for specific texture formats. Using this
benchmark I've measured the following improvement on my Ivybridge
Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.

Using 1024x1024, RGBA  source, mipmap
internal-format Before (MB/sec) After XRGB (MB/sec) After mip (MB/sec)
GL_RGBA 628.15  627.15  615.90
GL_RGB  265.95  456.35  611.53

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

Includes all feedback from gurket...@googlemail.com, matts...@gmail.com,
chad.vers...@linux.intel.com and e...@anholt.net.

Courtney Goeltzenleuchter (2):
  i965: add XRGB to tiled_memcpy
  i965: Enhance tiled_memcpy to support all levels

Courtney Goeltzenleuchter (2):
  i965: add XRGB to tiled_memcpy
  i965: Enhance tiled_memcpy to support all levels

 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-12-13 Thread Courtney Goeltzenleuchter
Hi Chris,

How goes arb_texture_view?
I'd like to see what you have. Please let me know if I can help.

Thanks,
Courtney


On Mon, Nov 25, 2013 at 1:42 PM, Courtney Goeltzenleuchter <
court...@lunarg.com> wrote:

> I've added a viewport_array-rc2 branch to my github repository with
> updates from the feedback so far. Also includes a commit from Ian to Add
> varying slot for viewport index.
>
> Courtney
>
>
> On Fri, Nov 22, 2013 at 3:51 PM, Courtney Goeltzenleuchter <
> court...@lunarg.com> wrote:
>
>> Got it.
>>
>>
>> On Fri, Nov 22, 2013 at 2:55 PM, Chris Forbes  wrote:
>>
>>> It's just that last block that were messed up -- rest was context.
>>>
>>> Sorry for any confusion.
>>>
>>>
>>> On Sat, Nov 23, 2013 at 10:06 AM, Courtney Goeltzenleuchter <
>>> court...@lunarg.com> wrote:
>>>
>>>> Hi Chris,
>>>>
>>>> I'm using this version of the spec:
>>>> http://www.opengl.org/registry/specs/ARB/viewport_array.txt
>>>>
>>>> On Thu, Nov 21, 2013 at 4:41 PM, Chris Forbes  wrote:
>>>>
>>>>> I was just comparing to the list in the ARB_viewport_array spec.
>>>>>
>>>>>
>>>>> On Fri, Nov 22, 2013 at 11:33 AM, Courtney Goeltzenleuchter <
>>>>> court...@lunarg.com> wrote:
>>>>>
>>>>>> Hi Chris,
>>>>>>
>>>>>> Where are you getting your defines?
>>>>>> I copied them from include/GL/gl.h
>>>>>> #define GL_VIEWPORT 0x0BA2
>>>>>> /* Scissor box */
>>>>>> #define GL_SCISSOR_BOX 0x0C10
>>>>>> #define GL_SCISSOR_TEST 0x0C11
>>>>>> #define GL_SCISSOR_TEST 0x0C11
>>>>>> #define GL_DEPTH_RANGE 0x0B70
>>>>>>
>>>>>> Ah, FIRST_VERTEX looks different.
>>>>>> #define GL_FIRST_VERTEX_CONVENTION0x8E4D
>>>>>>
>>>>>> I'll add PROVOKING_VERTEX
>>>>>>
>>>>>> Looks like UNDEFINED_VERTEX was wrong as well.
>>>>>> (include/GL/glext.h) #define GL_UNDEFINED_VERTEX   0x8260
>>>>>>
>>>>>>  I was modelling one of the other extension xml files and they had
>>>>>> similar defines, though I could see no effect including or excluding 
>>>>>> them.
>>>>>>
>>>>>> Should I just get rid of the definitions for values that already
>>>>>> exist in gl.h or glext.h?
>>>>>>
>>>>>> Courtney
>>>>>>
>>>>>>
>>>>>> On Thu, Nov 21, 2013 at 1:00 PM, Chris Forbes wrote:
>>>>>>
>>>>>>> I'm surprised the build system accepts the conflicting second
>>>>>>> definition of SCISSOR_BOX at all, actually -- that's weird.
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Nov 22, 2013 at 8:55 AM, Chris Forbes wrote:
>>>>>>>
>>>>>>>> I mean some of the values don't match the spec :)
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Nov 22, 2013 at 7:52 AM, Courtney Goeltzenleuchter <
>>>>>>>> court...@lunarg.com> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Nov 20, 2013 at 7:28 PM, Chris Forbes wrote:
>>>>>>>>>
>>>>>>>>>> Oops -- the 8E4E is obviously correct. Artifact of me switching
>>>>>>>>>> how I
>>>>>>>>>> was commenting halfway through.
>>>>>>>>>>
>>>>>>>>>> On Thu, Nov 21, 2013 at 3:25 PM, Chris Forbes 
>>>>>>>>>> wrote:
>>>>>>>>>> > These are bogus:
>>>>>>>>>> >
>>>>>>>>>> > +
>>>>>>>>>> > +
>>>>>>>>>> > +
>>>>>>>>>> > +
>>>>>>>>>> > +
>>>>>>>>>>
>>>>>>>>>
>>>> In the spec I'm using I see:
>>>>
>>>> New Tokens
>>>&

Re: [Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-12-05 Thread Courtney Goeltzenleuchter
Browsing the code a little, it's not clear that drivers are using the
texture object's BaseLevel in a "safe" manner.

Some example uses of BaseLevel:

[intel driver]

const struct gl_texture_image *img = t->Image[0][t->BaseLevel];  //
Without conditioning, this could lead to memory access error. Maybe
that's already an issue?


firstImage = tObj->Image[0][tObj->BaseLevel];  // Same with this

if (sampler->MinFilter == GL_NEAREST ||

   sampler->MinFilter == GL_LINEAR) {

   maxlevel = tObj->BaseLevel;

} else {
   maxlevel = tObj->_MaxLevel;

}


[st_atom_sampler]

sampler->min_lod = CLAMP(msamp->MinLod,

 0.0f,

 (GLfloat) texobj->MaxLevel - texobj->BaseLevel);


There are more. All using the values that were set in TexParam.


Courtney



On Thu, Dec 5, 2013 at 9:41 AM, Courtney Goeltzenleuchter <
court...@lunarg.com> wrote:

> Okay, that makes it easier.
>
> Should this change be conditional based on the type of context created?
>
> Courtney
>
>
> On Thu, Dec 5, 2013 at 8:52 AM, Brian Paul  wrote:
>
>> On 12/04/2013 03:46 PM, Courtney Goeltzenleuchter wrote:
>>
>>> It's come to my attention that Mesa's handling of GL_TEXTURE_BASE_LEVEL
>>> and GL_TEXTURE_MAX_LEVEL in glTexParameter and glGetTexParameter may be
>>> incorrect. The issue happens with the following sequence:
>>>
>>> glTexStorage2D(GL_TEXTURE_2D, 4, GL_RGBA8, 128, 128);
>>>
>>> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 5);
>>>
>>> glGetTexParameter(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, &n);
>>>
>>> The key question is: What is the value of n?
>>>
>>> Right now, the Mesa driver will clamp the glTexParameter call to the
>>> range 0 .. 3 (as specified by the TexStorage call) and n = 3 after the
>>> GetTexParameter call. However, the value returned on the Intel Windows
>>> driver and NVIDIA's Linux driver return 5. This has apparently been
>>> discussed among Kronos members in bug: 9342
>>> (https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9342
>>> <https://urldefense.proofpoint.com/v1/url?u=https:
>>> //cvs.khronos.org/bugzilla/show_bug.cgi?id%3D9342&k=
>>> oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%
>>> 2BTLs8wadB%2BiIj9xpBY%3D%0A&m=SrPAWBW251dxCErQJNhB0m93E9Vb62
>>> KGHxK3yiRBRuU%3D%0A&s=a0c086b7a31a804e3e786118fd1771
>>> b53c85717a4cf0c8dea41b60e5acd0406b>)
>>>
>>> which I don't have visibility of.
>>>
>>> To match that behavior the texture object will likely need two BaseLevel
>>> and MaxLevel attributes. One that's clamped and used locally and the
>>> other that simply holds the set value as given by the application in the
>>> glTexParameter call.
>>>
>>> Thoughts?
>>>
>>
>> From reading the bug report, it sounds like the ARB decided that clamping
>> should be done when the texture is used, not when glTexParameter is called.
>>  In the GL 4.3 spec I don't see any language about clamping in
>> glTexParameter either.
>>
>> We should be doing the use-time clamping already.  So I think we just
>> have to remove the clamping step in glTexParameter.
>>
>> -Brian
>>
>>
>
>
> --
> Courtney Goeltzenleuchter
> LunarG
>
>


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


Re: [Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-12-05 Thread Courtney Goeltzenleuchter
Okay, that makes it easier.

Should this change be conditional based on the type of context created?

Courtney


On Thu, Dec 5, 2013 at 8:52 AM, Brian Paul  wrote:

> On 12/04/2013 03:46 PM, Courtney Goeltzenleuchter wrote:
>
>> It's come to my attention that Mesa's handling of GL_TEXTURE_BASE_LEVEL
>> and GL_TEXTURE_MAX_LEVEL in glTexParameter and glGetTexParameter may be
>> incorrect. The issue happens with the following sequence:
>>
>> glTexStorage2D(GL_TEXTURE_2D, 4, GL_RGBA8, 128, 128);
>>
>> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 5);
>>
>> glGetTexParameter(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, &n);
>>
>> The key question is: What is the value of n?
>>
>> Right now, the Mesa driver will clamp the glTexParameter call to the
>> range 0 .. 3 (as specified by the TexStorage call) and n = 3 after the
>> GetTexParameter call. However, the value returned on the Intel Windows
>> driver and NVIDIA's Linux driver return 5. This has apparently been
>> discussed among Kronos members in bug: 9342
>> (https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9342
>> <https://urldefense.proofpoint.com/v1/url?u=https:
>> //cvs.khronos.org/bugzilla/show_bug.cgi?id%3D9342&k=
>> oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%
>> 2BTLs8wadB%2BiIj9xpBY%3D%0A&m=SrPAWBW251dxCErQJNhB0m93E9Vb62
>> KGHxK3yiRBRuU%3D%0A&s=a0c086b7a31a804e3e786118fd1771
>> b53c85717a4cf0c8dea41b60e5acd0406b>)
>>
>> which I don't have visibility of.
>>
>> To match that behavior the texture object will likely need two BaseLevel
>> and MaxLevel attributes. One that's clamped and used locally and the
>> other that simply holds the set value as given by the application in the
>> glTexParameter call.
>>
>> Thoughts?
>>
>
> From reading the bug report, it sounds like the ARB decided that clamping
> should be done when the texture is used, not when glTexParameter is called.
>  In the GL 4.3 spec I don't see any language about clamping in
> glTexParameter either.
>
> We should be doing the use-time clamping already.  So I think we just have
> to remove the clamping step in glTexParameter.
>
> -Brian
>
>


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


Re: [Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-12-04 Thread Courtney Goeltzenleuchter
It's come to my attention that Mesa's handling of GL_TEXTURE_BASE_LEVEL and
GL_TEXTURE_MAX_LEVEL in glTexParameter and glGetTexParameter may be
incorrect. The issue happens with the following sequence:

glTexStorage2D(GL_TEXTURE_2D, 4, GL_RGBA8, 128, 128);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 5);

glGetTexParameter(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, &n);

The key question is: What is the value of n?

Right now, the Mesa driver will clamp the glTexParameter call to the range
0 .. 3 (as specified by the TexStorage call) and n = 3 after the
GetTexParameter call. However, the value returned on the Intel Windows
driver and NVIDIA's Linux driver return 5. This has apparently been
discussed among Kronos members in bug: 9342 (
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9342) which I don't have
visibility of.

To match that behavior the texture object will likely need two BaseLevel
and MaxLevel attributes. One that's clamped and used locally and the other
that simply holds the set value as given by the application in the
glTexParameter call.

Thoughts?

Courtney


On Tue, Dec 3, 2013 at 4:30 PM, Courtney Goeltzenleuchter <
court...@lunarg.com> wrote:

>
>
>
> On Tue, Dec 3, 2013 at 4:28 PM, Brian Paul  wrote:
>
>> On 12/03/2013 02:56 PM, Courtney Goeltzenleuchter wrote:
>>
>>> Hi Brian,
>>>
>>> I've made all the recommended changes.
>>>
>>> I also added one, a test that the Driver.TextureView != NULL before
>>> calling. This lets me test the non DD functionality with the
>>> MESA_EXTENSION_OVERRIDE=+GL_ARB_texture_view
>>>
>>> I've also rebased to latest master (no changes required). Whole stream
>>> can be found at:
>>> https://github.com/courtney-lunarg/mesa/tree/texture_view-rc6
>>> <https://urldefense.proofpoint.com/v1/url?u=https:
>>> //github.com/courtney-lunarg/mesa/tree/texture_view-rc6&k=
>>> oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%
>>> 2BTLs8wadB%2BiIj9xpBY%3D%0A&m=StSJ4O%2Fa%2B9Zp%2FeTtJIDzJ1NxrKtDXrENaO%
>>> 2FoFA9gY1k%3D%0A&s=0439e3fc50d195734c13b4c5e22024
>>> f034c27b7e657c8f79e08993b98f117518>
>>>
>>>
>>> Let me know if you need me to post the patches to the mail list or not.
>>>
>>
>> The series LGTM.  Thanks.  Reviewed-by: Brian Paul 
>>
>> Do you need someone to push to master for you?
>
>
> Yes please!
>
>
>>
>>
>> -Brian
>>
>>
>
>
> --
> Courtney Goeltzenleuchter
> LunarG
>
>


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


Re: [Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-12-03 Thread Courtney Goeltzenleuchter
On Tue, Dec 3, 2013 at 4:28 PM, Brian Paul  wrote:

> On 12/03/2013 02:56 PM, Courtney Goeltzenleuchter wrote:
>
>> Hi Brian,
>>
>> I've made all the recommended changes.
>>
>> I also added one, a test that the Driver.TextureView != NULL before
>> calling. This lets me test the non DD functionality with the
>> MESA_EXTENSION_OVERRIDE=+GL_ARB_texture_view
>>
>> I've also rebased to latest master (no changes required). Whole stream
>> can be found at:
>> https://github.com/courtney-lunarg/mesa/tree/texture_view-rc6
>> <https://urldefense.proofpoint.com/v1/url?u=https:
>> //github.com/courtney-lunarg/mesa/tree/texture_view-rc6&k=
>> oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%
>> 2BTLs8wadB%2BiIj9xpBY%3D%0A&m=StSJ4O%2Fa%2B9Zp%2FeTtJIDzJ1NxrKtDXrENaO%
>> 2FoFA9gY1k%3D%0A&s=0439e3fc50d195734c13b4c5e22024
>> f034c27b7e657c8f79e08993b98f117518>
>>
>>
>> Let me know if you need me to post the patches to the mail list or not.
>>
>
> The series LGTM.  Thanks.  Reviewed-by: Brian Paul 
>
> Do you need someone to push to master for you?


Yes please!


>
>
> -Brian
>
>


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


Re: [Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-11-26 Thread Courtney Goeltzenleuchter
With these changes, what needs to happen to commit these changes to master?

Thanks,
Courtney


On Mon, Nov 25, 2013 at 6:01 PM, Courtney Goeltzenleuchter <
court...@lunarg.com> wrote:

> While incorporating Brian's comments I did some refactoring to consolidate
> multiple uses of next_mimap_level_size into one shared helper function.
> That adds another commit to the stream. I thought it was big enough now
> that I should post the branch to make it easier to use.
>
> I've posted the updated stream, including the next_mipmap_level_size
> refactoring on github here:
> https://github.com/courtney-lunarg/mesa/tree/texture_view-rc5
>
> Courtney
>
> --
> Courtney Goeltzenleuchter
> LunarG
>
>


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


Re: [Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-11-25 Thread Courtney Goeltzenleuchter
While incorporating Brian's comments I did some refactoring to consolidate
multiple uses of next_mimap_level_size into one shared helper function.
That adds another commit to the stream. I thought it was big enough now
that I should post the branch to make it easier to use.

I've posted the updated stream, including the next_mipmap_level_size
refactoring on github here:
https://github.com/courtney-lunarg/mesa/tree/texture_view-rc5

Courtney

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


[Mesa-dev] [PATCH 7/9] mesa: Fill out ARB_texture_view entry points

2013-11-25 Thread Courtney Goeltzenleuchter
Add Mesa TextureView logic.
Incorporate feedback on ARB_texture_view:
- Add S3TC VIEW_CLASSes to compatibility table
- Use existing _mesa_get_tex_image
- Clean up error strings
- Use bool instead of GLboolean for internal functions
- Split compound level & layer test into individual tests

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/textureview.c | 540 +++-
 1 file changed, 539 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 4a6bd62..1bfc86b 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -38,10 +38,318 @@
 #include "macros.h"
 #include "teximage.h"
 #include "texobj.h"
+#include "mipmap.h"
 #include "texstorage.h"
 #include "textureview.h"
+#include "stdbool.h"
 #include "mtypes.h"
 
+/* Table 3.X.2 (Compatible internal formats for TextureView)
+---
+| Class | Internal formats|
+---
+| VIEW_CLASS_128_BITS   | RGBA32F, RGBA32UI, RGBA32I  |
+---
+| VIEW_CLASS_96_BITS| RGB32F, RGB32UI, RGB32I |
+---
+| VIEW_CLASS_64_BITS| RGBA16F, RG32F, RGBA16UI, RG32UI, RGBA16I,  |
+|   | RG32I, RGBA16, RGBA16_SNORM |
+---
+| VIEW_CLASS_48_BITS| RGB16, RGB16_SNORM, RGB16F, RGB16UI, RGB16I |
+---
+| VIEW_CLASS_32_BITS| RG16F, R11F_G11F_B10F, R32F,|
+|   | RGB10_A2UI, RGBA8UI, RG16UI, R32UI, |
+|   | RGBA8I, RG16I, R32I, RGB10_A2, RGBA8, RG16, |
+|   | RGBA8_SNORM, RG16_SNORM, SRGB8_ALPHA8, RGB9_E5  |
+---
+| VIEW_CLASS_24_BITS| RGB8, RGB8_SNORM, SRGB8, RGB8UI, RGB8I  |
+---
+| VIEW_CLASS_16_BITS| R16F, RG8UI, R16UI, RG8I, R16I, RG8, R16,   |
+|   | RG8_SNORM, R16_SNORM|
+---
+| VIEW_CLASS_8_BITS | R8UI, R8I, R8, R8_SNORM |
+---
+| VIEW_CLASS_RGTC1_RED  | COMPRESSED_RED_RGTC1,   |
+|   | COMPRESSED_SIGNED_RED_RGTC1 |
+---
+| VIEW_CLASS_RGTC2_RG   | COMPRESSED_RG_RGTC2,|
+|   | COMPRESSED_SIGNED_RG_RGTC2  |
+---
+| VIEW_CLASS_BPTC_UNORM | COMPRESSED_RGBA_BPTC_UNORM, |
+|   | COMPRESSED_SRGB_ALPHA_BPTC_UNORM|
+---
+| VIEW_CLASS_BPTC_FLOAT | COMPRESSED_RGB_BPTC_SIGNED_FLOAT,   |
+|   | COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT  |
+---
+ */
+struct internal_format_class_info {
+   GLenum view_class;
+   GLenum internal_format;
+};
+#define INFO(c,f) {GL_##c, GL_##f}
+static const struct internal_format_class_info compatible_internal_formats[] = 
{
+   INFO(VIEW_CLASS_128_BITS, RGBA32F),
+   INFO(VIEW_CLASS_128_BITS, RGBA32UI),
+   INFO(VIEW_CLASS_128_BITS, RGBA32I),
+   INFO(VIEW_CLASS_96_BITS, RGB32F),
+   INFO(VIEW_CLASS_96_BITS, RGB32UI),
+   INFO(VIEW_CLASS_96_BITS, RGB32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16F),
+   INFO(VIEW_CLASS_64_BITS, RG32F),
+   INFO(VIEW_CLASS_64_BITS, RGBA16UI),
+   INFO(VIEW_CLASS_64_BITS, RG32UI),
+   INFO(VIEW_CLASS_64_BITS, RGBA16I),
+   INFO(VIEW_CLASS_64_BITS, RG32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16),
+   INFO(VIEW_CLASS_64_BITS, RGBA16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16),
+   INFO(VIEW_CLASS_48_BITS, RGB16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16F),
+   INFO(VIEW_CLASS_48_BITS, RGB16UI),
+   INFO(VIEW_CLASS_48_BITS, RGB16I),
+   INFO(VIEW_CLASS_32_BITS, RG16F),
+   INFO(VIEW_CLASS_32_BITS, R11F_G11F_B10F),
+   INFO(VIEW_CLASS_32_BITS, R32F),
+   I

[Mesa-dev] [PATCH 6/9] mesa: consolidate multiple next_mipmap_level_size

2013-11-25 Thread Courtney Goeltzenleuchter
Refactor to make next_mipmap_level_size defined in mipmap.c a
_mesa_ helper function that can then be used by texture_view

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/mipmap.c |  8 
 src/mesa/main/mipmap.h |  4 
 src/mesa/main/texstorage.c | 25 +++--
 3 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 180f891..0330157 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1767,8 +1767,8 @@ _mesa_generate_mipmap_level(GLenum target,
  * compute next (level+1) image size
  * \return GL_FALSE if no smaller size can be generated (eg. src is 1x1x1 size)
  */
-static GLboolean
-next_mipmap_level_size(GLenum target, GLint border,
+GLboolean
+_mesa_next_mipmap_level_size(GLenum target, GLint border,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint *dstWidth, GLint *dstHeight, GLint *dstDepth)
 {
@@ -1911,7 +1911,7 @@ generate_mipmap_uncompressed(struct gl_context *ctx, 
GLenum target,
   srcDepth = srcImage->Depth;
   border = srcImage->Border;
 
-  nextLevel = next_mipmap_level_size(target, border,
+  nextLevel = _mesa_next_mipmap_level_size(target, border,
  srcWidth, srcHeight, srcDepth,
  &dstWidth, &dstHeight, &dstDepth);
   if (!nextLevel)
@@ -2102,7 +2102,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum 
target,
   srcDepth = srcImage->Depth;
   border = srcImage->Border;
 
-  nextLevel = next_mipmap_level_size(target, border,
+  nextLevel = _mesa_next_mipmap_level_size(target, border,
  srcWidth, srcHeight, srcDepth,
  &dstWidth, &dstHeight, &dstDepth);
   if (!nextLevel)
diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h
index d5bd1d8..ee91df0 100644
--- a/src/mesa/main/mipmap.h
+++ b/src/mesa/main/mipmap.h
@@ -51,5 +51,9 @@ extern void
 _mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
   struct gl_texture_object *texObj);
 
+extern GLboolean
+_mesa_next_mipmap_level_size(GLenum target, GLint border,
+   GLint srcWidth, GLint srcHeight, GLint srcDepth,
+   GLint *dstWidth, GLint *dstHeight, GLint *dstDepth);
 
 #endif /* MIPMAP_H */
diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 84b8f82..8d472a2 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -37,6 +37,7 @@
 #include "macros.h"
 #include "teximage.h"
 #include "texobj.h"
+#include "mipmap.h"
 #include "texstorage.h"
 #include "mtypes.h"
 
@@ -100,27 +101,6 @@ legal_texobj_target(struct gl_context *ctx, GLuint dims, 
GLenum target)
 }
 
 
-/**
- * Compute the size of the next mipmap level.
- */
-static void
-next_mipmap_level_size(GLenum target,
-   GLint *width, GLint *height, GLint *depth)
-{
-   if (*width > 1) {
-  *width /= 2;
-   }
-
-   if ((*height > 1) && (target != GL_TEXTURE_1D_ARRAY)) {
-  *height /= 2;
-   }
-
-   if ((*depth > 1) && (target != GL_TEXTURE_2D_ARRAY)) {
-  *depth /= 2;
-   }
-}
-
-
 /** Helper to get a particular texture image in a texture object */
 static struct gl_texture_image *
 get_tex_image(struct gl_context *ctx, 
@@ -164,7 +144,8 @@ initialize_texture_fields(struct gl_context *ctx,
 0, internalFormat, texFormat);
   }
 
-  next_mipmap_level_size(target, &levelWidth, &levelHeight, &levelDepth);
+  _mesa_next_mipmap_level_size(target, 0, levelWidth, levelHeight, 
levelDepth,
+   &levelWidth, &levelHeight, &levelDepth);
}
return GL_TRUE;
 }
-- 
1.8.1.2

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


Re: [Mesa-dev] [v3 5/8] mesa: Add driver entry point for ARB_texture_view

2013-11-25 Thread Courtney Goeltzenleuchter
On Thu, Nov 21, 2013 at 5:56 PM, Brian Paul  wrote:

> On 11/19/2013 04:16 PM, Courtney Goeltzenleuchter wrote:
>
>>
>> Signed-off-by: Courtney Goeltzenleuchter 
>> ---
>>   src/mesa/drivers/common/driverfuncs.c | 3 +++
>>   src/mesa/main/dd.h| 5 +
>>   2 files changed, 8 insertions(+)
>>
>> diff --git a/src/mesa/drivers/common/driverfuncs.c
>> b/src/mesa/drivers/common/driverfuncs.c
>> index 5faa98a..f185688 100644
>> --- a/src/mesa/drivers/common/driverfuncs.c
>> +++ b/src/mesa/drivers/common/driverfuncs.c
>> @@ -211,6 +211,9 @@ _mesa_init_driver_functions(struct dd_function_table
>> *driver)
>>  /* GL_ARB_texture_storage */
>>  driver->AllocTextureStorage = _mesa_alloc_texture_storage;
>>
>> +   /* GL_ARB_texture_view */
>> +   driver->TextureView = NULL;
>> +
>>  /* GL_ARB_texture_multisample */
>>  driver->GetSamplePosition = NULL;
>>   }
>> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
>> index b5b874f..3e263f4 100644
>> --- a/src/mesa/main/dd.h
>> +++ b/src/mesa/main/dd.h
>> @@ -375,6 +375,11 @@ struct dd_function_table {
>>   GLsizei levels, GLsizei width,
>>   GLsizei height, GLsizei depth);
>>
>> +   /** Called as part of glTextureView to add views to origTexObj */
>> +   GLboolean (*TextureView)(struct gl_context *ctx,
>> +struct gl_texture_object *texObj,
>> +struct gl_texture_object *origTexObj);
>>
>
> Either the comment on this function, or the place where it's called from
> should probably be beefed up with more info about what's expected of the
> driver.  Is it possible to return FALSE for any reason beyond out-of-memory?
>
>
When the driver side is done I'll have more details. Ideally this should
never fail as we are simply creating a different way to look at a texture
that already exists.


>
>
>
>  +
>>  /**
>>   * Map a renderbuffer into user space.
>>   * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
>>
>>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



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


Re: [Mesa-dev] [v3 7/8] mesa: add texture_view helper function for TexStorage

2013-11-25 Thread Courtney Goeltzenleuchter
On Thu, Nov 21, 2013 at 5:56 PM, Brian Paul  wrote:

> On 11/19/2013 04:16 PM, Courtney Goeltzenleuchter wrote:
>
>> Add helper function to set texture_view state from TexStorage calls.
>>
>> Signed-off-by: Courtney Goeltzenleuchter 
>> ---
>>   src/mesa/main/textureview.c | 59 ++
>> +++
>>   src/mesa/main/textureview.h |  4 +++
>>   2 files changed, 63 insertions(+)
>>
>> diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
>> index 1858465..a25b928 100644
>> --- a/src/mesa/main/textureview.c
>> +++ b/src/mesa/main/textureview.c
>> @@ -379,6 +379,65 @@ compatible_format(struct gl_context *ctx, struct
>> gl_texture_object *origTexObj,
>>  _mesa_lookup_enum_by_nr(origInternalFormat));
>>  return GL_FALSE;
>>   }
>> +/**
>> + * Helper function for TexStorage to set TextureView state
>> + */
>>
>
> Could you put a bit more info into that comment?


How about:
/**
 * Helper function for TexStorage and teximagemultisample to set immutable
 * texture state needed by ARB_texture_view.
 */
void
_mesa_set_texture_view_state(struct gl_context *ctx, struct
gl_texture_object *texObj,
   GLenum target, GLuint levels)
...


>
>
>  +void
>> +set_texture_view_state(struct gl_context *ctx, struct gl_texture_object
>> *texObj,
>> +   GLenum target, GLuint levels)
>>
>
> non-static functions should be prefixed with "_mesa_".

See above.

>
>
>
>  +{
>> +   struct gl_texture_image *texImage;
>> +
>> +   /* Get a reference to what will become this View's base level */
>> +   texImage = _mesa_select_tex_image(ctx, texObj, target, 0);
>>
>
> Early return if texImage is NULL (out of memory, etc?)?

Immutable textures have all their image levels allocated when they are
created, so teximage should never be null at this point. At least as I
understand things.


>
>
>
>  +
>> +   /* If the command is successful,
>>
>
> If what command is successful?  glTexStorage()?


That is a copy & paste from the ARB_texture_view spec, meaning that if the
glTexStorage command is successful...

Modify subsection 3.9.16 (Immutable-Format Texture Images)

Modify the second to last bullet on p. 258:

If the command is successful, TEXTURE_IMMUTABLE_FORMAT becomes
TRUE,TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become
.

I can change that to something like: When an immutable texture is created
via glTexStorage or glTexImageMultisample,


>
>
>
>  +* TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
>> +* TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
>> +* If the texture target is TEXTURE_1D_ARRAY then
>> +* TEXTURE_VIEW_NUM_LAYERS becomes height.
>> +* If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
>> +* or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS
>> becomes depth.
>> +* If the texture target is TEXTURE_CUBE_MAP, then
>> +* TEXTURE_VIEW_NUM_LAYERS becomes 6.
>> +* For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
>> +*
>> +* ARB_texture_multisample: Multisample textures do
>> +* not have multiple image levels.
>> +*/
>> +
>> +   texObj->Immutable = GL_TRUE;
>> +   texObj->ImmutableLevels = levels;
>> +   texObj->MinLevel = 0;
>> +   texObj->NumLevels = levels;
>> +   texObj->MinLayer = 0;
>> +   texObj->NumLayers = 1;
>> +   switch (target) {
>> +   case GL_TEXTURE_1D_ARRAY:
>> +  texObj->NumLayers = texImage->Height;
>> +  break;
>> +
>> +   case GL_TEXTURE_2D_MULTISAMPLE:
>> +  texObj->NumLevels = 1;
>> +  texObj->ImmutableLevels = 1;
>> +  break;
>> +
>> +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>> +  texObj->NumLevels = 1;
>> +  texObj->ImmutableLevels = 1;
>> +  /* fall through to set NumLayers */
>> +
>> +   case GL_TEXTURE_2D_ARRAY:
>> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
>> +  texObj->NumLayers = texImage->Depth;
>> +  break;
>> +
>> +   case GL_TEXTURE_CUBE_MAP:
>> +  texObj->NumLayers = 6;
>> +  break;
>> +
>> +   }
>> +}
>>
>>   /**
>>* glTextureView (ARB_texture_view)
>> diff --git a/src/mesa/main/textureview.h b/src/mesa/main/textureview.h
>> index c2f0f32..36a8ed3 100644
>> --- a/src/mesa/main/textureview.h
>> +++ b/src/mesa/main/textureview.h
>> @@ -36,4 +36,8 @@ _mesa_TextureView(GL

Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-11-25 Thread Courtney Goeltzenleuchter
I've added a viewport_array-rc2 branch to my github repository with updates
from the feedback so far. Also includes a commit from Ian to Add varying
slot for viewport index.

Courtney


On Fri, Nov 22, 2013 at 3:51 PM, Courtney Goeltzenleuchter <
court...@lunarg.com> wrote:

> Got it.
>
>
> On Fri, Nov 22, 2013 at 2:55 PM, Chris Forbes  wrote:
>
>> It's just that last block that were messed up -- rest was context.
>>
>> Sorry for any confusion.
>>
>>
>> On Sat, Nov 23, 2013 at 10:06 AM, Courtney Goeltzenleuchter <
>> court...@lunarg.com> wrote:
>>
>>> Hi Chris,
>>>
>>> I'm using this version of the spec:
>>> http://www.opengl.org/registry/specs/ARB/viewport_array.txt
>>>
>>> On Thu, Nov 21, 2013 at 4:41 PM, Chris Forbes  wrote:
>>>
>>>> I was just comparing to the list in the ARB_viewport_array spec.
>>>>
>>>>
>>>> On Fri, Nov 22, 2013 at 11:33 AM, Courtney Goeltzenleuchter <
>>>> court...@lunarg.com> wrote:
>>>>
>>>>> Hi Chris,
>>>>>
>>>>> Where are you getting your defines?
>>>>> I copied them from include/GL/gl.h
>>>>> #define GL_VIEWPORT 0x0BA2
>>>>> /* Scissor box */
>>>>> #define GL_SCISSOR_BOX 0x0C10
>>>>> #define GL_SCISSOR_TEST 0x0C11
>>>>> #define GL_SCISSOR_TEST 0x0C11
>>>>> #define GL_DEPTH_RANGE 0x0B70
>>>>>
>>>>> Ah, FIRST_VERTEX looks different.
>>>>> #define GL_FIRST_VERTEX_CONVENTION0x8E4D
>>>>>
>>>>> I'll add PROVOKING_VERTEX
>>>>>
>>>>> Looks like UNDEFINED_VERTEX was wrong as well.
>>>>> (include/GL/glext.h) #define GL_UNDEFINED_VERTEX   0x8260
>>>>>
>>>>>  I was modelling one of the other extension xml files and they had
>>>>> similar defines, though I could see no effect including or excluding them.
>>>>>
>>>>> Should I just get rid of the definitions for values that already exist
>>>>> in gl.h or glext.h?
>>>>>
>>>>> Courtney
>>>>>
>>>>>
>>>>> On Thu, Nov 21, 2013 at 1:00 PM, Chris Forbes wrote:
>>>>>
>>>>>> I'm surprised the build system accepts the conflicting second
>>>>>> definition of SCISSOR_BOX at all, actually -- that's weird.
>>>>>>
>>>>>>
>>>>>> On Fri, Nov 22, 2013 at 8:55 AM, Chris Forbes wrote:
>>>>>>
>>>>>>> I mean some of the values don't match the spec :)
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Nov 22, 2013 at 7:52 AM, Courtney Goeltzenleuchter <
>>>>>>> court...@lunarg.com> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Nov 20, 2013 at 7:28 PM, Chris Forbes wrote:
>>>>>>>>
>>>>>>>>> Oops -- the 8E4E is obviously correct. Artifact of me switching
>>>>>>>>> how I
>>>>>>>>> was commenting halfway through.
>>>>>>>>>
>>>>>>>>> On Thu, Nov 21, 2013 at 3:25 PM, Chris Forbes 
>>>>>>>>> wrote:
>>>>>>>>> > These are bogus:
>>>>>>>>> >
>>>>>>>>> > +
>>>>>>>>> > +
>>>>>>>>> > +
>>>>>>>>> > +
>>>>>>>>> > +
>>>>>>>>>
>>>>>>>>
>>> In the spec I'm using I see:
>>>
>>> New Tokens
>>>
>>> Accepted by the  parameter of GetBooleanv, GetIntegerv, 
>>> GetFloatv,
>>> GetDoublev and GetInteger64v:
>>>
>>> MAX_VIEWPORTS   0x825B
>>> VIEWPORT_SUBPIXEL_BITS  0x825C
>>> VIEWPORT_BOUNDS_RANGE   0x825D
>>>     LAYER_PROVOKING_VERTEX  0x825E
>>> VIEWPORT_INDEX_PROVOKING_VERTEX     0x825F
>>>
>>> Accepted by the  parameter of GetIntegeri_v:
>>>
>>>     *SCISSOR_BOX     0x0C10*

Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-11-22 Thread Courtney Goeltzenleuchter
Got it.


On Fri, Nov 22, 2013 at 2:55 PM, Chris Forbes  wrote:

> It's just that last block that were messed up -- rest was context.
>
> Sorry for any confusion.
>
>
> On Sat, Nov 23, 2013 at 10:06 AM, Courtney Goeltzenleuchter <
> court...@lunarg.com> wrote:
>
>> Hi Chris,
>>
>> I'm using this version of the spec:
>> http://www.opengl.org/registry/specs/ARB/viewport_array.txt
>>
>> On Thu, Nov 21, 2013 at 4:41 PM, Chris Forbes  wrote:
>>
>>> I was just comparing to the list in the ARB_viewport_array spec.
>>>
>>>
>>> On Fri, Nov 22, 2013 at 11:33 AM, Courtney Goeltzenleuchter <
>>> court...@lunarg.com> wrote:
>>>
>>>> Hi Chris,
>>>>
>>>> Where are you getting your defines?
>>>> I copied them from include/GL/gl.h
>>>> #define GL_VIEWPORT 0x0BA2
>>>> /* Scissor box */
>>>> #define GL_SCISSOR_BOX 0x0C10
>>>> #define GL_SCISSOR_TEST 0x0C11
>>>> #define GL_SCISSOR_TEST 0x0C11
>>>> #define GL_DEPTH_RANGE 0x0B70
>>>>
>>>> Ah, FIRST_VERTEX looks different.
>>>> #define GL_FIRST_VERTEX_CONVENTION0x8E4D
>>>>
>>>> I'll add PROVOKING_VERTEX
>>>>
>>>> Looks like UNDEFINED_VERTEX was wrong as well.
>>>> (include/GL/glext.h) #define GL_UNDEFINED_VERTEX   0x8260
>>>>
>>>>  I was modelling one of the other extension xml files and they had
>>>> similar defines, though I could see no effect including or excluding them.
>>>>
>>>> Should I just get rid of the definitions for values that already exist
>>>> in gl.h or glext.h?
>>>>
>>>> Courtney
>>>>
>>>>
>>>> On Thu, Nov 21, 2013 at 1:00 PM, Chris Forbes  wrote:
>>>>
>>>>> I'm surprised the build system accepts the conflicting second
>>>>> definition of SCISSOR_BOX at all, actually -- that's weird.
>>>>>
>>>>>
>>>>> On Fri, Nov 22, 2013 at 8:55 AM, Chris Forbes wrote:
>>>>>
>>>>>> I mean some of the values don't match the spec :)
>>>>>>
>>>>>>
>>>>>> On Fri, Nov 22, 2013 at 7:52 AM, Courtney Goeltzenleuchter <
>>>>>> court...@lunarg.com> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Nov 20, 2013 at 7:28 PM, Chris Forbes wrote:
>>>>>>>
>>>>>>>> Oops -- the 8E4E is obviously correct. Artifact of me switching how
>>>>>>>> I
>>>>>>>> was commenting halfway through.
>>>>>>>>
>>>>>>>> On Thu, Nov 21, 2013 at 3:25 PM, Chris Forbes 
>>>>>>>> wrote:
>>>>>>>> > These are bogus:
>>>>>>>> >
>>>>>>>> > +
>>>>>>>> > +
>>>>>>>> > +
>>>>>>>> > +
>>>>>>>> > +
>>>>>>>>
>>>>>>>
>> In the spec I'm using I see:
>>
>> New Tokens
>>
>> Accepted by the  parameter of GetBooleanv, GetIntegerv, GetFloatv,
>> GetDoublev and GetInteger64v:
>>
>> MAX_VIEWPORTS   0x825B
>> VIEWPORT_SUBPIXEL_BITS  0x825C
>> VIEWPORT_BOUNDS_RANGE   0x825D
>> LAYER_PROVOKING_VERTEX  0x825E
>> VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
>>
>> Accepted by the  parameter of GetIntegeri_v:
>>
>> *SCISSOR_BOX     0x0C10*
>>
>> Accepted by the  parameter of GetFloati_v:
>>
>> *VIEWPORT0x0BA2*
>>
>> Accepted by the  parameter of GetDoublei_v:
>>
>> *DEPTH_RANGE 0x0B70*
>>
>> Accepted by the  parameter of Enablei, Disablei, and IsEnabledi:
>>
>> *SCISSOR_TEST0x0C11*
>>
>> Thus my confusion regarding "bogus" values.
>>
>> Returned in the  parameter from a Get query with a  of
>> LAYER_PROVOKING_VERTEX or VIEWPORT_INDEX_PROVOKING_VERTEX:
>>
>> FIRST_VERTEX_CONVENTION 0x8E4D
>> LAST_VERTEX_CONVENTION  0x8E4E
>> PROVOKING_VERTEX0x8E4F
>> UNDEFINED_VERTEX0x8260
>>
>>
>>
>>
>>>
>>>>>>> What do you mean by "bogus"?
>>>>>>> I was emulating other extension xml files. Are these not needed
>>>>>>> because they are already defined in gl_ext.h?
>>>>>>>
>>>>>>>
>>>>>>>> >
>>>>>>>> > 0x8E4D
>>>>>>>> >
>>>>>>>> > +
>>>>>>>> >
>>>>>>>> > 0x8E4E
>>>>>>>> >
>>>>>>>> > add: 
>>>>>>>> >
>>>>>>>> > +
>>>>>>>> >
>>>>>>>> > 0x8260
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Courtney Goeltzenleuchter
>>>>>>> LunarG
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Courtney Goeltzenleuchter
>>>> LunarG
>>>>
>>>>
>>>
>>
>>
>> --
>> Courtney Goeltzenleuchter
>> LunarG
>>
>>
>


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


Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-11-22 Thread Courtney Goeltzenleuchter
Hi Chris,

I'm using this version of the spec:
http://www.opengl.org/registry/specs/ARB/viewport_array.txt

On Thu, Nov 21, 2013 at 4:41 PM, Chris Forbes  wrote:

> I was just comparing to the list in the ARB_viewport_array spec.
>
>
> On Fri, Nov 22, 2013 at 11:33 AM, Courtney Goeltzenleuchter <
> court...@lunarg.com> wrote:
>
>> Hi Chris,
>>
>> Where are you getting your defines?
>> I copied them from include/GL/gl.h
>> #define GL_VIEWPORT 0x0BA2
>> /* Scissor box */
>> #define GL_SCISSOR_BOX 0x0C10
>> #define GL_SCISSOR_TEST 0x0C11
>> #define GL_SCISSOR_TEST 0x0C11
>> #define GL_DEPTH_RANGE 0x0B70
>>
>> Ah, FIRST_VERTEX looks different.
>> #define GL_FIRST_VERTEX_CONVENTION0x8E4D
>>
>> I'll add PROVOKING_VERTEX
>>
>> Looks like UNDEFINED_VERTEX was wrong as well.
>> (include/GL/glext.h) #define GL_UNDEFINED_VERTEX   0x8260
>>
>>  I was modelling one of the other extension xml files and they had
>> similar defines, though I could see no effect including or excluding them.
>>
>> Should I just get rid of the definitions for values that already exist in
>> gl.h or glext.h?
>>
>> Courtney
>>
>>
>> On Thu, Nov 21, 2013 at 1:00 PM, Chris Forbes  wrote:
>>
>>> I'm surprised the build system accepts the conflicting second definition
>>> of SCISSOR_BOX at all, actually -- that's weird.
>>>
>>>
>>> On Fri, Nov 22, 2013 at 8:55 AM, Chris Forbes  wrote:
>>>
>>>> I mean some of the values don't match the spec :)
>>>>
>>>>
>>>> On Fri, Nov 22, 2013 at 7:52 AM, Courtney Goeltzenleuchter <
>>>> court...@lunarg.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Wed, Nov 20, 2013 at 7:28 PM, Chris Forbes wrote:
>>>>>
>>>>>> Oops -- the 8E4E is obviously correct. Artifact of me switching how I
>>>>>> was commenting halfway through.
>>>>>>
>>>>>> On Thu, Nov 21, 2013 at 3:25 PM, Chris Forbes 
>>>>>> wrote:
>>>>>> > These are bogus:
>>>>>> >
>>>>>> > +
>>>>>> > +
>>>>>> > +
>>>>>> > +
>>>>>> > +
>>>>>>
>>>>>
In the spec I'm using I see:

New Tokens

Accepted by the  parameter of GetBooleanv, GetIntegerv, GetFloatv,
GetDoublev and GetInteger64v:

MAX_VIEWPORTS   0x825B
VIEWPORT_SUBPIXEL_BITS  0x825C
VIEWPORT_BOUNDS_RANGE   0x825D
LAYER_PROVOKING_VERTEX  0x825E
VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F

Accepted by the  parameter of GetIntegeri_v:

*SCISSOR_BOX 0x0C10*

Accepted by the  parameter of GetFloati_v:

*VIEWPORT0x0BA2*

Accepted by the  parameter of GetDoublei_v:

*DEPTH_RANGE 0x0B70*

Accepted by the  parameter of Enablei, Disablei, and IsEnabledi:

*SCISSOR_TEST0x0C11*

Thus my confusion regarding "bogus" values.

Returned in the  parameter from a Get query with a  of
LAYER_PROVOKING_VERTEX or VIEWPORT_INDEX_PROVOKING_VERTEX:

FIRST_VERTEX_CONVENTION     0x8E4D
LAST_VERTEX_CONVENTION  0x8E4E
PROVOKING_VERTEX0x8E4F
UNDEFINED_VERTEX0x8260




>
>>>>> What do you mean by "bogus"?
>>>>> I was emulating other extension xml files. Are these not needed
>>>>> because they are already defined in gl_ext.h?
>>>>>
>>>>>
>>>>>> >
>>>>>> > 0x8E4D
>>>>>> >
>>>>>> > +
>>>>>> >
>>>>>> > 0x8E4E
>>>>>> >
>>>>>> > add: 
>>>>>> >
>>>>>> > +
>>>>>> >
>>>>>> > 0x8260
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Courtney Goeltzenleuchter
>>>>> LunarG
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Courtney Goeltzenleuchter
>> LunarG
>>
>>
>


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


Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-11-21 Thread Courtney Goeltzenleuchter
Hi Chris,

Where are you getting your defines?
I copied them from include/GL/gl.h
#define GL_VIEWPORT 0x0BA2
/* Scissor box */
#define GL_SCISSOR_BOX 0x0C10
#define GL_SCISSOR_TEST 0x0C11
#define GL_SCISSOR_TEST 0x0C11
#define GL_DEPTH_RANGE 0x0B70

Ah, FIRST_VERTEX looks different.
#define GL_FIRST_VERTEX_CONVENTION0x8E4D

I'll add PROVOKING_VERTEX

Looks like UNDEFINED_VERTEX was wrong as well.
(include/GL/glext.h) #define GL_UNDEFINED_VERTEX   0x8260

I was modelling one of the other extension xml files and they had similar
defines, though I could see no effect including or excluding them.

Should I just get rid of the definitions for values that already exist in
gl.h or glext.h?

Courtney

On Thu, Nov 21, 2013 at 1:00 PM, Chris Forbes  wrote:

> I'm surprised the build system accepts the conflicting second definition
> of SCISSOR_BOX at all, actually -- that's weird.
>
>
> On Fri, Nov 22, 2013 at 8:55 AM, Chris Forbes  wrote:
>
>> I mean some of the values don't match the spec :)
>>
>>
>> On Fri, Nov 22, 2013 at 7:52 AM, Courtney Goeltzenleuchter <
>> court...@lunarg.com> wrote:
>>
>>>
>>>
>>> On Wed, Nov 20, 2013 at 7:28 PM, Chris Forbes  wrote:
>>>
>>>> Oops -- the 8E4E is obviously correct. Artifact of me switching how I
>>>> was commenting halfway through.
>>>>
>>>> On Thu, Nov 21, 2013 at 3:25 PM, Chris Forbes  wrote:
>>>> > These are bogus:
>>>> >
>>>> > +
>>>> > +
>>>> > +
>>>> > +
>>>> > +
>>>>
>>>
>>> What do you mean by "bogus"?
>>> I was emulating other extension xml files. Are these not needed because
>>> they are already defined in gl_ext.h?
>>>
>>>
>>>> >
>>>> > 0x8E4D
>>>> >
>>>> > +
>>>> >
>>>> > 0x8E4E
>>>> >
>>>> > add: 
>>>> >
>>>> > +
>>>> >
>>>> > 0x8260
>>>>
>>>
>>>
>>>
>>> --
>>> Courtney Goeltzenleuchter
>>> LunarG
>>>
>>>
>>
>


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


Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-11-21 Thread Courtney Goeltzenleuchter
On Wed, Nov 20, 2013 at 7:28 PM, Chris Forbes  wrote:

> Oops -- the 8E4E is obviously correct. Artifact of me switching how I
> was commenting halfway through.
>
> On Thu, Nov 21, 2013 at 3:25 PM, Chris Forbes  wrote:
> > These are bogus:
> >
> > +
> > +
> > +
> > +
> > +
>

What do you mean by "bogus"?
I was emulating other extension xml files. Are these not needed because
they are already defined in gl_ext.h?


> >
> > 0x8E4D
> >
> > +
> >
> > 0x8E4E
> >
> > add: 
> >
> > +
> >
> > 0x8260
>



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


Re: [Mesa-dev] [PATCH 00/15] Add ARB_viewport_array extension

2013-11-20 Thread Courtney Goeltzenleuchter
On Wed, Nov 20, 2013 at 5:06 PM, Ian Romanick  wrote:

> On 11/20/2013 02:59 PM, Courtney Goeltzenleuchter wrote:
> > This series starts by updating the driver interface for
> > scissor, viewport and DepthRange. This includes removing
> > unused arguments from the Scissor, Viewport and DepthRange.
> > I kept the index argument, although it is not used, it may
> > be useful to the dri driver to know which array element
> > is being updated.
>
> For such a long series, could you also make a GIT tree available
> somewhere?  It makes it a lot easier to play with.
>

I've posted the branch corresponding to these comments on github:
https://github.com/courtney-lunarg/mesa.git


>
> I think I'll rebase your tree on top of some of my patches.  I think
> that will make the overall series a little cleaner and more compact.
> For example, I think removing the parameters from the dd functions
> should go first.  That would basically eliminate your patches 1, 2, and 3.
>

I deliberately put the remove arguments at the end in case someone raised a
complaint about the removal. It seemed easier to back out there.


>
> > I added things incrementally, each having no effect
> > on piglit. I tested the full series against the arb_viewport_array
> > piglit tests submitted by LunarG and a stubbed version of the
> > i965 driver that enables ARB_viewport_array. I've not
> > included that stub in this series.
>
> You can also do this with an environment variable:
>
> MESA_GL_EXTENSION_OVERRIDE=+GL_ARB_viewport_array
>

Cool!


>
> > I modeled the indexed Get functions off GL_COLOR_WRITEMASK.
> >
> > Since the removal of x, y, w, h touches the same files as
> > references to gl_context.Viewport it seemed just as easy to
> > convert those references to the array reference with index 0.
> > Should the driver add ARB_viewport_array support they would
> > simply put the right index value in place of 0.
> >
> >
> > Courtney Goeltzenleuchter (18):
> >   mesa: Change scissor dd interface for viewport_array
> >   mesa: Update viewport dd interface for viewport_array
> >   mesa: Change DepthRange dd interface
> >   mesa: Update gl_scissor_attrib to support ARB_viewport_array
> >   mesa: Update viewport driver args for ARB_viewport_array
> >   mesa: Update viewport state for viewport_array
> >   meta: Update meta driver to use API entry point
> >   mesa: Add indexed version of mesa_scissor
> >   mesa: Add new get entrypoints for ARB_viewport_array
> >   mesa: Add custom get function for SCISSOR
> >   mesa: Add ARB_viewport_array state to gl_context
> >   mesa: Add scissor entry points for viewport_array
> >   mesa: Add ARB_viewport_array viewport entry points
> >   mesa: Add gl_ViewportIndex variable to GLSL
> >   mesa: Add ARB_viewport_array plumbing
> >   mesa: Remove unused arguments from driver->Scissor
> >   mesa: Remove unused arguments from driver->Viewport
> >   mesa: Remove unused arguments from driver->DepthRange
> >
> >  src/glsl/builtin_variables.cpp  |   2 +
> >  src/glsl/glsl_parser_extras.h   |   1 +
> >  src/mapi/glapi/gen/ARB_viewport_array.xml   |  79 ++
> >  src/mapi/glapi/gen/Makefile.am  |   1 +
> >  src/mapi/glapi/gen/gl_API.xml   |   2 +-
> >  src/mesa/drivers/common/driverfuncs.c   |  11 +-
> >  src/mesa/drivers/common/meta.c  |  52 ++--
> >  src/mesa/drivers/dri/i915/i830_state.c  |  26 +-
> >  src/mesa/drivers/dri/i915/i830_vtbl.c   |   5 +-
> >  src/mesa/drivers/dri/i915/i915_state.c  |  50 ++--
> >  src/mesa/drivers/dri/i915/i915_vtbl.c   |   5 +-
> >  src/mesa/drivers/dri/i915/intel_context.c   |  15 +-
> >  src/mesa/drivers/dri/i915/intel_fbo.c   |   2 +-
> >  src/mesa/drivers/dri/i965/brw_cc.c  |   4 +-
> >  src/mesa/drivers/dri/i965/brw_clear.c   |  12 +-
> >  src/mesa/drivers/dri/i965/brw_clip_state.c  |  12 +-
> >  src/mesa/drivers/dri/i965/brw_context.c |   7 +-
> >  src/mesa/drivers/dri/i965/brw_sf_state.c|   4 +-
> >  src/mesa/drivers/dri/i965/gen6_clip_state.c |   8 +-
> >  src/mesa/drivers/dri/i965/gen6_sf_state.c   |   2 +-
> >  src/mesa/drivers/dri/i965/gen6_viewport_state.c |   6 +-
> >  src/mesa/drivers/dri/i965/gen7_sf_state.c   |   2 +-
> >  src/mesa/drivers/dri/i965/gen7_viewport_state.c |   6 +-
> >  src/mesa/drivers/dri/i965/intel_fbo.c   |   2 +-
> >  src/mesa/drivers/dri/nouveau/nouveau_util.h |   4 +-
> >  src/mesa/drive

[Mesa-dev] [PATCH 16/18] mesa: Remove unused arguments from driver->Scissor

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/common/driverfuncs.c   |  4 +---
 src/mesa/drivers/dri/i915/i830_state.c  | 24 ++--
 src/mesa/drivers/dri/i915/i830_vtbl.c   |  3 +--
 src/mesa/drivers/dri/i915/i915_state.c  | 24 ++--
 src/mesa/drivers/dri/i915/i915_vtbl.c   |  3 +--
 src/mesa/drivers/dri/radeon/radeon_common.c |  2 +-
 src/mesa/drivers/dri/radeon/radeon_common.h |  2 +-
 src/mesa/main/dd.h  |  4 +---
 src/mesa/main/scissor.c |  4 +---
 9 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index f232766..ba923b2 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -298,9 +298,7 @@ _mesa_init_driver_state(struct gl_context *ctx)
{
   GLint i;
   for (i = 0; i < ctx->Const.MaxViewports; i++) {
- ctx->Driver.Scissor(ctx, i,
- ctx->Scissor.ScissorArray[i].X, 
ctx->Scissor.ScissorArray[i].Y,
- ctx->Scissor.ScissorArray[i].Width, 
ctx->Scissor.ScissorArray[i].Height);
+ ctx->Driver.Scissor(ctx, i);
   }
}
 
diff --git a/src/mesa/drivers/dri/i915/i830_state.c 
b/src/mesa/drivers/dri/i915/i830_state.c
index 090e4a0..b4298ad 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -527,7 +527,7 @@ i830PolygonStipple(struct gl_context * ctx, const GLubyte * 
mask)
  * Hardware clipping
  */
 static void
-i830Scissor(struct gl_context * ctx, GLuint idx, GLint x, GLint y, GLsizei w, 
GLsizei h)
+i830Scissor(struct gl_context * ctx, GLuint idx)
 {
struct i830_context *i830 = i830_context(ctx);
int x1, y1, x2, y2;
@@ -535,22 +535,26 @@ i830Scissor(struct gl_context * ctx, GLuint idx, GLint x, 
GLint y, GLsizei w, GL
if (!ctx->DrawBuffer)
   return;
 
-   DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
+   DBG("%s idx=%d %d,%d %dx%d\n", __FUNCTION__, idx,
+   ctx->Scissor.ScissorArray[idx].X,
+   ctx->Scissor.ScissorArray[idx].Y,
+   ctx->Scissor.ScissorArray[idx].Width,
+   ctx->Scissor.ScissorArray[idx].Height);
 
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-  x1 = x;
-  y1 = ctx->DrawBuffer->Height - (y + h);
-  x2 = x + w - 1;
-  y2 = y1 + h - 1;
+  x1 = ctx->Scissor.ScissorArray[idx].X;
+  y1 = ctx->DrawBuffer->Height - (ctx->Scissor.ScissorArray[idx].Y + 
ctx->Scissor.ScissorArray[idx].Height);
+  x2 = ctx->Scissor.ScissorArray[idx].X + 
ctx->Scissor.ScissorArray[idx].Width - 1;
+  y2 = y1 + ctx->Scissor.ScissorArray[idx].Height - 1;
   DBG("%s %d..%d,%d..%d (inverted)\n", __FUNCTION__, x1, x2, y1, y2);
}
else {
   /* FBO - not inverted
*/
-  x1 = x;
-  y1 = y;
-  x2 = x + w - 1;
-  y2 = y + h - 1;
+  x1 = ctx->Scissor.ScissorArray[idx].X;
+  y1 = ctx->Scissor.ScissorArray[idx].Y;
+  x2 = ctx->Scissor.ScissorArray[idx].X + 
ctx->Scissor.ScissorArray[idx].Width - 1;
+  y2 = ctx->Scissor.ScissorArray[idx].Y + 
ctx->Scissor.ScissorArray[idx].Height - 1;
   DBG("%s %d..%d,%d..%d (not inverted)\n", __FUNCTION__, x1, x2, y1, y2);
}
 
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index e0959cc..0a90fc0 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -837,8 +837,7 @@ i830_update_draw_buffer(struct intel_context *intel)
 
/* Set state we know depends on drawable parameters:
 */
-   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.ScissorArray[0].X, 
ctx->Scissor.ScissorArray[0].Y,
-  ctx->Scissor.ScissorArray[0].Width, 
ctx->Scissor.ScissorArray[0].Height);
+   ctx->Driver.Scissor(ctx, 0);
 
ctx->Driver.DepthRange(ctx, 0, ctx->ViewportArray[0].Near, 
ctx->ViewportArray[0].Far);
 
diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index 5f58f33..8ae7202 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -501,7 +501,7 @@ i915PolygonStipple(struct gl_context * ctx, const GLubyte * 
mask)
  * Hardware clipping
  */
 static void
-i915Scissor(struct gl_context * ctx, GLuint idx, GLint x, GLint y, GLsizei w, 
GLsizei h)
+i915Scissor(struct gl_context * ctx, GLuint idx)
 {
struct i915_context *i915 = I915_CONTEXT(ctx);
int x1, y1, x2, y2;
@@ -509,22 +509,26 @@ i915Scissor(struct gl_context * ctx, GLuint idx, GLint x, 
GLint y, GLsizei w, GL
if (!ctx->DrawBuffer)
   return;
 
-   DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
+   DBG("%s idx=%d %d,%d %dx%d\n", __FUNCTION__, idx,
+ 

[Mesa-dev] [PATCH 17/18] mesa: Remove unused arguments from driver->Viewport

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i915/intel_context.c   | 14 ++
 src/mesa/drivers/dri/i965/brw_context.c |  7 +--
 src/mesa/drivers/dri/r200/r200_state.c  |  9 +
 src/mesa/drivers/dri/radeon/radeon_common.c |  4 +---
 src/mesa/drivers/dri/radeon/radeon_state.c  |  8 +---
 src/mesa/drivers/dri/swrast/swrast.c|  9 +++--
 src/mesa/main/dd.h  |  4 +---
 src/mesa/main/viewport.c|  4 +---
 src/mesa/state_tracker/st_cb_viewport.c |  4 +---
 9 files changed, 12 insertions(+), 51 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_context.c 
b/src/mesa/drivers/dri/i915/intel_context.c
index 24837cd..2291b0e 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -271,16 +271,12 @@ intel_prepare_render(struct intel_context *intel)
 }
 
 static void
-intel_viewport(struct gl_context *ctx, GLuint idx, GLfloat x, GLfloat y, 
GLfloat w, GLfloat h)
+intel_viewport(struct gl_context *ctx, GLuint idx)
 {
 struct intel_context *intel = intel_context(ctx);
 __DRIcontext *driContext = intel->driContext;
 
 (void) idx;
-(void) x;
-(void) y;
-(void) w;
-(void) h;
 
 intelCalcViewport(ctx);
 
@@ -291,14 +287,8 @@ intel_viewport(struct gl_context *ctx, GLuint idx, GLfloat 
x, GLfloat y, GLfloat
 }
 
 static void
-intel_noninvalidate_viewport(struct gl_context *ctx, GLuint idx, GLfloat x, 
GLfloat y, GLfloat w, GLfloat h)
+intel_noninvalidate_viewport(struct gl_context *ctx, GLuint idx)
 {
-(void) idx;
-(void) x;
-(void) y;
-(void) w;
-(void) h;
-
 intelCalcViewport(ctx);
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index bf01caa..2c03a6c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -134,16 +134,11 @@ intelGetString(struct gl_context * ctx, GLenum name)
 }
 
 static void
-intel_viewport(struct gl_context *ctx, GLuint idx, GLfloat x, GLfloat y, 
GLfloat w, GLfloat h)
+intel_viewport(struct gl_context *ctx, GLuint idx)
 {
struct brw_context *brw = brw_context(ctx);
__DRIcontext *driContext = brw->driContext;
 
-   (void) x;
-   (void) y;
-   (void) w;
-   (void) h;
-
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
   dri2InvalidateDrawable(driContext->driDrawablePriv);
   dri2InvalidateDrawable(driContext->driReadablePriv);
diff --git a/src/mesa/drivers/dri/r200/r200_state.c 
b/src/mesa/drivers/dri/r200/r200_state.c
index a62928e..a9c9f9f 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1600,15 +1600,8 @@ void r200_vtbl_update_scissor( struct gl_context *ctx )
 }
 
 
-static void r200Viewport( struct gl_context *ctx, GLuint idx,
-  GLfloat x, GLfloat y,
- GLfloat width, GLfloat height )
+static void r200Viewport( struct gl_context *ctx, GLuint idx)
 {
-   (void) x;
-   (void) y;
-   (void) width;
-   (void) height;
-
/* Don't pipeline viewport changes, conflict with window offset
 * setting below.  Could apply deltas to rescue pipelined viewport
 * values, or keep the originals hanging around.
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index 692e22a..d7121c4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -410,9 +410,7 @@ void radeon_viewport(struct gl_context *ctx)
 {
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
__DRIcontext *driContext = radeon->dri.context;
-   void (*old_viewport)(struct gl_context *ctx, GLuint idx,
- GLfloat X, GLfloat Y,
- GLfloat Width, GLfloat Height);
+   void (*old_viewport)(struct gl_context *ctx, GLuint idx);
 
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
if (radeon->is_front_buffer_rendering) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c 
b/src/mesa/drivers/dri/radeon/radeon_state.c
index 1225cd5..52ddbfd 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1383,14 +1383,8 @@ void radeonUpdateWindow( struct gl_context *ctx )
 }
 
 
-static void radeonViewport( struct gl_context *ctx, GLuint idx,
-GLfloat x, GLfloat y,
-   GLfloat width, GLfloat height )
+static void radeonViewport( struct gl_context *ctx, GLuint idx)
 {
-   (void) x;
-   (void) y;
-   (void) width;
-   (void) height;
 
/* Don't pipeline viewport changes, conflict with window offset
 * setting below.  Could apply deltas to rescue pipelined viewport
diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index 2e3177d..34e63ee 100644
--- a/sr

[Mesa-dev] [PATCH 11/18] mesa: Add ARB_viewport_array state to gl_context

2013-11-20 Thread Courtney Goeltzenleuchter
Add ARB_viewport_array in extensions.c and a flag in gl_extensions.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/context.c|  3 +++
 src/mesa/main/extensions.c |  1 +
 src/mesa/main/get.c|  1 +
 src/mesa/main/mtypes.h | 10 --
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 91f3812..2baf4ef 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -589,6 +589,9 @@ _mesa_init_constants(struct gl_context *ctx)
 
/* Driver must override if it supports ARB_viewport_array */
ctx->Const.MaxViewports = 1;
+   ctx->Const.ViewportSubpixelBits = 0;
+   ctx->Const.ViewportBounds.Min = 0;
+   ctx->Const.ViewportBounds.Max = 0;
 
/** GL_ARB_uniform_buffer_object */
ctx->Const.MaxCombinedUniformBlocks = 36;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 104618c..dc82d5a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -171,6 +171,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_vertex_shader",   o(ARB_vertex_shader),   
GL, 2002 },
{ "GL_ARB_vertex_type_10f_11f_11f_rev", 
o(ARB_vertex_type_10f_11f_11f_rev), GL, 2013 },
{ "GL_ARB_vertex_type_2_10_10_10_rev",  
o(ARB_vertex_type_2_10_10_10_rev),  GL, 2009 },
+   { "GL_ARB_viewport_array",  o(ARB_viewport_array),  
GL, 2010 },
{ "GL_ARB_window_pos",  o(dummy_true),  
GLL,2001 },
/* EXT extensions */
{ "GL_EXT_abgr",o(dummy_true),  
GL, 1995 },
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9e5c04a..de1d9c5 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -378,6 +378,7 @@ EXTRA_EXT(ARB_texture_buffer_range);
 EXTRA_EXT(ARB_texture_multisample);
 EXTRA_EXT(ARB_texture_gather);
 EXTRA_EXT(ARB_shader_atomic_counters);
+EXTRA_EXT(ARB_viewport_array);
 
 static const int
 extra_ARB_color_buffer_float_or_glcore[] = {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b295027..01be5de 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -998,7 +998,7 @@ struct gl_scissor_rect
 };
 struct gl_scissor_attrib
 {
-   GLboolean EnableFlags;  /**< Scissor test enabled? */
+   GLbitfield EnableFlags; /**< Scissor test enabled? */
struct gl_scissor_rect ScissorArray[MAX_VIEWPORTS];
 };
 
@@ -3118,8 +3118,13 @@ struct gl_constants
GLfloat MaxShininess; /**< GL_NV_light_max_exponent */
GLfloat MaxSpotExponent;  /**< GL_NV_light_max_exponent */
 
-   GLuint MaxViewportWidth, MaxViewportHeight;
+   GLfloat MaxViewportWidth, MaxViewportHeight;
GLuint MaxViewports;  /**< GL_ARB_viewport_array */
+   GLuint ViewportSubpixelBits;  /**< GL_ARB_viewport_array */
+   struct {
+  GLfloat Min;
+  GLfloat Max;
+   } ViewportBounds; /**< GL_ARB_viewport_array */
 
struct gl_program_constants VertexProgram;   /**< GL_ARB_vertex_program */
struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */
@@ -3381,6 +3386,7 @@ struct gl_extensions
GLboolean ARB_vertex_shader;
GLboolean ARB_vertex_type_10f_11f_11f_rev;
GLboolean ARB_vertex_type_2_10_10_10_rev;
+   GLboolean ARB_viewport_array;
GLboolean EXT_blend_color;
GLboolean EXT_blend_equation_separate;
GLboolean EXT_blend_func_separate;
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 11/18] mesa: Add custom get function for SCISSOR

2013-11-20 Thread Courtney Goeltzenleuchter
Now that the scissor enable state is a bitfield need a
custom function to extract the correct value from gl_context.
Modeled Scissor.EnableFlags after Color.BlendEnabled.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/context.c| 3 +++
 src/mesa/main/extensions.c | 1 +
 src/mesa/main/get.c| 1 +
 src/mesa/main/mtypes.h | 8 +++-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 91f3812..2baf4ef 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -589,6 +589,9 @@ _mesa_init_constants(struct gl_context *ctx)
 
/* Driver must override if it supports ARB_viewport_array */
ctx->Const.MaxViewports = 1;
+   ctx->Const.ViewportSubpixelBits = 0;
+   ctx->Const.ViewportBounds.Min = 0;
+   ctx->Const.ViewportBounds.Max = 0;
 
/** GL_ARB_uniform_buffer_object */
ctx->Const.MaxCombinedUniformBlocks = 36;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 104618c..dc82d5a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -171,6 +171,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_vertex_shader",   o(ARB_vertex_shader),   
GL, 2002 },
{ "GL_ARB_vertex_type_10f_11f_11f_rev", 
o(ARB_vertex_type_10f_11f_11f_rev), GL, 2013 },
{ "GL_ARB_vertex_type_2_10_10_10_rev",  
o(ARB_vertex_type_2_10_10_10_rev),  GL, 2009 },
+   { "GL_ARB_viewport_array",  o(ARB_viewport_array),  
GL, 2010 },
{ "GL_ARB_window_pos",  o(dummy_true),  
GLL,2001 },
/* EXT extensions */
{ "GL_EXT_abgr",o(dummy_true),  
GL, 1995 },
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9e5c04a..de1d9c5 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -378,6 +378,7 @@ EXTRA_EXT(ARB_texture_buffer_range);
 EXTRA_EXT(ARB_texture_multisample);
 EXTRA_EXT(ARB_texture_gather);
 EXTRA_EXT(ARB_shader_atomic_counters);
+EXTRA_EXT(ARB_viewport_array);
 
 static const int
 extra_ARB_color_buffer_float_or_glcore[] = {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 63d1420..01be5de 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3118,8 +3118,13 @@ struct gl_constants
GLfloat MaxShininess; /**< GL_NV_light_max_exponent */
GLfloat MaxSpotExponent;  /**< GL_NV_light_max_exponent */
 
-   GLuint MaxViewportWidth, MaxViewportHeight;
+   GLfloat MaxViewportWidth, MaxViewportHeight;
GLuint MaxViewports;  /**< GL_ARB_viewport_array */
+   GLuint ViewportSubpixelBits;  /**< GL_ARB_viewport_array */
+   struct {
+  GLfloat Min;
+  GLfloat Max;
+   } ViewportBounds; /**< GL_ARB_viewport_array */
 
struct gl_program_constants VertexProgram;   /**< GL_ARB_vertex_program */
struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */
@@ -3381,6 +3386,7 @@ struct gl_extensions
GLboolean ARB_vertex_shader;
GLboolean ARB_vertex_type_10f_11f_11f_rev;
GLboolean ARB_vertex_type_2_10_10_10_rev;
+   GLboolean ARB_viewport_array;
GLboolean EXT_blend_color;
GLboolean EXT_blend_equation_separate;
GLboolean EXT_blend_func_separate;
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 18/18] mesa: Remove unused arguments from driver->DepthRange

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i915/i830_state.c  | 2 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c   | 2 +-
 src/mesa/drivers/dri/i915/i915_state.c  | 2 +-
 src/mesa/drivers/dri/i915/i915_vtbl.c   | 2 +-
 src/mesa/drivers/dri/r200/r200_state.c  | 3 +--
 src/mesa/drivers/dri/radeon/radeon_common.c | 4 +---
 src/mesa/drivers/dri/radeon/radeon_state.c  | 3 +--
 src/mesa/main/dd.h  | 3 +--
 src/mesa/main/viewport.c| 2 +-
 9 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_state.c 
b/src/mesa/drivers/dri/i915/i830_state.c
index b4298ad..3435359 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -453,7 +453,7 @@ i830DepthMask(struct gl_context * ctx, GLboolean flag)
 
 /** Called from ctx->Driver.DepthRange() */
 static void
-i830DepthRange(struct gl_context * ctx, GLuint idx, GLclampd nearval, GLclampd 
farval)
+i830DepthRange(struct gl_context * ctx, GLuint idx)
 {
intelCalcViewport(ctx);
 }
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 0a90fc0..a8e67c2 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -839,7 +839,7 @@ i830_update_draw_buffer(struct intel_context *intel)
 */
ctx->Driver.Scissor(ctx, 0);
 
-   ctx->Driver.DepthRange(ctx, 0, ctx->ViewportArray[0].Near, 
ctx->ViewportArray[0].Far);
+   ctx->Driver.DepthRange(ctx, 0);
 
/* Update culling direction which changes depending on the
 * orientation of the buffer:
diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index 8ae7202..47c01a0 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -426,7 +426,7 @@ intelCalcViewport(struct gl_context * ctx)
 
 /** Called from ctx->Driver.DepthRange() */
 static void
-i915DepthRange(struct gl_context * ctx, GLuint idx, GLclampd nearval, GLclampd 
farval)
+i915DepthRange(struct gl_context * ctx, GLuint idx)
 {
intelCalcViewport(ctx);
 }
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 80a0ff3..778e523 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -811,7 +811,7 @@ i915_update_draw_buffer(struct intel_context *intel)
 
/* Set state we know depends on drawable parameters:
 */
-   ctx->Driver.DepthRange(ctx, 0, ctx->ViewportArray[0].Near, 
ctx->ViewportArray[0].Far);
+   ctx->Driver.DepthRange(ctx, 0);
ctx->Driver.Scissor(ctx, 0);
 
/* Update culling direction which changes depending on the
diff --git a/src/mesa/drivers/dri/r200/r200_state.c 
b/src/mesa/drivers/dri/r200/r200_state.c
index a9c9f9f..bda8d89 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1611,8 +1611,7 @@ static void r200Viewport( struct gl_context *ctx, GLuint 
idx)
radeon_viewport(ctx);
 }
 
-static void r200DepthRange( struct gl_context *ctx, GLuint idx,
-GLclampd nearval, GLclampd farval )
+static void r200DepthRange( struct gl_context *ctx, GLuint idx)
 {
r200UpdateWindow( ctx );
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index d7121c4..eeedae5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -333,9 +333,7 @@ void radeon_draw_buffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
radeon->NewGLState |= _NEW_SCISSOR;
 
if (ctx->Driver.DepthRange)
-   ctx->Driver.DepthRange(ctx, 0,
-  ctx->ViewportArray[0].Near,
-  ctx->ViewportArray[0].Far);
+   ctx->Driver.DepthRange(ctx, 0);
 
/* Update culling direction which changes depending on the
 * orientation of the buffer:
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c 
b/src/mesa/drivers/dri/radeon/radeon_state.c
index 52ddbfd..534ec46 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1395,8 +1395,7 @@ static void radeonViewport( struct gl_context *ctx, 
GLuint idx)
radeon_viewport(ctx);
 }
 
-static void radeonDepthRange( struct gl_context *ctx, GLuint idx,
- GLclampd nearval, GLclampd farval )
+static void radeonDepthRange( struct gl_context *ctx, GLuint idx)
 {
radeonUpdateWindow( ctx );
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index c61fe12..c8618b5 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -479,8 +479,7 @@ struct dd_function_table {
/** Enable or disable writing into the depth buffer */
void (*DepthMask)(struct gl_context *ctx, GLboolean flag);

[Mesa-dev] [PATCH 04/18] mesa: Update gl_scissor_attrib to support ARB_viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter
Update Mesa and drivers to access updated gl_scissor_attrib.
Now have an enable bitfield and array of gl_scissor_rects.
Drivers have been updated to the new scissor enable state
attribute (gl_context.scissor.EnableFlags) but still treat it
as a single boolean which is okay as mesa will only use
bit 0 when communicating with a driver that does not support
ARB_viewport_array.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/common/driverfuncs.c   | 13 ++---
 src/mesa/drivers/common/meta.c  |  6 +++---
 src/mesa/drivers/dri/i915/i830_vtbl.c   |  4 ++--
 src/mesa/drivers/dri/i915/i915_vtbl.c   |  4 ++--
 src/mesa/drivers/dri/i915/intel_fbo.c   |  2 +-
 src/mesa/drivers/dri/i965/brw_clear.c   | 12 ++--
 src/mesa/drivers/dri/i965/brw_sf_state.c|  2 +-
 src/mesa/drivers/dri/i965/gen6_sf_state.c   |  2 +-
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |  2 +-
 src/mesa/drivers/dri/i965/intel_fbo.c   |  2 +-
 src/mesa/drivers/dri/radeon/radeon_common.c |  6 +++---
 src/mesa/main/attrib.c  | 21 +++--
 src/mesa/main/config.h  |  3 +++
 src/mesa/main/enable.c  | 29 -
 src/mesa/main/framebuffer.c | 19 ++-
 src/mesa/main/get.c | 12 
 src/mesa/main/get_hash_params.py|  2 +-
 src/mesa/main/mtypes.h  |  9 +++--
 src/mesa/main/scissor.c | 26 +-
 src/mesa/state_tracker/st_atom_rasterizer.c |  2 +-
 src/mesa/state_tracker/st_atom_scissor.c| 14 +++---
 src/mesa/state_tracker/st_cb_bitmap.c   |  2 +-
 src/mesa/state_tracker/st_cb_clear.c| 10 +-
 src/mesa/state_tracker/st_cb_drawpixels.c   |  2 +-
 src/mesa/swrast/s_context.c |  2 +-
 25 files changed, 128 insertions(+), 80 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index e45dc0e..f232766 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -271,7 +271,7 @@ _mesa_init_driver_state(struct gl_context *ctx)
ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled);
ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag);
ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag);
-   ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled);
+   ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.EnableFlags);
ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
@@ -295,12 +295,19 @@ _mesa_init_driver_state(struct gl_context *ctx)
   ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f);
}
 
+   {
+  GLint i;
+  for (i = 0; i < ctx->Const.MaxViewports; i++) {
+ ctx->Driver.Scissor(ctx, i,
+ ctx->Scissor.ScissorArray[i].X, 
ctx->Scissor.ScissorArray[i].Y,
+ ctx->Scissor.ScissorArray[i].Width, 
ctx->Scissor.ScissorArray[i].Height);
+  }
+   }
+
ctx->Driver.LineWidth(ctx, ctx->Line.Width);
ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
ctx->Driver.PointSize(ctx, ctx->Point.Size);
ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
-   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
-   ctx->Scissor.Width, ctx->Scissor.Height);
ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
ctx->Stencil.Function[0],
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 99b02ba..7b0e42c 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -931,9 +931,9 @@ _mesa_meta_end(struct gl_context *ctx)
}
 
if (state & MESA_META_SCISSOR) {
-  _mesa_set_enable(ctx, GL_SCISSOR_TEST, save->Scissor.Enabled);
-  _mesa_Scissor(save->Scissor.X, save->Scissor.Y,
-save->Scissor.Width, save->Scissor.Height);
+  _mesa_set_enable(ctx, GL_SCISSOR_TEST, save->Scissor.EnableFlags);
+  _mesa_Scissor(save->Scissor.ScissorArray[0].X, 
save->Scissor.ScissorArray[0].Y,
+save->Scissor.ScissorArray[0].Width, 
save->Scissor.ScissorArray[0].Height);
}
 
if (state & MESA_META_SHADER) {
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 33ca002..72445ae 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -837,8 +837,8 @@ i830_update_draw_buffer(struct intel_context *intel

[Mesa-dev] [PATCH 09/18] mesa: Add new get entrypoints for ARB_viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/get.c | 189 
 src/mesa/main/get.h |   6 ++
 2 files changed, 195 insertions(+)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index b8929a5..9e5c04a 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1671,6 +1671,31 @@ find_value_indexed(const char *func, GLenum pname, 
GLuint index, union value *v)
   v->value_int_4[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0;
   return TYPE_INT_4;
 
+   case GL_SCISSOR_BOX:
+  if (index >= ctx->Const.MaxViewports)
+ goto invalid_value;
+  v->value_int_4[0] = ctx->Scissor.ScissorArray[index].X;
+  v->value_int_4[1] = ctx->Scissor.ScissorArray[index].Y;
+  v->value_int_4[2] = ctx->Scissor.ScissorArray[index].Width;
+  v->value_int_4[3] = ctx->Scissor.ScissorArray[index].Height;
+  return TYPE_INT_4;
+
+   case GL_VIEWPORT:
+  if (index >= ctx->Const.MaxViewports)
+ goto invalid_value;
+  v->value_float_4[0] = ctx->ViewportArray[index].X;
+  v->value_float_4[1] = ctx->ViewportArray[index].Y;
+  v->value_float_4[2] = ctx->ViewportArray[index].Width;
+  v->value_float_4[3] = ctx->ViewportArray[index].Height;
+  return TYPE_FLOAT_4;
+
+   case GL_DEPTH_RANGE:
+  if (index >= ctx->Const.MaxViewports)
+ goto invalid_value;
+  v->value_double_2[0] = ctx->ViewportArray[index].Near;
+  v->value_double_2[1] = ctx->ViewportArray[index].Far;
+  return TYPE_DOUBLEN_2;
+
case GL_TRANSFORM_FEEDBACK_BUFFER_START:
   if (index >= ctx->Const.MaxTransformFeedbackBuffers)
 goto invalid_value;
@@ -1821,6 +1846,26 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint 
*params )
   find_value_indexed("glGetIntegeri_v", pname, index, &v);
 
switch (type) {
+   case TYPE_FLOAT_4:
+   case TYPE_FLOATN_4:
+  params[3] = IROUND(v.value_float_4[3]);
+   case TYPE_FLOAT_3:
+   case TYPE_FLOATN_3:
+  params[2] = IROUND(v.value_float_4[2]);
+   case TYPE_FLOAT_2:
+   case TYPE_FLOATN_2:
+  params[1] = IROUND(v.value_float_4[1]);
+   case TYPE_FLOAT:
+   case TYPE_FLOATN:
+  params[0] = IROUND(v.value_float_4[0]);
+  break;
+
+   case TYPE_DOUBLEN_2:
+  params[1] = IROUND(v.value_double_2[1]);
+   case TYPE_DOUBLEN:
+  params[0] = IROUND(v.value_double_2[0]);
+  break;
+
case TYPE_INT:
   params[0] = v.value_int;
   break;
@@ -1864,6 +1909,150 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, 
GLint64 *params )
 }
 
 void GLAPIENTRY
+_mesa_GetFloati_v(GLenum pname, GLuint index, GLfloat *params)
+{
+   GLuint i;
+   GLmatrix *m;
+   union value v;
+   enum value_type type =
+  find_value_indexed("glGetFloati_v", pname, index, &v);
+
+   switch (type) {
+   case TYPE_FLOAT_4:
+   case TYPE_FLOATN_4:
+  params[3] = v.value_float_4[3];
+   case TYPE_FLOAT_3:
+   case TYPE_FLOATN_3:
+  params[2] = v.value_float_4[2];
+   case TYPE_FLOAT_2:
+   case TYPE_FLOATN_2:
+  params[1] = v.value_float_4[1];
+   case TYPE_FLOAT:
+   case TYPE_FLOATN:
+  params[0] = v.value_float_4[0];
+  break;
+
+   case TYPE_DOUBLEN_2:
+  params[1] = (GLfloat) v.value_double_2[1];
+   case TYPE_DOUBLEN:
+  params[0] = (GLfloat) v.value_double_2[0];
+  break;
+
+   case TYPE_INT_4:
+  params[3] = (GLfloat) v.value_int_4[3];
+   case TYPE_INT_3:
+  params[2] = (GLfloat) v.value_int_4[2];
+   case TYPE_INT_2:
+   case TYPE_ENUM_2:
+  params[1] = (GLfloat) v.value_int_4[1];
+   case TYPE_INT:
+   case TYPE_ENUM:
+  params[0] = (GLfloat) v.value_int_4[0];
+  break;
+
+   case TYPE_INT_N:
+  for (i = 0; i < v.value_int_n.n; i++)
+params[i] = INT_TO_FLOAT(v.value_int_n.ints[i]);
+  break;
+
+   case TYPE_INT64:
+  params[0] = (GLfloat) v.value_int64;
+  break;
+
+   case TYPE_BOOLEAN:
+  params[0] = BOOLEAN_TO_FLOAT(v.value_bool);
+  break;
+
+   case TYPE_MATRIX:
+  m = *(GLmatrix **) &v;
+  for (i = 0; i < 16; i++)
+params[i] = m->m[i];
+  break;
+
+   case TYPE_MATRIX_T:
+  m = *(GLmatrix **) &v;
+  for (i = 0; i < 16; i++)
+params[i] = m->m[transpose[i]];
+  break;
+
+   default:
+  ;
+   }
+}
+
+void GLAPIENTRY
+_mesa_GetDoublei_v(GLenum pname, GLuint index, GLdouble *params)
+{
+   GLuint i;
+   GLmatrix *m;
+   union value v;
+   enum value_type type =
+  find_value_indexed("glGetDoublei_v", pname, index, &v);
+
+   switch (type) {
+   case TYPE_FLOAT_4:
+   case TYPE_FLOATN_4:
+  params[3] = (GLdouble) v.value_float_4[3];
+   case TYPE_FLOAT_3:
+   case TYPE_FLOATN_3:
+  params[2] = (GLdouble) v.value_float_4[2];
+   case TYPE_FLOAT_2:
+   case TYPE_FLOATN_2:
+  params[1] = (GLdouble) v.value_float_4[1];
+   case TYPE_FL

[Mesa-dev] [PATCH 06/18] mesa: Update viewport state for viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter
Include DepthRange as well since it's state is lumped together with
viewport state.
Updates all the drivers that reference Viewport state in
gl_context.

Have meta driver call _mesa_Viewport as that interface is not
changing.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/common/meta.c  | 32 +++
 src/mesa/drivers/dri/i915/i830_vtbl.c   |  2 +-
 src/mesa/drivers/dri/i915/i915_state.c  | 24 ++--
 src/mesa/drivers/dri/i915/i915_vtbl.c   |  2 +-
 src/mesa/drivers/dri/i965/brw_cc.c  |  4 +-
 src/mesa/drivers/dri/i965/brw_clip_state.c  | 12 +++---
 src/mesa/drivers/dri/i965/brw_sf_state.c|  2 +-
 src/mesa/drivers/dri/i965/gen6_clip_state.c |  8 ++--
 src/mesa/drivers/dri/i965/gen6_viewport_state.c |  6 +--
 src/mesa/drivers/dri/i965/gen7_viewport_state.c |  6 +--
 src/mesa/drivers/dri/nouveau/nouveau_util.h |  4 +-
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c|  2 +-
 src/mesa/drivers/dri/r200/r200_state.c  |  6 +--
 src/mesa/drivers/dri/radeon/radeon_common.c |  4 +-
 src/mesa/drivers/dri/radeon/radeon_state.c  |  4 +-
 src/mesa/main/attrib.c  |  6 ++-
 src/mesa/main/context.c | 21 ++
 src/mesa/main/get.c | 16 ++--
 src/mesa/main/get_hash_params.py|  2 +-
 src/mesa/main/mtypes.h  |  8 ++--
 src/mesa/main/rastpos.c |  4 +-
 src/mesa/main/state.c   | 17 
 src/mesa/main/viewport.c| 52 -
 src/mesa/math/m_matrix.c|  9 +++--
 src/mesa/math/m_matrix.h|  4 +-
 src/mesa/program/prog_statevars.c   |  7 ++--
 src/mesa/state_tracker/st_atom_viewport.c   | 12 +++---
 src/mesa/swrast/s_context.c |  8 ++--
 src/mesa/swrast/s_depth.c   | 10 ++---
 src/mesa/swrast_setup/ss_context.c  |  4 +-
 src/mesa/tnl/t_rasterpos.c  | 16 
 31 files changed, 166 insertions(+), 148 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7b0e42c..0cb6625 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -735,21 +735,21 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 
if (state & MESA_META_VIEWPORT) {
   /* save viewport state */
-  save->ViewportX = ctx->Viewport.X;
-  save->ViewportY = ctx->Viewport.Y;
-  save->ViewportW = ctx->Viewport.Width;
-  save->ViewportH = ctx->Viewport.Height;
+  save->ViewportX = ctx->ViewportArray[0].X;
+  save->ViewportY = ctx->ViewportArray[0].Y;
+  save->ViewportW = ctx->ViewportArray[0].Width;
+  save->ViewportH = ctx->ViewportArray[0].Height;
   /* set viewport to match window size */
-  if (ctx->Viewport.X != 0 ||
-  ctx->Viewport.Y != 0 ||
-  ctx->Viewport.Width != ctx->DrawBuffer->Width ||
-  ctx->Viewport.Height != ctx->DrawBuffer->Height) {
- _mesa_set_viewport(ctx, 0, 0,
-ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
+  if (ctx->ViewportArray[0].X != 0 ||
+  ctx->ViewportArray[0].Y != 0 ||
+  ctx->ViewportArray[0].Width != ctx->DrawBuffer->Width ||
+  ctx->ViewportArray[0].Height != ctx->DrawBuffer->Height) {
+ _mesa_Viewport(0, 0,
+ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
   }
   /* save depth range state */
-  save->DepthNear = ctx->Viewport.Near;
-  save->DepthFar = ctx->Viewport.Far;
+  save->DepthNear = ctx->ViewportArray[0].Near;
+  save->DepthFar = ctx->ViewportArray[0].Far;
   /* set depth range to default */
   _mesa_DepthRange(0.0, 1.0);
}
@@ -1087,10 +1087,10 @@ _mesa_meta_end(struct gl_context *ctx)
}
 
if (state & MESA_META_VIEWPORT) {
-  if (save->ViewportX != ctx->Viewport.X ||
-  save->ViewportY != ctx->Viewport.Y ||
-  save->ViewportW != ctx->Viewport.Width ||
-  save->ViewportH != ctx->Viewport.Height) {
+  if (save->ViewportX != ctx->ViewportArray[0].X ||
+  save->ViewportY != ctx->ViewportArray[0].Y ||
+  save->ViewportW != ctx->ViewportArray[0].Width ||
+  save->ViewportH != ctx->ViewportArray[0].Height) {
  _mesa_set_viewport(ctx, save->ViewportX, save->ViewportY,
 save->ViewportW, save->ViewportH);
   }
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 72445ae..e0959cc 100644
--- a/src/mesa/drivers/dri/i915/i830_vt

[Mesa-dev] [PATCH 08/18] mesa: Add indexed version of mesa_scissor

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/attrib.c  | 17 ++---
 src/mesa/main/context.c | 10 +-
 src/mesa/main/scissor.c | 46 ++
 src/mesa/main/scissor.h |  2 +-
 4 files changed, 50 insertions(+), 25 deletions(-)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 996e2cf..3f9c648 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1210,14 +1210,17 @@ _mesa_PopAttrib(void)
  case GL_SCISSOR_BIT:
 {
const struct gl_scissor_attrib *scissor;
+   GLuint i;
scissor = (const struct gl_scissor_attrib *) attr->data;
-   _mesa_set_scissor(ctx,
- scissor->ScissorArray[0].X,
- scissor->ScissorArray[0].Y,
- scissor->ScissorArray[0].Width,
- scissor->ScissorArray[0].Height);
-   _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->EnableFlags & 
1);
-
+   for (i = 0; i < ctx->Const.MaxViewports; i++) {
+  _mesa_set_scissori(ctx, i,
+ scissor->ScissorArray[i].X,
+ scissor->ScissorArray[i].Y,
+ scissor->ScissorArray[i].Width,
+ scissor->ScissorArray[i].Height);
+  _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i,
+(scissor->EnableFlags >> i) & 1);
+   }
 }
 break;
  case GL_STENCIL_BUFFER_BIT:
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 15eedcd..91f3812 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1426,13 +1426,21 @@ check_compatible(const struct gl_context *ctx,
 void
 _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
 {
+   GLuint i;
+
if (!ctx->ViewportInitialized && width > 0 && height > 0) {
   /* Note: set flag here, before calling _mesa_set_viewport(), to prevent
* potential infinite recursion.
*/
   ctx->ViewportInitialized = GL_TRUE;
   _mesa_set_viewport(ctx, 0, 0, width, height);
-  _mesa_set_scissor(ctx, 0, 0, width, height);
+  /* ARB_viewport_array specifies that glScissor is equivalent to
+   * calling glViewportArray with an array containing a single
+   * viewport once for each supported viewport.
+   */
+  for (i = 0; i < ctx->Const.MaxViewports; i++) {
+ _mesa_set_scissori(ctx, i, 0, 0, width, height);
+  }
}
 }
 
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 426632e..3187ab1 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -35,6 +35,7 @@
 void GLAPIENTRY
 _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
 {
+   GLuint i;
GET_CURRENT_CONTEXT(ctx);
 
if (MESA_VERBOSE & VERBOSE_API)
@@ -45,7 +46,13 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei 
height )
   return;
}
 
-   _mesa_set_scissor(ctx, x, y, width, height);
+   /* ARB_viewport_array specifies that glScissor is equivalent to
+* calling glViewportArray with an array containing a single
+* viewport once for each supported viewport.
+*/
+   for (i = 0; i < ctx->Const.MaxViewports; i++) {
+  _mesa_set_scissori(ctx, i, x, y, width, height);
+   }
 }
 
 
@@ -63,23 +70,25 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei 
height )
  * the dd_function_table::Scissor callback.
  */
 void
-_mesa_set_scissor(struct gl_context *ctx, 
+_mesa_set_scissori(struct gl_context *ctx, GLuint index,
   GLint x, GLint y, GLsizei width, GLsizei height)
 {
-   if (x == ctx->Scissor.ScissorArray[0].X &&
-   y == ctx->Scissor.ScissorArray[0].Y &&
-   width == ctx->Scissor.ScissorArray[0].Width &&
-   height == ctx->Scissor.ScissorArray[0].Height)
+   if (x == ctx->Scissor.ScissorArray[index].X &&
+   y == ctx->Scissor.ScissorArray[index].Y &&
+   width == ctx->Scissor.ScissorArray[index].Width &&
+   height == ctx->Scissor.ScissorArray[index].Height)
   return;
 
FLUSH_VERTICES(ctx, _NEW_SCISSOR);
-   ctx->Scissor.ScissorArray[0].X = x;
-   ctx->Scissor.ScissorArray[0].Y = y;
-   ctx->Scissor.ScissorArray[0].Width = width;
-   ctx->Scissor.ScissorArray[0].Height = height;
+   ctx->Scissor.ScissorArray[index].X = x;
+   ctx->Scissor.ScissorArray[index].Y = y;
+   ctx->Scissor.ScissorArray[index].Width = width;
+   ctx->Scissor.ScissorArray[index].Height = height;
 
if (ctx->Driver.Scissor)
-  ctx->Driver.Scissor( ctx, 0, x, y, width, height );
+  ctx->Driver.Scissor(ctx, inde

[Mesa-dev] [PATCH 10/18] mesa: Add custom get function for SCISSOR

2013-11-20 Thread Courtney Goeltzenleuchter
Now that the scissor enable state is a bitfield need a
custom function to extract the correct value from gl_context.
Modeled Scissor.EnableFlags after Color.BlendEnabled.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/enable.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 1e06ea8..779a258 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1156,6 +1156,13 @@ _mesa_IsEnabledi( GLenum cap, GLuint index )
  return GL_FALSE;
   }
   return (ctx->Color.BlendEnabled >> index) & 1;
+   case GL_SCISSOR_TEST:
+  if (index >= ctx->Const.MaxViewports) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)",
+ index);
+ return GL_FALSE;
+  }
+  return (ctx->Scissor.EnableFlags >> index) & 1;
default:
   _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabledIndexed(cap=%s)",
   _mesa_lookup_enum_by_nr(cap));
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 13/18] mesa: Add ARB_viewport_array viewport entry points

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/context.c  |   2 +-
 src/mesa/main/scissor.c  |   2 +-
 src/mesa/main/viewport.c | 316 +++
 src/mesa/main/viewport.h |  22 +++-
 4 files changed, 287 insertions(+), 55 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2baf4ef..6020883 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1436,12 +1436,12 @@ _mesa_check_init_viewport(struct gl_context *ctx, 
GLuint width, GLuint height)
* potential infinite recursion.
*/
   ctx->ViewportInitialized = GL_TRUE;
-  _mesa_set_viewport(ctx, 0, 0, width, height);
   /* ARB_viewport_array specifies that glScissor is equivalent to
* calling glViewportArray with an array containing a single
* viewport once for each supported viewport.
*/
   for (i = 0; i < ctx->Const.MaxViewports; i++) {
+ _mesa_set_viewporti(ctx, i, 0, 0, width, height);
  _mesa_set_scissori(ctx, i, 0, 0, width, height);
   }
}
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 580558e..20731f7 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -109,7 +109,7 @@ _mesa_ScissorArrayv(GLuint first, GLsizei count, const 
GLint * v)
struct gl_scissor_rect *p = (struct gl_scissor_rect *) v;
GET_CURRENT_CONTEXT(ctx);
 
-   if ((first + count) >= ctx->Const.MaxViewports) {
+   if ((first + count) > ctx->Const.MaxViewports) {
   _mesa_error(ctx, GL_INVALID_VALUE,
   "glScissorArrayv: first (%d) + count (%d) >= MaxViewports 
(%d)",
   first, count, ctx->Const.MaxViewports);
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 08efd05..e191923 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -34,6 +34,16 @@
 #include "mtypes.h"
 #include "viewport.h"
 
+struct gl_viewport_inputs
+{
+   GLfloat X, Y;/**< position */
+   GLfloat Width, Height;  /**< size */
+};
+
+struct gl_depthrange_inputs
+{
+   GLdouble Near, Far; /**< Depth buffer range */
+};
 
 /**
  * Set the viewport.
@@ -45,42 +55,151 @@
 void GLAPIENTRY
 _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
 {
+   GLuint i;
GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0);
-   _mesa_set_viewport(ctx, x, y, width, height);
-}
 
+   if (MESA_VERBOSE & VERBOSE_API)
+  _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
+
+   if (width < 0 || height < 0) {
+  _mesa_error(ctx,  GL_INVALID_VALUE,
+   "glViewport(%d, %d, %d, %d)", x, y, width, height);
+  return;
+   }
+
+   /* ARB_viewport_array specifies that glScissor is equivalent to
+* calling glViewportArray with an array containing a single
+* viewport once for each supported viewport.
+*/
+   for (i = 0; i < ctx->Const.MaxViewports; i++) {
+  _mesa_set_viewporti(ctx, i, x, y, width, height);
+   }
+}
 
 /**
  * Set new viewport parameters and update derived state (the _WindowMap
  * matrix).  Usually called from _mesa_Viewport().
- * 
+ *
  * \param ctx GL context.
  * \param x, y coordinates of the lower left corner of the viewport rectangle.
  * \param width width of the viewport rectangle.
  * \param height height of the viewport rectangle.
  */
 void
-_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
-GLsizei width, GLsizei height)
+_mesa_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
 {
+   GLuint i;
+   struct gl_viewport_inputs *p = (struct gl_viewport_inputs *) v;
+   GET_CURRENT_CONTEXT(ctx);
+
if (MESA_VERBOSE & VERBOSE_API)
-  _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
+  _mesa_debug(ctx, "glViewportArrayv %d %d\n", first, count);
 
-   if (width < 0 || height < 0) {
-  _mesa_error(ctx,  GL_INVALID_VALUE,
-   "glViewport(%d, %d, %d, %d)", x, y, width, height);
+   if ((first + count) > ctx->Const.MaxViewports) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glViewportArrayv: first (%d) + count (%d) > MaxViewports 
(%d)",
+  first, count, ctx->Const.MaxViewports);
+  return;
+   }
+
+   /* Verify width & height */
+   for (i = 0; i < count; i++) {
+  if (p[i].Width < 0 || p[i].Height < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glViewportArrayv: index (%d) width or height < 0 (%f, 
%f)",
+ i + first, p[i].Width, p[i].Height);
+  }
+   }
+
+   for (i = 0; i < count; i++)
+  _mesa_set_viewporti(ctx, i + first, p[i].X, p[i].Y, p[i].Width, 
p[i].Height);
+}
+
+void GLAPIENTRY
+_mesa_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y,
+  

[Mesa-dev] [PATCH 14/18] mesa: Add gl_ViewportIndex variable to GLSL

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/glsl/builtin_variables.cpp | 2 ++
 src/glsl/glsl_parser_extras.h  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 4d44104..862d255 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -778,6 +778,8 @@ void
 builtin_variable_generator::generate_gs_special_vars()
 {
add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
+   if (state->ARB_viewport_array_enable)
+  add_output(VARYING_SLOT_LAYER, int_t, "gl_ViewportIndex");
 
/* Although gl_PrimitiveID appears in tessellation control and tessellation
 * evaluation shaders, it has a different function there than it has in
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index d232bb3..5257a84 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -356,6 +356,7 @@ struct _mesa_glsl_parse_state {
bool EXT_shader_integer_mix_warn;
bool ARB_shader_atomic_counters_enable;
bool ARB_shader_atomic_counters_warn;
+   bool ARB_viewport_array_enable;
/*@}*/
 
/** Extensions supported by the OpenGL implementation. */
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing

2013-11-20 Thread Courtney Goeltzenleuchter
Define API connections to extension entry points added in previous
commits. Update entry points to use floating point arguments as
required by the extension.
Add get tokens for ARB_viewport_array state.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mapi/glapi/gen/ARB_viewport_array.xml | 79 +++
 src/mapi/glapi/gen/Makefile.am|  1 +
 src/mapi/glapi/gen/gl_API.xml |  2 +-
 src/mesa/main/get_hash_params.py  | 11 -
 src/mesa/main/viewport.c  |  8 ++--
 src/mesa/main/viewport.h  |  4 +-
 6 files changed, 95 insertions(+), 10 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_viewport_array.xml

diff --git a/src/mapi/glapi/gen/ARB_viewport_array.xml 
b/src/mapi/glapi/gen/ARB_viewport_array.xml
new file mode 100644
index 000..3fb17fd
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_viewport_array.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index 476d943..ba702ba 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -126,6 +126,7 @@ API_XML = \
ARB_texture_storage.xml \
ARB_vertex_array_object.xml \
ARB_vertex_attrib_binding.xml \
+   ARB_viewport_array.xml \
AMD_draw_buffers_blend.xml \
AMD_performance_monitor.xml \
ARB_vertex_type_2_10_10_10_rev.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index a2d914a..fdb3439 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -9916,7 +9916,7 @@
 
 
 
-
+http://www.w3.org/2001/XInclude"/>
 
 
 
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 1081ff0..3efaef8 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -22,7 +22,7 @@ descriptor=[
   [ "MAX_ELEMENTS_VERTICES", "CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA" ],
   [ "MAX_ELEMENTS_INDICES", "CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA" ],
   [ "MAX_TEXTURE_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_context, 
Const.MaxTextureLevels), NO_EXTRA" ],
-  [ "MAX_VIEWPORT_DIMS", "CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA" ],
+  [ "MAX_VIEWPORT_DIMS", "CONTEXT_FLOAT2(Const.MaxViewportWidth), NO_EXTRA" ],
   [ "PACK_ALIGNMENT", "CONTEXT_INT(Pack.Alignment), NO_EXTRA" ],
   [ "ALIASED_POINT_SIZE_RANGE", "CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA" 
],
   [ "POLYGON_OFFSET_FACTOR", "CONTEXT_FLOAT(Polygon.OffsetFactor ), NO_EXTRA" 
],
@@ -44,7 +44,7 @@ descriptor=[
   [ "SUBPIXEL_BITS", "CONTEXT_INT(Const.SubPixelBits), NO_EXTRA" ],
   [ "TEXTURE_BINDING_2D", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA" ],
   [ "UNPACK_ALIGNMENT", "CONTEXT_INT(Unpack.Alignment), NO_EXTRA" ],
-  [ "VIEWPORT", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ],
+  [ "VIEWPORT", "LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA" ],
 
 # GL_ARB_multitexture
   [ "ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
@@ -741,6 +741,13 @@ descriptor=[
 # GL_ARB_vertex_attrib_binding
   [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
   [ "MAX_VERTEX_ATTRIB_BINDINGS", 
"CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
+
+# GL_ARB_viewport_array
+  [ "MAX_VIEWPORTS", "CONTEXT_INT(Const.MaxViewports), 
extra_ARB_viewport_array" ],
+  [ "VIEWPORT_SUBPIXEL_BITS", "CONTEXT_INT(Const.ViewportSubpixelBits), 
extra_ARB_viewport_array" ],
+  [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), 
extra_ARB_viewport_array" ],
+  [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), 
extra_ARB_viewport_array" ],
+  [ "VIEWPORT_INDEX_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), 
extra_ARB_viewport_array" ],
 ]},
 
 # Enums restricted to OpenGL Core profile
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index e191923..e3d64b8 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -182,8 +182,8

[Mesa-dev] [PATCH 12/18] mesa: Add scissor entry points for viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/scissor.c | 113 
 src/mesa/main/scissor.h |   8 
 2 files changed, 121 insertions(+)

diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 3187ab1..580558e 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -91,6 +91,119 @@ _mesa_set_scissori(struct gl_context *ctx, GLuint index,
   ctx->Scissor.ScissorArray[index].Width, 
ctx->Scissor.ScissorArray[index].Height);
 }
 
+/**
+ * Define count scissor boxes starting at index.
+ *
+ * \param index  index of first scissor records to set
+ * \param count  number of scissor records to set
+ * \param x, y   pointer to array of struct gl_scissor_rects
+ *
+ * \sa glScissorArrayv().
+ *
+ * Verifies the parameters and call _mesa_set_scissori to do the work.
+ */
+void GLAPIENTRY
+_mesa_ScissorArrayv(GLuint first, GLsizei count, const GLint * v)
+{
+   GLuint i;
+   struct gl_scissor_rect *p = (struct gl_scissor_rect *) v;
+   GET_CURRENT_CONTEXT(ctx);
+
+   if ((first + count) >= ctx->Const.MaxViewports) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glScissorArrayv: first (%d) + count (%d) >= MaxViewports 
(%d)",
+  first, count, ctx->Const.MaxViewports);
+  return;
+   }
+
+   /* Verify width & height */
+   for (i = 0; i < count; i++) {
+  if (p[i].Width < 0 || p[i].Height < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glScissorArrayv: index (%d) width or height < 0 (%d, 
%d)",
+ i, p[i].Width, p[i].Height);
+  }
+   }
+
+   for (i = 0; i < count; i++)
+  _mesa_set_scissori(ctx, i + first, p[i].X, p[i].Y, p[i].Width, 
p[i].Height);
+
+}
+
+/**
+ * Define the scissor box.
+ *
+ * \param index  index of scissor records to set
+ * \param x, y   coordinates of the scissor box lower-left corner.
+ * \param width  width of the scissor box.
+ * \param height height of the scissor box.
+ *
+ * \sa glScissorIndexed().
+ *
+ * Verifies the parameters call _mesa_set_scissori to do the work.
+ */
+void GLAPIENTRY
+_mesa_ScissorIndexed(GLuint index, GLint left, GLint bottom,
+ GLsizei width, GLsizei height)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+  _mesa_debug(ctx, "glScissorIndexed(%d, %d, %d, %d, %d)\n", index,
+  left, bottom, width, height);
+
+   if (width < 0 || height < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glScissorIndexed: index (%d) width or height < 0 (%d, 
%d)",
+ index, width, height);
+  }
+
+   if (index >= ctx->Const.MaxViewports) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glScissorIndexed: index (%d) >= MaxViewports (%d)",
+  index, ctx->Const.MaxViewports);
+  return;
+   }
+
+   _mesa_set_scissori(ctx, index, left, bottom, width, height);
+}
+
+/**
+ * Define the scissor box.
+ *
+ * \param x, y coordinates of the scissor box lower-left corner.
+ * \param width width of the scissor box.
+ * \param height height of the scissor box.
+ *
+ * \sa glScissor().
+ *
+ * Verifies the parameters call _mesa_set_scissori to do the work.
+ */
+void GLAPIENTRY
+_mesa_ScissorIndexedv(GLuint index, const GLint * v)
+{
+   struct gl_scissor_rect *p = (struct gl_scissor_rect *) v;
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+  _mesa_debug(ctx, "glScissorIndexedv(%d, %d, %d, %d, %d)\n", index,
+  p->X, p->Y, p->Width, p->Height);
+
+   if (p->Width < 0 || p->Height < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glScissorIndexedv: index (%d) width or height < 0 (%d, 
%d)",
+ index, p->Width, p->Height);
+  }
+
+   if (index >= ctx->Const.MaxViewports) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glScissorIndexedv: index (%d) >= MaxViewports (%d)",
+  index, ctx->Const.MaxViewports);
+  return;
+   }
+
+   _mesa_set_scissori(ctx, index, p->X, p->Y, p->Width, p->Height);
+}
 
 /**
  * Initialize the context's scissor state.
diff --git a/src/mesa/main/scissor.h b/src/mesa/main/scissor.h
index f8aca2c..68f644f 100644
--- a/src/mesa/main/scissor.h
+++ b/src/mesa/main/scissor.h
@@ -34,6 +34,14 @@ struct gl_context;
 extern void GLAPIENTRY
 _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
 
+extern void GLAPIENTRY
+_mesa_ScissorArrayv(GLuint first, GLsizei count, const GLint * v);
+
+extern void GLAPIENTRY
+_mesa_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, 
GLsizei height);
+
+extern void GLAPIENTRY
+_mesa_ScissorIndexedv(GLuint index, const GLint * v);
 
 extern void

[Mesa-dev] [PATCH 07/18] meta: Update meta driver to use API entry point

2013-11-20 Thread Courtney Goeltzenleuchter
Using Mesa's GL entry point allows the meta driver to ignore
interface changes due to ARB_viewport_array

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/common/meta.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 0cb6625..4752705 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1091,8 +1091,8 @@ _mesa_meta_end(struct gl_context *ctx)
   save->ViewportY != ctx->ViewportArray[0].Y ||
   save->ViewportW != ctx->ViewportArray[0].Width ||
   save->ViewportH != ctx->ViewportArray[0].Height) {
- _mesa_set_viewport(ctx, save->ViewportX, save->ViewportY,
-save->ViewportW, save->ViewportH);
+ _mesa_Viewport(save->ViewportX, save->ViewportY,
+save->ViewportW, save->ViewportH);
   }
   _mesa_DepthRange(save->DepthNear, save->DepthFar);
}
@@ -1759,7 +1759,7 @@ blitframebuffer_texture(struct gl_context *ctx,
  }
 
  /* setup viewport */
- _mesa_set_viewport(ctx, dstX, dstY, dstW, dstH);
+ _mesa_Viewport(dstX, dstY, dstW, dstH);
  _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
  _mesa_DepthMask(GL_FALSE);
  _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -1914,7 +1914,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
  _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
   }
 
-  _mesa_set_viewport(ctx, dstX, dstY, dstW, dstH);
+  _mesa_Viewport(dstX, dstY, dstW, dstH);
   _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
   _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_FALSE);
   _mesa_DepthMask(GL_FALSE);
@@ -1963,7 +1963,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
  _mesa_DepthFunc(GL_ALWAYS);
  _mesa_DepthMask(GL_TRUE);
 
- _mesa_set_viewport(ctx, dstX, dstY, dstW, dstH);
+ _mesa_Viewport(dstX, dstY, dstW, dstH);
  _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
  _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
  mask &= ~GL_DEPTH_BUFFER_BIT;
@@ -3736,7 +3736,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
   assert(dstHeight == ctx->DrawBuffer->Height);
 
   /* setup viewport */
-  _mesa_set_viewport(ctx, 0, 0, dstWidth, dstHeight);
+  _mesa_Viewport(0, 0, dstWidth, dstHeight);
 
   _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
@@ -4026,7 +4026,7 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
_mesa_Ortho(0.0, width, 0.0, height, -1.0, 1.0);
-   _mesa_set_viewport(ctx, 0, 0, width, height);
+   _mesa_Viewport(0, 0, width, height);
 
/* upload new vertex data */
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 03/18] mesa: Change DepthRange dd interface

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i915/i830_state.c  | 2 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c   | 2 +-
 src/mesa/drivers/dri/i915/i915_state.c  | 2 +-
 src/mesa/drivers/dri/i915/i915_vtbl.c   | 2 +-
 src/mesa/drivers/dri/r200/r200_state.c  | 4 ++--
 src/mesa/drivers/dri/radeon/radeon_common.c | 2 +-
 src/mesa/drivers/dri/radeon/radeon_state.c  | 4 ++--
 src/mesa/main/dd.h  | 3 ++-
 src/mesa/main/viewport.c| 2 +-
 9 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_state.c 
b/src/mesa/drivers/dri/i915/i830_state.c
index e140e04..090e4a0 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -453,7 +453,7 @@ i830DepthMask(struct gl_context * ctx, GLboolean flag)
 
 /** Called from ctx->Driver.DepthRange() */
 static void
-i830DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval)
+i830DepthRange(struct gl_context * ctx, GLuint idx, GLclampd nearval, GLclampd 
farval)
 {
intelCalcViewport(ctx);
 }
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index cea6930..33ca002 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -840,7 +840,7 @@ i830_update_draw_buffer(struct intel_context *intel)
ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
   ctx->Scissor.Width, ctx->Scissor.Height);
 
-   ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
+   ctx->Driver.DepthRange(ctx, 0, ctx->Viewport.Near, ctx->Viewport.Far);
 
/* Update culling direction which changes depending on the
 * orientation of the buffer:
diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index ca26bdc..ee7d4ae 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -426,7 +426,7 @@ intelCalcViewport(struct gl_context * ctx)
 
 /** Called from ctx->Driver.DepthRange() */
 static void
-i915DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval)
+i915DepthRange(struct gl_context * ctx, GLuint idx, GLclampd nearval, GLclampd 
farval)
 {
intelCalcViewport(ctx);
 }
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index f7656f9..10a2865 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -813,7 +813,7 @@ i915_update_draw_buffer(struct intel_context *intel)
 */
ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
   ctx->Scissor.Width, ctx->Scissor.Height);
-   ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
+   ctx->Driver.DepthRange(ctx, 0, ctx->Viewport.Near, ctx->Viewport.Far);
 
/* Update culling direction which changes depending on the
 * orientation of the buffer:
diff --git a/src/mesa/drivers/dri/r200/r200_state.c 
b/src/mesa/drivers/dri/r200/r200_state.c
index 515499e..219fc49 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1617,8 +1617,8 @@ static void r200Viewport( struct gl_context *ctx, GLuint 
idx, GLint x, GLint y,
radeon_viewport(ctx);
 }
 
-static void r200DepthRange( struct gl_context *ctx, GLclampd nearval,
- GLclampd farval )
+static void r200DepthRange( struct gl_context *ctx, GLuint idx,
+   GLclampd nearval, GLclampd farval )
 {
r200UpdateWindow( ctx );
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index 671c15f..b3c8393 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -333,7 +333,7 @@ void radeon_draw_buffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
radeon->NewGLState |= _NEW_SCISSOR;
 
if (ctx->Driver.DepthRange)
-   ctx->Driver.DepthRange(ctx,
+   ctx->Driver.DepthRange(ctx, 0,
   ctx->Viewport.Near,
   ctx->Viewport.Far);
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c 
b/src/mesa/drivers/dri/radeon/radeon_state.c
index 48bbbd8..b62a51a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1400,8 +1400,8 @@ static void radeonViewport( struct gl_context *ctx, 
GLuint idx, GLint x, GLint y
radeon_viewport(ctx);
 }
 
-static void radeonDepthRange( struct gl_context *ctx, GLclampd nearval,
- GLclampd farval )
+static void radeonDepthRange( struct gl_context *ctx, GLuint idx,
+ GLclampd nearval, GLclampd farval )
 {
radeonUpdateWindow( ctx );
 }
diff --git a

[Mesa-dev] [PATCH 05/18] mesa: Update viewport driver args for ARB_viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter
Change the Driver viewport method arguments to be floats
instead of ints.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i915/intel_context.c   | 7 ---
 src/mesa/drivers/dri/i965/brw_context.c | 2 +-
 src/mesa/drivers/dri/r200/r200_state.c  | 5 +++--
 src/mesa/drivers/dri/radeon/radeon_common.c | 5 +++--
 src/mesa/drivers/dri/radeon/radeon_state.c  | 5 +++--
 src/mesa/drivers/dri/swrast/swrast.c| 2 +-
 src/mesa/main/dd.h  | 3 ++-
 src/mesa/state_tracker/st_cb_viewport.c | 4 ++--
 8 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_context.c 
b/src/mesa/drivers/dri/i915/intel_context.c
index 6752f4b..24837cd 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -271,12 +271,12 @@ intel_prepare_render(struct intel_context *intel)
 }
 
 static void
-intel_noninvalidate_viewport(struct gl_context *ctx, GLuint idx, GLint x, 
GLint y,
- GLsizei w, GLsizei h)
+intel_viewport(struct gl_context *ctx, GLuint idx, GLfloat x, GLfloat y, 
GLfloat w, GLfloat h)
 {
 struct intel_context *intel = intel_context(ctx);
 __DRIcontext *driContext = intel->driContext;
 
+(void) idx;
 (void) x;
 (void) y;
 (void) w;
@@ -291,8 +291,9 @@ intel_noninvalidate_viewport(struct gl_context *ctx, GLuint 
idx, GLint x, GLint
 }
 
 static void
-intel_viewport(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei 
w, GLsizei h)
+intel_noninvalidate_viewport(struct gl_context *ctx, GLuint idx, GLfloat x, 
GLfloat y, GLfloat w, GLfloat h)
 {
+(void) idx;
 (void) x;
 (void) y;
 (void) w;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 8f049e7..bf01caa 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -134,7 +134,7 @@ intelGetString(struct gl_context * ctx, GLenum name)
 }
 
 static void
-intel_viewport(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei 
w, GLsizei h)
+intel_viewport(struct gl_context *ctx, GLuint idx, GLfloat x, GLfloat y, 
GLfloat w, GLfloat h)
 {
struct brw_context *brw = brw_context(ctx);
__DRIcontext *driContext = brw->driContext;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c 
b/src/mesa/drivers/dri/r200/r200_state.c
index 219fc49..388e904 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1600,8 +1600,9 @@ void r200_vtbl_update_scissor( struct gl_context *ctx )
 }
 
 
-static void r200Viewport( struct gl_context *ctx, GLuint idx, GLint x, GLint y,
-   GLsizei width, GLsizei height )
+static void r200Viewport( struct gl_context *ctx, GLuint idx,
+  GLfloat x, GLfloat y,
+ GLfloat width, GLfloat height )
 {
(void) x;
(void) y;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index d78c0c2..88f530a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -410,8 +410,9 @@ void radeon_viewport(struct gl_context *ctx)
 {
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
__DRIcontext *driContext = radeon->dri.context;
-   void (*old_viewport)(struct gl_context *ctx, GLuint idx, GLint x, GLint 
y,
-GLsizei w, GLsizei h);
+   void (*old_viewport)(struct gl_context *ctx, GLuint idx,
+ GLfloat X, GLfloat Y,
+ GLfloat Width, GLfloat Height);
 
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
if (radeon->is_front_buffer_rendering) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c 
b/src/mesa/drivers/dri/radeon/radeon_state.c
index b62a51a..258f18f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1383,8 +1383,9 @@ void radeonUpdateWindow( struct gl_context *ctx )
 }
 
 
-static void radeonViewport( struct gl_context *ctx, GLuint idx, GLint x, GLint 
y,
-   GLsizei width, GLsizei height )
+static void radeonViewport( struct gl_context *ctx, GLuint idx,
+GLfloat x, GLfloat y,
+   GLfloat width, GLfloat height )
 {
(void) x;
(void) y;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index deba27e..2e3177d 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -619,7 +619,7 @@ update_state( struct gl_context *ctx, GLuint new_state )
 
 static void
 viewport(struct gl_context *ctx, GLuint idx,
- GLint x, GLint y, GLsizei w, GLsizei h)
+ GLfloat x, GLfloat y, GLfloat w, GLfloat h)
 {
 struct gl_framebuffer *draw = ctx->WinSysDrawBuffer;
 struct gl

[Mesa-dev] [PATCH 01/18] mesa: Change scissor dd interface for viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/common/driverfuncs.c   | 2 +-
 src/mesa/drivers/dri/i915/i830_state.c  | 2 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c   | 2 +-
 src/mesa/drivers/dri/i915/i915_state.c  | 2 +-
 src/mesa/drivers/dri/i915/i915_vtbl.c   | 2 +-
 src/mesa/drivers/dri/radeon/radeon_common.c | 3 +--
 src/mesa/drivers/dri/radeon/radeon_common.h | 2 +-
 src/mesa/main/dd.h  | 4 +++-
 src/mesa/main/scissor.c | 2 +-
 9 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 5faa98a..e45dc0e 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -299,7 +299,7 @@ _mesa_init_driver_state(struct gl_context *ctx)
ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
ctx->Driver.PointSize(ctx, ctx->Point.Size);
ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
-   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
+   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
diff --git a/src/mesa/drivers/dri/i915/i830_state.c 
b/src/mesa/drivers/dri/i915/i830_state.c
index bbf0cef..e140e04 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -527,7 +527,7 @@ i830PolygonStipple(struct gl_context * ctx, const GLubyte * 
mask)
  * Hardware clipping
  */
 static void
-i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+i830Scissor(struct gl_context * ctx, GLuint idx, GLint x, GLint y, GLsizei w, 
GLsizei h)
 {
struct i830_context *i830 = i830_context(ctx);
int x1, y1, x2, y2;
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index f988a83..cea6930 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -837,7 +837,7 @@ i830_update_draw_buffer(struct intel_context *intel)
 
/* Set state we know depends on drawable parameters:
 */
-   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
+   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
   ctx->Scissor.Width, ctx->Scissor.Height);
 
ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index fedafec..ca26bdc 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -501,7 +501,7 @@ i915PolygonStipple(struct gl_context * ctx, const GLubyte * 
mask)
  * Hardware clipping
  */
 static void
-i915Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+i915Scissor(struct gl_context * ctx, GLuint idx, GLint x, GLint y, GLsizei w, 
GLsizei h)
 {
struct i915_context *i915 = I915_CONTEXT(ctx);
int x1, y1, x2, y2;
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 3368fe4..f7656f9 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -811,7 +811,7 @@ i915_update_draw_buffer(struct intel_context *intel)
 
/* Set state we know depends on drawable parameters:
 */
-   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
+   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
   ctx->Scissor.Width, ctx->Scissor.Height);
ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index 7be0ba7..c4090fa 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -141,8 +141,7 @@ void radeonUpdateScissor( struct gl_context *ctx )
 /* =
  * Scissoring
  */
-
-void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, 
GLsizei h)
+void radeonScissor(struct gl_context* ctx, GLuint idx, GLint x, GLint y, 
GLsizei w, GLsizei h)
 {
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
if (ctx->Scissor.Enabled) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h 
b/src/mesa/drivers/dri/radeon/radeon_common.h
index 69a1727..173b473 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common.h
@@ -8,7 +8,7 @@
 void radeonUserClear(struct gl_context *ctx, GLuint mask);
 void radeonSetCliprects(radeonContextPtr radeon);
 void radeonUpdateScissor( struct gl_context *ctx );
-void radeonScissor(struct gl_context* ctx, GLint x, GLint y,

[Mesa-dev] [PATCH 00/15] Add ARB_viewport_array extension

2013-11-20 Thread Courtney Goeltzenleuchter
This series starts by updating the driver interface for
scissor, viewport and DepthRange. This includes removing
unused arguments from the Scissor, Viewport and DepthRange.
I kept the index argument, although it is not used, it may
be useful to the dri driver to know which array element
is being updated.

I added things incrementally, each having no effect
on piglit. I tested the full series against the arb_viewport_array
piglit tests submitted by LunarG and a stubbed version of the
i965 driver that enables ARB_viewport_array. I've not
included that stub in this series.

I modeled the indexed Get functions off GL_COLOR_WRITEMASK.

Since the removal of x, y, w, h touches the same files as
references to gl_context.Viewport it seemed just as easy to
convert those references to the array reference with index 0.
Should the driver add ARB_viewport_array support they would
simply put the right index value in place of 0.


Courtney Goeltzenleuchter (18):
  mesa: Change scissor dd interface for viewport_array
  mesa: Update viewport dd interface for viewport_array
  mesa: Change DepthRange dd interface
  mesa: Update gl_scissor_attrib to support ARB_viewport_array
  mesa: Update viewport driver args for ARB_viewport_array
  mesa: Update viewport state for viewport_array
  meta: Update meta driver to use API entry point
  mesa: Add indexed version of mesa_scissor
  mesa: Add new get entrypoints for ARB_viewport_array
  mesa: Add custom get function for SCISSOR
  mesa: Add ARB_viewport_array state to gl_context
  mesa: Add scissor entry points for viewport_array
  mesa: Add ARB_viewport_array viewport entry points
  mesa: Add gl_ViewportIndex variable to GLSL
  mesa: Add ARB_viewport_array plumbing
  mesa: Remove unused arguments from driver->Scissor
  mesa: Remove unused arguments from driver->Viewport
  mesa: Remove unused arguments from driver->DepthRange

 src/glsl/builtin_variables.cpp  |   2 +
 src/glsl/glsl_parser_extras.h   |   1 +
 src/mapi/glapi/gen/ARB_viewport_array.xml   |  79 ++
 src/mapi/glapi/gen/Makefile.am  |   1 +
 src/mapi/glapi/gen/gl_API.xml   |   2 +-
 src/mesa/drivers/common/driverfuncs.c   |  11 +-
 src/mesa/drivers/common/meta.c  |  52 ++--
 src/mesa/drivers/dri/i915/i830_state.c  |  26 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c   |   5 +-
 src/mesa/drivers/dri/i915/i915_state.c  |  50 ++--
 src/mesa/drivers/dri/i915/i915_vtbl.c   |   5 +-
 src/mesa/drivers/dri/i915/intel_context.c   |  15 +-
 src/mesa/drivers/dri/i915/intel_fbo.c   |   2 +-
 src/mesa/drivers/dri/i965/brw_cc.c  |   4 +-
 src/mesa/drivers/dri/i965/brw_clear.c   |  12 +-
 src/mesa/drivers/dri/i965/brw_clip_state.c  |  12 +-
 src/mesa/drivers/dri/i965/brw_context.c |   7 +-
 src/mesa/drivers/dri/i965/brw_sf_state.c|   4 +-
 src/mesa/drivers/dri/i965/gen6_clip_state.c |   8 +-
 src/mesa/drivers/dri/i965/gen6_sf_state.c   |   2 +-
 src/mesa/drivers/dri/i965/gen6_viewport_state.c |   6 +-
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |   2 +-
 src/mesa/drivers/dri/i965/gen7_viewport_state.c |   6 +-
 src/mesa/drivers/dri/i965/intel_fbo.c   |   2 +-
 src/mesa/drivers/dri/nouveau/nouveau_util.h |   4 +-
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c|   2 +-
 src/mesa/drivers/dri/r200/r200_state.c  |  15 +-
 src/mesa/drivers/dri/radeon/radeon_common.c |  18 +-
 src/mesa/drivers/dri/radeon/radeon_common.h |   2 +-
 src/mesa/drivers/dri/radeon/radeon_state.c  |  14 +-
 src/mesa/drivers/dri/swrast/swrast.c|   8 +-
 src/mesa/main/attrib.c  |  30 ++-
 src/mesa/main/config.h  |   3 +
 src/mesa/main/context.c |  36 ++-
 src/mesa/main/dd.h  |   6 +-
 src/mesa/main/enable.c  |  36 ++-
 src/mesa/main/extensions.c  |   1 +
 src/mesa/main/framebuffer.c |  19 +-
 src/mesa/main/get.c | 218 +++-
 src/mesa/main/get.h |   6 +
 src/mesa/main/get_hash_params.py|  15 +-
 src/mesa/main/mtypes.h  |  25 +-
 src/mesa/main/rastpos.c |   4 +-
 src/mesa/main/scissor.c | 157 ++--
 src/mesa/main/scissor.h |  10 +-
 src/mesa/main/state.c   |  17 +-
 src/mesa/main/viewport.c| 314 
 src/mesa/main/viewport.h|  22 +-
 src/mesa/math/m_matrix.c|   9 +-
 src/mesa/math/m_matrix.h|   4 +-
 src/mesa/program/prog_statevars.c   |   7 +-
 src/mesa/state_tracker/st_atom_rasterizer.c |   2 +-
 src/mesa/state_tracker/st_

[Mesa-dev] [PATCH 02/18] mesa: Update viewport dd interface for viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i915/intel_context.c   | 4 ++--
 src/mesa/drivers/dri/i965/brw_context.c | 2 +-
 src/mesa/drivers/dri/r200/r200_state.c  | 2 +-
 src/mesa/drivers/dri/radeon/radeon_common.c | 4 ++--
 src/mesa/drivers/dri/radeon/radeon_state.c  | 2 +-
 src/mesa/drivers/dri/swrast/swrast.c| 3 ++-
 src/mesa/main/dd.h  | 3 ++-
 src/mesa/main/viewport.c| 2 +-
 src/mesa/state_tracker/st_cb_viewport.c | 3 ++-
 9 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_context.c 
b/src/mesa/drivers/dri/i915/intel_context.c
index 3618893..6752f4b 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -271,7 +271,7 @@ intel_prepare_render(struct intel_context *intel)
 }
 
 static void
-intel_noninvalidate_viewport(struct gl_context *ctx, GLint x, GLint y,
+intel_noninvalidate_viewport(struct gl_context *ctx, GLuint idx, GLint x, 
GLint y,
  GLsizei w, GLsizei h)
 {
 struct intel_context *intel = intel_context(ctx);
@@ -291,7 +291,7 @@ intel_noninvalidate_viewport(struct gl_context *ctx, GLint 
x, GLint y,
 }
 
 static void
-intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+intel_viewport(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei 
w, GLsizei h)
 {
 (void) x;
 (void) y;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 0399ec0..8f049e7 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -134,7 +134,7 @@ intelGetString(struct gl_context * ctx, GLenum name)
 }
 
 static void
-intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+intel_viewport(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei 
w, GLsizei h)
 {
struct brw_context *brw = brw_context(ctx);
__DRIcontext *driContext = brw->driContext;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c 
b/src/mesa/drivers/dri/r200/r200_state.c
index ee7b945..515499e 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1600,7 +1600,7 @@ void r200_vtbl_update_scissor( struct gl_context *ctx )
 }
 
 
-static void r200Viewport( struct gl_context *ctx, GLint x, GLint y,
+static void r200Viewport( struct gl_context *ctx, GLuint idx, GLint x, GLint y,
GLsizei width, GLsizei height )
 {
(void) x;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index c4090fa..671c15f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -319,7 +319,7 @@ void radeon_draw_buffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 #if 0
/* update viewport since it depends on window size */
if (ctx->Driver.Viewport) {
-   ctx->Driver.Viewport(ctx, ctx->Viewport.X, ctx->Viewport.Y,
+   ctx->Driver.Viewport(ctx, 0, ctx->Viewport.X, ctx->Viewport.Y,
 ctx->Viewport.Width, ctx->Viewport.Height);
} else {
 
@@ -410,7 +410,7 @@ void radeon_viewport(struct gl_context *ctx)
 {
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
__DRIcontext *driContext = radeon->dri.context;
-   void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y,
+   void (*old_viewport)(struct gl_context *ctx, GLuint idx, GLint x, GLint 
y,
 GLsizei w, GLsizei h);
 
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c 
b/src/mesa/drivers/dri/radeon/radeon_state.c
index 625271d..48bbbd8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1383,7 +1383,7 @@ void radeonUpdateWindow( struct gl_context *ctx )
 }
 
 
-static void radeonViewport( struct gl_context *ctx, GLint x, GLint y,
+static void radeonViewport( struct gl_context *ctx, GLuint idx, GLint x, GLint 
y,
GLsizei width, GLsizei height )
 {
(void) x;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index c062071..deba27e 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -618,7 +618,8 @@ update_state( struct gl_context *ctx, GLuint new_state )
 }
 
 static void
-viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+viewport(struct gl_context *ctx, GLuint idx,
+ GLint x, GLint y, GLsizei w, GLsizei h)
 {
 struct gl_framebuffer *draw = ctx->WinSysDrawBuffer;
 struct gl_framebuffer *read = ctx->WinSysReadBuffer;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 1910d2c..ed4ad6f 100644
--- a/src/mesa/main/dd.h

Re: [Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter
I've got st_atom_viewport.c covered, that one is easy.

Marek's comment is what I'm looking for. As I was looking at the
possibility of removing the Driver::Viewport I wanted to make sure I
understood possible ramifications. I will not include the removal of
Driver::Viewport or Driver::Scissor in my ARB_viewport_array patches.

Thanks,
Courtney


On Tue, Nov 19, 2013 at 5:13 PM, Marek Olšák  wrote:

> st_viewport has nothing to do with the viewport. It's used if libGL
> doesn't expose __DRI_USE_INVALIDATE, so I don't think it's safe to remove
> it. If Driver::Viewport is about to removed, the code of st_viewport should
> be moved somewhere else.
>
> Marek
>
>
>
> On Wed, Nov 20, 2013 at 12:53 AM, Courtney Goeltzenleuchter <
> court...@lunarg.com> wrote:
>
>> The Gallium state tracker has a st_viewport that it puts into
>> driver->Viewport function table.
>>
>> It's not clear to me how _NEW_VIEWPORT replaces the function of the
>> Driver->Viewport call.
>>
>> Is it really safe to remove the driver->Viewport call for Gallium?
>>
>> Courtney
>>
>>
>> On Mon, Nov 4, 2013 at 12:31 PM, Brian Paul  wrote:
>>
>>> On 11/04/2013 11:43 AM, Ian Romanick wrote:
>>>
>>>> -BEGIN PGP SIGNED MESSAGE-
>>>> Hash: SHA1
>>>>
>>>> On 11/01/2013 04:12 PM, Francisco Jerez wrote:
>>>>
>>>>> Ian Romanick  writes:
>>>>>
>>>>>  On 11/01/2013 02:04 PM, Courtney Goeltzenleuchter wrote:
>>>>>>
>>>>>>> [...]
>>>>>>>
>>>>>> More often, the dd_function_table functions allow core Mesa to
>>>>>> signal the driver driver that something happened... and the
>>>>>> driver may need to do something in response.  For DRI2 drivers,
>>>>>> the Viewport function is a good example.  DRI2 drivers use that
>>>>>> signal as a hint that the window may have been resized.
>>>>>>
>>>>>> Other dd_function_table functions are used by core Mesa to
>>>>>> request the driver create or destroy some resource (e.g., texture
>>>>>> storage).
>>>>>>
>>>>>> If it weren't for the way nouveau used the DepthRange and Scissor
>>>>>> hooks, I think we could just about get rid of them altogether.  I
>>>>>> wish that driver just used the dirty state bits like everyone
>>>>>> else. :(
>>>>>>
>>>>>
>>>>> Cases like the new dd_function_table::Scissor and ::Viewport hooks
>>>>> introduced in this patch series are the reason why nouveau tends
>>>>> to prefer overriding the dd_function_table to keep track of state
>>>>> changes rather than looking at the ctx->NewState bits, because the
>>>>> latter tend to be very coarse-grained -- e.g. there's one big
>>>>> _NEW_TEXTURE flag for all the state of all texture units while
>>>>> nouveau is able to update a subset of the texture state
>>>>> independently for only those texture units that have changed.
>>>>>
>>>>> With the dd_function_table interface proposed in this patch series
>>>>> it would be possible for the drivers to update the state of each
>>>>> viewport in the viewport array independently, which might be
>>>>> beneficial for some hardware someday, removing ::DepthRange and
>>>>> ::Scissor would preclude that possibility.
>>>>>
>>>>
>>>> Right... I wonder if we might be better of just tracking a bit per
>>>> viewport in the gl_context.  I'm assuming we'll end up with something
>>>> like:
>>>>
>>>>  struct gl_viewport_attrib Viewports[MAX_VIEWPORTS];
>>>>
>>>> in the gl_context.  It would be easy to add
>>>>
>>>>  GLbitfield  _DirtyViewports;
>>>>
>>>> along side it.  The various Viewport and DepthRange functions would
>>>> set bits in that field along with _NEW_VIEWPORT.  Drivers that care
>>>> could examine (and clear) those bits.
>>>>
>>>> We'd do similar for Scissor.
>>>>
>>>> Looking at the i965 hardware (and our driver architecture), I believe
>>>> we have to upload all of the viewports anytime there's a change
>>>> anyway.  The viewports are just stored as an array in a BO.  See
>>>> gen7_upload_sf_clip_viewport and similar functions.
>>>>
>>>> Marek:  Do you know what Radeon / Gallium want?
>>>>
>>>
>>> The gallium interface takes a start,count array of viewports.  The
>>> st/mesa state tracker could use the bitfield to determine the changed
>>> range.  But we also have the CSO module to help filter out redundant state
>>> changes.
>>>
>>> -Brian
>>>
>>>
>>> ___
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>
>>
>>
>>
>> --
>> Courtney Goeltzenleuchter
>> LunarG
>>
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>>
>


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


Re: [Mesa-dev] [PATCH 0/1]: Preparing for ARB_viewport_array

2013-11-20 Thread Courtney Goeltzenleuchter
Hi Ian,

I see that you have a shadow Viewport and Scissor attribute structure. I
was trying to avoid managing two copies of the data so I just updated all
the drivers to use index 0 of the array directly. You'd probably want to do
the same thing with the scissor enable flag that becomes a bitfield of
enables. Changing from Viewport to Viewports (I used ViewportArray) in the
drivers touches about 20 files. Have to touch those same files when
removing the x,y,w,h arguments from Viewport and Scissor anyway so I
figured it was no harder to change the references to Scissor and Viewport
to be array references to index 0.

Shall I just post my changes for folks to poke at? Or is a fdo personal
repository easier to work with?

Courtney


On Tue, Nov 19, 2013 at 5:54 PM, Ian Romanick  wrote:

> On 10/31/2013 08:55 AM, Courtney Goeltzenleuchter wrote:
> > The following patch will begin the process of adding ARB_viewport_array
> > to Mesa. Next will be to extend the gl_context Scissor and Viewport
> > attributes to hold multiple viewport, scissor and scissor enables.
> > Then the DI side of ARB_viewport_array.
>
> I pushed a viewport-array branch to my freedesktop.org repository.
> There's a bunch of in-progress refactoring there.  The big thing is
> making the current viewport-related structures derived state.  This
> minimizes the changes necessary to non-array drivers.
>
> Opinions?
>
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>


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


Re: [Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels

2013-11-19 Thread Courtney Goeltzenleuchter
My apologies, I was distracted by other maters - updated commit follows.


On Mon, Nov 11, 2013 at 2:21 PM, Chad Versace
wrote:

> On 11/08/2013 08:13 AM, Courtney Goeltzenleuchter wrote:
>
>> Support all levels of a supported texture format.
>>
>> Using 1024x1024, RGBA  source, mipmap
>> <>
>> internal-format Before (MB/sec) XRGB (MB/sec)   mipmap (MB/sec)
>> GL_RGBA 628.15  627.15  615.90
>> GL_RGB  265.95  456.35  611.53
>> 512x512
>> GL_RGBA 600.23  597.00  619.95
>> GL_RGB  255.50  440.62  611.28
>> 256x256
>> GL_RGBA 489.08  487.80  587.42
>> GL_RGB  229.03  376.63  585.00
>>
>> Test shows similar pattern for 512x512 and 256x256.
>>
>> Benchmark has been sent to mesa-dev list: teximage_enh
>>
>> Courtney Goeltzenleuchter (2):
>>i965: add XRGB to tiled_memcpy
>>i965: Enhance tiled_memcpy to support all levels
>>
>>   src/mesa/drivers/dri/i965/intel_tex_subimage.c | 11 ---
>>   1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> --
>> 1.8.1.2
>>
>> Signed-off-by: Courtney Goeltzenleuchter 
>> ---
>>   src/mesa/drivers/dri/i965/intel_tex_subimage.c | 8 ++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
>> b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
>> index b1826fa..50f802f 100644
>> --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
>> +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
>> @@ -543,7 +543,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
>> ctx,
>>  uint32_t cpp;
>>  mem_copy_fn mem_copy = NULL;
>>
>> -   /* This fastpath is restricted to specific texture types: level 0 of
>> +   /* This fastpath is restricted to specific texture types:
>>   * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to
>> support
>>   * more types.
>>   *
>> @@ -555,7 +555,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
>> ctx,
>>  if (!brw->has_llc ||
>>  type != GL_UNSIGNED_BYTE ||
>>  texImage->TexObject->Target != GL_TEXTURE_2D ||
>> -   texImage->Level != 0 ||
>>  pixels == NULL ||
>>  _mesa_is_bufferobj(packing->BufferObj) ||
>>  packing->Alignment > 4 ||
>> @@ -631,6 +630,11 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
>> ctx,
>>  packing->Alignment, packing->RowLength, packing->SkipPixels,
>>  packing->SkipRows, for_glTexImage);
>>
>> +   /* Adjust x and y offset based on miplevel
>> +*/
>>
>
> One small nitpick. The above comment is short enough to fit on a single
> line.
> There's no need to place '*/' on a line by itself.
>
>
>  +   xoffset += image->mt->level[texImage->Level].level_x;
>> +   yoffset += image->mt->level[texImage->Level].level_y;
>> +
>>  linear_to_tiled(
>> xoffset * cpp, (xoffset + width) * cpp,
>> yoffset, yoffset + height,
>>
>>
> The code looks good, though I haven't tested it yet. But, I see the same
> issues with the commit message that I had with patch 1.
>



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


[Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels

2013-11-19 Thread Courtney Goeltzenleuchter
Support all levels of a supported texture format.

Using 1024x1024, RGBA  source, mipmap
internal-format Before (MB/sec) mipmap (MB/sec)
GL_RGBA 627.15  615.90
GL_RGB  456.35  611.53
512x512
GL_RGBA 597.00  619.95
GL_RGB  440.62  611.28
256x256
GL_RGBA 487.80  587.42
GL_RGB  376.63  585.00

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index b1826fa..50f802f 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -543,7 +543,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
uint32_t cpp;
mem_copy_fn mem_copy = NULL;
 
-   /* This fastpath is restricted to specific texture types: level 0 of
+   /* This fastpath is restricted to specific texture types:
 * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to support
 * more types.
 *
@@ -555,7 +555,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
if (!brw->has_llc ||
type != GL_UNSIGNED_BYTE ||
texImage->TexObject->Target != GL_TEXTURE_2D ||
-   texImage->Level != 0 ||
pixels == NULL ||
_mesa_is_bufferobj(packing->BufferObj) ||
packing->Alignment > 4 ||
@@ -631,6 +630,11 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Alignment, packing->RowLength, packing->SkipPixels,
packing->SkipRows, for_glTexImage);
 
+   /* Adjust x and y offset based on miplevel */
+   xoffset += image->mt->level[texImage->Level].level_x;
+   yoffset += image->mt->level[texImage->Level].level_y;
+
linear_to_tiled(
   xoffset * cpp, (xoffset + width) * cpp,
   yoffset, yoffset + height,
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 1/2] i965: add XRGB to tiled_memcpy

2013-11-19 Thread Courtney Goeltzenleuchter
MESA_FORMAT_XRGB is equivalent to MESA_FORMAT_ARGB in terms
of storage on the device, so okay to use this optimized copy routine.

This series builds on work from Frank Henigman to optimize the
process of uploading a texture to the GPU. This series adds support for
MESA_XRGB_ and full miptrees where were found to be common activities
in the Smokin' Guns game. The issue was found while profiling the app
but that part is not benchmarked. Smokin-Guns uses mipmap textures with
an internal format of GL_RGB (MESA_XRGB_ in the driver).

These changes need a performance tool to run against to show how they
improve execution performance for specific texture formats. Using this
benchmark I've measured the following improvement on my Ivybridge
Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.

1024x1024 texture size
internal-format Before (MB/sec) XRGB (MB/sec)
GL_RGBA 628.15  627.15
GL_RGB  265.95  456.35

512x512 texture size
internal-format Before (MB/sec) XRGB (MB/sec)
GL_RGBA 600.23  597.00
GL_RGB  255.50  440.62

256x256 texture size
internal-format Before (MB/sec) XRGB (MB/sec)
GL_RGBA 489.08  487.80
GL_RGB  229.03  376.63

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index 0384bcc..b1826fa 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -571,7 +571,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
(texImage->TexFormat == MESA_FORMAT_A8 && format == GL_ALPHA)) {
   cpp = 1;
   mem_copy = memcpy;
-   } else if (texImage->TexFormat == MESA_FORMAT_ARGB) {
+   } else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
+ || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
   cpp = 4;
   if (format == GL_BGRA) {
  mem_copy = memcpy;
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array

2013-11-19 Thread Courtney Goeltzenleuchter
The Gallium state tracker has a st_viewport that it puts into
driver->Viewport function table.

It's not clear to me how _NEW_VIEWPORT replaces the function of the
Driver->Viewport call.

Is it really safe to remove the driver->Viewport call for Gallium?

Courtney


On Mon, Nov 4, 2013 at 12:31 PM, Brian Paul  wrote:

> On 11/04/2013 11:43 AM, Ian Romanick wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> On 11/01/2013 04:12 PM, Francisco Jerez wrote:
>>
>>> Ian Romanick  writes:
>>>
>>>  On 11/01/2013 02:04 PM, Courtney Goeltzenleuchter wrote:
>>>>
>>>>> [...]
>>>>>
>>>> More often, the dd_function_table functions allow core Mesa to
>>>> signal the driver driver that something happened... and the
>>>> driver may need to do something in response.  For DRI2 drivers,
>>>> the Viewport function is a good example.  DRI2 drivers use that
>>>> signal as a hint that the window may have been resized.
>>>>
>>>> Other dd_function_table functions are used by core Mesa to
>>>> request the driver create or destroy some resource (e.g., texture
>>>> storage).
>>>>
>>>> If it weren't for the way nouveau used the DepthRange and Scissor
>>>> hooks, I think we could just about get rid of them altogether.  I
>>>> wish that driver just used the dirty state bits like everyone
>>>> else. :(
>>>>
>>>
>>> Cases like the new dd_function_table::Scissor and ::Viewport hooks
>>> introduced in this patch series are the reason why nouveau tends
>>> to prefer overriding the dd_function_table to keep track of state
>>> changes rather than looking at the ctx->NewState bits, because the
>>> latter tend to be very coarse-grained -- e.g. there's one big
>>> _NEW_TEXTURE flag for all the state of all texture units while
>>> nouveau is able to update a subset of the texture state
>>> independently for only those texture units that have changed.
>>>
>>> With the dd_function_table interface proposed in this patch series
>>> it would be possible for the drivers to update the state of each
>>> viewport in the viewport array independently, which might be
>>> beneficial for some hardware someday, removing ::DepthRange and
>>> ::Scissor would preclude that possibility.
>>>
>>
>> Right... I wonder if we might be better of just tracking a bit per
>> viewport in the gl_context.  I'm assuming we'll end up with something
>> like:
>>
>>  struct gl_viewport_attrib Viewports[MAX_VIEWPORTS];
>>
>> in the gl_context.  It would be easy to add
>>
>>  GLbitfield  _DirtyViewports;
>>
>> along side it.  The various Viewport and DepthRange functions would
>> set bits in that field along with _NEW_VIEWPORT.  Drivers that care
>> could examine (and clear) those bits.
>>
>> We'd do similar for Scissor.
>>
>> Looking at the i965 hardware (and our driver architecture), I believe
>> we have to upload all of the viewports anytime there's a change
>> anyway.  The viewports are just stored as an array in a BO.  See
>> gen7_upload_sf_clip_viewport and similar functions.
>>
>> Marek:  Do you know what Radeon / Gallium want?
>>
>
> The gallium interface takes a start,count array of viewports.  The st/mesa
> state tracker could use the bitfield to determine the changed range.  But
> we also have the CSO module to help filter out redundant state changes.
>
> -Brian
>
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



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


[Mesa-dev] [v3 8/8] mesa: Update TexStorage to support ARB_texture_view

2013-11-19 Thread Courtney Goeltzenleuchter
Call TextureView helper function to set TextureView state
appropriately for the TexStorage calls.

Misc updates from review feedback.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/teximage.c   | 6 ++
 src/mesa/main/texstorage.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 793c5d3..149b6da 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -48,6 +48,7 @@
 #include "texobj.h"
 #include "texstate.h"
 #include "texstorage.h"
+#include "textureview.h"
 #include "mtypes.h"
 #include "glformats.h"
 
@@ -4348,6 +4349,11 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei 
samples,
   }
 
   texObj->Immutable = immutable;
+
+  if (immutable) {
+ set_texture_view_state(ctx, texObj, target, 1);
+  }
+
   _mesa_update_fbo_texture(ctx, texObj, 0, 0);
}
 }
diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 84b8f82..4cdcb02 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -38,6 +38,7 @@
 #include "teximage.h"
 #include "texobj.h"
 #include "texstorage.h"
+#include "textureview.h"
 #include "mtypes.h"
 
 
@@ -436,8 +437,8 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
  return;
   }
 
-  texObj->Immutable = GL_TRUE;
-  texObj->ImmutableLevels = levels;
+  set_texture_view_state(ctx, texObj, target, levels);
+
}
 }
 
-- 
1.8.1.2

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


[Mesa-dev] [v3 2/8] mesa: Tracking for ARB_texture_view extension

2013-11-19 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/extensions.c | 1 +
 src/mesa/main/mtypes.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 104618c..b7da884 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -156,6 +156,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_rg",  o(ARB_texture_rg),  
GL, 2008 },
{ "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 },
{ "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), 
GL, 2008 },
{ "GL_ARB_timer_query", o(ARB_timer_query), 
GL, 2010 },
{ "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), 
GL, 2010 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8801d6f..f6ce6d0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3367,6 +3367,7 @@ struct gl_extensions
GLboolean ARB_texture_query_lod;
GLboolean ARB_texture_rg;
GLboolean ARB_texture_rgb10_a2ui;
+   GLboolean ARB_texture_view;
GLboolean ARB_timer_query;
GLboolean ARB_transform_feedback2;
GLboolean ARB_transform_feedback3;
-- 
1.8.1.2

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


[Mesa-dev] [v3 6/8] mesa: Fill out ARB_texture_view entry points

2013-11-19 Thread Courtney Goeltzenleuchter
Add Mesa TextureView logic.
Incorporate feedback on ARB_texture_view

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/textureview.c | 562 +++-
 1 file changed, 561 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 4a6bd62..1858465 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -40,8 +40,346 @@
 #include "texobj.h"
 #include "texstorage.h"
 #include "textureview.h"
+#include "stdbool.h"
 #include "mtypes.h"
 
+/* Table 3.X.2 (Compatible internal formats for TextureView)
+---
+| Class | Internal formats|
+---
+| VIEW_CLASS_128_BITS   | RGBA32F, RGBA32UI, RGBA32I  |
+---
+| VIEW_CLASS_96_BITS| RGB32F, RGB32UI, RGB32I |
+---
+| VIEW_CLASS_64_BITS| RGBA16F, RG32F, RGBA16UI, RG32UI, RGBA16I,  |
+|   | RG32I, RGBA16, RGBA16_SNORM |
+---
+| VIEW_CLASS_48_BITS| RGB16, RGB16_SNORM, RGB16F, RGB16UI, RGB16I |
+---
+| VIEW_CLASS_32_BITS| RG16F, R11F_G11F_B10F, R32F,|
+|   | RGB10_A2UI, RGBA8UI, RG16UI, R32UI, |
+|   | RGBA8I, RG16I, R32I, RGB10_A2, RGBA8, RG16, |
+|   | RGBA8_SNORM, RG16_SNORM, SRGB8_ALPHA8, RGB9_E5  |
+---
+| VIEW_CLASS_24_BITS| RGB8, RGB8_SNORM, SRGB8, RGB8UI, RGB8I  |
+---
+| VIEW_CLASS_16_BITS| R16F, RG8UI, R16UI, RG8I, R16I, RG8, R16,   |
+|   | RG8_SNORM, R16_SNORM|
+---
+| VIEW_CLASS_8_BITS | R8UI, R8I, R8, R8_SNORM |
+---
+| VIEW_CLASS_RGTC1_RED  | COMPRESSED_RED_RGTC1,   |
+|   | COMPRESSED_SIGNED_RED_RGTC1 |
+---
+| VIEW_CLASS_RGTC2_RG   | COMPRESSED_RG_RGTC2,|
+|   | COMPRESSED_SIGNED_RG_RGTC2  |
+---
+| VIEW_CLASS_BPTC_UNORM | COMPRESSED_RGBA_BPTC_UNORM, |
+|   | COMPRESSED_SRGB_ALPHA_BPTC_UNORM|
+---
+| VIEW_CLASS_BPTC_FLOAT | COMPRESSED_RGB_BPTC_SIGNED_FLOAT,   |
+|   | COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT  |
+---
+ */
+struct internal_format_class_info {
+   GLenum view_class;
+   GLenum internal_format;
+};
+#define INFO(c,f) {GL_##c, GL_##f}
+static const struct internal_format_class_info _compatible_internal_formats[] 
= {
+   INFO(VIEW_CLASS_128_BITS, RGBA32F),
+   INFO(VIEW_CLASS_128_BITS, RGBA32UI),
+   INFO(VIEW_CLASS_128_BITS, RGBA32I),
+   INFO(VIEW_CLASS_96_BITS, RGB32F),
+   INFO(VIEW_CLASS_96_BITS, RGB32UI),
+   INFO(VIEW_CLASS_96_BITS, RGB32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16F),
+   INFO(VIEW_CLASS_64_BITS, RG32F),
+   INFO(VIEW_CLASS_64_BITS, RGBA16UI),
+   INFO(VIEW_CLASS_64_BITS, RG32UI),
+   INFO(VIEW_CLASS_64_BITS, RGBA16I),
+   INFO(VIEW_CLASS_64_BITS, RG32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16),
+   INFO(VIEW_CLASS_64_BITS, RGBA16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16),
+   INFO(VIEW_CLASS_48_BITS, RGB16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16F),
+   INFO(VIEW_CLASS_48_BITS, RGB16UI),
+   INFO(VIEW_CLASS_48_BITS, RGB16I),
+   INFO(VIEW_CLASS_32_BITS, RG16F),
+   INFO(VIEW_CLASS_32_BITS, R11F_G11F_B10F),
+   INFO(VIEW_CLASS_32_BITS, R32F),
+   INFO(VIEW_CLASS_32_BITS, RGB10_A2UI),
+   INFO(VIEW_CLASS_32_BITS, RGBA8UI),
+   INFO(VIEW_CLASS_32_BITS, RG16UI),
+   INFO(VIEW_CLASS_32_BITS, R32UI),
+   INFO(VIEW_CLASS_32_BITS, RGBA8I),
+   INFO(VIEW_CLASS_32_BITS, RG16I),
+   INFO(VIEW_CLASS_32_BITS, R32I),
+   INFO(VIEW_CLASS_32_BITS, RGB10_A2),
+   INFO(VIEW_CLASS_32_BITS, RG

[Mesa-dev] [v3 5/8] mesa: Add driver entry point for ARB_texture_view

2013-11-19 Thread Courtney Goeltzenleuchter

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/common/driverfuncs.c | 3 +++
 src/mesa/main/dd.h| 5 +
 2 files changed, 8 insertions(+)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 5faa98a..f185688 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -211,6 +211,9 @@ _mesa_init_driver_functions(struct dd_function_table 
*driver)
/* GL_ARB_texture_storage */
driver->AllocTextureStorage = _mesa_alloc_texture_storage;
 
+   /* GL_ARB_texture_view */
+   driver->TextureView = NULL;
+
/* GL_ARB_texture_multisample */
driver->GetSamplePosition = NULL;
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index b5b874f..3e263f4 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -375,6 +375,11 @@ struct dd_function_table {
 GLsizei levels, GLsizei width,
 GLsizei height, GLsizei depth);
 
+   /** Called as part of glTextureView to add views to origTexObj */
+   GLboolean (*TextureView)(struct gl_context *ctx,
+struct gl_texture_object *texObj,
+struct gl_texture_object *origTexObj);
+
/**
 * Map a renderbuffer into user space.
 * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
-- 
1.8.1.2

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


[Mesa-dev] [v3 0/8] Add ARB_texture_view

2013-11-19 Thread Courtney Goeltzenleuchter
The following patches add the necessary functions to Mesa
to support ARB_texture_view. These patches do not include
the actual driver elements, just the device independent portion.
This extension requires ARB_texture_storage.

The extension supports one new API call, glTextureView and
a handful of enums that have been added as queriable texture
parameters.

Adds one new driver entry point for the driver to
map the view specified onto the origtexture given.

Includes review feedback and a bug fix in compatible_format.

Passes non-rendering ARB_texture_view piglit tests.

Courtney Goeltzenleuchter (8):
  mesa: Add API definitions for ARB_texture_view
  mesa: Tracking for ARB_texture_view extension
  mesa: update texture object for ARB_texture_view
  mesa: ARB_texture_view get parameters
  mesa: Add driver entry point for ARB_texture_view
  mesa: Fill out ARB_texture_view entry points
  mesa: add texture_view helper function for TexStorage
  mesa: Update TexStorage to support ARB_texture_view

 src/mapi/glapi/gen/ARB_texture_view.xml |  23 ++
 src/mapi/glapi/gen/Makefile.am  |   1 +
 src/mapi/glapi/gen/gl_API.xml   |   4 +-
 src/mapi/glapi/gen/gl_genexec.py|   1 +
 src/mesa/Makefile.sources   |   1 +
 src/mesa/SConscript |   1 +
 src/mesa/drivers/common/driverfuncs.c   |   3 +
 src/mesa/main/dd.h  |   5 +
 src/mesa/main/extensions.c  |   1 +
 src/mesa/main/mtypes.h  |   6 +
 src/mesa/main/tests/dispatch_sanity.cpp |   2 +-
 src/mesa/main/teximage.c|   6 +
 src/mesa/main/texparam.c|  60 ++-
 src/mesa/main/texstorage.c  |   5 +-
 src/mesa/main/textureview.c | 684 
 src/mesa/main/textureview.h |  43 ++
 16 files changed, 838 insertions(+), 8 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_texture_view.xml
 create mode 100644 src/mesa/main/textureview.c
 create mode 100644 src/mesa/main/textureview.h

-- 
1.8.1.2

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


[Mesa-dev] [v3 7/8] mesa: add texture_view helper function for TexStorage

2013-11-19 Thread Courtney Goeltzenleuchter
Add helper function to set texture_view state from TexStorage calls.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/textureview.c | 59 +
 src/mesa/main/textureview.h |  4 +++
 2 files changed, 63 insertions(+)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 1858465..a25b928 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -379,6 +379,65 @@ compatible_format(struct gl_context *ctx, struct 
gl_texture_object *origTexObj,
_mesa_lookup_enum_by_nr(origInternalFormat));
return GL_FALSE;
 }
+/**
+ * Helper function for TexStorage to set TextureView state
+ */
+void
+set_texture_view_state(struct gl_context *ctx, struct gl_texture_object 
*texObj,
+   GLenum target, GLuint levels)
+{
+   struct gl_texture_image *texImage;
+
+   /* Get a reference to what will become this View's base level */
+   texImage = _mesa_select_tex_image(ctx, texObj, target, 0);
+
+   /* If the command is successful,
+* TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
+* TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
+* If the texture target is TEXTURE_1D_ARRAY then
+* TEXTURE_VIEW_NUM_LAYERS becomes height.
+* If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
+* or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes 
depth.
+* If the texture target is TEXTURE_CUBE_MAP, then
+* TEXTURE_VIEW_NUM_LAYERS becomes 6.
+* For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
+* 
+* ARB_texture_multisample: Multisample textures do
+* not have multiple image levels.
+*/
+
+   texObj->Immutable = GL_TRUE;
+   texObj->ImmutableLevels = levels;
+   texObj->MinLevel = 0;
+   texObj->NumLevels = levels;
+   texObj->MinLayer = 0;
+   texObj->NumLayers = 1;
+   switch (target) {
+   case GL_TEXTURE_1D_ARRAY:
+  texObj->NumLayers = texImage->Height;
+  break;
+
+   case GL_TEXTURE_2D_MULTISAMPLE:
+  texObj->NumLevels = 1;
+  texObj->ImmutableLevels = 1;
+  break;
+
+   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+  texObj->NumLevels = 1;
+  texObj->ImmutableLevels = 1;
+  /* fall through to set NumLayers */
+
+   case GL_TEXTURE_2D_ARRAY:
+   case GL_TEXTURE_CUBE_MAP_ARRAY:
+  texObj->NumLayers = texImage->Depth;
+  break;
+
+   case GL_TEXTURE_CUBE_MAP:
+  texObj->NumLayers = 6;
+  break;
+
+   }
+}
 
 /**
  * glTextureView (ARB_texture_view)
diff --git a/src/mesa/main/textureview.h b/src/mesa/main/textureview.h
index c2f0f32..36a8ed3 100644
--- a/src/mesa/main/textureview.h
+++ b/src/mesa/main/textureview.h
@@ -36,4 +36,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
   GLuint minlevel, GLuint numlevels,
   GLuint minlayer, GLuint numlayers);
 
+extern void
+set_texture_view_state(struct gl_context *ctx, struct gl_texture_object 
*texObj,
+   GLenum target, GLuint levels);
+
 #endif /* TEXTUREVIEW_H */
-- 
1.8.1.2

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


[Mesa-dev] [v3 3/8] mesa: update texture object for ARB_texture_view

2013-11-19 Thread Courtney Goeltzenleuchter
Add state needed by glTextureView to the gl_texture_object.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/mtypes.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f6ce6d0..82fcd61 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1193,6 +1193,11 @@ struct gl_texture_object
 pressure? */
GLboolean Immutable;/**< GL_ARB_texture_storage */
 
+   GLuint MinLevel;/**< GL_ARB_texture_view */
+   GLuint MinLayer;/**< GL_ARB_texture_view */
+   GLuint NumLevels;   /**< GL_ARB_texture_view */
+   GLuint NumLayers;   /**< GL_ARB_texture_view */
+
/** Actual texture images, indexed by [cube face] and [mipmap level] */
struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
 
-- 
1.8.1.2

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


[Mesa-dev] [v3 1/8] mesa: Add API definitions for ARB_texture_view

2013-11-19 Thread Courtney Goeltzenleuchter
Stub in glTextureView API call to go with the
glTextureView API xml definition.
Includes dispatch test for glTextureView

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mapi/glapi/gen/ARB_texture_view.xml | 23 
 src/mapi/glapi/gen/Makefile.am  |  1 +
 src/mapi/glapi/gen/gl_API.xml   |  4 +-
 src/mapi/glapi/gen/gl_genexec.py|  1 +
 src/mesa/Makefile.sources   |  1 +
 src/mesa/SConscript |  1 +
 src/mesa/main/tests/dispatch_sanity.cpp |  2 +-
 src/mesa/main/textureview.c | 65 +
 src/mesa/main/textureview.h | 39 
 9 files changed, 135 insertions(+), 2 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_texture_view.xml
 create mode 100644 src/mesa/main/textureview.c
 create mode 100644 src/mesa/main/textureview.h

diff --git a/src/mapi/glapi/gen/ARB_texture_view.xml 
b/src/mapi/glapi/gen/ARB_texture_view.xml
new file mode 100644
index 000..3e6b8c9
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_texture_view.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+   
+  
+  
+  
+  
+  
+  
+  
+  
+   
+
+
+
+
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index 476d943..8c08119 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -124,6 +124,7 @@ API_XML = \
ARB_texture_rg.xml \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
+   ARB_texture_view.xml \
ARB_vertex_array_object.xml \
ARB_vertex_attrib_binding.xml \
AMD_draw_buffers_blend.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index a2d914a..ca4bdd3 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8458,8 +8458,10 @@
 
 
 
-
 
+
+
+http://www.w3.org/2001/XInclude"/>
 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 3ce190f..b557b3b 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -102,6 +102,7 @@ header = """/**
 #include "main/texstate.h"
 #include "main/texstorage.h"
 #include "main/texturebarrier.h"
+#include "main/textureview.h"
 #include "main/transformfeedback.h"
 #include "main/mtypes.h"
 #include "main/varray.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index a84f8a7..39525bc 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -103,6 +103,7 @@ MAIN_FILES = \
$(SRCDIR)main/texstate.c \
$(SRCDIR)main/texstorage.c \
$(SRCDIR)main/texstore.c \
+$(SRCDIR)main/textureview.c \
$(SRCDIR)main/texturebarrier.c \
$(SRCDIR)main/transformfeedback.c \
$(SRCDIR)main/uniforms.c \
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index a2bb9f1..bb9b304 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -133,6 +133,7 @@ main_sources = [
 'main/texstorage.c',
 'main/texstore.c',
 'main/texturebarrier.c',
+'main/textureview.c',
 'main/transformfeedback.c',
 'main/uniform_query.cpp',
 'main/uniforms.c',
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 922f0ac..d5388e3 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -853,7 +853,7 @@ const struct function gl_core_functions_possible[] = {
 // { "glDispatchCompute", 43, -1 }, // XXX: Add to xml
 // { "glDispatchComputeIndirect", 43, -1 }, // XXX: Add to xml
 // { "glCopyImageSubData", 43, -1 },// XXX: Add to xml
-// { "glTextureView", 43, -1 }, // XXX: Add to xml
+   { "glTextureView", 43, -1 },
{ "glBindVertexBuffer", 43, -1 },
{ "glVertexAttribFormat", 43, -1 },
{ "glVertexAttribIFormat", 43, -1 },
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
new file mode 100644
index 000..4a6bd62
--- /dev/null
+++ b/src/mesa/main/textureview.c
@@ -0,0 +1,65 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2013 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission 

[Mesa-dev] [v3 4/8] mesa: ARB_texture_view get parameters

2013-11-19 Thread Courtney Goeltzenleuchter
Add support for ARB_texture_view get parameters:
GL_TEXTURE_VIEW_MIN_LEVEL
GL_TEXTURE_VIEW_NUM_LEVELS
GL_TEXTURE_VIEW_MIN_LAYER
GL_TEXTURE_VIEW_NUM_LAYERS

Incorporate feedback regarding when to allow query of
GL_TEXTURE_IMMUTABLE_LEVELS.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/texparam.c | 60 
 1 file changed, 56 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d56b7d9..b3e2d0a 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1565,9 +1565,35 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, 
GLfloat *params )
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (!_mesa_is_gles3(ctx))
+ if (_mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+*params = (GLfloat) obj->ImmutableLevels;
+ else
+goto invalid_pname;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LEVEL:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS:
+ if (!ctx->Extensions.ARB_texture_view)
 goto invalid_pname;
- *params = (GLfloat) obj->ImmutableLevels;
+ *params = (GLfloat) obj->NumLayers;
  break;
 
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
@@ -1746,9 +1772,35 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, 
GLint *params )
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (!_mesa_is_gles3(ctx))
+ if (_mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+*params = obj->ImmutableLevels;
+ else
+goto invalid_pname;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LEVEL:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS:
+ if (!ctx->Extensions.ARB_texture_view)
 goto invalid_pname;
- *params = obj->ImmutableLevels;
+ *params = (GLint) obj->NumLayers;
  break;
 
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH 1/2 v3] i965: add XRGB to tiled_memcpy

2013-11-12 Thread Courtney Goeltzenleuchter
Hi Chad,

Does Matt's explanation help?

I wanted to tell the performance story and show the progression of
performance enhancements with these two patches.

Thanks,
Courtney


On Mon, Nov 11, 2013 at 3:01 PM, Matt Turner  wrote:

> On Mon, Nov 11, 2013 at 1:19 PM, Chad Versace
>  wrote:
> > On 11/07/2013 01:59 PM, Courtney Goeltzenleuchter wrote:
> >>
> >> MESA_FORMAT_XRGB is equivalent to MESA_FORMAT_ARGB in terms
> >> of storage on the device, so okay to use this optimized copy routine.
> >>
> >> This series builds on work from Frank Henigman to optimize the
> >> process of uploading a texture to the GPU. This series adds support for
> >> MESA_XRGB_ and full miptrees where were found to be common
> activities
> >> in the Smokin' Guns game. The issue was found while profiling the app
> >> but that part is not benchmarked. Smokin-Guns uses mipmap textures with
> >> an internal format of GL_RGB (MESA_XRGB_ in the driver).
> >>
> >> These changes need a performance tool to run against to show how they
> >> improve execution performance for specific texture formats. Using this
> >> benchmark I've measured the following improvement on my Ivybridge
> >> Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.
> >>
> >> Using 1024x1024, RGBA  source, mipmap
> >>  <>
> >
> >
> > I don't understand. What do you mean by ``<>``? That all
> these
> > numbers were obtained with this patch? But that doesn't make sense,
> because
> > these are before-and-after numbers. And it can't be just this patch,
> because
> > these numbers are identical to the numbers quoted in patch 2.
>
> The first column is "before", the second is after patch 1, and the
> third is after patch 2. Instead of doing before->after patch 1 in
> patch 1's commit, and after patch 1->after patch 2 in patch 2's
> commit, he just pasted the same data in and added <> above
> the column that corresponds to the patch.
>



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


[Mesa-dev] [PATCH demos v2 1/3] Perf: Add command line capabilities to perf framework

2013-11-11 Thread Courtney Goeltzenleuchter
These were entirely interactive. Adding ability to pass in
command line arguments allows future tests to include
automated test capabilities.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/perf/copytex.c  | 2 +-
 src/perf/drawoverhead.c | 2 +-
 src/perf/fbobind.c  | 2 +-
 src/perf/fill.c | 2 +-
 src/perf/genmipmap.c| 2 +-
 src/perf/glmain.c   | 2 +-
 src/perf/glmain.h   | 2 +-
 src/perf/glslstateschange.c | 2 +-
 src/perf/readpixels.c   | 2 +-
 src/perf/swapbuffers.c  | 2 +-
 src/perf/teximage.c | 2 +-
 src/perf/vbo.c  | 2 +-
 src/perf/vertexrate.c   | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/perf/copytex.c b/src/perf/copytex.c
index f7a6b8a..376d699 100644
--- a/src/perf/copytex.c
+++ b/src/perf/copytex.c
@@ -57,7 +57,7 @@ static const struct vertex vertices[1] = {
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
const GLenum filter = GL_LINEAR;
GLenum stat;
diff --git a/src/perf/drawoverhead.c b/src/perf/drawoverhead.c
index f75c9bb..06a815f 100644
--- a/src/perf/drawoverhead.c
+++ b/src/perf/drawoverhead.c
@@ -55,7 +55,7 @@ static const struct vertex vertices[4] = {
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
/* setup VBO w/ vertex data */
glGenBuffersARB(1, &VBO);
diff --git a/src/perf/fbobind.c b/src/perf/fbobind.c
index fb52a93..4206294 100644
--- a/src/perf/fbobind.c
+++ b/src/perf/fbobind.c
@@ -56,7 +56,7 @@ static const struct vertex vertices[1] = {
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
const GLenum filter = GL_LINEAR;
GLenum stat;
diff --git a/src/perf/fill.c b/src/perf/fill.c
index 279f2b5..70cb64b 100644
--- a/src/perf/fill.c
+++ b/src/perf/fill.c
@@ -120,7 +120,7 @@ static GLuint ShaderProg1, ShaderProg2;
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
GLint u;
 
diff --git a/src/perf/genmipmap.c b/src/perf/genmipmap.c
index 20e2fa3..a37f7ab 100644
--- a/src/perf/genmipmap.c
+++ b/src/perf/genmipmap.c
@@ -52,7 +52,7 @@ static const struct vertex vertices[1] = {
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
if (!PerfExtensionSupported("GL_ARB_framebuffer_object")) {
   printf("Sorry, this test requires GL_ARB_framebuffer_object\n");
diff --git a/src/perf/glmain.c b/src/perf/glmain.c
index 81c1173..3bc18ad 100644
--- a/src/perf/glmain.c
+++ b/src/perf/glmain.c
@@ -258,7 +258,7 @@ main(int argc, char *argv[])
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
glutIdleFunc(Idle);
-   PerfInit();
+   PerfInit(argc, argv);
glutMainLoop();
return 0;
 }
diff --git a/src/perf/glmain.h b/src/perf/glmain.h
index d9bcd5f..18cde08 100644
--- a/src/perf/glmain.h
+++ b/src/perf/glmain.h
@@ -56,7 +56,7 @@ PerfExtensionSupported(const char *ext);
 /** Test programs must implement these functions **/
 
 extern void
-PerfInit(void);
+PerfInit(int argc, char *argv[]);
 
 extern void
 PerfNextRound(void);
diff --git a/src/perf/glslstateschange.c b/src/perf/glslstateschange.c
index 7422b78..83f8d6b 100644
--- a/src/perf/glslstateschange.c
+++ b/src/perf/glslstateschange.c
@@ -257,7 +257,7 @@ InitPrograms(void)
 }
 
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
if (!ShadersSupported())
   exit(1);
diff --git a/src/perf/readpixels.c b/src/perf/readpixels.c
index ac7dc42..1e777a6 100644
--- a/src/perf/readpixels.c
+++ b/src/perf/readpixels.c
@@ -51,7 +51,7 @@ static GLvoid *ReadBuffer;
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
/* setup VBO */
glGenBuffersARB(1, &VBO);
diff --git a/src/perf/swapbuffers.c b/src/perf/swapbuffers.c
index 63c7fc0..24436f7 100644
--- a/src/perf/swapbuffers.c
+++ b/src/perf/swapbuffers.c
@@ -50,7 +50,7 @@ static const struct vertex vertices[4] = {
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
/* setup VBO w/ vertex data */
glGenBuffersARB(1, &VBO);
diff --git a/src/perf/teximage.c b/src/perf/teximage.c
index a3005d0..88316f3 100644
--- a/src/perf/teximage.c
+++ b/src/perf/teximage.c
@@ -73,7 +73,7 @@ static const struct vertex vertices[1] = {
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
/* setup VBO w/ vertex data */
glGenBuffersARB(1, &VBO);
diff --git a/src/perf/vbo.c b/src/perf/vbo.c
index b326c05..6a0d313 100644
--- a/src/perf/vbo.c
+++ b/src/perf/vbo.c
@@ -51,7 +51,7 @@ static const GLfloat Vertex0[2] = { 0.0, 0.0 };
 
 /** Called from test harness/main */
 void
-PerfInit(void)
+PerfInit(int argc, char *argv[])
 {
/* setup VBO */
glGenBuffersARB(1, &VBO);
diff --git a/src/perf/vertexrate

[Mesa-dev] [PATCH demos v2 2/3] perf: Update teximage to measure more formats

2013-11-11 Thread Courtney Goeltzenleuchter
Needed test to measure texture upload speed under a variety
of modes (mipmap, source format, internal format, size, etc.)
This new test has an interactive run mode like the other Mesa
Perf tests but also includes command line options to make
it automatable.
Fix up code formatting.
Integrate review feedback.

This provides a quick way to get feedback on texture upload
related performance tuning.
Texture image data is initialized and aligned to 64 byte bounary.
Uses Mesa demos Perf library to do the measurements.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/perf/teximage.c | 720 
 1 file changed, 563 insertions(+), 157 deletions(-)

diff --git a/src/perf/teximage.c b/src/perf/teximage.c
index 88316f3..3ab33a5 100644
--- a/src/perf/teximage.c
+++ b/src/perf/teximage.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
+ * Copyright (C) 2012-2013 LunarG, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -14,49 +15,64 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
  */
 
 /**
- * Measure glTex[Sub]Image2D() and glGetTexImage() rate
- *
- * Brian Paul
- * 16 Sep 2009
+ * Measure glTexImage2D() rate
+ *   enhanced from teximage.c by Brian Paul, 16 Sep 2009
+ *  2013 - Lisa Owens (lisa at lunarg.com)
+ *   - Courtney Goeltzenleuchter (courtney at lunarg.com)
  */
 
 #include "glmain.h"
 #include "common.h"
+#include 
+#include 
+#include 
 
+/**
+ * Align a value up to an alignment value
+ *
+ * If \c value is not already aligned to the requested alignment value, it
+ * will be rounded up.
+ *
+ * \param value  Value to be rounded
+ * \param alignment  Alignment value to be used.  This must be a power of two.
+ *
+ * \sa ROUND_DOWN_TO()
+ */
+#define ALIGN_PTR(value, alignment)  (((uintptr_t)(value) + (alignment) - 1) & 
~ (uintptr_t)((alignment) - 1))
 
 int WinWidth = 100, WinHeight = 100;
 
+/* for texture creation */
 static GLuint VBO;
 static GLuint TexObj = 0;
 static GLubyte *TexImage = NULL;
-static GLsizei TexSize;
-static GLenum TexIntFormat, TexSrcFormat, TexSrcType;
-
-static const GLboolean DrawPoint = GL_TRUE;
-static const GLboolean TexSubImage4 = GL_FALSE;
 
 enum {
-   MODE_CREATE_TEXIMAGE,
-   MODE_TEXIMAGE,
-   MODE_TEXSUBIMAGE,
-   MODE_GETTEXIMAGE,
-   MODE_COUNT
+   TEST_CREATE_TEXIMAGE,
+   TEST_TEXIMAGE,
+   TEST_TEXIMAGE_MIPMAP,
+   TEST_TEXSUBIMAGE,
+   TEST_GETTEXIMAGE,
+   TEST_COUNT
 };
 
-static const char *mode_name[MODE_COUNT] = 
-{
+static const char *test_name[TEST_COUNT] = {
"Create_TexImage",
"TexImage",
+   "TexImage_Mipmap",
"TexSubImage",
"GetTexImage"
 };
 
+GLboolean test_enable[TEST_COUNT];
 
 
 struct vertex
@@ -68,8 +84,322 @@ static const struct vertex vertices[1] = {
{ 0.0, 0.0, 0.5, 0.5 },
 };
 
+
+/** define some functions */
+GLenum parseType(char *);
+GLenum parseFormat(char *, int);
+GLuint determineTexelSize(GLenum format, GLenum type);
+void parseConfigFile(void);
+GLuint GenerateMipmapImages(void);
+
 #define VOFFSET(F) ((void *) offsetof(struct vertex, F))
 
+/** defaults; options can be provided to set these */
+GLint g_level = 0;
+GLsizei g_width = 256;
+GLsizei g_height = 256;
+GLuint g_texelsize = 4;
+GLenum g_texsrctype = GL_UNSIGNED_BYTE;
+GLenum g_texfmt = GL_RGBA;
+GLenum g_texintfmt = 0;
+GLboolean g_drawpoint = GL_TRUE;
+GLboolean g_subtexquad = GL_FALSE;
+char configName[2056];
+int formattype = 1;
+int intformattype = 2;
+char typeName[256] = "GL_UNSIGNED_BYTE";
+char formatName[256] = "GL_RGBA";
+char internalformatName[256] = "GL_RGBA";
+GLboolean g_verbose = GL_FALSE;
+
+/* used when mipmapping */
+static GLsizei g_initialwidth;
+static GLsizei g_initialheight;
+int g_numLevel = 0;
+GLubyte *g_mipmapimgs[64];
+GLsizei g_mmwidths[64];
+GLsizei g_mmheights[64];
+
+enum csvStyle {
+   CSV_STYLE_OFF,
+   CSV_STYLE_DATA,
+   CSV_STYLE_FULL
+};
+enum csvStyle g_csvstyle = CSV_STYLE_OFF;
+
+struct gl_parse_type {
+   char *name;
+   GLenum type;
+   bool fixed_size; /* true indicates texel size is component size */
+   int component_size;
+};
+
+struct gl_parse_type parse_type_table[] = {
+   {"GL_UNSIGNED_BYTE", GL_UNSIGNED_BYTE, false, 1},
+   {"GL_BYTE", GL_BYTE, false, 1},

[Mesa-dev] [PATCH demos v2 3/3] perf: Add script to run collection of texture formats

2013-11-11 Thread Courtney Goeltzenleuchter
bench_teximage.sh runs all the same formats that teximage
ran. Also passes the command line arguments of the script
to the benchmark to allow tester to set --csvstyle to full
or data for output more easily parsed by scripts and such.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/perf/bench_teximage.sh | 44 
 1 file changed, 44 insertions(+)
 create mode 100755 src/perf/bench_teximage.sh

diff --git a/src/perf/bench_teximage.sh b/src/perf/bench_teximage.sh
new file mode 100755
index 000..29a2aa6
--- /dev/null
+++ b/src/perf/bench_teximage.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+./teximage --width 16 --height 16 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test Create_TexImage $@
+./teximage --width 64 --height 64 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test Create_TexImage $@
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test Create_TexImage $@
+./teximage --width 1024 --height 1024 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test Create_TexImage $@
+./teximage --width 4096 --height 4096 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test Create_TexImage $@
+echo ""
+./teximage --width 16 --height 16 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test TexImage $@
+./teximage --width 64 --height 64 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test TexImage $@
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test TexImage $@
+./teximage --width 1024 --height 1024 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test TexImage $@
+./teximage --width 4096 --height 4096 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test TexImage $@
+echo ""
+./teximage --width 16 --height 16 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test GetTexImage $@
+./teximage --width 64 --height 64 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test GetTexImage $@
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test GetTexImage $@
+./teximage --width 1024 --height 1024 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test GetTexImage $@
+./teximage --width 4096 --height 4096 --type GL_UNSIGNED_BYTE --format GL_RGBA 
--internalformat GL_RGBA --test GetTexImage $@
+echo ""
+# TexImage(RGB/ubyte 256 x 256): 3287.3 images/sec, 616.4 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_RGB 
--internalformat GL_RGB --test TexImage $@
+#TexSubImage(RGB/ubyte 256 x 256): 3335.5 images/sec, 625.4 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_RGB 
--internalformat GL_RGB --test TexSubImage $@
+#GetTexImage(RGB/ubyte 256 x 256): 1161.0 images/sec, 217.7 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_RGB 
--internalformat GL_RGB --test GetTexImage $@
+#TexImage(RGB/565 256 x 256): 266.2 images/sec, 33.3 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_SHORT_5_6_5 --format 
GL_RGB --internalformat GL_RGB --test TexImage $@
+#TexSubImage(RGB/565 256 x 256): 264.6 images/sec, 33.1 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_SHORT_5_6_5 --format 
GL_RGB --internalformat GL_RGB --test TexSubImage $@
+#GetTexImage(RGB/565 256 x 256): 641.2 images/sec, 80.2 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_SHORT_5_6_5 --format 
GL_RGB --internalformat GL_RGB --test GetTexImage $@
+#TexImage(BGRA/ubyte 256 x 256): 8691.8 images/sec, 2172.9 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_BGRA 
--internalformat GL_RGBA --test TexImage $@
+#TexSubImage(BGRA/ubyte 256 x 256): 8953.0 images/sec, 2238.3 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_BGRA 
--internalformat GL_RGBA --test TexSubImage $@
+#GetTexImage(BGRA/ubyte 256 x 256): 11736.4 images/sec, 2934.1 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format GL_BGRA 
--internalformat GL_RGBA --test GetTexImage $@
+#TexImage(L/ubyte 256 x 256): 20898.0 images/sec, 1306.1 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format 
GL_LUMINANCE --internalformat GL_LUMINANCE --test TexImage $@
+#TexSubImage(L/ubyte 256 x 256): 21830.8 images/sec, 1364.4 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format 
GL_LUMINANCE --internalformat GL_LUMINANCE --test TexSubImage $@
+#GetTexImage(L/ubyte 256 x 256): 30453.5 images/sec, 1903.3 MB/sec
+./teximage --width 256 --height 256 --type GL_UNSIGNED_BYTE --format 
GL_LUMINANCE --internalformat GL_LUMINANCE --test GetTexImage $@
+
-- 
1.8.1.2

___

[Mesa-dev] [PATCH demos v2 0/3] Customizable texture upload benchmark

2013-11-11 Thread Courtney Goeltzenleuchter
This patch series updates teximage to support additional
test modes and commandline interface.
I had started with adding a new test but it was similar to teximage
and, as suggested, I'm submitting this patch that simply
replaces teximage with this new test.
Can run interactively, similar to previous teximage test or can use
command line arguments to specify size of texture, mipmap or not,
source pixel format and internal pixel format.

Test includes [--csvstyle off | data | full] argument that
outputs the benchmark data in a more easily parsed manner
for test automation scripts.

The first patch adds command line argument passing to the perf
infrastructure.

One big commit to update teximage. Would have been similar
commit using other route (new test eventually replacing teximage.)

Add bash script to benchmark all the modes tested previously.

Courtney Goeltzenleuchter (3):
  Perf: Add command line capabilities to perf framework
  Perf: Add test to measure texture upload
  Perf: teximage_enh Add command line options

 src/perf/CMakeLists.txt|   1 +
 src/perf/Makefile.am   |   1 +
 src/perf/bench_glTexImage2D.sh |  73 +
 src/perf/copytex.c |   2 +-
 src/perf/drawoverhead.c|   2 +-
 src/perf/fbobind.c |   2 +-
 src/perf/fill.c|   2 +-
 src/perf/genmipmap.c   |   2 +-
 src/perf/glmain.c  |   2 +-
 src/perf/glmain.h  |   2 +-
 src/perf/glslstateschange.c|   2 +-
 src/perf/readpixels.c  |   2 +-
 src/perf/swapbuffers.c |   2 +-
 src/perf/teximage.c|   2 +-
 src/perf/teximage_enh.README   |  10 +
 src/perf/teximage_enh.c| 597 +
 src/perf/vbo.c |   2 +-
 src/perf/vertexrate.c  |   2 +-
 18 files changed, 695 insertions(+), 13 deletions(-)
 create mode 100755 src/perf/bench_glTexImage2D.sh
 create mode 100644 src/perf/teximage_enh.README
 create mode 100644 src/perf/teximage_enh.c

-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-11 Thread Courtney Goeltzenleuchter
On Mon, Nov 11, 2013 at 11:15 AM, Ian Romanick  wrote:

> On 11/05/2013 11:36 AM, Courtney Goeltzenleuchter wrote:
> > On Tue, Nov 5, 2013 at 12:22 PM, Ian Romanick  > <mailto:i...@freedesktop.org>> wrote:
> >
> > On 11/05/2013 09:44 AM, Chris Forbes wrote:
> > >> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.
> >  Hmm...
> > >
> > > My understanding is you can't actually, since views can only be
> > > created from immutable-format textures, and GL_LUMINANCE is not a
> > > sized internalformat, so it can't be used with TexStorage?
> >
> > I was just using GL_LUMINANCE as shorthand for GL_LUMINANCE4,
> > GL_LUMINANCE8, GL_LUMINANCE12, and GL_LUMINANCE16.  As far as I can
> > tell,
> >
> > glGenTextures(1, &tex);
> > glBindTexture(GL_TEXTURE_2D, tex);
> > glTexStorage2D(GL_TEXTURE_2D,
> > 8,
> > GL_LUMINANCE8,
> > 1024, 1024);
> >
> > is perfectly valid.  Sayeth GL_ARB_texture_storage:
> >
> > Accepted by the  parameter of TexStorage* when
> > implemented on OpenGL ES:
> >
> > ALPHA8_EXT 0x803C
> > LUMINANCE8_EXT 0x8040
> > LUMINANCE8_ALPHA8_EXT  0x8045
> >
> > I guess that means GL_LUMINANCE4, GL_LUMINANCE12, and GL_LUMINANCE16
> are
> > out.  As are all GL_INTENSITY formats.  There are still these three
> > legacy formats to handle.
> >
> > So, if we support GL_ARB_texture_view in a compatibility profile,
> >
> > glGenTextures(1, &view);
> > glTextureView(view,
> > GL_TEXTURE_2D,
> > tex,
> > GL_LUMINANCE8,
> > 1, 1, 1, 1);
> >
> > is also valid.
> >
> > Right?
> >
> >
> > The spec is pickier than that.  For 8bit texels the allowed internal
> > formats are: R8UI, R8I, R8, R8_SNORM
> > I use the table specified in the ARB_texture_view to translate the
> > target internalFormat passed to glTextureView into a VIEW_CLASS.
> > GL_LUMINANCE8 does not have a valid VIEW_CLASS and could not match the
> > internal format of the source texture.
>
> I don't think it matters that GL_LUMINANCE8 is missing from the table or
> that it doesn't have a VIEW_CLASS.  The GL_ARB_texture_view spec says
> (emphasis mine):
>
>The two textures' internal formats must be compatible according to
>Table 3.X.2 (Compatible internal formats for TextureView) if the
>internal format exists in that table and *the internal formats
>must be identical if not in that table*, or else an
>INVALID_OPERATION error is generated.
>
> In my above code example, the internal formats are identical.  By my
> reading of the above quoted text, that code is legal.  We should modify
> one of the texture_view tests to use these legacy formats, and try that
> test on NVIDIA with a compatibility profile.
>

Good point. I'll talk with Jon about testing that if we don't already.

Courtney


>
> > That makes me wonder, should I be trying to map the target
> > internalformat into a driver internal format?
> >
> > Courtney
> >
> > --
> > Courtney Goeltzenleuchter
> > LunarG
>
>


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


Re: [Mesa-dev] [PATCH demos 2/3] Perf: Add test to measure texture upload

2013-11-08 Thread Courtney Goeltzenleuchter
enh = enhanced

Suggestions on something more descriptive?
teximage2?
bench_teximage?
teximage_perf?

Thanks for the feedback.


On Thu, Nov 7, 2013 at 5:49 PM, Brian Paul  wrote:

> On 11/07/2013 02:16 PM, Courtney Goeltzenleuchter wrote:
>
>> Needed test to measure texture upload speed under a variety
>> of modes (mipmap, source format, internal format, size, etc.)
>> This new test has an interactive run mode like the other Mesa
>> Perf tests but also includes command line options to make
>> it automatable.
>> Fix up code formatting.
>>
>> Signed-off-by: Courtney Goeltzenleuchter 
>> ---
>>   src/perf/CMakeLists.txt|   1 +
>>   src/perf/Makefile.am   |   1 +
>>   src/perf/bench_glTexImage2D.sh |  13 ++
>>   src/perf/teximage_enh.README   |  10 ++
>>   src/perf/teximage_enh.c| 391 ++
>> +++
>>
>
> What does "enh" mean?  Maybe you could find something a bit more obvious?
>
>
>
>5 files changed, 416 insertions(+)
>>   create mode 100755 src/perf/bench_glTexImage2D.sh
>>   create mode 100644 src/perf/teximage_enh.README
>>   create mode 100644 src/perf/teximage_enh.c
>>
>> diff --git a/src/perf/CMakeLists.txt b/src/perf/CMakeLists.txt
>> index 68b6875..ded 100644
>> --- a/src/perf/CMakeLists.txt
>> +++ b/src/perf/CMakeLists.txt
>> @@ -28,6 +28,7 @@ set (targets
>> readpixels
>> swapbuffers
>> teximage
>> +   teximage_enh
>> vbo
>> vertexrate
>>   )
>> diff --git a/src/perf/Makefile.am b/src/perf/Makefile.am
>> index 5363c58..1cc5c43 100644
>> --- a/src/perf/Makefile.am
>> +++ b/src/perf/Makefile.am
>> @@ -51,6 +51,7 @@ bin_PROGRAMS = \
>> readpixels \
>> swapbuffers \
>> teximage \
>> +   teximage_enh \
>> vbo \
>> vertexrate \
>> glslstateschange
>> diff --git a/src/perf/bench_glTexImage2D.sh
>> b/src/perf/bench_glTexImage2D.sh
>> new file mode 100755
>> index 000..c63a251
>> --- /dev/null
>> +++ b/src/perf/bench_glTexImage2D.sh
>> @@ -0,0 +1,13 @@
>> +#!/bin/bash
>> +./teximage_enh --width 1024 --height 1024 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGBA --csvstyle full
>> --test TexImage
>> +./teximage_enh --width 1024 --height 1024 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGB --csvstyle data
>> --test TexImage
>> +./teximage_enh --width  512 --height  512 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGBA --csvstyle data
>> --test TexImage
>> +./teximage_enh --width  512 --height  512 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGB --csvstyle data
>> --test TexImage
>> +./teximage_enh --width  256 --height  256 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGBA --csvstyle data
>> --test TexImage
>> +./teximage_enh --width  256 --height  256 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGB --csvstyle data
>> --test TexImage
>> +./teximage_enh --width 1024 --height 1024 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGBA --csvstyle data
>> --test TexImage_Mipmap
>> +./teximage_enh --width 1024 --height 1024 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGB --csvstyle data
>> --test TexImage_Mipmap
>> +./teximage_enh --width  512 --height  512 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGBA --csvstyle data
>> --test TexImage_Mipmap
>> +./teximage_enh --width  512 --height  512 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGB --csvstyle data
>> --test TexImage_Mipmap
>> +./teximage_enh --width  256 --height  256 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGBA --csvstyle data
>> --test TexImage_Mipmap
>> +./teximage_enh --width  256 --height  256 --type GL_UNSIGNED_BYTE
>> --format GL_RGBA --texelsize 4 --internalformat GL_RGB --csvstyle data
>> --test TexImage_Mipmap
>> diff --git a/src/perf/teximage_enh.README b/src/perf/teximage_enh.README
>> new file mode 100644
>> index 000..44e8aea
>> --- /dev/null
>> +++ b/src/perf/teximage_enh.README
>> @@ -0,0 +1,10 @@
>> +glTexImage2D benchmark
>> +  - executable name:  teximage_enh
>> +  - modified files:  CMakeLists.txt  Mak

Re: [Mesa-dev] [PATCH demos 3/3] Perf: teximage_enh Add command line options

2013-11-08 Thread Courtney Goeltzenleuchter
Hi Brian,

Oops, I meant to get rid of that. Is unnecessary now that the perf
framework has command line arguments.

Courtney


On Thu, Nov 7, 2013 at 5:49 PM, Brian Paul  wrote:

> On 11/07/2013 02:16 PM, Courtney Goeltzenleuchter wrote:
>
>> texture_enh allows the user to specify source, internal formats
>> and mipmap or not. This provides a quick way to get feedback
>> on texture upload related performance tuning.
>> Texture image data is initialized and aligned to 64 byte bounary.
>> Uses Mesa demos Perf library to do the measurements.
>>
>>
>
> It looks like the previous patch in the series added the shell script
> which passes command line params.  Shouldn't this patch come before that
> feature?
>
> I'm not too concerned though.
>
> Acked-by: Brian Paul 
>
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



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


[Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels

2013-11-08 Thread Courtney Goeltzenleuchter
Support all levels of a supported texture format.

Using 1024x1024, RGBA  source, mipmap
<>
internal-format Before (MB/sec) XRGB (MB/sec)   mipmap (MB/sec)
GL_RGBA 628.15  627.15  615.90
GL_RGB  265.95  456.35  611.53
512x512
GL_RGBA 600.23  597.00  619.95
GL_RGB  255.50  440.62  611.28
256x256
GL_RGBA 489.08  487.80  587.42
GL_RGB  229.03  376.63  585.00

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

Courtney Goeltzenleuchter (2):
  i965: add XRGB to tiled_memcpy
  i965: Enhance tiled_memcpy to support all levels

 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index b1826fa..50f802f 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -543,7 +543,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
uint32_t cpp;
mem_copy_fn mem_copy = NULL;
 
-   /* This fastpath is restricted to specific texture types: level 0 of
+   /* This fastpath is restricted to specific texture types:
 * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to support
 * more types.
 *
@@ -555,7 +555,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
if (!brw->has_llc ||
type != GL_UNSIGNED_BYTE ||
texImage->TexObject->Target != GL_TEXTURE_2D ||
-   texImage->Level != 0 ||
pixels == NULL ||
_mesa_is_bufferobj(packing->BufferObj) ||
packing->Alignment > 4 ||
@@ -631,6 +630,11 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Alignment, packing->RowLength, packing->SkipPixels,
packing->SkipRows, for_glTexImage);
 
+   /* Adjust x and y offset based on miplevel
+*/
+   xoffset += image->mt->level[texImage->Level].level_x;
+   yoffset += image->mt->level[texImage->Level].level_y;
+
linear_to_tiled(
   xoffset * cpp, (xoffset + width) * cpp,
   yoffset, yoffset + height,
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH 0/2v2] i965: Extend fast texture upload

2013-11-07 Thread Courtney Goeltzenleuchter
Re-posted patches with updated commit messages.

Thanks,
Courtney


On Thu, Nov 7, 2013 at 2:34 PM, Matt Turner  wrote:

> On Thu, Nov 7, 2013 at 1:22 PM, Courtney Goeltzenleuchter
>  wrote:
> > This series builds on work from Frank Henigman to optimize the
> > process of uploading a texture to the GPU. This series adds support for
> > MESA_XRGB_ and full miptrees where were found to be common activities
> > in the Smokin' Guns game. The issue was found while profiling the app
> > but that part is not benchmarked. Smokin-Guns uses mipmap textures with
> > an internal format of GL_RGB (MESA_XRGB_ in the driver).
> >
> > These changes need a performance tool to run against to show how they
> > improve execution performance for specific texture formats. Using this
> > benchmark I've measured the following improvement on my Ivybridge
> > Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.
> >
> > Using 1024x1024, RGBA  source, mipmap
> > internal-format Before (MB/sec) After XRGB (MB/sec) After mip
> (MB/sec)
> > GL_RGBA 628.15  627.15  615.90
> > GL_RGB  265.95  456.35  611.53
>
> Put these results into the individual commit messages.
>
> > Test shows similar pattern for 512x512 and 256x256.
>
> Wouldn't hurt to include these as well.
>
> Patch 1 (with benchmarks in the commit message) is:
>
> Reviewed-by: Matt Turner 
>
> I don't know anything about the miptree layout, so I don't feel able
> to review the second patch, but it seems plausible.
>



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


[Mesa-dev] [PATCH 2/2 v3] i965: Enhance tiled_memcpy to support all levels

2013-11-07 Thread Courtney Goeltzenleuchter
Support all levels of a supported texture format.

Using 1024x1024, RGBA  source, mipmap
<>
internal-format Before (MB/sec) XRGB (MB/sec)   mipmap (MB/sec)
GL_RGBA 628.15  627.15  615.90
GL_RGB  265.95  456.35  611.53
512x512
GL_RGBA 600.23  597.00  619.95
GL_RGB  255.50  440.62  611.28
256x256
GL_RGBA 489.08  487.80  587.42
GL_RGB  229.03  376.63  585.00

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

Courtney Goeltzenleuchter (2):
  i965: add XRGB to tiled_memcpy
  i965: Enhance tiled_memcpy to support all levels

 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index b1826fa..b32af3d 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -543,7 +543,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
uint32_t cpp;
mem_copy_fn mem_copy = NULL;
 
-   /* This fastpath is restricted to specific texture types: level 0 of
+   /* This fastpath is restricted to specific texture types:
 * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to support
 * more types.
 *
@@ -555,7 +555,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
if (!brw->has_llc ||
type != GL_UNSIGNED_BYTE ||
texImage->TexObject->Target != GL_TEXTURE_2D ||
-   texImage->Level != 0 ||
pixels == NULL ||
_mesa_is_bufferobj(packing->BufferObj) ||
packing->Alignment > 4 ||
@@ -572,7 +571,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
   cpp = 1;
   mem_copy = memcpy;
} else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
- || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
+|| (texImage->TexFormat == MESA_FORMAT_XRGB)) {
   cpp = 4;
   if (format == GL_BGRA) {
  mem_copy = memcpy;
@@ -631,6 +630,11 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Alignment, packing->RowLength, packing->SkipPixels,
packing->SkipRows, for_glTexImage);
 
+   /* Adjust x and y offset based on miplevel
+*/
+   xoffset += image->mt->level[texImage->Level].level_x;
+   yoffset += image->mt->level[texImage->Level].level_y;
+
linear_to_tiled(
   xoffset * cpp, (xoffset + width) * cpp,
   yoffset, yoffset + height,
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 1/2 v3] i965: add XRGB to tiled_memcpy

2013-11-07 Thread Courtney Goeltzenleuchter
MESA_FORMAT_XRGB is equivalent to MESA_FORMAT_ARGB in terms
of storage on the device, so okay to use this optimized copy routine.

This series builds on work from Frank Henigman to optimize the
process of uploading a texture to the GPU. This series adds support for
MESA_XRGB_ and full miptrees where were found to be common activities
in the Smokin' Guns game. The issue was found while profiling the app
but that part is not benchmarked. Smokin-Guns uses mipmap textures with
an internal format of GL_RGB (MESA_XRGB_ in the driver).

These changes need a performance tool to run against to show how they
improve execution performance for specific texture formats. Using this
benchmark I've measured the following improvement on my Ivybridge
Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.

Using 1024x1024, RGBA  source, mipmap
<>
internal-format Before (MB/sec) XRGB (MB/sec)   mipmap (MB/sec)
GL_RGBA 628.15  627.15  615.90
GL_RGB  265.95  456.35  611.53
512x512
GL_RGBA 600.23  597.00  619.95
GL_RGB  255.50  440.62  611.28
256x256
GL_RGBA 489.08  487.80  587.42
GL_RGB  229.03  376.63  585.00

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

Courtney Goeltzenleuchter (2):
  i965: add XRGB to tiled_memcpy
  i965: Enhance tiled_memcpy to support all levels

 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

--
1.8.1.2

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index 0384bcc..b1826fa 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -571,7 +571,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
(texImage->TexFormat == MESA_FORMAT_A8 && format == GL_ALPHA)) {
   cpp = 1;
   mem_copy = memcpy;
-   } else if (texImage->TexFormat == MESA_FORMAT_ARGB) {
+   } else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
+ || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
   cpp = 4;
   if (format == GL_BGRA) {
  mem_copy = memcpy;
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels

2013-11-07 Thread Courtney Goeltzenleuchter
Hi Matt,

I posted results in my cover letter email: [PATCH 0/2v2] i965: Extend fast
texture upload

Please let me know if you want more details.

Courtney


On Thu, Nov 7, 2013 at 2:28 PM, Matt Turner  wrote:

> I saw the perf demo patches and expected to see results from them in
> this patch. Any results to share?
>
> On Thu, Nov 7, 2013 at 1:22 PM, Courtney Goeltzenleuchter
>  wrote:
> > Support all levels of a supported texture format.
> >
> > Signed-off-by: Courtney Goeltzenleuchter 
> > ---
> >  src/mesa/drivers/dri/i965/intel_tex_subimage.c | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> > index b1826fa..b32af3d 100644
> > --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> > +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
> > @@ -543,7 +543,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
> ctx,
> > uint32_t cpp;
> > mem_copy_fn mem_copy = NULL;
> >
> > -   /* This fastpath is restricted to specific texture types: level 0 of
> > +   /* This fastpath is restricted to specific texture types:
> >  * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to
> support
> >  * more types.
> >  *
> > @@ -555,7 +555,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
> ctx,
> > if (!brw->has_llc ||
> > type != GL_UNSIGNED_BYTE ||
> > texImage->TexObject->Target != GL_TEXTURE_2D ||
> > -   texImage->Level != 0 ||
> > pixels == NULL ||
> > _mesa_is_bufferobj(packing->BufferObj) ||
> > packing->Alignment > 4 ||
> > @@ -572,7 +571,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
> ctx,
> >cpp = 1;
> >mem_copy = memcpy;
> > } else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
> > - || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
> > +|| (texImage->TexFormat == MESA_FORMAT_XRGB)) {
>
> Extraneous change?
>
> >cpp = 4;
> >if (format == GL_BGRA) {
> >   mem_copy = memcpy;
> > @@ -631,6 +630,11 @@ intel_texsubimage_tiled_memcpy(struct gl_context *
> ctx,
> > packing->Alignment, packing->RowLength, packing->SkipPixels,
> > packing->SkipRows, for_glTexImage);
> >
> > +   /* Adjust x and y offset based on miplevel
> > +*/
> > +   xoffset += image->mt->level[texImage->Level].level_x;
> > +   yoffset += image->mt->level[texImage->Level].level_y;
> > +
> > linear_to_tiled(
> >xoffset * cpp, (xoffset + width) * cpp,
> >yoffset, yoffset + height,
> > --
> > 1.8.1.2
>



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


[Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels

2013-11-07 Thread Courtney Goeltzenleuchter
Support all levels of a supported texture format.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index b1826fa..b32af3d 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -543,7 +543,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
uint32_t cpp;
mem_copy_fn mem_copy = NULL;
 
-   /* This fastpath is restricted to specific texture types: level 0 of
+   /* This fastpath is restricted to specific texture types:
 * a 2D BGRA, RGBA, L8 or A8 texture. It could be generalized to support
 * more types.
 *
@@ -555,7 +555,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
if (!brw->has_llc ||
type != GL_UNSIGNED_BYTE ||
texImage->TexObject->Target != GL_TEXTURE_2D ||
-   texImage->Level != 0 ||
pixels == NULL ||
_mesa_is_bufferobj(packing->BufferObj) ||
packing->Alignment > 4 ||
@@ -572,7 +571,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
   cpp = 1;
   mem_copy = memcpy;
} else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
- || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
+|| (texImage->TexFormat == MESA_FORMAT_XRGB)) {
   cpp = 4;
   if (format == GL_BGRA) {
  mem_copy = memcpy;
@@ -631,6 +630,11 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
packing->Alignment, packing->RowLength, packing->SkipPixels,
packing->SkipRows, for_glTexImage);
 
+   /* Adjust x and y offset based on miplevel
+*/
+   xoffset += image->mt->level[texImage->Level].level_x;
+   yoffset += image->mt->level[texImage->Level].level_y;
+
linear_to_tiled(
   xoffset * cpp, (xoffset + width) * cpp,
   yoffset, yoffset + height,
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 0/2v2] i965: Extend fast texture upload

2013-11-07 Thread Courtney Goeltzenleuchter
This series builds on work from Frank Henigman to optimize the
process of uploading a texture to the GPU. This series adds support for
MESA_XRGB_ and full miptrees where were found to be common activities
in the Smokin' Guns game. The issue was found while profiling the app
but that part is not benchmarked. Smokin-Guns uses mipmap textures with
an internal format of GL_RGB (MESA_XRGB_ in the driver).

These changes need a performance tool to run against to show how they
improve execution performance for specific texture formats. Using this
benchmark I've measured the following improvement on my Ivybridge
Intel(R) Xeon(R) CPU E3-1225 V2 @ 3.20GHz.

Using 1024x1024, RGBA  source, mipmap
internal-format Before (MB/sec) After XRGB (MB/sec) After mip (MB/sec)
GL_RGBA 628.15  627.15  615.90
GL_RGB  265.95  456.35  611.53

Test shows similar pattern for 512x512 and 256x256.

Benchmark has been sent to mesa-dev list: teximage_enh

Courtney Goeltzenleuchter (2):
  i965: add XRGB to tiled_memcpy
  i965: Enhance tiled_memcpy to support all levels

 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
1.8.1.2

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


[Mesa-dev] [PATCH 1/2] i965: add XRGB to tiled_memcpy

2013-11-07 Thread Courtney Goeltzenleuchter
MESA_FORMAT_XRGB is equivalent to MESA_FORMAT_ARGB in terms
of storage on the device, so okay to use this optimized copy routine.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index 0384bcc..b1826fa 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -571,7 +571,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
(texImage->TexFormat == MESA_FORMAT_A8 && format == GL_ALPHA)) {
   cpp = 1;
   mem_copy = memcpy;
-   } else if (texImage->TexFormat == MESA_FORMAT_ARGB) {
+   } else if ((texImage->TexFormat == MESA_FORMAT_ARGB)
+ || (texImage->TexFormat == MESA_FORMAT_XRGB)) {
   cpp = 4;
   if (format == GL_BGRA) {
  mem_copy = memcpy;
-- 
1.8.1.2

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


  1   2   >