Dnia niedziela, 31 maja 2009 o 17:58:26 Nicolai Hähnle napisał(a): > Am Saturday 30 May 2009 21:00:51 schrieb Maciej Cencora: > > this round of patches for r300 brings: > > 1) hardware accelerated support for 8bit and 16bit vertex attribute data > > formats, > > 2) support for 16bit vertex indices, > > 3) support for EXT_vertex_array_bgra extension, > > 4) T&L path cleanup. it's used when hardware TCL is enabled, but we have > > to fallback for software TCL - clipping is still done in hardware unlike > > in software TCL path. > > Thanks for this work! > > > Those patches are unfinished, to be done: > > 1) unmap bo's after rendering is finished > > Currently the map/unmap functions are noop so it's working ok, but when > > we will add support for VBO's it won't work. > > > > 2) handle big endian machines correctly > > Is this really an issue? > > Good question. Anybody who works on big-endian able to fill in the gaps of > whether (and if so, where) the card needs to be setup for byteswap? > > > 3) testing > > Currently I've tested these patches only with some simple apps from > > mesa/progs, sauerbraten game and with 3dmark 2000 on wine (patches give > > nice performance boost here, the "high polygon count" test result > > increased from 6M tris/sec to 8M tris/sec on my rv380). > > > > 4) rename 4th commit ;) > > > > Please review and comment. > > The general structure of the patches is looking good. For the rest, see IRC > #radeon... > > cu, > Nicolai >
Attached patch should fix the issues you've reported. Thanks for review! Maciej Cencora
From 629ec2b4b628c003f3294fa31efa97459967f8be Mon Sep 17 00:00:00 2001 From: Maciej Cencora <m.cenc...@gmail.com> Date: Sun, 31 May 2009 23:00:57 +0200 Subject: [PATCH] r300: GL_(U)SHORT and GL_(U)BYTE with < 4 components can also be HW accelerated Also when index format is GL_UBYTE, convert it to GL_USHORT not GL_UINT. Fix license header too. --- src/mesa/drivers/dri/r300/r300_draw.c | 56 ++++++++++++++++++++++---------- 1 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index bb85d63..a8033d1 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -17,7 +17,7 @@ * 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 NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * IN NO EVENT SHALL THE AUTHOR(S) AND/OR ITS SUPPLIERS 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. @@ -69,16 +69,16 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) { GLubyte *in = (GLubyte *)src_ptr; - GLuint *out = _mesa_malloc(sizeof(GLuint) * mesa_ind_buf->count); + GLushort *out = _mesa_malloc(sizeof(GLushort) * mesa_ind_buf->count); int i; for (i = 0; i < mesa_ind_buf->count; ++i) { - out[i] = (GLuint) in[i]; + out[i] = (GLushort) in[i]; } ind_buf->ptr = out; ind_buf->free_needed = GL_TRUE; - ind_buf->is_32bit = GL_TRUE; + ind_buf->is_32bit = GL_FALSE; } else if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) { ind_buf->ptr = src_ptr; ind_buf->free_needed = GL_FALSE; @@ -157,7 +157,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st } else src_ptr = input->Ptr; - if (input->Type == GL_DOUBLE || ((getTypeSize(input->Type) * input->Size) % 4 > 0)) { + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || input->StrideB < 4){ if (RADEON_DEBUG & DEBUG_FALLBACKS) { fprintf(stderr, "%s: Converting vertex attributes, attribute data format %x,", __FUNCTION__, input->Type); fprintf(stderr, "stride %d, components %d\n", input->StrideB, input->Size); @@ -189,6 +189,9 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st case GL_BYTE: CONVERT(GLbyte, BYTE_TO_FLOAT); break; + default: + assert(0); + break; } type = GL_FLOAT; @@ -222,32 +225,49 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st case GL_SHORT: r300_attr._signed = 1; r300_attr.normalize = input->Normalized; - if (input->Size == 2) - r300_attr.data_type = R300_DATA_TYPE_SHORT_2; - else if (input->Size == 4) - r300_attr.data_type = R300_DATA_TYPE_SHORT_4; - else - assert(0); + switch (input->Size) { + case 1: + r300_attr.dwords = 2; + /* fall through */ + case 2: + r300_attr.data_type = R300_DATA_TYPE_SHORT_2; + break; + case 3: + r300_attr.dwords = 4; + /* fall through */ + case 4: + r300_attr.data_type = R300_DATA_TYPE_SHORT_4; + break; + } break; case GL_BYTE: - assert(input->Size == 4); r300_attr._signed = 1; r300_attr.normalize = input->Normalized; + r300_attr.dwords = 1; r300_attr.data_type = R300_DATA_TYPE_BYTE; break; case GL_UNSIGNED_SHORT: r300_attr._signed = 0; r300_attr.normalize = input->Normalized; - if (input->Size == 2) - r300_attr.data_type = R300_DATA_TYPE_SHORT_2; - else if (input->Size == 4) - r300_attr.data_type = R300_DATA_TYPE_SHORT_4; - else - assert(0); + switch (input->Size) { + case 1: + r300_attr.dwords = 2; + /* fall through */ + case 2: + r300_attr.data_type = R300_DATA_TYPE_SHORT_2; + break; + case 3: + r300_attr.dwords = 4; + /* fall through */ + case 4: + r300_attr.data_type = R300_DATA_TYPE_SHORT_4; + break; + } break; case GL_UNSIGNED_BYTE: assert(input->Size == 4); r300_attr._signed = 0; + r300_attr.dwords = 1; r300_attr.normalize = input->Normalized; if (input->Format == GL_BGRA) r300_attr.data_type = R300_DATA_TYPE_D3DCOLOR; -- 1.6.0.4
------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev