[Mesa-dev] [PATCH] i965: add XRGB to fast texture upload
MESA_FORMAT_XRGB is equivalent to MESA_FORMAT_ARGB in terms of storage on the device, so okay to use this optimized copy routine. --- 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 5cfdbd9..4aec05d 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c @@ -564,7 +564,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
[Mesa-dev] [PATCH] i965: Fast texture upload now supports all levels
Support all levels of a supported texture format. --- src/mesa/drivers/dri/i965/intel_tex_subimage.c | 13 +++-- 1 file changed, 11 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 4aec05d..5e46760 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c @@ -541,14 +541,13 @@ 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. */ 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 || @@ -616,6 +615,16 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx, DBG("%s: level=%d offset=(%d,%d) (w,h)=(%d,%d)\n", __FUNCTION__, texImage->Level, xoffset, yoffset, width, height); + /* Adjust x and y offset based on miplevel +*/ + if (texImage->Level) { + GLuint xlevel, ylevel; + intel_miptree_get_image_offset(image->mt, texImage->Level, 0, + &xlevel, &ylevel); + xoffset += xlevel; + yoffset += ylevel; + } + 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] i965: add XRGB to fast texture upload
On Sun, Oct 13, 2013 at 1:41 PM, Ian Romanick wrote: > On 10/11/2013 10:16 AM, 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. > > --- > > 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 5cfdbd9..4aec05d 100644 > > --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c > > +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c > > @@ -564,7 +564,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; > > > > Are there appropriate test cases that hit this path? I don't think > piglit exercises a lot of different texture formats. I just want to be > sure that some test now hits this fast path that didn't hit it before. > This path is exercised by the Smokin' Guns benchmark during it's initialization but not during the measured part of the run. I've also verified that the piglit test: glean -o -v -v -v -t +pixelFormats --quick exercises this path. As for other benchmarks, I'd welcome suggestions. I couldn't find anything beyond the Mesa demo that Frank used to test his patch. On Smokin' Guns, with these patches combined (Franks, XRGB and all-levels), using valgrind I measured a reduction in instruction count of intelTexImage of 47.3% (from 2344404725 to 1235584087). Without all three patches, the driver was falling back to a Mesa copy routine that copied one byte at a time. Does that help? Courtney -- 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: Fast texture upload now supports all levels
On Sun, Oct 13, 2013 at 2:50 PM, Frank Henigman wrote: > On Fri, Oct 11, 2013 at 10:00 PM, Chad Versace > wrote: > > On 10/11/2013 10:17 AM, Courtney Goeltzenleuchter wrote: > >> > >> Support all levels of a supported texture format. > >> --- > >> src/mesa/drivers/dri/i965/intel_tex_subimage.c | 13 +++-- > >> 1 file changed, 11 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 4aec05d..5e46760 100644 > >> --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c > >> +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c > >> @@ -541,14 +541,13 @@ 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. > >> */ > >> 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 || > >> @@ -616,6 +615,16 @@ intel_texsubimage_tiled_memcpy(struct gl_context * > >> ctx, > >> DBG("%s: level=%d offset=(%d,%d) (w,h)=(%d,%d)\n", > >> __FUNCTION__, texImage->Level, xoffset, yoffset, width, > height); > >> > >> + /* Adjust x and y offset based on miplevel > >> +*/ > >> + if (texImage->Level) { > >> + GLuint xlevel, ylevel; > >> + intel_miptree_get_image_offset(image->mt, texImage->Level, 0, > >> + &xlevel, &ylevel); > >> + xoffset += xlevel; > >> + yoffset += ylevel; > >> + } > >> + > >> linear_to_tiled( > >> xoffset * cpp, (xoffset + width) * cpp, > >> yoffset, yoffset + height, > >> > > > > Usually when we commit performance patches like this, we state in the > > commit message what the observed relative performance gain. > > > > What gain did you see? Hardware? Benchmark? Kernel version? How many > > runs? > > We could quote from my patch, as this is just opening more paths into that > code. > Or do you think this calls for different testing? > Smokin' Guns goes down this path (and when it's wrong you can see it :-). I'll check piglit. -- 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: Fast texture upload now supports all levels
On Sun, Oct 13, 2013 at 4:39 PM, Courtney Goeltzenleuchter < court...@lunarg.com> wrote: > > On Sun, Oct 13, 2013 at 2:50 PM, Frank Henigman wrote: > >> On Fri, Oct 11, 2013 at 10:00 PM, Chad Versace >> wrote: >> > On 10/11/2013 10:17 AM, Courtney Goeltzenleuchter wrote: >> >> >> >> Support all levels of a supported texture format. >> >> --- >> >> src/mesa/drivers/dri/i965/intel_tex_subimage.c | 13 +++-- >> >> 1 file changed, 11 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 4aec05d..5e46760 100644 >> >> --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c >> >> +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c >> >> @@ -541,14 +541,13 @@ 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. >> >> */ >> >> 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 || >> >> @@ -616,6 +615,16 @@ intel_texsubimage_tiled_memcpy(struct gl_context * >> >> ctx, >> >> DBG("%s: level=%d offset=(%d,%d) (w,h)=(%d,%d)\n", >> >> __FUNCTION__, texImage->Level, xoffset, yoffset, width, >> height); >> >> >> >> + /* Adjust x and y offset based on miplevel >> >> +*/ >> >> + if (texImage->Level) { >> >> + GLuint xlevel, ylevel; >> >> + intel_miptree_get_image_offset(image->mt, texImage->Level, 0, >> >> + &xlevel, &ylevel); >> >> + xoffset += xlevel; >> >> + yoffset += ylevel; >> >> + } >> >> + >> >> linear_to_tiled( >> >> xoffset * cpp, (xoffset + width) * cpp, >> >> yoffset, yoffset + height, >> >> >> > >> > Usually when we commit performance patches like this, we state in the >> > commit message what the observed relative performance gain. >> > >> > What gain did you see? Hardware? Benchmark? Kernel version? How many >> > runs? >> >> We could quote from my patch, as this is just opening more paths into >> that code. >> Or do you think this calls for different testing? >> > > Smokin' Guns goes down this path (and when it's wrong you can see it :-). > > I'll check piglit. > All the piglit glsl1 (bin/glean -o -v -v -v -t +glsl1 --quick) and a bunch of the ARB_ES3_compatibility tests go through this path as well as a handful of other tests. > > -- > 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] i965: Fast texture upload now supports all levels
Does anyone know of a test that measures frame 0 time? Or texture upload speed? For Smokin' Guns, I tried measuring the overall time, but an improved frame 0 time has difficulty standing out of a 2607 frame test. I may have to create something. Suggestions for an appropriate framework? Thanks, Courtney On Mon, Oct 14, 2013 at 8:32 AM, Chad Versace wrote: > On 10/13/2013 08:33 PM, Ian Romanick wrote: > >> On 10/13/2013 01:50 PM, Frank Henigman wrote: >> >>> On Fri, Oct 11, 2013 at 10:00 PM, Chad Versace >>> wrote: >>> >>>> On 10/11/2013 10:17 AM, Courtney Goeltzenleuchter wrote: >>>> >>>>> >>>>> Support all levels of a supported texture format. >>>>> --- >>>>>src/mesa/drivers/dri/i965/**intel_tex_subimage.c | 13 +++-- >>>>>1 file changed, 11 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 4aec05d..5e46760 100644 >>>>> --- a/src/mesa/drivers/dri/i965/**intel_tex_subimage.c >>>>> +++ b/src/mesa/drivers/dri/i965/**intel_tex_subimage.c >>>>> @@ -541,14 +541,13 @@ 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. >>>>>*/ >>>>> 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 || >>>>> @@ -616,6 +615,16 @@ intel_texsubimage_tiled_**memcpy(struct >>>>> gl_context * >>>>> ctx, >>>>> DBG("%s: level=%d offset=(%d,%d) (w,h)=(%d,%d)\n", >>>>> __FUNCTION__, texImage->Level, xoffset, yoffset, width, >>>>> height); >>>>> >>>>> + /* Adjust x and y offset based on miplevel >>>>> +*/ >>>>> + if (texImage->Level) { >>>>> + GLuint xlevel, ylevel; >>>>> + intel_miptree_get_image_**offset(image->mt, texImage->Level, 0, >>>>> + &xlevel, &ylevel); >>>>> + xoffset += xlevel; >>>>> + yoffset += ylevel; >>>>> + } >>>>> + >>>>> linear_to_tiled( >>>>> xoffset * cpp, (xoffset + width) * cpp, >>>>> yoffset, yoffset + height, >>>>> >>>>> >>>> Usually when we commit performance patches like this, we state in the >>>> commit message what the observed relative performance gain. >>>> >>>> What gain did you see? Hardware? Benchmark? Kernel version? How many >>>> runs? >>>> >>> >>> We could quote from my patch, as this is just opening more paths into >>> that code. >>> Or do you think this calls for different testing? >>> >> >> I think what Chad is asking is whether there's some information like >> "Improves load time of application XYZ 12.3+4.5%" or similar. >> >> In the past, we've had problems with patches that just make vague claims >> of "improves performance" when we later find critical bugs in those >> patches... can we just revert the code, or is it going to run the >> performance of... something? >> >> For reference, see commit 329cd6a9b and this thread from mesa-dev: >> >> http://lists.freedesktop.org/**archives/mesa-dev/2013-June/**040811.html<http://lists.freedesktop.org/archives/mesa-dev/2013-June/040811.html> >> > > Ian read my mind correctly. The commit message should say "Improves XYZ of > application ABC by 10.3+-1.2%", as well as state the hardware at a minimum, > and kernel version too if you're feeling gracious. > > In the future, if someone discover that this patch introduces a bug, the > commit > message's performance claim will prevent that someone from simply > reverting the > code. > > -- 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: Fast texture upload now supports all levels
On Mon, Oct 14, 2013 at 12:43 PM, Chad Versace wrote: > On 10/14/2013 10:54 AM, Eric Anholt wrote: > >> Courtney Goeltzenleuchter writes: >> >> Does anyone know of a test that measures frame 0 time? Or texture upload >>> speed? >>> >>> For Smokin' Guns, I tried measuring the overall time, but an improved >>> frame >>> 0 time has difficulty standing out of a 2607 frame test. >>> >>> I may have to create something. Suggestions for an appropriate framework? >>> >> >> Run an apitrace replay on a trace trimmed to frame > textures are first used>? Sure, apitrace isn't real-world benchmarking >> for fps, but it should get at the "how much did we cut off of load >> time", assuming that texture load time isn't swamped by apitrace >> decompression. >> > > I believe Frank has a microbenchmark for measuring texture > upload time. Maybe he can share it with us. But, data obtained from real > apps is always preferred. > > Frank referenced mesa demos teximage as his benchmark. Right now that only does level 0 and a small selection of texture formats. I thought I'd take a look at extending it to cover the added formats from my patches. I like the apitrace idea as well, that ties it (loosely) to a real app. Thanks for the suggestions folks! Courtney -- Courtney Goeltzenleuchter LunarG ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Core Profile and extension strings question
I'm curious about what the proper behavior should be for extensions that have been integrated into core. In particular I'm looking at ARB_texture_cube_map as we are using that in one of the ARB_texture_view piglit tests and when run on the Mesa driver the piglit function piglit_require_extension("GL_ARB_texture_cube_map") fails. Running with MESA_INFO on I see: Mesa: Mesa GL_VERSION = 3.1 (Core Profile) Mesa 9.3.0-devel (git-0398dd3) Mesa: Mesa GL_RENDERER = Mesa DRI Intel(R) Ivybridge Server Mesa: Mesa GL_VENDOR = Intel Open Source Technology Center Mesa: Mesa GL_EXTENSIONS does not contain ARB_texture_cube_map When we run the same test on the NVIDIA closed source driver the test does find an ARB_texture_cube_map extension. It also is given a compatibility context and not a Core Profile context. The spec says that deprecated features may not be available in newer Core Profiles. ARB_texture_cube_map has not been deprecated, it's been promoted into core. According to the OpenGL Spec: H.3.2 Promoting Extensions to Core Features Extensions can be promoted to required core features in later revisions of OpenGL. When this occurs, the extension specifications are merged into the core specifica- tion. Functions and enumerants that are part of such promoted extensions will have the ARB, KHR, EXT, or vendor affix removed. I*mplementations of such later revisions should continue to export the name* *strings of promoted extensions in the EXTENSIONS strings and continue to support* *the affixed versions of functions and enumerants as a transition aid.* For descriptions of extensions promoted to core features in OpenGL 1.3 and beyond, see the corresponding version of the OpenGL specification, or the de- scriptions of that version in version-specific appendices to later versions of the specification. This says to me that the Mesa driver should be listing GL_ARB_texture_cube_map in it's extension string. So, why isn't it there? What am I missing? What should the piglit test do? Is this going to be a compatibility issue for applications? Thanks, Courtney -- Courtney Goeltzenleuchter LunarG ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Core Profile and extension strings question
On Tue, Oct 22, 2013 at 11:01 AM, Ian Romanick wrote: > On 10/22/2013 09:00 AM, Courtney Goeltzenleuchter wrote: > > I'm curious about what the proper behavior should be for extensions that > > have been integrated into core. In particular I'm looking at > > ARB_texture_cube_map as we are using that in one of the ARB_texture_view > > piglit tests and when run on the Mesa driver the piglit > > function piglit_require_extension("GL_ARB_texture_cube_map") fails. > > We've basically taken a page from Apple's playbook. See the extension > list at > https://developer.apple.com/graphicsimaging/opengl/capabilities/. They > don't list *anything* that's part of OpenGL 3.2 Core Profile. > > Applications have to specifically request a core profile context, so > we're assuming that they're not going to check for extensions that have > been part of core for years. We set the cut-off at GL 1.5. See 0fef911 > and the few patches just before it. > This has been Mesa behavior for over a year, and we haven't encountered > any application problems. > > > Running with MESA_INFO on I see: > > Mesa: Mesa GL_VERSION = 3.1 (Core Profile) Mesa 9.3.0-devel (git-0398dd3) > > Mesa: Mesa GL_RENDERER = Mesa DRI Intel(R) Ivybridge Server > > Mesa: Mesa GL_VENDOR = Intel Open Source Technology Center > > Mesa: Mesa GL_EXTENSIONS does not contain ARB_texture_cube_map > > > > When we run the same test on the NVIDIA closed source driver the test > > does find an ARB_texture_cube_map extension. It also is given a > > compatibility context and not a Core Profile context. > > This will depend on how you set the config.supports_gl_core_version and > config.supports_gl_compat_version values in the test. I believe the > framework first tries the requested compatibility version. If that > fails, it tries the requested core version. We only support up to 3.0 > in compatibility profile. > The piglit test is setting compatibility and core as: config.supports_gl_compat_version = 13; config.supports_gl_core_version = 31; Looks like piglit's make_context_current (piglit_wfl_framework.c) tries the core version first, then compatibility. > There are quite a few piglit tests that do things like (from > tests/spec/arb_sync/DeleteSync.c): > > if (piglit_get_gl_version() < 32) { > piglit_require_extension("GL_ARB_sync"); > } > We'll do this for our tests. Thanks! > > However, there are probably many other tests that have latent bugs in > core profile checking because they always get a sufficiently high > compatibility profile version. > > > The spec says that deprecated features may not be available in newer > > Core Profiles. ARB_texture_cube_map has not been deprecated, it's been > > promoted into core. According to the OpenGL Spec: > > > > H.3.2 > > Promoting Extensions to Core Features > > Extensions can be promoted to required core features in later > > revisions of OpenGL. > > When this occurs, the extension specifications are merged into the > > core specifica- > > tion. Functions and enumerants that are part of such promoted > > extensions will have > > the ARB, KHR, EXT, or vendor affix removed. > > I*mplementations of such later revisions should continue to export > > the name* > > *strings of promoted extensions in the EXTENSIONS strings and > > continue to support* > > *the affixed versions of functions and enumerants as a transition > aid.* > > For descriptions of extensions promoted to core features in OpenGL > > 1.3 and > > beyond, see the corresponding version of the OpenGL specification, > > or the de- > > scriptions of that version in version-specific appendices to later > > versions of the > > specification. > > > > > > This says to me that the Mesa driver should be listing > > GL_ARB_texture_cube_map in it's extension string. So, why isn't it > > there? What am I missing? > > > > What should the piglit test do? > > Is this going to be a compatibility issue for applications? > > > > Thanks, > > Courtney > > > > -- > > 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
[Mesa-dev] [PATCH] i965: Update MESA_INFO to eliminate error
If a user set MESA_INFO and the OpenGL application uses a 3.0 or later context then the MESA_INFO debug output will have an error when it queries for extensions using the deprecated enum GL_EXTENSIONS. Passing context argument allows code to return extension list directly regardless of profile. --- src/mesa/main/context.c | 2 +- src/mesa/main/debug.c | 10 +++--- src/mesa/main/debug.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0d1f71c..8218153 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1522,7 +1522,7 @@ _mesa_make_current( struct gl_context *newCtx, * information. */ if (_mesa_getenv("MESA_INFO")) { - _mesa_print_info(); + _mesa_print_info(newCtx); } newCtx->FirstTimeCurrent = GL_FALSE; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 9434c1e..99b2147 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -103,7 +103,7 @@ _mesa_print_state( const char *msg, GLuint state ) /** * Print information about this Mesa version and build options. */ -void _mesa_print_info( void ) +void _mesa_print_info( struct gl_context *ctx ) { _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", (char *) _mesa_GetString(GL_VERSION)); @@ -111,8 +111,12 @@ void _mesa_print_info( void ) (char *) _mesa_GetString(GL_RENDERER)); _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", (char *) _mesa_GetString(GL_VENDOR)); - _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", - (char *) _mesa_GetString(GL_EXTENSIONS)); + + /* use ctx as GL_EXTENSIONS will not work on 3.0 or higher +* core contexts. +*/ + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", ctx->Extensions.String); + #if defined(THREADS) _mesa_debug(NULL, "Mesa thread-safe: YES\n"); #else diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index 8414c5e..902f595 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -43,7 +43,7 @@ struct gl_texture_image; extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); extern void _mesa_print_state( const char *msg, GLuint state ); -extern void _mesa_print_info( void ); +extern void _mesa_print_info( struct gl_context *ctx ); extern void _mesa_init_debug( struct gl_context *ctx ); extern void -- 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] i965: Update MESA_INFO to eliminate error
Hi Matt, I think the intended use was to provide glxinfo-like information from the app's perspective, i.e. if it asked for a compatibility context or something like that. That was how I discovered it, I wanted to get at the list of extensions that was being given to the app as it was different than what glxinfo was reporting. Other than that I'm not sure of it's usefulness. Courtney On Wed, Oct 23, 2013 at 3:05 PM, Matt Turner wrote: > On Wed, Oct 23, 2013 at 12:41 PM, Courtney Goeltzenleuchter > wrote: > > If a user set MESA_INFO and the OpenGL application uses a > > 3.0 or later context then the MESA_INFO debug output will have > > an error when it queries for extensions using the deprecated > > enum GL_EXTENSIONS. Passing context argument allows code > > to return extension list directly regardless of profile. > > --- > > src/mesa/main/context.c | 2 +- > > src/mesa/main/debug.c | 10 +++--- > > src/mesa/main/debug.h | 2 +- > > 3 files changed, 9 insertions(+), 5 deletions(-) > > > > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c > > index 0d1f71c..8218153 100644 > > --- a/src/mesa/main/context.c > > +++ b/src/mesa/main/context.c > > @@ -1522,7 +1522,7 @@ _mesa_make_current( struct gl_context *newCtx, > >* information. > >*/ > > if (_mesa_getenv("MESA_INFO")) { > > - _mesa_print_info(); > > + _mesa_print_info(newCtx); > > } > > > > newCtx->FirstTimeCurrent = GL_FALSE; > > diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c > > index 9434c1e..99b2147 100644 > > --- a/src/mesa/main/debug.c > > +++ b/src/mesa/main/debug.c > > @@ -103,7 +103,7 @@ _mesa_print_state( const char *msg, GLuint state ) > > /** > > * Print information about this Mesa version and build options. > > */ > > -void _mesa_print_info( void ) > > +void _mesa_print_info( struct gl_context *ctx ) > > { > > _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", > >(char *) _mesa_GetString(GL_VERSION)); > > @@ -111,8 +111,12 @@ void _mesa_print_info( void ) > >(char *) _mesa_GetString(GL_RENDERER)); > > _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", > >(char *) _mesa_GetString(GL_VENDOR)); > > - _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", > > - (char *) _mesa_GetString(GL_EXTENSIONS)); > > + > > + /* use ctx as GL_EXTENSIONS will not work on 3.0 or higher > > +* core contexts. > > +*/ > > + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", > ctx->Extensions.String); > > I think I'd go ahead and make the same change for version, renderer, > and vendor now that the context is directly available. > > Although, I've never heard of MESA_INFO before. It doesn't appear in > any of my IRC logs going back to April 2011 so I don't think anyone > else even knows about it, much less suggests it for debugging. It's > also not mentioned in the Mesa docs. > > I don't see any information in it that would be useful that glxinfo > doesn't already provide. Maybe we should just throw the whole function > out. > -- Courtney Goeltzenleuchter LunarG ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Update MESA_INFO to eliminate error
If a user set MESA_INFO and the OpenGL application uses a 3.0 or later context then the MESA_INFO debug output will have an error when it queries for extensions using the deprecated enum GL_EXTENSIONS. Passing context argument allows code to return extension list directly regardless of profile. Commit title updated as recommended by Kenneth Graunke. --- src/mesa/main/context.c | 2 +- src/mesa/main/debug.c | 10 +++--- src/mesa/main/debug.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0d1f71c..8218153 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1522,7 +1522,7 @@ _mesa_make_current( struct gl_context *newCtx, * information. */ if (_mesa_getenv("MESA_INFO")) { - _mesa_print_info(); + _mesa_print_info(newCtx); } newCtx->FirstTimeCurrent = GL_FALSE; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 9434c1e..99b2147 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -103,7 +103,7 @@ _mesa_print_state( const char *msg, GLuint state ) /** * Print information about this Mesa version and build options. */ -void _mesa_print_info( void ) +void _mesa_print_info( struct gl_context *ctx ) { _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", (char *) _mesa_GetString(GL_VERSION)); @@ -111,8 +111,12 @@ void _mesa_print_info( void ) (char *) _mesa_GetString(GL_RENDERER)); _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", (char *) _mesa_GetString(GL_VENDOR)); - _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", - (char *) _mesa_GetString(GL_EXTENSIONS)); + + /* use ctx as GL_EXTENSIONS will not work on 3.0 or higher +* core contexts. +*/ + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", ctx->Extensions.String); + #if defined(THREADS) _mesa_debug(NULL, "Mesa thread-safe: YES\n"); #else diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index 8414c5e..902f595 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -43,7 +43,7 @@ struct gl_texture_image; extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); extern void _mesa_print_state( const char *msg, GLuint state ); -extern void _mesa_print_info( void ); +extern void _mesa_print_info( struct gl_context *ctx ); extern void _mesa_init_debug( struct gl_context *ctx ); extern void -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Fix compiler warning.
fix: intel_screen.c:1320:4: warning: initialization from incompatible pointer type [enabled by default] --- src/mesa/drivers/dri/i965/brw_context.c | 2 +- src/mesa/drivers/dri/i965/brw_context.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 2a923c4..5b4d662d 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -498,7 +498,7 @@ brw_process_driconf_options(struct brw_context *brw) driQueryOptionb(options, "disable_glsl_line_continuations"); } -bool +GLboolean brwCreateContext(gl_api api, const struct gl_config *mesaVis, __DRIcontext *driContextPriv, diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 7f7d5c2..c261ae8 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1446,7 +1446,7 @@ void intel_prepare_render(struct brw_context *brw); void intel_resolve_for_dri2_flush(struct brw_context *brw, __DRIdrawable *drawable); -bool brwCreateContext(gl_api api, +GLboolean brwCreateContext(gl_api api, const struct gl_config *mesaVis, __DRIcontext *driContextPriv, unsigned major_version, -- 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/1]: Preparing for ARB_viewport_array
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. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array
Add the index parameter to the Scissor, Viewport and DepthRange driver methods. Update i965 and Gallium to the change. Index always 0. --- src/mesa/drivers/common/driverfuncs.c | 2 +- src/mesa/drivers/dri/i965/brw_context.c | 4 ++-- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/swrast/swrast.c| 3 ++- src/mesa/main/dd.h | 10 +++--- src/mesa/main/scissor.c | 2 +- src/mesa/main/viewport.c| 4 ++-- src/mesa/state_tracker/st_cb_viewport.c | 3 ++- 8 files changed, 18 insertions(+), 12 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/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 3880e18..5b4d662d 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -125,13 +125,13 @@ 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; if (brw->saved_viewport) - brw->saved_viewport(ctx, x, y, w, h); + brw->saved_viewport(ctx, idx, x, y, w, h); if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { dri2InvalidateDrawable(driContext->driDrawablePriv); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 3be2138..c261ae8 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1411,7 +1411,7 @@ struct brw_context __DRIcontext *driContext; struct intel_screen *intelScreen; - void (*saved_viewport)(struct gl_context *ctx, + void (*saved_viewport)(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei width, GLsizei height); }; diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index bfa2efd..ffb1fa0 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 5011921..7f57a39 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -479,7 +479,8 @@ struct dd_function_table { /** Enable or disable writing into the depth buffer */ void (*DepthMask)(struct gl_context *ctx, GLboolean flag); /** Specify mapping of depth values from NDC to window coordinates */ - void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval); + void (*DepthRange)(struct gl_context *ctx, GLuint idx, + GLclampd nearval, GLclampd farval); /** Specify the current buffer for writing */ void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer ); /** Specify the buffers for writing for fragment programs*/ @@ -519,7 +520,9 @@ struct dd_function_table { /** Set rasterization mode */ void (*RenderMode)(struct gl_context *ctx, GLenum mode ); /** Define the scissor box */ - void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + void (*Scissor)(struct gl_context *ctx, GLuint idx, + GLint x, GLint y, + GLsizei width, GLsizei height); /** Select flat or smooth shading */ void (*ShadeModel)(struct gl_context *ctx, GLenum mode); /** OpenGL 2.0 two-sided StencilFunc */ @@ -541,7 +544,8 @@ struct dd_function_table { struct gl_texture_object *texObj, GLenum pname, const GLfloat *params); /** Set the viewport */ - void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + void (*Viewport)(struct gl_context *ctx, GLuint idx, +GLint x, GLint y, GLsizei w, GLsizei
[Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array
Start setting the stage for ARB_viewport_array extension support. Add the index parameter to the Scissor, Viewport and DepthRange driver methods. Update i965 and Gallium to match. Include change for i915, nouveau and radeon per feedback from mesa-dev. piglit quick.tests passes --- src/mesa/drivers/common/driverfuncs.c| 2 +- src/mesa/drivers/dri/i915/i830_state.c | 6 +++--- src/mesa/drivers/dri/i915/i830_vtbl.c| 4 ++-- src/mesa/drivers/dri/i915/i915_state.c | 6 +++--- src/mesa/drivers/dri/i915/i915_vtbl.c| 4 ++-- src/mesa/drivers/dri/i915/intel_context.c| 4 ++-- src/mesa/drivers/dri/i915/intel_context.h| 2 +- src/mesa/drivers/dri/i965/brw_context.c | 4 ++-- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_state.c | 6 +++--- src/mesa/drivers/dri/r200/r200_state.c | 6 +++--- src/mesa/drivers/dri/radeon/radeon_common.c | 9 - src/mesa/drivers/dri/radeon/radeon_common.h | 2 +- src/mesa/drivers/dri/radeon/radeon_state.c | 6 +++--- src/mesa/drivers/dri/swrast/swrast.c | 3 ++- src/mesa/main/dd.h | 10 +++--- src/mesa/main/scissor.c | 2 +- src/mesa/main/viewport.c | 4 ++-- src/mesa/state_tracker/st_cb_viewport.c | 3 ++- 19 files changed, 45 insertions(+), 40 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 cedc58a..c66feb3 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.Viewport() */ static void -i830Viewport(struct gl_context * ctx, +i830Viewport(struct gl_context * ctx, GLuint idx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); @@ -462,7 +462,7 @@ i830Viewport(struct gl_context * ctx, /** 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); } @@ -536,7 +536,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..33ca002 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -837,10 +837,10 @@ 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); + 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 2fd0bf1..fb6b7a1 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.Viewport() */ static void -i915Viewport(struct gl_context * ctx, +i915Viewport(struct gl_context * ctx, GLuint idx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); @@ -435,7 +435,7 @@ i915Viewport(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) { intelCalcVi
[Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core
return; } + /* 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. + */ + 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 = height; + break; + + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + texObj->NumLayers = depth; + break; + + case GL_TEXTURE_CUBE_MAP: + texObj->NumLayers = 6; + break; + } + } } diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c new file mode 100644 index 000..62b295b --- /dev/null +++ b/src/mesa/main/textureview.c @@ -0,0 +1,622 @@ +/* + * 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 notice shall be included + * in all copies or substantial portions of the Software. + * + * 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 + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Courtney Goeltzenleuchter + */ + + +/** + * \file textureview.c + * GL_ARB_texture_view functions + */ + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "imports.h" +#include "macros.h" +#include "teximage.h" +#include "texobj.h" +#include "texstorage.h" +#include "textureview.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_SNO
Re: [Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array
On Fri, Nov 1, 2013 at 1:51 PM, Ian Romanick wrote: > On 10/31/2013 08:55 AM, Courtney Goeltzenleuchter wrote: > > Add the index parameter to the Scissor, Viewport and > > DepthRange driver methods. Update i965 and Gallium > > to the change. Index always 0. > > I just sent out a patch series that cleans up a bunch of the driver > implementations of dd_function_table::Viewport. One thing is worth > noting... no driver uses any of the x, y, width, or height parameters > passed to Viewport. I think we should just eliminate those parameters > altogether. > > It also appears that every driver that implements > dd_function_table::DepthRange uses the same (or nearly the same) > implementation as dd_function_table::Viewport... and the parameters to > it are also unused. We should eliminate those parameters as well. > > For dd_function_table::Scissor, it looks like i830 and i915 both use the > parameters passed. I'm on the fence whether those should be modified to > just look in the context (like other drivers do). Do you think that > would simplify later patches? > When I was writing this it troubled me that I was having to change driver code beyond the actual dd interface. It gets uglier when I extend the Viewport and Scissor attributes to be arrays. There are a lot of driver files touched. Isn't the dd interface supposed to help shield the driver from such changes? It would make future patches for ARB_viewport_array simpler if the drivers *did* use the parameters from the dd interface. Then I wouldn't have to change driver elements as I extend the Mesa side to support viewport_arrays and only drivers that supported viewport_arrays would have to worry about an array index other than 0. I'd be curious to hear what the philosophy is around the dd interface. What would be right? Why? It would appear that it's common practice to grab the viewport, scissor and depth data right out of the gl_context structure. If all the drivers are going to get the data straight from the gl_context structure then removing the unused parameters seems like a good idea to me. I'll put that into the next round. Appreciate the feedback. > > Also... since this is modifying three separate functions, it should be > three patches. > > > --- > > src/mesa/drivers/common/driverfuncs.c | 2 +- > > src/mesa/drivers/dri/i965/brw_context.c | 4 ++-- > > src/mesa/drivers/dri/i965/brw_context.h | 2 +- > > src/mesa/drivers/dri/swrast/swrast.c| 3 ++- > > src/mesa/main/dd.h | 10 +++--- > > src/mesa/main/scissor.c | 2 +- > > src/mesa/main/viewport.c| 4 ++-- > > src/mesa/state_tracker/st_cb_viewport.c | 3 ++- > > 8 files changed, 18 insertions(+), 12 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/i965/brw_context.c > b/src/mesa/drivers/dri/i965/brw_context.c > > index 3880e18..5b4d662d 100644 > > --- a/src/mesa/drivers/dri/i965/brw_context.c > > +++ b/src/mesa/drivers/dri/i965/brw_context.c > > @@ -125,13 +125,13 @@ 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; > > > > if (brw->saved_viewport) > > - brw->saved_viewport(ctx, x, y, w, h); > > + brw->saved_viewport(ctx, idx, x, y, w, h); > > > > if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { > >dri2InvalidateDrawable(driContext->driDrawablePriv); > > diff --git a/src/mesa/drivers/dri/i965/brw_context.h &
Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core
On Tue, Nov 5, 2013 at 10: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? > Chris is correct. GL_LUMINANCE is unsized and is not an allowed format for glTexStorage. -- 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 ARB_texture_view to Mesa core
On Tue, Nov 5, 2013 at 9:40 AM, Ian Romanick wrote: > On 11/04/2013 03:34 PM, Courtney Goeltzenleuchter wrote: > > > > On Fri, Nov 1, 2013 at 1:42 PM, Ian Romanick > <mailto:i...@freedesktop.org>> wrote: > > > > On 11/01/2013 09:54 AM, Courtney Goeltzenleuchter wrote: > > > @@ -1746,11 +1770,37 @@ _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) > > > > This if-statement will never evaluate to true because at least one of > > _mesa_is_gles3 or _mesa_is_desktop_gl will be false. > > > > > > The intent - as I understand it - is to only return > > GL_TEXTURE_IMMUTABLE_LEVELS if we are being called using a context that > > can support it. How about: > > if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_texture_view) > >*params = obj->ImmutableLevels; > > else > >goto invalid_pname; > > > > Does that protect GL_TEXTURE_IMMUTABLE_LEVELS properly? > > No... it still lets it slip through in OpenGL ES 1.x. :) > >if (!_mesa_is_gles3(ctx) && >!(_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view)) > goto invalid_pname; > The !'s make my brain hurt. This should be equivalent to: if (_mesa_is_gles3(ctx) || (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view)) { return param } else { goto invalid_pname } In English, if this is a gles3 context or this is a desktop context that supports ARB_texture_view you can get the value of TEXTURE_IMMUTABLE_LEVELS. If this is not a gles3 context, it's not sufficient to just support the ARB_texture_view extension, this has to be a desktop context for this glGet to succeed. That makes me wonder about the other ARB_texture_view texture parameters. I.e. case GL_TEXTURE_VIEW_MIN_LEVEL: if (!ctx->Extensions.ARB_texture_view) goto invalid_pname; *params = (GLint) obj->MinLevel; Is it sufficient to allow the query any time the extension is supported regardless of the context? > I'm also debating whether or not we should expose this compatibility > profiles. The extension spec doesn't mention anything about legacy > texture formats (luminance, etc.). I haven't looked at the OpenGL 4.3 > Compatibility Profile spec yet. The only relevant text in the extension > spec is: > > "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." > > So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture. Hmm... > > -- 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 ARB_texture_view to Mesa core
On Tue, Nov 5, 2013 at 12:22 PM, Ian Romanick 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. That makes me wonder, should I be trying to map the target internalformat into a driver internal format? Courtney -- 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 API debug logging to TexStorage
Give glTexStorage* equivalent debug logging to glTexImage*. Signed-off-by: Courtney Goeltzenleuchter --- src/mesa/main/texstorage.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 7bd8652..84b8f82 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -365,6 +365,13 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexStorage%uD %s %d %s %d %d %d\n", + dims, + _mesa_lookup_enum_by_nr(target), levels, + _mesa_lookup_enum_by_nr(internalformat), + width, height, depth); + if (tex_storage_error_check(ctx, dims, target, levels, internalformat, width, height, depth)) { return; /* error was recorded */ -- 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/7] Add ARB_texture_view
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. Passes non-rendering ARB_texture_view piglit tests (recently added). Courtney Goeltzenleuchter (7): 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: Update TexStorage to support ARB_texture_view mesa: Add driver entry point for ARB_texture_view mesa: Fill out ARB_texture_view entry points src/mapi/glapi/gen/ARB_texture_view.xml | 23 ++ src/mapi/glapi/gen/Makefile.am | 1 + src/mapi/glapi/gen/gl_API.xml | 6 +- 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/texparam.c| 60 ++- src/mesa/main/texstorage.c | 32 ++ src/mesa/main/textureview.c | 621 src/mesa/main/textureview.h | 39 ++ 15 files changed, 796 insertions(+), 6 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] [PATCH 7/7] mesa: Fill out ARB_texture_view entry points
Add Mesa TextureView logic. Incorporate feedback on ARB_texture_view --- src/mesa/main/texstorage.c | 3 +- src/mesa/main/textureview.c | 558 +++- 2 files changed, 558 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 4da3c91..8519bb8 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -454,8 +454,7 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, texObj->NumLevels = levels; texObj->MinLayer = 0; texObj->NumLayers = 1; - switch (target) - { + switch (target) { case GL_TEXTURE_1D_ARRAY: texObj->NumLayers = height; break; diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index 4a6bd62..a30598d 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -42,6 +42,340 @@ #include "textureview.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_
[Mesa-dev] [PATCH 6/7] mesa: Add driver entry point for ARB_texture_view
--- 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 d7c4327..6690e5a 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] [PATCH 1/7] mesa: Add API definitions for ARB_texture_view
conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * 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 + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Courtney Goeltzenleuchter + */ + + +/** + * \file textureview.c + * GL_ARB_texture_view functions + */ + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "imports.h" +#include "macros.h" +#include "teximage.h" +#include "texobj.h" +#include "texstorage.h" +#include "textureview.h" +#include "mtypes.h" + +/** + * glTextureView (ARB_texture_view) + * If an error is found, record it with _mesa_error() + * \return none. + */ +void GLAPIENTRY +_mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture, + GLenum internalformat, + GLuint minlevel, GLuint numlevels, + GLuint minlayer, GLuint numlayers) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTextureView (unfinished) %d %s %d %s %d %d %d %d\n", + texture, _mesa_lookup_enum_by_nr(target), origtexture, + _mesa_lookup_enum_by_nr(internalformat), + minlevel, numlevels, minlayer, numlayers); + + +} diff --git a/src/mesa/main/textureview.h b/src/mesa/main/textureview.h new file mode 100644 index 000..c2f0f32 --- /dev/null +++ b/src/mesa/main/textureview.h @@ -0,0 +1,39 @@ +/* + * Mesa 3-D graphics library + * + * 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"), + * 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 notice shall be included + * in all copies or substantial portions of the Software. + * + * 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 + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Courtney Goeltzenleuchter + */ + + +#ifndef TEXTUREVIEW_H +#define TEXTUREVIEW_H + + +extern void GLAPIENTRY +_mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture, + GLenum internalformat, + GLuint minlevel, GLuint numlevels, + GLuint minlayer, GLuint numlayers); + +#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] [PATCH 2/7] mesa: Tracking for ARB_texture_view extension
--- 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 48c4e9f..75591b0 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 b5c5583..a35e9d9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3284,6 +3284,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] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view
TexStorage now updates texture object state needed by ARB_texture_view extension. Set appropriate TextureView state in texture object. --- src/mesa/main/texstorage.c | 33 + 1 file changed, 33 insertions(+) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 84b8f82..4da3c91 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, return; } + /* 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. + */ + 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 = height; + break; + + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + texObj->NumLayers = depth; + break; + + case GL_TEXTURE_CUBE_MAP: + texObj->NumLayers = 6; + break; + } + } } -- 1.8.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/7] mesa: ARB_texture_view get parameters
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. --- 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
[Mesa-dev] [PATCH 3/7] mesa: update texture object for ARB_texture_view
Add state needed by glTextureView to the gl_texture_object. --- 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 a35e9d9..2c5343c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1192,6 +1192,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] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view
TexStorage and TexStorageMultisample updates texture object state needed by ARB_texture_view extension. Set appropriate TextureView state in texture object. mesa: Add ARB_texture_view Signed-off-by: Courtney Goeltzenleuchter --- src/mesa/main/teximage.c | 38 ++ src/mesa/main/texstorage.c | 33 + 2 files changed, 71 insertions(+) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 793c5d3..c01f72e 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -4348,6 +4348,44 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples, } texObj->Immutable = immutable; + + if (immutable) { + /* 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 = 1; + texObj->MinLevel = 0; + texObj->NumLevels = 1; + texObj->MinLayer = 0; + texObj->NumLayers = 1; + switch (target) { + case GL_TEXTURE_1D_ARRAY: +texObj->NumLayers = height; +break; + + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: +texObj->NumLayers = depth; +break; + + case GL_TEXTURE_CUBE_MAP: +texObj->NumLayers = 6; +break; + } + } + _mesa_update_fbo_texture(ctx, texObj, 0, 0); } } diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 84b8f82..4da3c91 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, return; } + /* 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. + */ + 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 = height; + break; + + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + texObj->NumLayers = depth; + break; + + case GL_TEXTURE_CUBE_MAP: + texObj->NumLayers = 6; + break; + } + } } -- 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 5/7] mesa: Update TexStorage to support ARB_texture_view
Correct and I check_multisample_target checks for that. And we never get to this code if using a PROXY target. Or did I miss something? On Wed, Nov 6, 2013 at 1:14 PM, Chris Forbes wrote: > The only interesting targets in teximagemultisample are > GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY. > > On Thu, Nov 7, 2013 at 8:55 AM, Courtney Goeltzenleuchter > wrote: > > TexStorage and TexStorageMultisample updates texture object > > state needed by ARB_texture_view extension. > > > > Set appropriate TextureView state in texture object. > > > > mesa: Add ARB_texture_view > > > > Signed-off-by: Courtney Goeltzenleuchter > > --- > > src/mesa/main/teximage.c | 38 ++ > > src/mesa/main/texstorage.c | 33 + > > 2 files changed, 71 insertions(+) > > > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c > > index 793c5d3..c01f72e 100644 > > --- a/src/mesa/main/teximage.c > > +++ b/src/mesa/main/teximage.c > > @@ -4348,6 +4348,44 @@ teximagemultisample(GLuint dims, GLenum target, > GLsizei samples, > >} > > > >texObj->Immutable = immutable; > > + > > + if (immutable) { > > + /* 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 = 1; > > + texObj->MinLevel = 0; > > + texObj->NumLevels = 1; > > + texObj->MinLayer = 0; > > + texObj->NumLayers = 1; > > + switch (target) { > > + case GL_TEXTURE_1D_ARRAY: > > +texObj->NumLayers = height; > > +break; > > + > > + case GL_TEXTURE_2D_ARRAY: > > + case GL_TEXTURE_CUBE_MAP_ARRAY: > > + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: > > +texObj->NumLayers = depth; > > +break; > > + > > + case GL_TEXTURE_CUBE_MAP: > > +texObj->NumLayers = 6; > > +break; > > + } > > + } > > + > >_mesa_update_fbo_texture(ctx, texObj, 0, 0); > > } > > } > > diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c > > index 84b8f82..4da3c91 100644 > > --- a/src/mesa/main/texstorage.c > > +++ b/src/mesa/main/texstorage.c > > @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei > levels, GLenum internalformat, > > return; > >} > > > > + /* 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. > > + */ > > + > >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 = height; > > + break; > > + > > + case GL_TEXTURE_2D_ARRAY: > > + case GL_TEXTURE_CUBE_MAP_ARRAY: > > + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: > > + texObj->NumLayers = depth; > > + break; > > + > > + case GL_TEXTURE_CUBE_MAP: > > + texObj->NumLayers = 6; > > + break; > > + } > > + > > } > > } > > > > -- > > 1.8.1.2 > > > > ___ > > 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 5/7] mesa: Update TexStorage to support ARB_texture_view
Ah, I get it, the switch statement after. Yeah, that could make sense as a helper wouldn't it. I'll look at that. On Wed, Nov 6, 2013 at 1:42 PM, Chris Forbes wrote: > Your change to teximagemultisample just has a bunch of spurious stuff for > other targets. not harmful -- it will never get reached -- but spurious. > > It might be worth pulling both blocks out into a shared helper. > > > > > On Thu, Nov 7, 2013 at 9:32 AM, Courtney Goeltzenleuchter < > court...@lunarg.com> wrote: > >> Correct and I check_multisample_target checks for that. >> And we never get to this code if using a PROXY target. >> Or did I miss something? >> >> >> On Wed, Nov 6, 2013 at 1:14 PM, Chris Forbes wrote: >> >>> The only interesting targets in teximagemultisample are >>> GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY. >>> >>> On Thu, Nov 7, 2013 at 8:55 AM, Courtney Goeltzenleuchter >>> wrote: >>> > TexStorage and TexStorageMultisample updates texture object >>> > state needed by ARB_texture_view extension. >>> > >>> > Set appropriate TextureView state in texture object. >>> > >>> > mesa: Add ARB_texture_view >>> > >>> > Signed-off-by: Courtney Goeltzenleuchter >>> > --- >>> > src/mesa/main/teximage.c | 38 ++ >>> > src/mesa/main/texstorage.c | 33 + >>> > 2 files changed, 71 insertions(+) >>> > >>> > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c >>> > index 793c5d3..c01f72e 100644 >>> > --- a/src/mesa/main/teximage.c >>> > +++ b/src/mesa/main/teximage.c >>> > @@ -4348,6 +4348,44 @@ teximagemultisample(GLuint dims, GLenum target, >>> GLsizei samples, >>> >} >>> > >>> >texObj->Immutable = immutable; >>> > + >>> > + if (immutable) { >>> > + /* 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 = 1; >>> > + texObj->MinLevel = 0; >>> > + texObj->NumLevels = 1; >>> > + texObj->MinLayer = 0; >>> > + texObj->NumLayers = 1; >>> > + switch (target) { >>> > + case GL_TEXTURE_1D_ARRAY: >>> > +texObj->NumLayers = height; >>> > +break; >>> > + >>> > + case GL_TEXTURE_2D_ARRAY: >>> > + case GL_TEXTURE_CUBE_MAP_ARRAY: >>> > + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: >>> > +texObj->NumLayers = depth; >>> > +break; >>> > + >>> > + case GL_TEXTURE_CUBE_MAP: >>> > +texObj->NumLayers = 6; >>> > +break; >>> > + } >>> > + } >>> > + >>> >_mesa_update_fbo_texture(ctx, texObj, 0, 0); >>> > } >>> > } >>> > diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c >>> > index 84b8f82..4da3c91 100644 >>> > --- a/src/mesa/main/texstorage.c >>> > +++ b/src/mesa/main/texstorage.c >>> > @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei >>> levels, GLenum internalformat, >>> > return; >>> >} >>> > >>> > + /* If the command is successful, >>> > + * TEXTURE_IMMUTABLE_FO
Re: [Mesa-dev] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view
Okay, making that change, the commit's flow better if patches 5,6,7 become new 5,6,7,8. What's the recommended process for superseding the previous patches for these new ones? Courtney On Wed, Nov 6, 2013 at 2:04 PM, Courtney Goeltzenleuchter < court...@lunarg.com> wrote: > Ah, I get it, the switch statement after. Yeah, that could make sense as a > helper wouldn't it. I'll look at that. > > > On Wed, Nov 6, 2013 at 1:42 PM, Chris Forbes wrote: > >> Your change to teximagemultisample just has a bunch of spurious stuff for >> other targets. not harmful -- it will never get reached -- but spurious. >> >> It might be worth pulling both blocks out into a shared helper. >> >> >> >> >> On Thu, Nov 7, 2013 at 9:32 AM, Courtney Goeltzenleuchter < >> court...@lunarg.com> wrote: >> >>> Correct and I check_multisample_target checks for that. >>> And we never get to this code if using a PROXY target. >>> Or did I miss something? >>> >>> >>> On Wed, Nov 6, 2013 at 1:14 PM, Chris Forbes wrote: >>> >>>> The only interesting targets in teximagemultisample are >>>> GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY. >>>> >>>> On Thu, Nov 7, 2013 at 8:55 AM, Courtney Goeltzenleuchter >>>> wrote: >>>> > TexStorage and TexStorageMultisample updates texture object >>>> > state needed by ARB_texture_view extension. >>>> > >>>> > Set appropriate TextureView state in texture object. >>>> > >>>> > mesa: Add ARB_texture_view >>>> > >>>> > Signed-off-by: Courtney Goeltzenleuchter >>>> > --- >>>> > src/mesa/main/teximage.c | 38 >>>> ++ >>>> > src/mesa/main/texstorage.c | 33 + >>>> > 2 files changed, 71 insertions(+) >>>> > >>>> > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c >>>> > index 793c5d3..c01f72e 100644 >>>> > --- a/src/mesa/main/teximage.c >>>> > +++ b/src/mesa/main/teximage.c >>>> > @@ -4348,6 +4348,44 @@ teximagemultisample(GLuint dims, GLenum >>>> target, GLsizei samples, >>>> >} >>>> > >>>> >texObj->Immutable = immutable; >>>> > + >>>> > + if (immutable) { >>>> > + /* 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 = 1; >>>> > + texObj->MinLevel = 0; >>>> > + texObj->NumLevels = 1; >>>> > + texObj->MinLayer = 0; >>>> > + texObj->NumLayers = 1; >>>> > + switch (target) { >>>> > + case GL_TEXTURE_1D_ARRAY: >>>> > +texObj->NumLayers = height; >>>> > +break; >>>> > + >>>> > + case GL_TEXTURE_2D_ARRAY: >>>> > + case GL_TEXTURE_CUBE_MAP_ARRAY: >>>> > + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: >>>> > +texObj->NumLayers = depth; >>>> > +break; >>>> > + >>>> > + case GL_TEXTURE_CUBE_MAP: >>>> > +texObj->NumLayers = 6; >>>> > +break; >>>> > + } >>>> > + } >&
[Mesa-dev] Contributing to Mesa Demos?
What's the process of contributing a test to the Mesa demos repository? Thanks, Courtney -- Courtney Goeltzenleuchter LunarG ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Contributing to Mesa Demos?
Hi Eric, Include performance tests? In my quick look I didn't see anything that looked appropriate to performance regression testing. The Perf folder under Mesa demos seemed the closest that I could find. Thanks, Courtney On Thu, Nov 7, 2013 at 10:20 AM, Eric Anholt wrote: > Courtney Goeltzenleuchter writes: > > > What's the process of contributing a test to the Mesa demos repository? > > Tests should be made automated and put in piglit, instead of in the Mesa > demos repository. > -- Courtney Goeltzenleuchter LunarG ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH demos 1/3] Perf: Add command line capabilities to perf framework
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 0/3] Customizable texture upload benchmark
This patch series adds a new benchmark test designed to measure texture upload speed with configurable parameters. Can run interactively, similar to teximage test or can use command line arguments to specify size of texture, mipmap or not, source pixel format and internal pixel format. The first patch adds command line argument passing to the perf infrastructure. Then adding a simple version of the test. And finally adding the full command line configurability. 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
[Mesa-dev] [PATCH demos 3/3] Perf: teximage_enh Add command line options
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. Signed-off-by: Courtney Goeltzenleuchter --- src/perf/teximage_enh.c | 366 +--- 1 file changed, 287 insertions(+), 79 deletions(-) diff --git a/src/perf/teximage_enh.c b/src/perf/teximage_enh.c index 9bb3944..0f5d2f7 100644 --- a/src/perf/teximage_enh.c +++ b/src/perf/teximage_enh.c @@ -31,6 +31,19 @@ #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 */ @@ -39,16 +52,20 @@ static GLuint TexObj = 0; static GLubyte *TexImage = NULL; enum { - MODE_CREATE_TEXIMAGE, - MODE_TEXIMAGE, - MODE_COUNT + TEST_CREATE_TEXIMAGE, + TEST_TEXIMAGE, + TEST_TEXIMAGE_MIPMAP, + TEST_COUNT }; -static const char *mode_name[MODE_COUNT] ={ +static const char *test_name[TEST_COUNT] = { "Create_TexImage", "TexImage", + "TexImage_Mipmap", }; +GLboolean test_enable[TEST_COUNT]; + struct vertex { GLfloat x, y, s, t; }; @@ -62,17 +79,17 @@ static const struct vertex vertices[1] = { GLenum parseType(char *); GLenum parseFormat(char *, int); void parseConfigFile(void); +GLuint GenerateMipmapImages(void); #define VOFFSET(F) ((void *) offsetof(struct vertex, F)) -/** defaults; config file options can be provided to set these */ -static const char *configFile = "teximage_enh.opts"; -GLint g_level = 1; +/** 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_RGB; +GLenum g_texfmt = GL_RGBA; GLenum g_texintfmt = 0; GLboolean g_drawpoint = GL_TRUE; char configName[2056]; @@ -82,7 +99,21 @@ char typeName[256] = "GL_UNSIGNED_BYTE"; char formatName[256] = "GL_RGB"; char internalformatName[256] = "GL_RGB"; GLboolean g_verbose = GL_FALSE; -GLboolean g_csvstyle = 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; /** parse the type string */ GLenum @@ -141,12 +172,12 @@ parseFormat(char *formatstr, int ftype) } else { /* if we get here, format specified is invalid; use a default */ perf_printf("\n"); - perf_printf("warning: format %s unknown; using GL_RGB\n", formatstr); + perf_printf("warning: format %s unknown; using GL_RGBA\n", formatstr); oglformat = GL_RGB; if (ftype == formattype) { - strcpy(formatName, "GL_RGB"); + strcpy(formatName, "GL_RGBA"); } else { - strcpy(internalformatName, "GL_RGB"); + strcpy(internalformatName, "GL_RGBA"); } } @@ -154,74 +185,135 @@ parseFormat(char *formatstr, int ftype) } /** parse the args in the teximage_enh.opts file */ -void -parseConfigFile(void) +static void +parseCommands(int argc, char *argv[]) { - FILE *fp; char *key, *value; - char *equal = "="; - char line[ 128]; - int len; int intval; + int arg, i; - //perf_printf("parsing configuration file %s\n", configFile); - fp = fopen(configFile, "r"); - if (!fp) { - perf_printf("%s file does not exist, using defaults\n", configFile); - } else { - while (fgets(line, sizeof line, fp) != NULL) { - //perf_printf("config file line read: %s\n", line); - /* TODO - better check for blank line */ - if ((strncmp(line, "#", 1) == 0) || (line[0] == '\n')) { -/* comment or blank line, continue */ -//perf_printf("found comment or blank line; continuing\n"); -continue; - } + bzero(test_enable, sizeof (test_enable)); - /* get the key and value */ - key = strtok(line, equal); - value = strtok(NULL, equal); - intval = atoi(value); - - /* remove line feed */ - len = strlen(value); - if (value[len - 1] == '\n') { -
[Mesa-dev] [PATCH demos 2/3] Perf: Add test to measure texture upload
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 + 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 Makefile.am + - new files: + teximage_enh.c - code + bench_glTexImage2D.sh +direct run command: ./teximage_enh + +script usage:./test_glTexImage2D.sh + diff --git a/src/perf/teximage_enh.c b/src/perf/teximage_enh.c new file mode 100644 index 000..9bb3944 --- /dev/null +++ b/src/perf/teximage_enh.c @@ -0,0 +1,391 @@ +/* + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * 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 notice shall be included + * in all copies or substantial portions of the Software. + * + * 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 NONINFRIN
[Mesa-dev] [PATCH 1/2] i965: add XRGB to tiled_memcpy
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
[Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels
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
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
Re: [Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels
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 1/2 v3] i965: add XRGB to tiled_memcpy
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
[Mesa-dev] [PATCH 2/2 v3] i965: Enhance tiled_memcpy to support all levels
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
Re: [Mesa-dev] [PATCH 0/2v2] i965: Extend fast texture upload
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] i965: Enhance tiled_memcpy to support all levels
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 demos 3/3] Perf: teximage_enh Add command line options
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
Re: [Mesa-dev] [PATCH demos 2/3] Perf: Add test to measure texture upload
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] mesa: Add ARB_texture_view to Mesa core
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
[Mesa-dev] [PATCH demos v2 0/3] Customizable texture upload benchmark
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
[Mesa-dev] [PATCH demos v2 3/3] perf: Add script to run collection of texture formats
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 1/3] Perf: Add command line capabilities to perf framework
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
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},
Re: [Mesa-dev] [PATCH 1/2 v3] i965: add XRGB to tiled_memcpy
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] [v3 1/8] mesa: Add API definitions for ARB_texture_view
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 7/8] mesa: add texture_view helper function for TexStorage
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
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 4/8] mesa: ARB_texture_view get parameters
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
[Mesa-dev] [v3 0/8] Add ARB_texture_view
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 5/8] mesa: Add driver entry point for ARB_texture_view
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 6/8] mesa: Fill out ARB_texture_view entry points
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 2/8] mesa: Tracking for ARB_texture_view extension
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 8/8] mesa: Update TexStorage to support ARB_texture_view
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
Re: [Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array
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] [PATCH 1/2] i965: add XRGB to tiled_memcpy
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
[Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels
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
Re: [Mesa-dev] [PATCH 2/2] i965: Enhance tiled_memcpy to support all levels
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
Re: [Mesa-dev] [PATCH 0/1]: Preparing for ARB_viewport_array
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] mesa: Change driver interface for ARB_viewport_array
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
[Mesa-dev] [PATCH 00/15] Add ARB_viewport_array extension
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
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
[Mesa-dev] [PATCH 05/18] mesa: Update viewport driver args for ARB_viewport_array
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
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 07/18] meta: Update meta driver to use API entry point
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
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 12/18] mesa: Add scissor entry points for viewport_array
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 14/18] mesa: Add gl_ViewportIndex variable to GLSL
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
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 08/18] mesa: Add indexed version of mesa_scissor
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
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
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 06/18] mesa: Update viewport state for viewport_array
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 04/18] mesa: Update gl_scissor_attrib to support ARB_viewport_array
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
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 11/18] mesa: Add ARB_viewport_array state to gl_context
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
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
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 17/18] mesa: Remove unused arguments from driver->Viewport
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 16/18] mesa: Remove unused arguments from driver->Scissor
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, +
Re: [Mesa-dev] [PATCH 00/15] Add ARB_viewport_array extension
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
Re: [Mesa-dev] [PATCH 15/18] mesa: Add ARB_viewport_array plumbing
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
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 15/18] mesa: Add ARB_viewport_array plumbing
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
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] mesa: Fix substitution of large shaders
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
[Mesa-dev] [PATCH] mesa: glx: Reduce error log level
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 12/15] mesa: Add a gles3 error condition for sized internalformat in glCopyTexImage*()
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
Re: [Mesa-dev] [PATCH] i965: Make glGetTex to PBO path use blorp to handle swizzled formats
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