Mesa (master): pipebuffer/debug: Fix a recursive mutex lock
Module: Mesa Branch: master Commit: 037e7a68f504f019b409ec8cb92f0075019a90f5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=037e7a68f504f019b409ec8cb92f0075019a90f5 Author: Thomas Hellstrom Date: Mon Oct 31 12:14:05 2011 +0100 pipebuffer/debug: Fix a recursive mutex lock pb_debug_manager_dump was trying to take a lock already held by all callers. Signed-off-by: Thomas Hellstrom Signed-off-by: Jos� Fonseca --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index b923735..2ea63d6 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -339,13 +339,11 @@ pb_debug_buffer_vtbl = { static void -pb_debug_manager_dump(struct pb_debug_manager *mgr) +pb_debug_manager_dump_locked(struct pb_debug_manager *mgr) { struct list_head *curr, *next; struct pb_debug_buffer *buf; - pipe_mutex_lock(mgr->mutex); - curr = mgr->list.next; next = curr->next; while(curr != &mgr->list) { @@ -359,7 +357,6 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr) next = curr->next; } - pipe_mutex_unlock(mgr->mutex); } @@ -394,7 +391,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, pipe_mutex_lock(mgr->mutex); debug_printf("%s: failed to create buffer\n", __FUNCTION__); if(!LIST_IS_EMPTY(&mgr->list)) - pb_debug_manager_dump(mgr); + pb_debug_manager_dump_locked(mgr); pipe_mutex_unlock(mgr->mutex); #endif return NULL; @@ -448,7 +445,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr) pipe_mutex_lock(mgr->mutex); if(!LIST_IS_EMPTY(&mgr->list)) { debug_printf("%s: unfreed buffers\n", __FUNCTION__); - pb_debug_manager_dump(mgr); + pb_debug_manager_dump_locked(mgr); } pipe_mutex_unlock(mgr->mutex); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/xa: Plug a pipe context leak.
Module: Mesa Branch: master Commit: c04b9d1d561cc3a1300e65bd410f33dfff6fe1e0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c04b9d1d561cc3a1300e65bd410f33dfff6fe1e0 Author: Thomas Hellstrom Date: Mon Oct 31 14:01:39 2011 +0100 st/xa: Plug a pipe context leak. Forgot to destroy the pipe context on xa context destroy. Signed-off-by: Thomas Hellstrom Reviewed-by: José Fonseca --- src/gallium/state_trackers/xa/xa_context.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index 1d918de..b52ee27 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -79,6 +79,8 @@ xa_context_destroy(struct xa_context *r) cso_destroy_context(r->cso); r->cso = NULL; } + +r->pipe->destroy(r->pipe); } int ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: Flush the hwtnl primitives before writing to buffers.
Module: Mesa Branch: master Commit: 1e9d8934a1a56e888f07a3571038a3f9205a72ae URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e9d8934a1a56e888f07a3571038a3f9205a72ae Author: José Fonseca Date: Thu Oct 27 19:09:25 2011 +0100 svga: Flush the hwtnl primitives before writing to buffers. svga keeps a small queue of similar primitive draws in order to coalesce them into a single draw primitive command. But the buffers referred in primitives not yet emitted were being ignored in the considerations to flush or not the context. This fixes piglit vbo-map-remap, vbo-subdata-sync, vbo-subdata-zero, and Seeker. Based on investigation and patch from Brian Paul. Reviewed-By: Brian Paul --- src/gallium/drivers/svga/svga_context.c | 14 + src/gallium/drivers/svga/svga_context.h |2 + src/gallium/drivers/svga/svga_draw.c| 33 +++ src/gallium/drivers/svga/svga_draw.h|4 +++ src/gallium/drivers/svga/svga_resource_buffer.c | 13 ++--- 5 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index 9f4f8a4..cbeb424 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -259,6 +259,20 @@ void svga_hwtnl_flush_retry( struct svga_context *svga ) } +/** + * Flush the primitive queue if this buffer is referred. + * + * Otherwise DMA commands on the referred buffer will be emitted too late. + */ +void svga_hwtnl_flush_buffer( struct svga_context *svga, + struct pipe_resource *buffer ) +{ + if (svga_hwtnl_is_buffer_referred(svga->hwtnl, buffer)) { + svga_hwtnl_flush_retry(svga); + } +} + + /* Emit all operations pending on host surfaces. */ void svga_surfaces_flush(struct svga_context *svga) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index a03a817..07d3c5f 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -454,6 +454,8 @@ void svga_context_flush( struct svga_context *svga, struct pipe_fence_handle **pfence ); void svga_hwtnl_flush_retry( struct svga_context *svga ); +void svga_hwtnl_flush_buffer( struct svga_context *svga, + struct pipe_resource *buffer ); void svga_surfaces_flush(struct svga_context *svga); diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 5186999..c43d1a3 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -128,6 +128,39 @@ void svga_hwtnl_vdecl( struct svga_hwtnl *hwtnl, } +/** + * Determine whether the specified buffer is referred in the primitive queue, + * for which no commands have been written yet. + */ +boolean +svga_hwtnl_is_buffer_referred( struct svga_hwtnl *hwtnl, + struct pipe_resource *buffer) +{ + unsigned i; + + if (svga_buffer_is_user_buffer(buffer)) { + return FALSE; + } + + if (!hwtnl->cmd.prim_count) { + return FALSE; + } + + for (i = 0; i < hwtnl->cmd.vdecl_count; ++i) { + if (hwtnl->cmd.vdecl_vb[i] == buffer) { + return TRUE; + } + } + + for (i = 0; i < hwtnl->cmd.prim_count; ++i) { + if (hwtnl->cmd.prim_ib[i] == buffer) { + return TRUE; + } + } + + return FALSE; +} + enum pipe_error svga_hwtnl_flush( struct svga_hwtnl *hwtnl ) diff --git a/src/gallium/drivers/svga/svga_draw.h b/src/gallium/drivers/svga/svga_draw.h index 1dac174..31bea52 100644 --- a/src/gallium/drivers/svga/svga_draw.h +++ b/src/gallium/drivers/svga/svga_draw.h @@ -76,6 +76,10 @@ svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, unsigned start, unsigned count ); +boolean +svga_hwtnl_is_buffer_referred( struct svga_hwtnl *hwtnl, + struct pipe_resource *buffer ); + enum pipe_error svga_hwtnl_flush( struct svga_hwtnl *hwtnl ); diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index 34ab9e1..fa713ee 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -87,10 +87,13 @@ svga_buffer_get_transfer(struct pipe_context *pipe, if (usage & PIPE_TRANSFER_WRITE) { if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) { /* - * Finish writing any pending DMA commands, and tell the host to discard - * the buffer contents on the next DMA operation. + * Flush any pending primitives, finish writing any pending DMA + * commands, and tell the host to discard the buffer contents on + * the next DMA operation. */ + svga_hwtnl_flush_buffer(svga, resource); + if (sbuf->dma.pending) {
Mesa (master): mesa: add new fields for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: b296315881e4da60798e546f24c727a49deb9a89 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b296315881e4da60798e546f24c727a49deb9a89 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: add new fields for GL_ARB_texture_storage --- src/mesa/main/mtypes.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index aa3fa6a..652bad5 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1334,6 +1334,7 @@ struct gl_texture_object GLboolean _Complete;/**< Is texture object complete? */ GLboolean _RenderToTexture; /**< Any rendering to this texture? */ GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ + GLboolean Immutable; /**< GL_ARB_texture_storage */ /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; @@ -2826,6 +2827,7 @@ struct gl_extensions GLboolean ARB_texture_non_power_of_two; GLboolean ARB_texture_rg; GLboolean ARB_texture_rgb10_a2ui; + GLboolean ARB_texture_storage; GLboolean ARB_timer_query; GLboolean ARB_transform_feedback2; GLboolean ARB_transpose_matrix; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: add new driver hook for AllocTextureStorage()
Module: Mesa Branch: master Commit: 2e322bb8d18502833f8734f5ecc6770cbc4c93f0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e322bb8d18502833f8734f5ecc6770cbc4c93f0 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: add new driver hook for AllocTextureStorage() --- src/mesa/main/dd.h |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 8607008..86a547d 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -514,6 +514,15 @@ struct dd_function_table { /** Unmap texture images from user space */ void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj ); + /** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack. +* All the gl_texture_images in the texture object will have their +* dimensions, format, etc. initialized already. +*/ + GLboolean (*AllocTextureStorage)(struct gl_context *ctx, +struct gl_texture_object *texObj, +GLsizei levels, GLsizei width, +GLsizei height, GLsizei depth); + /** * Note: no context argument. This function doesn't initially look * like it belongs here, except that the driver is the only entity ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glapi: new API specs for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: af95504dad2840c959013bc8a627340ff56c082c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=af95504dad2840c959013bc8a627340ff56c082c Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 glapi: new API specs for GL_ARB_texture_storage --- src/mapi/glapi/gen/ARB_texture_storage.xml | 67 src/mapi/glapi/gen/Makefile|1 + src/mapi/glapi/gen/gl_API.xml |2 + 3 files changed, 70 insertions(+), 0 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_texture_storage.xml b/src/mapi/glapi/gen/ARB_texture_storage.xml new file mode 100644 index 000..9454679 --- /dev/null +++ b/src/mapi/glapi/gen/ARB_texture_storage.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/Makefile b/src/mapi/glapi/gen/Makefile index ec82d48..4110cda 100644 --- a/src/mapi/glapi/gen/Makefile +++ b/src/mapi/glapi/gen/Makefile @@ -87,6 +87,7 @@ API_XML = \ ARB_seamless_cube_map.xml \ ARB_sync.xml \ ARB_texture_buffer_object.xml \ + ARB_texture_storage.xml \ ARB_vertex_array_object.xml \ AMD_draw_buffers_blend.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 a9be003..b115f45 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -12420,6 +12420,8 @@ http://www.w3.org/2001/XInclude"/> +http://www.w3.org/2001/XInclude"/> + http://www.w3.org/2001/XInclude"/> ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glapi: regenerated API files for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: ae9bef240d22532e21ae5aee6c9dca812d92c325 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae9bef240d22532e21ae5aee6c9dca812d92c325 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 glapi: regenerated API files for GL_ARB_texture_storage --- src/mapi/glapi/glapi_gentable.c | 42 + src/mapi/glapi/glapi_mapi_tmp.h | 1536 ++-- src/mapi/glapi/glapi_sparc.S| 620 +++--- src/mapi/glapi/glapi_x86-64.S | 2904 - src/mapi/glapi/glapi_x86.S | 928 src/mapi/glapi/glapitable.h | 570 ++-- src/mapi/glapi/glapitemp.h | 260 ++- src/mapi/glapi/glprocs.h| 1436 +- src/mesa/main/dispatch.h| 1216 + src/mesa/main/enums.c | 5513 --- src/mesa/main/remap_helper.h| 3546 +- 11 files changed, 9581 insertions(+), 8990 deletions(-) Diff: http://cgit.freedesktop.org/mesa/mesa/diff/?id=ae9bef240d22532e21ae5aee6c9dca812d92c325 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: implement new functions for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: a8fcb7927b2f50886eb33e81aa7feeb96bc300e4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8fcb7927b2f50886eb33e81aa7feeb96bc300e4 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: implement new functions for GL_ARB_texture_storage This is the glTexStorage1D/2D/3D() functions. Basically do error checking then call the driver hook to actually allocate memory. --- src/mesa/main/texstorage.c | 402 src/mesa/main/texstorage.h | 61 +++ 2 files changed, 463 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c new file mode 100644 index 000..241a940 --- /dev/null +++ b/src/mesa/main/texstorage.c @@ -0,0 +1,402 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2011 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 NONINFRINGEMENT. IN NO EVENT SHALL + * 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. + */ + + +/** + * \file texstorage.c + * GL_ARB_texture_storage functions + */ + + + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "imports.h" +#include "macros.h" +#include "mfeatures.h" +#include "teximage.h" +#include "texstorage.h" +#include "mtypes.h" + + + +/** + * Check if the given texture target is a legal texture object target + * for a glTexStorage() command. + * This is a bit different than legal_teximage_target() when it comes + * to cube maps. + */ +static GLboolean +legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target) +{ + switch (dims) { + case 1: + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + return GL_TRUE; + default: + return GL_FALSE; + } + case 2: + switch (target) { + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + return GL_TRUE; + case GL_TEXTURE_CUBE_MAP: + case GL_PROXY_TEXTURE_CUBE_MAP: + return ctx->Extensions.ARB_texture_cube_map; + case GL_TEXTURE_RECTANGLE: + case GL_PROXY_TEXTURE_RECTANGLE: + return ctx->Extensions.NV_texture_rectangle; + case GL_TEXTURE_1D_ARRAY: + case GL_PROXY_TEXTURE_1D_ARRAY: + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); + default: + return GL_FALSE; + } + case 3: + switch (target) { + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return GL_TRUE; + case GL_TEXTURE_2D_ARRAY: + case GL_PROXY_TEXTURE_2D_ARRAY: + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); + default: + return GL_FALSE; + } + default: + _mesa_problem(ctx, "invalid dims=%u in legal_texobj_target()", dims); + return GL_FALSE; + } +} + + +/** + * Compute the size of the next mipmap level. + */ +static void +next_mipmap_level_size(GLenum target, + GLint *width, GLint *height, GLint *depth) +{ + if (*width > 1) { + *width /= 2; + } + + if ((*height > 1) && (target != GL_TEXTURE_1D_ARRAY)) { + *height /= 2; + } + + if ((*depth > 1) && (target != GL_TEXTURE_2D_ARRAY)) { + *depth /= 2; + } +} + + +/** + * Do actual memory allocation for glTexStorage1/2/3D(). + */ +static void +setup_texstorage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLuint dims, + GLsizei levels, GLenum internalFormat, + GLsizei width, GLsizei height, GLsizei depth) +{ + const GLenum target = texObj->Target; + const GLuint numFaces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + gl_format texFormat; + GLint level, levelWidth = width, levelHeight = height, levelDepth = depth; + GLuint face; + + assert(levels > 0); + assert(width > 0); + assert(height > 0); + assert(depth > 0); + + texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0, +
Mesa (master): mesa: glGetTexParameter support for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: fbc419314e9d1f06d624d8e3997394db7f829f63 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbc419314e9d1f06d624d8e3997394db7f829f63 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: glGetTexParameter support for GL_ARB_texture_storage --- src/mesa/main/texparam.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index dc5ee33..a242448 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1204,6 +1204,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) *params = (GLfloat) obj->Sampler.CubeMapSeamless; break; + case GL_TEXTURE_IMMUTABLE_FORMAT: + if (!ctx->Extensions.ARB_texture_storage) +goto invalid_pname; + *params = (GLfloat) obj->Immutable; + break; + default: goto invalid_pname; } @@ -1338,6 +1344,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) *params = (GLint) obj->Sampler.CubeMapSeamless; break; + case GL_TEXTURE_IMMUTABLE_FORMAT: + if (!ctx->Extensions.ARB_texture_storage) +goto invalid_pname; + *params = (GLint) obj->Immutable; + break; + default: goto invalid_pname; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: new glTexImage error checks for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: a0d736b3b7c325ab0295da3b0e3b92d170b44261 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0d736b3b7c325ab0295da3b0e3b92d170b44261 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: new glTexImage error checks for GL_ARB_texture_storage If the texture memory was allocated with glTexStorage1/2/3D() we can only change the image data with glTexSubImage calls. --- src/mesa/main/teximage.c | 34 ++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index acf7187..58b0e5d 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1433,6 +1433,23 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) /** + * Helper function to determine if a texture object is mutable (in terms + * of GL_ARB_texture_storage). + */ +static GLboolean +mutable_tex_object(struct gl_context *ctx, GLenum target) +{ + if (ctx->Extensions.ARB_texture_storage) { + struct gl_texture_object *texObj = + _mesa_get_current_tex_object(ctx, target); + return !texObj->Immutable; + } + return GL_TRUE; +} + + + +/** * Test the glTexImage[123]D() parameters for errors. * * \param ctx GL context. @@ -1643,6 +1660,12 @@ texture_error_check( struct gl_context *ctx, return GL_TRUE; } + if (!mutable_tex_object(ctx, target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(immutable texture)", dimensions); + return GL_TRUE; + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -1906,6 +1929,12 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, } } + if (!mutable_tex_object(ctx, target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(immutable texture)", dimensions); + return GL_TRUE; + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -3107,6 +3136,11 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions, return GL_INVALID_VALUE; } + if (!mutable_tex_object(ctx, target)) { + *reason = "immutable texture"; + return GL_INVALID_OPERATION; + } + return GL_NO_ERROR; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: display list dispatch for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: 7d577d703d7d4f79cae047db6f29d5fd0643edd5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d577d703d7d4f79cae047db6f29d5fd0643edd5 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: display list dispatch for GL_ARB_texture_storage --- src/mesa/main/dlist.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 52548fd..06832b6 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -61,6 +61,7 @@ #include "shaderapi.h" #include "syncobj.h" #include "teximage.h" +#include "texstorage.h" #include "mtypes.h" #include "varray.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program @@ -10364,6 +10365,14 @@ _mesa_create_save_table(void) _mesa_init_sync_dispatch(table); SET_WaitSync(table, save_WaitSync); + /* GL_ARB_texture_storage (no dlist support) */ + SET_TexStorage1D(table, _mesa_TexStorage1D); + SET_TexStorage2D(table, _mesa_TexStorage2D); + SET_TexStorage3D(table, _mesa_TexStorage3D); + SET_TextureStorage1DEXT(table, _mesa_TextureStorage1DEXT); + SET_TextureStorage2DEXT(table, _mesa_TextureStorage2DEXT); + SET_TextureStorage3DEXT(table, _mesa_TextureStorage3DEXT); + return table; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: init extension entry for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: a7d9e449f0a492c31ffb6417c98b87a543496930 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7d9e449f0a492c31ffb6417c98b87a543496930 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: init extension entry for GL_ARB_texture_storage --- src/mesa/main/extensions.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 52b928e..14f6f1f 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -134,6 +134,7 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 }, { "GL_ARB_texture_rgb10_a2ui", o(ARB_texture_rgb10_a2ui), GL, 2009 }, { "GL_ARB_texture_rg", o(ARB_texture_rg), GL, 2008 }, + { "GL_ARB_texture_storage", o(ARB_texture_storage), GL, 2011 }, { "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), GL, 2008 }, { "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 }, { "GL_ARB_transpose_matrix",o(ARB_transpose_matrix), GL, 1999 }, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: compile new texstore.c file
Module: Mesa Branch: master Commit: 29eb2e89444691d319902679016738112173cc31 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29eb2e89444691d319902679016738112173cc31 Author: Brian Paul Date: Mon Oct 31 10:52:56 2011 -0600 mesa: compile new texstore.c file --- src/mesa/SConscript |1 + src/mesa/sources.mak |1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 45414bc..7688ce9 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -126,6 +126,7 @@ main_sources = [ 'main/texpal.c', 'main/texparam.c', 'main/texstate.c', +'main/texstorage.c', 'main/texstore.c', 'main/texturebarrier.c', 'main/transformfeedback.c', diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index aedee3d..6e327a4 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -93,6 +93,7 @@ MAIN_SOURCES = \ main/texpal.c \ main/texparam.c \ main/texstate.c \ + main/texstorage.c \ main/texstore.c \ main/texturebarrier.c \ main/transformfeedback.c \ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: plug in dispatch functions for GL_ARB_texture_storage
Module: Mesa Branch: master Commit: 2ace9ffc8e2354acce4dc45d425d71c3f1a349b2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ace9ffc8e2354acce4dc45d425d71c3f1a349b2 Author: Brian Paul Date: Mon Oct 31 10:52:57 2011 -0600 mesa: plug in dispatch functions for GL_ARB_texture_storage --- src/mesa/main/api_exec.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 1bc39db..26fd37e 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -90,6 +90,7 @@ #include "texobj.h" #include "texparam.h" #include "texstate.h" +#include "texstorage.h" #include "texturebarrier.h" #include "transformfeedback.h" #include "mtypes.h" @@ -742,6 +743,14 @@ _mesa_create_exec_table(void) /* GL_ARB_texture_buffer_object */ SET_TexBufferARB(exec, _mesa_TexBuffer); + /* GL_ARB_texture_storage */ + SET_TexStorage1D(exec, _mesa_TexStorage1D); + SET_TexStorage2D(exec, _mesa_TexStorage2D); + SET_TexStorage3D(exec, _mesa_TexStorage3D); + SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT); + SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT); + SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT); + #if FEATURE_ARB_sampler_objects _mesa_init_sampler_object_dispatch(exec); #endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: implement GL_ARB_texture_storage
Module: Mesa Branch: master Commit: e0a0496971dfd6c0f22b3870e6320128fa895d4d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0a0496971dfd6c0f22b3870e6320128fa895d4d Author: Brian Paul Date: Mon Oct 31 10:52:57 2011 -0600 st/mesa: implement GL_ARB_texture_storage --- src/mesa/state_tracker/st_cb_texture.c | 62 src/mesa/state_tracker/st_extensions.c |1 + 2 files changed, 63 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f82346b..06c2642 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1842,6 +1842,66 @@ st_get_default_texture(struct st_context *st) } +/** + * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory + * for a whole mipmap stack. + */ +static GLboolean +st_AllocTextureStorage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth) +{ + const GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + struct st_context *st = st_context(ctx); + struct st_texture_object *stObj = st_texture_object(texObj); + GLuint ptWidth, ptHeight, ptDepth, ptLayers, bindings; + enum pipe_format fmt; + GLint level; + + assert(levels > 0); + + /* Save the level=0 dimensions */ + stObj->width0 = width; + stObj->height0 = height; + stObj->depth0 = depth; + stObj->lastLevel = levels - 1; + + fmt = st_mesa_format_to_pipe_format(texObj->Image[0][0]->TexFormat); + + bindings = default_bindings(st, fmt); + + st_gl_texture_dims_to_pipe_dims(texObj->Target, + width, height, depth, + &ptWidth, &ptHeight, &ptDepth, &ptLayers); + + stObj->pt = st_texture_create(st, + gl_target_to_pipe(texObj->Target), + fmt, + levels, + ptWidth, + ptHeight, + ptDepth, + ptLayers, + bindings); + if (!stObj->pt) + return GL_FALSE; + + /* Set image resource pointers */ + for (level = 0; level < levels; level++) { + GLuint face; + for (face = 0; face < numFaces; face++) { + struct st_texture_image *stImage = +st_texture_image(texObj->Image[face][level]); + pipe_resource_reference(&stImage->pt, stObj->pt); + } + } + + return GL_TRUE; +} + + + void st_init_texture_functions(struct dd_function_table *functions) { @@ -1879,4 +1939,6 @@ st_init_texture_functions(struct dd_function_table *functions) /* XXX Temporary until we can query pipe's texture sizes */ functions->TestProxyTexImage = _mesa_test_proxy_teximage; + + functions->AllocTextureStorage = st_AllocTextureStorage; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 6b9ff6b..f97cf36 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -264,6 +264,7 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; + ctx->Extensions.ARB_texture_storage = GL_TRUE; ctx->Extensions.ARB_vertex_array_object = GL_TRUE; ctx->Extensions.ARB_vertex_program = GL_TRUE; ctx->Extensions.ARB_window_pos = GL_TRUE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swrast: implement GL_ARB_texture_storage
Module: Mesa Branch: master Commit: 12d69fca096facf0ddb4642faaed4d5f02d76848 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=12d69fca096facf0ddb4642faaed4d5f02d76848 Author: Brian Paul Date: Mon Oct 31 10:52:57 2011 -0600 swrast: implement GL_ARB_texture_storage --- src/mesa/drivers/common/driverfuncs.c |3 +++ src/mesa/main/extensions.c|1 + src/mesa/swrast/s_texture.c | 32 src/mesa/swrast/swrast.h |7 +++ 4 files changed, 43 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 80db4bd..9202716 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -218,6 +218,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->EndList = NULL; driver->BeginCallList = NULL; driver->EndCallList = NULL; + + /* GL_ARB_texture_storage */ + driver->AllocTextureStorage = _swrast_AllocTextureStorage; } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 14f6f1f..b0fe4c3 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -422,6 +422,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; ctx->Extensions.ARB_texture_rg = GL_TRUE; ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE; + ctx->Extensions.ARB_texture_storage = GL_TRUE; ctx->Extensions.ARB_vertex_array_object = GL_TRUE; #if FEATURE_ARB_vertex_program ctx->Extensions.ARB_vertex_program = GL_TRUE; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index fb1edb3..ba67c6f 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -359,3 +359,35 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx) if (ctx->ReadBuffer != ctx->DrawBuffer) map_unmap_renderbuffers(ctx, ctx->ReadBuffer, GL_FALSE); } + + + +/** + * Called via ctx->Driver.AllocTextureStorage() + * Just have to allocate memory for the texture images. + */ +GLboolean +_swrast_AllocTextureStorage(struct gl_context *ctx, +struct gl_texture_object *texObj, +GLsizei levels, GLsizei width, +GLsizei height, GLsizei depth) +{ + const GLint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + GLint face, level; + + for (face = 0; face < numFaces; face++) { + for (level = 0; level < levels; level++) { + struct gl_texture_image *texImage = texObj->Image[face][level]; + if (!_swrast_alloc_texture_image_buffer(ctx, texImage, + texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth)) { +return GL_FALSE; + } + } + } + + return GL_TRUE; +} + diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 06cc651..08d565b 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -249,6 +249,13 @@ _swrast_finish_render_texture(struct gl_context *ctx, +extern GLboolean +_swrast_AllocTextureStorage(struct gl_context *ctx, +struct gl_texture_object *texObj, +GLsizei levels, GLsizei width, +GLsizei height, GLsizei depth); + + /** * The driver interface for the software rasterizer. * XXX this may go away. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: add note about immutable textures for _mesa_test_texobj_completeness()
Module: Mesa Branch: master Commit: 414e183ed7345828ce3ca572ddab1ad6317ec175 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=414e183ed7345828ce3ca572ddab1ad6317ec175 Author: Brian Paul Date: Mon Oct 31 10:52:57 2011 -0600 mesa: add note about immutable textures for _mesa_test_texobj_completeness() --- src/mesa/main/texobj.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 4d9942b..a8c0b8e 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -406,6 +406,10 @@ incomplete(struct gl_texture_object *t, const char *fmt, ...) * The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE * accordingly. * + * XXX TODO: For immutable textures (GL_ARB_texture_storage) we can skip + * many of the checks below since we know the mipmap images will have + * consistent sizes. + * * \param ctx GL context. * \param t texture object. * ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: list GL_ARB_texture_storage in 7.12 release notes
Module: Mesa Branch: master Commit: d09b1109d4ea42c54ec40aa7dad0591aa3622436 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d09b1109d4ea42c54ec40aa7dad0591aa3622436 Author: Brian Paul Date: Mon Oct 31 10:52:57 2011 -0600 docs: list GL_ARB_texture_storage in 7.12 release notes --- docs/relnotes-7.12.html |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/docs/relnotes-7.12.html b/docs/relnotes-7.12.html index 40d85f0..88b1379 100644 --- a/docs/relnotes-7.12.html +++ b/docs/relnotes-7.12.html @@ -39,6 +39,7 @@ tbd GL_ARB_ES2_compatibility (r300g, r600g) GL_ARB_depth_buffer_float (r600g) GL_ARB_vertex_type_2_10_10_10_rev (r600g) +GL_ARB_texture_storage (gallium drivers and swrast) GL_EXT_packed_float (i965) GL_EXT_texture_array (r600g) GL_EXT_texture_shared_exponent (i965) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Fix copy-paste error in constant_expression_value( ir_binop_nequal)
Module: Mesa Branch: master Commit: b726639e1be0614fb6bbb75a6f07c63eacc6d787 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b726639e1be0614fb6bbb75a6f07c63eacc6d787 Author: Paul Berry Date: Thu Oct 6 11:28:42 2011 -0700 glsl: Fix copy-paste error in constant_expression_value(ir_binop_nequal) The implementation of ir_binop_nequal in constant_expression_value() appears to have been copy-and-pasted from the implementation of ir_binop_equal, but with all instances of '==' changed to '!='. This is correct except for one minor flaw: one of those '==' operators was in an assertion checking that the types of the two arguments were equal. That one needs to stay an '=='. Fixes piglit tests {fs,vs}-inline-notequal. --- src/glsl/ir_constant_expression.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 83f084d..492be32 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -719,7 +719,7 @@ ir_expression::constant_expression_value() } break; case ir_binop_nequal: - assert(op[0]->type != op[1]->type); + assert(op[0]->type == op[1]->type); for (unsigned c = 0; c < components; c++) { switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Add '.ir' extension to builtin IR files
Module: Mesa Branch: master Commit: b6f32bbe12e1082e78951b6ef073bf244ba0b8b7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6f32bbe12e1082e78951b6ef073bf244ba0b8b7 Author: Paul Berry Date: Thu Oct 6 10:31:34 2011 -0700 glsl: Add '.ir' extension to builtin IR files This patch adds the extension '.ir' to all the files in src/glsl/builtins/ir/, and changes generate_builtins.py so that it no longer globs on '*' to find the files to build. This prevents spurious files (such as EMACS' infamous *~ backup files) from breaking the build. --- src/glsl/builtins/ir/{abs => abs.ir} |0 src/glsl/builtins/ir/{acos => acos.ir} |0 src/glsl/builtins/ir/{acosh => acosh.ir} |0 src/glsl/builtins/ir/{all => all.ir} |0 src/glsl/builtins/ir/{any => any.ir} |0 src/glsl/builtins/ir/{asin => asin.ir} |0 src/glsl/builtins/ir/{asinh => asinh.ir} |0 src/glsl/builtins/ir/{atan => atan.ir} |0 src/glsl/builtins/ir/{atanh => atanh.ir} |0 src/glsl/builtins/ir/{ceil => ceil.ir} |0 src/glsl/builtins/ir/{clamp => clamp.ir} |0 src/glsl/builtins/ir/{cos => cos.ir} |0 src/glsl/builtins/ir/{cosh => cosh.ir} |0 src/glsl/builtins/ir/{cross => cross.ir} |0 src/glsl/builtins/ir/{dFdx => dFdx.ir} |0 src/glsl/builtins/ir/{dFdy => dFdy.ir} |0 src/glsl/builtins/ir/{degrees => degrees.ir} |0 src/glsl/builtins/ir/{distance => distance.ir} |0 src/glsl/builtins/ir/{dot => dot.ir} |0 src/glsl/builtins/ir/{equal => equal.ir} |0 src/glsl/builtins/ir/{exp => exp.ir} |0 src/glsl/builtins/ir/{exp2 => exp2.ir} |0 .../builtins/ir/{faceforward => faceforward.ir}|0 src/glsl/builtins/ir/{floor => floor.ir} |0 src/glsl/builtins/ir/{fract => fract.ir} |0 src/glsl/builtins/ir/{ftransform => ftransform.ir} |0 src/glsl/builtins/ir/{fwidth => fwidth.ir} |0 .../builtins/ir/{greaterThan => greaterThan.ir}|0 .../ir/{greaterThanEqual => greaterThanEqual.ir} |0 .../builtins/ir/{inversesqrt => inversesqrt.ir}|0 src/glsl/builtins/ir/{length => length.ir} |0 src/glsl/builtins/ir/{lessThan => lessThan.ir} |0 .../ir/{lessThanEqual => lessThanEqual.ir} |0 src/glsl/builtins/ir/{log => log.ir} |0 src/glsl/builtins/ir/{log2 => log2.ir} |0 .../ir/{matrixCompMult => matrixCompMult.ir} |0 src/glsl/builtins/ir/{max => max.ir} |0 src/glsl/builtins/ir/{min => min.ir} |0 src/glsl/builtins/ir/{mix => mix.ir} |0 src/glsl/builtins/ir/{mod => mod.ir} |0 src/glsl/builtins/ir/{modf => modf.ir} |0 src/glsl/builtins/ir/{noise1 => noise1.ir} |0 src/glsl/builtins/ir/{noise2 => noise2.ir} |0 src/glsl/builtins/ir/{noise3 => noise3.ir} |0 src/glsl/builtins/ir/{noise4 => noise4.ir} |0 src/glsl/builtins/ir/{normalize => normalize.ir} |0 src/glsl/builtins/ir/{not => not.ir} |0 src/glsl/builtins/ir/{notEqual => notEqual.ir} |0 .../builtins/ir/{outerProduct => outerProduct.ir} |0 src/glsl/builtins/ir/{pow => pow.ir} |0 src/glsl/builtins/ir/{radians => radians.ir} |0 src/glsl/builtins/ir/{reflect => reflect.ir} |0 src/glsl/builtins/ir/{refract => refract.ir} |0 src/glsl/builtins/ir/{round => round.ir} |0 src/glsl/builtins/ir/{roundEven => roundEven.ir} |0 src/glsl/builtins/ir/{sign => sign.ir} |0 src/glsl/builtins/ir/{sin => sin.ir} |0 src/glsl/builtins/ir/{sinh => sinh.ir} |0 src/glsl/builtins/ir/{smoothstep => smoothstep.ir} |0 src/glsl/builtins/ir/{sqrt => sqrt.ir} |0 src/glsl/builtins/ir/{step => step.ir} |0 src/glsl/builtins/ir/{tan => tan.ir} |0 src/glsl/builtins/ir/{tanh => tanh.ir} |0 src/glsl/builtins/ir/{transpose => transpose.ir} |0 src/glsl/builtins/ir/{trunc => trunc.ir} |0 src/glsl/builtins/tools/generate_builtins.py | 12 +--- 66 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/glsl/builtins/ir/abs b/src/glsl/builtins/ir/abs.ir similarity index 100% rename from src/glsl/builtins/ir/abs rename to src/glsl/builtins/ir/abs.ir diff --git a/src/glsl/builtins/ir/acos b/src/glsl/builtins/ir/acos.ir similarity index 100% rename from src/glsl/builtins/ir/acos rename to src/glsl/builtins/ir/acos.ir diff --git a/src/glsl/builtins/ir/acosh b/src/glsl/builtins/ir/acosh.ir similari
Mesa (master): glsl: Add isinf() and isnan() builtins.
Module: Mesa Branch: master Commit: ede60bc4670a8d9c14921c77abee1ac57fc0e6bf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ede60bc4670a8d9c14921c77abee1ac57fc0e6bf Author: Paul Berry Date: Thu Oct 6 10:20:10 2011 -0700 glsl: Add isinf() and isnan() builtins. The implementations are as follows: isinf(x) = (abs(x) == +infinity) isnan(x) = (x != x) Note: the latter formula is not necessarily obvious. It works because NaN is the only floating point number that does not equal itself. Fixes piglit tests "isinf-and-isnan fs_basic" and "isinf-and-isnan vs_basic". --- src/glsl/builtins/ir/isinf.ir | 17 + src/glsl/builtins/ir/isnan.ir | 17 + src/glsl/builtins/profiles/130.frag |2 -- src/glsl/builtins/profiles/130.vert |2 -- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/glsl/builtins/ir/isinf.ir b/src/glsl/builtins/ir/isinf.ir new file mode 100644 index 000..92922f6 --- /dev/null +++ b/src/glsl/builtins/ir/isinf.ir @@ -0,0 +1,17 @@ +((function isinf + (signature bool + (parameters + (declare (in) float x)) + ((return (expression bool == (expression float abs (var_ref x)) (constant float (+INF)) + (signature bvec2 + (parameters + (declare (in) vec2 x)) + ((return (expression bvec2 == (expression vec2 abs (var_ref x)) (constant vec2 (+INF +INF)) + (signature bvec3 + (parameters + (declare (in) vec3 x)) + ((return (expression bvec3 == (expression vec3 abs (var_ref x)) (constant vec3 (+INF +INF +INF)) + (signature bvec4 + (parameters + (declare (in) vec4 x)) + ((return (expression bvec4 == (expression vec4 abs (var_ref x)) (constant vec4 (+INF +INF +INF +INF diff --git a/src/glsl/builtins/ir/isnan.ir b/src/glsl/builtins/ir/isnan.ir new file mode 100644 index 000..b67349f --- /dev/null +++ b/src/glsl/builtins/ir/isnan.ir @@ -0,0 +1,17 @@ +((function isnan + (signature bool + (parameters + (declare (in) float x)) + ((return (expression bool != (var_ref x) (var_ref x) + (signature bvec2 + (parameters + (declare (in) vec2 x)) + ((return (expression bvec2 != (var_ref x) (var_ref x) + (signature bvec3 + (parameters + (declare (in) vec3 x)) + ((return (expression bvec3 != (var_ref x) (var_ref x) + (signature bvec4 + (parameters + (declare (in) vec4 x)) + ((return (expression bvec4 != (var_ref x) (var_ref x))) diff --git a/src/glsl/builtins/profiles/130.frag b/src/glsl/builtins/profiles/130.frag index c121859..1f212c1 100644 --- a/src/glsl/builtins/profiles/130.frag +++ b/src/glsl/builtins/profiles/130.frag @@ -288,7 +288,6 @@ vec2 smoothstep(float edge0, float edge1, vec2 x); vec3 smoothstep(float edge0, float edge1, vec3 x); vec4 smoothstep(float edge0, float edge1, vec4 x); -#if 0 bool isnan(float x); bvec2 isnan(vec2 x); bvec3 isnan(vec3 x); @@ -298,7 +297,6 @@ bool isinf(float x); bvec2 isinf(vec2 x); bvec3 isinf(vec3 x); bvec4 isinf(vec4 x); -#endif /* * 8.4 - Geometric Functions diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert index ebd9a50..df17ede 100644 --- a/src/glsl/builtins/profiles/130.vert +++ b/src/glsl/builtins/profiles/130.vert @@ -288,7 +288,6 @@ vec2 smoothstep(float edge0, float edge1, vec2 x); vec3 smoothstep(float edge0, float edge1, vec3 x); vec4 smoothstep(float edge0, float edge1, vec4 x); -#if 0 bool isnan(float x); bvec2 isnan(vec2 x); bvec3 isnan(vec3 x); @@ -298,7 +297,6 @@ bool isinf(float x); bvec2 isinf(vec2 x); bvec3 isinf(vec3 x); bvec4 isinf(vec4 x); -#endif /* * 8.4 - Geometric Functions ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen6+: Switch GLSL from ALT to IEEE floating point mode
Module: Mesa Branch: master Commit: f40c6b2a992f3ca796826a47743c0c80232d7ab2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f40c6b2a992f3ca796826a47743c0c80232d7ab2 Author: Paul Berry Date: Fri Oct 7 17:37:32 2011 -0700 i965/gen6+: Switch GLSL from ALT to IEEE floating point mode i965 graphics hardware has two floating point modes: ALT and IEEE. In ALT mode, floating-point operations never generate infinities or NaNs, and MOV instructions translate infinities and NaNs to finite values. In IEEE mode, infinities and NaNs behave as specified in the IEEE 754 spec. Previously, we used ALT mode for all vertex and fragment programs, whether they were GLSL programs or ARB programs. The GLSL spec is sufficiently vague about how infs and nans are to be handled that it was unclear whether this mode was compliant with the GLSL 1.30 spec or not, and it made it very difficult to test the isinf() and isnan() functions. This patch changes i965 GLSL programs to use IEEE floating-point mode, which is clearly compliant with GLSL 1.30's inf/nan requirements. In addition to making the Piglit isinf and isnan tests pass, this paves the way for future support of the ARB_shader_precision extension. Unfortunately we still have to use ALT floating-point mode when executing ARB programs, because those programs require 0^0 == 1, and i965 hardware generates 0^0 == NaN in IEEE mode. Fixes piglit tests "isinf-and-isnan fs_fbo", "isinf-and-isnan vs_fbo", and {fs,vs}-{isinf,isnan}-{vec2,vec3,vec4}. --- src/mesa/drivers/dri/i965/gen6_vs_state.c |9 - src/mesa/drivers/dri/i965/gen6_wm_state.c |7 +-- src/mesa/drivers/dri/i965/gen7_vs_state.c |9 - src/mesa/drivers/dri/i965/gen7_wm_state.c |7 +-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index e06c7b4..e22fd39 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -131,6 +131,7 @@ static void upload_vs_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; + uint32_t floating_point_mode = 0; if (brw->vs.push_const_size == 0) { /* Disable the push constant buffers. */ @@ -157,11 +158,17 @@ upload_vs_state(struct brw_context *brw) ADVANCE_BATCH(); } + /* Use ALT floating point mode for ARB vertex programs, because they +* require 0^0 == 1. +*/ + if (intel->ctx.Shader.CurrentVertexProgram == NULL) + floating_point_mode = GEN6_VS_FLOATING_POINT_MODE_ALT; + BEGIN_BATCH(6); OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2)); OUT_BATCH(brw->vs.prog_offset); OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | -GEN6_VS_FLOATING_POINT_MODE_ALT | + floating_point_mode | (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT)); if (brw->vs.prog_data->total_scratch) { diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 25e0fa2..714d594 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -134,8 +134,11 @@ upload_wm_state(struct brw_context *brw) dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0; dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5; - /* OpenGL non-ieee floating point mode */ - dw2 |= GEN6_WM_FLOATING_POINT_MODE_ALT; + /* Use ALT floating point mode for ARB fragment programs, because they +* require 0^0 == 1. +*/ + if (ctx->Shader.CurrentFragmentProgram == NULL) + dw2 |= GEN6_WM_FLOATING_POINT_MODE_ALT; /* BRW_NEW_NR_WM_SURFACES */ dw2 |= brw->wm.nr_surfaces << GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT; diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c index 4ef9c68..dbf9346 100644 --- a/src/mesa/drivers/dri/i965/gen7_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c @@ -33,6 +33,7 @@ static void upload_vs_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; + uint32_t floating_point_mode = 0; BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_VS << 16 | (2 - 2)); @@ -65,11 +66,17 @@ upload_vs_state(struct brw_context *brw) ADVANCE_BATCH(); } + /* Use ALT floating point mode for ARB vertex programs, because they +* require 0^0 == 1. +*/ + if (intel->ctx.Shader.CurrentVertexProgram == NULL) + floating_point_mode = GEN6_VS_FLOATING_POINT_MODE_ALT; + BEGIN_BATCH(6); OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2)); OUT_BATCH(brw->vs.prog_offset); OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | -GEN6_VS_FLOATING_POINT_MODE_ALT | + floating_point_mode | (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT)); if (brw->vs.prog_data->total_scratch) { diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_stat
Mesa (master): mesa: Add glsl_type::get_scalar_type() function.
Module: Mesa Branch: master Commit: fa0066ae2b2d304065ee8d93d9b5ecc8b457425a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa0066ae2b2d304065ee8d93d9b5ecc8b457425a Author: Paul Berry Date: Tue Oct 25 16:24:03 2011 -0700 mesa: Add glsl_type::get_scalar_type() function. This function is similar to get_base_type(), but when called on arrays, it returns the scalar type composing the array. For example, glsl_type(vec4[]) => float_type. Acked-by: Kenneth Graunke --- src/glsl/glsl_types.cpp | 23 +++ src/glsl/glsl_types.h | 11 +++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index c94aec0..03e9987 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -258,6 +258,29 @@ const glsl_type *glsl_type::get_base_type() const } +const glsl_type *glsl_type::get_scalar_type() const +{ + const glsl_type *type = this; + + /* Handle arrays */ + while (type->base_type == GLSL_TYPE_ARRAY) + type = type->fields.array; + + /* Handle vectors and matrices */ + switch (type->base_type) { + case GLSL_TYPE_UINT: + return uint_type; + case GLSL_TYPE_INT: + return int_type; + case GLSL_TYPE_FLOAT: + return float_type; + default: + /* Handle everything else */ + return type; + } +} + + void _mesa_glsl_release_types(void) { diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 0486966..2f849af 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -178,6 +178,17 @@ struct glsl_type { const glsl_type *get_base_type() const; /** +* Get the basic scalar type which this type aggregates. +* +* If the type is a numeric or boolean scalar, vector, or matrix, or an +* array of any of those, this function gets the scalar type of the +* individual components. For structs and arrays of structs, this function +* returns the struct type. For samplers and arrays of samplers, this +* function returns the sampler type. +*/ + const glsl_type *get_scalar_type() const; + + /** * Query the type of elements in an array * * \return ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Fix flat integral varyings.
Module: Mesa Branch: master Commit: 9734bd05608c00a1d84851f3d46d5deb52e75d5e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9734bd05608c00a1d84851f3d46d5deb52e75d5e Author: Paul Berry Date: Mon Oct 24 17:46:26 2011 -0700 i965: Fix flat integral varyings. Previously, the vertex and fragment shader back-ends assumed that all varyings were floats. In GLSL 1.30 this is no longer true--they can also be of integral types provided that they have an interpolation qualifier of "flat". This required two changes in each back-end: assigning the correct type to the register that holds the varying value during shader execution, and assigning the correct type to the register that ties the varying value to the rest of the graphics pipeline (the message register in the case of VS, and the payload register in the case of FS). Fixes piglit tests fs-int-interpolation and fs-uint-interpolation. Acked-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.cpp |4 ++-- src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 31c3116..e58545b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -424,8 +424,7 @@ fs_reg * fs_visitor::emit_general_interpolation(ir_variable *ir) { fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); - /* Interpolation is always in floating point regs. */ - reg->type = BRW_REGISTER_TYPE_F; + reg->type = brw_type_for_base_type(ir->type->get_scalar_type()); fs_reg attr = *reg; unsigned int array_elements; @@ -465,6 +464,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) for (unsigned int k = 0; k < type->vector_elements; k++) { struct brw_reg interp = interp_reg(location, k); interp = suboffset(interp, 3); + interp.type = reg->type; emit(FS_OPCODE_CINTERP, attr, fs_reg(interp)); attr.reg_offset++; } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 1312c0d..e5d5997 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -853,7 +853,8 @@ vec4_visitor::visit(ir_variable *ir) for (int i = 0; i < type_size(ir->type); i++) { output_reg[ir->location + i] = *reg; output_reg[ir->location + i].reg_offset = i; -output_reg[ir->location + i].type = BRW_REGISTER_TYPE_F; +output_reg[ir->location + i].type = +brw_type_for_base_type(ir->type->get_scalar_type()); output_reg_annotation[ir->location + i] = ir->name; } break; @@ -1915,6 +1916,7 @@ void vec4_visitor::emit_generic_urb_slot(dst_reg reg, int vert_result) { assert (vert_result < VERT_RESULT_MAX); + reg.type = output_reg[vert_result].type; current_annotation = output_reg_annotation[vert_result]; /* Copy the register, saturating if necessary */ vec4_instruction *inst = emit(MOV(reg, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Add missing initializer.
Module: Mesa Branch: master Commit: 7ff247712d7c01141756d0999ff86af1e109ce7c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ff247712d7c01141756d0999ff86af1e109ce7c Author: José Fonseca Date: Mon Oct 31 19:04:08 2011 + util: Add missing initializer. --- src/gallium/auxiliary/util/u_format_table.py |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py index 250a535..703d999 100755 --- a/src/gallium/auxiliary/util/u_format_table.py +++ b/src/gallium/auxiliary/util/u_format_table.py @@ -115,7 +115,7 @@ def write_format_table(formats): if channel.size: print " {%s, %s, %s, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, sep, "xyzw"[i], channel.name) else: -print " {0, 0, 0}%s" % (sep,) +print " {0, 0, 0, 0}%s" % (sep,) print " }," print " {" for i in range(4): ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): llvmpipe: Remove unsed variables.
Module: Mesa Branch: master Commit: 0f26c6ae3f9bd6b8c97e9e8a461d55b30e429239 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f26c6ae3f9bd6b8c97e9e8a461d55b30e429239 Author: José Fonseca Date: Mon Oct 31 19:36:07 2011 + llvmpipe: Remove unsed variables. --- src/gallium/auxiliary/gallivm/lp_bld_conv.c |4 src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c |3 +-- 2 files changed, 1 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index c261d76..8a08663 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -346,10 +346,8 @@ lp_build_conv(struct gallivm_state *gallivm, LLVMValueRef src_int1; LLVMValueRef src_int2; LLVMValueRef src_int3; - LLVMTypeRef int16_vec_type; LLVMTypeRef int32_vec_type; LLVMTypeRef src_vec_type; - LLVMTypeRef dst_vec_type; LLVMValueRef const_255f; LLVMValueRef a, b, c, d; @@ -362,8 +360,6 @@ lp_build_conv(struct gallivm_state *gallivm, int32_type.sign = 1; src_vec_type = lp_build_vec_type(gallivm, src_type); - dst_vec_type = lp_build_vec_type(gallivm, dst_type); - int16_vec_type = lp_build_vec_type(gallivm, int16_type); int32_vec_type = lp_build_vec_type(gallivm, int32_type); const_255f = lp_build_const_vec(gallivm, src_type, 255.0f); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 4f16015..b215f38 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -268,7 +268,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, const unsigned dims = bld->dims; LLVMBuilderRef builder = bld->gallivm->builder; struct lp_build_context i32, h16, u8n; - LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; + LLVMTypeRef i32_vec_type, u8n_vec_type; LLVMValueRef i32_c8; LLVMValueRef width_vec, height_vec, depth_vec; LLVMValueRef s_ipart, t_ipart = NULL, r_ipart = NULL; @@ -281,7 +281,6 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld, lp_build_context_init(&u8n, bld->gallivm, lp_type_unorm(8)); i32_vec_type = lp_build_vec_type(bld->gallivm, i32.type); - h16_vec_type = lp_build_vec_type(bld->gallivm, h16.type); u8n_vec_type = lp_build_vec_type(bld->gallivm, u8n.type); lp_build_extract_image_sizes(bld, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: Fix potential buffer overflow in rs draw state.
Module: Mesa Branch: master Commit: e33447aac62da5e7fe8f6a262cacaa97ce212ef5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e33447aac62da5e7fe8f6a262cacaa97ce212ef5 Author: José Fonseca Date: Mon Oct 31 19:26:53 2011 + svga: Fix potential buffer overflow in rs draw state. Reviewed-by: Brian Paul --- src/gallium/drivers/svga/svga_context.h | 12 +--- src/gallium/drivers/svga/svga_state_constants.c | 12 ++-- src/gallium/drivers/svga/svga_state_rss.c |3 +++ src/gallium/drivers/svga/svga_state_tss.c |5 + 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 07d3c5f..47e08ba 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -36,6 +36,8 @@ #include "tgsi/tgsi_scan.h" #include "svga_state.h" +#include "svga_hw_reg.h" +#include "svga3d_shaderdefs.h" #define SVGA_TEX_UNITS 8 @@ -236,10 +238,6 @@ struct svga_state float zero_stride_constants[PIPE_MAX_ATTRIBS*4]; }; -#define RS_MAX 97 -#define TS_MAX 30 -#define CB_MAX 256 - struct svga_prescale { float translate[4]; float scale[4]; @@ -276,9 +274,9 @@ struct svga_hw_view_state */ struct svga_hw_draw_state { - unsigned rs[RS_MAX]; - unsigned ts[16][TS_MAX]; - float cb[PIPE_SHADER_TYPES][CB_MAX][4]; + unsigned rs[SVGA3D_RS_MAX]; + unsigned ts[SVGA3D_PIXEL_SAMPLERREG_MAX][SVGA3D_TS_MAX]; + float cb[PIPE_SHADER_TYPES][SVGA3D_CONSTREG_MAX][4]; struct svga_shader_result *fs; struct svga_shader_result *vs; diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index a1c5ee8..245b6d4 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -68,10 +68,10 @@ emit_const(struct svga_context *svga, unsigned shader, unsigned i, { enum pipe_error ret = PIPE_OK; - assert(i < CB_MAX); - assert(shader < PIPE_SHADER_TYPES); + assert(i < SVGA3D_CONSTREG_MAX); + if (memcmp(svga->state.hw_draw.cb[shader][i], value, 4 * sizeof(float)) != 0) { if (SVGA_DEBUG & DEBUG_CONSTS) debug_printf("%s %s %u: %f %f %f %f\n", @@ -112,13 +112,13 @@ static enum pipe_error emit_const_range( struct svga_context *svga, enum pipe_error ret; #ifdef DEBUG - if (offset + count > CB_MAX) { + if (offset + count > SVGA3D_CONSTREG_MAX) { debug_printf("svga: too many constants (offset + count = %u)\n", offset + count); } #endif - if (offset > CB_MAX) { + if (offset > SVGA3D_CONSTREG_MAX) { /* This isn't OK, but if we propagate an error all the way up we'll * just get into more trouble. * XXX note that offset is always zero at this time so this is moot. @@ -126,13 +126,13 @@ static enum pipe_error emit_const_range( struct svga_context *svga, return PIPE_OK; } - if (offset + count > CB_MAX) { + if (offset + count > SVGA3D_CONSTREG_MAX) { /* Just drop the extra constants for now. * Ideally we should not have allowed the app to create a shader * that exceeds our constant buffer size but there's no way to * express that in gallium at this time. */ - count = CB_MAX - offset; + count = SVGA3D_CONSTREG_MAX - offset; } i = 0; diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c index a37e1f8..a4d56bd 100644 --- a/src/gallium/drivers/svga/svga_state_rss.c +++ b/src/gallium/drivers/svga/svga_state_rss.c @@ -24,6 +24,7 @@ **/ #include "util/u_inlines.h" +#include "util/u_memory.h" #include "pipe/p_defines.h" #include "util/u_math.h" @@ -40,6 +41,7 @@ struct rs_queue { #define EMIT_RS(svga, value, token, fail) \ do {\ + assert(SVGA3D_RS_##token < Elements(svga->state.hw_draw.rs)); \ if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) {\ svga_queue_rs( &queue, SVGA3D_RS_##token, value );\ svga->state.hw_draw.rs[SVGA3D_RS_##token] = value;\ @@ -49,6 +51,7 @@ do { \ #define EMIT_RS_FLOAT(svga, fvalue, token, fail)\ do {\ unsigned value = fui(fvalue);\ + assert(SVGA3D_RS_##token < Elements(svga->state.hw_draw.rs)); \ if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) {\ svga_queue_rs( &queue, SVGA3D_RS_##token, value );\ svga->state.hw_draw.rs[SVGA3D_RS_##token] = value;\ diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c index 8b11a2a..8dc51b7 100644 -