diff options
Diffstat (limited to 'src/mesa/drivers/dri/i965')
25 files changed, 74 insertions, 739 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index d7a2b46e1cf..48ecadfd890 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -21,6 +21,7 @@ DRIVER_SOURCES = \ intel_pixel_bitmap.c \ intel_state.c \ intel_tex.c \ + intel_tex_format.c \ intel_tex_layout.c \ intel_tex_validate.c \ brw_cc.c \ diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6231cba3f93..4654ab1ddfe 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -70,12 +70,14 @@ static void brwUseProgram(GLcontext *ctx, GLuint program) if (sh_prog) { if (sh_prog->VertexProgram) { brw->attribs.VertexProgram->Current = sh_prog->VertexProgram; + sh_prog->VertexProgram->Base.RefCount++; ctx->VertexProgram.Enabled = GL_TRUE; }else ctx->VertexProgram.Enabled = GL_FALSE; if (sh_prog->FragmentProgram) { brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram; + sh_prog->FragmentProgram->Base.RefCount++; ctx->FragmentProgram.Enabled = GL_TRUE; } else ctx->FragmentProgram.Enabled = GL_FALSE; @@ -89,7 +91,6 @@ static void brwInitProgFuncs( struct dd_function_table *functions ) static void brwInitDriverFunctions( struct dd_function_table *functions ) { intelInitDriverFunctions( functions ); - brwInitTextureFuncs( functions ); brwInitFragProgFuncs( functions ); brwInitProgFuncs( functions ); } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index aa797b72ce6..3c227faba65 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -664,7 +664,6 @@ void brw_destroy_state( struct brw_context *brw ); * brw_tex.c */ void brwUpdateTextureState( struct intel_context *intel ); -void brwInitTextureFuncs( struct dd_function_table *functions ); void brw_FrameBufferTexInit( struct brw_context *brw ); void brw_FrameBufferTexDestroy( struct brw_context *brw ); diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index b23b3579888..969be594af2 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -48,7 +48,7 @@ #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" - +#define FILE_DEBUG_FLAG DEBUG_BATCH static GLuint hw_prim[GL_POLYGON+1] = { _3DPRIM_POINTLIST, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 95f9f027530..284307341cb 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -676,7 +676,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, insn->header.execution_size = do_insn->header.execution_size; assert(do_insn->header.opcode == BRW_OPCODE_DO); - insn->bits3.if_else.jump_count = do_insn - insn; + insn->bits3.if_else.jump_count = do_insn - insn + 1; insn->bits3.if_else.pop_count = 0; insn->bits3.if_else.pad0 = 0; } diff --git a/src/mesa/drivers/dri/i965/brw_exec_generic.c b/src/mesa/drivers/dri/i965/brw_exec_generic.c deleted file mode 100644 index 11d1ef76f59..00000000000 --- a/src/mesa/drivers/dri/i965/brw_exec_generic.c +++ /dev/null @@ -1,530 +0,0 @@ -/************************************************************************** - -Copyright 2004 Tungsten Graphics Inc., Cedar Park, Texas. - -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 -on the rights to use, copy, modify, merge, publish, distribute, sub -license, 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 (including the next -paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL -ATI, TUNGSTEN GRAPHICS AND/OR THEIR 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. - -**************************************************************************/ - -/* - * Authors: - * Keith Whitwell <[email protected]> - */ - -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "vtxfmt.h" -#include "dlist.h" -#include "state.h" -#include "light.h" -#include "api_arrayelt.h" -#include "api_noop.h" - -#include "brw_exec.h" - - -/* Versions of all the entrypoints for situations where codegen isn't - * available. - * - * Note: Only one size for each attribute may be active at once. - * Eg. if Color3f is installed/active, then Color4f may not be, even - * if the vertex actually contains 4 color coordinates. This is - * because the 3f version won't otherwise set color[3] to 1.0 -- this - * is the job of the chooser function when switching between Color4f - * and Color3f. - */ -#define ATTRFV( ATTR, N ) \ -static void attrib_##ATTR##_##N( const GLfloat *v ) \ -{ \ - GET_CURRENT_CONTEXT( ctx ); \ - struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec; \ - \ - if ((ATTR) == 0) { \ - GLuint i; \ - \ - if (N>0) exec->vtx.vbptr[0] = v[0]; \ - if (N>1) exec->vtx.vbptr[1] = v[1]; \ - if (N>2) exec->vtx.vbptr[2] = v[2]; \ - if (N>3) exec->vtx.vbptr[3] = v[3]; \ - \ - for (i = N; i < exec->vtx.vertex_size; i++) \ - exec->vtx.vbptr[i] = exec->vtx.vertex[i]; \ - \ - exec->vtx.vbptr += exec->vtx.vertex_size; \ - exec->ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; \ - \ - if (++exec->vtx.vert_count >= exec->vtx.max_vert) \ - brw_exec_vtx_wrap( exec ); \ - } \ - else { \ - GLfloat *dest = exec->vtx.attrptr[ATTR]; \ - if (N>0) dest[0] = v[0]; \ - if (N>1) dest[1] = v[1]; \ - if (N>2) dest[2] = v[2]; \ - if (N>3) dest[3] = v[3]; \ - } \ -} - -#define INIT(TAB, ATTR) \ - TAB[ATTR][0] = attrib_##ATTR##_1; \ - TAB[ATTR][1] = attrib_##ATTR##_2; \ - TAB[ATTR][2] = attrib_##ATTR##_3; \ - TAB[ATTR][3] = attrib_##ATTR##_4; - - -#define ATTRS( ATTRIB ) \ - ATTRFV( ATTRIB, 1 ) \ - ATTRFV( ATTRIB, 2 ) \ - ATTRFV( ATTRIB, 3 ) \ - ATTRFV( ATTRIB, 4 ) - -ATTRS( 0 ) -ATTRS( 1 ) -ATTRS( 2 ) -ATTRS( 3 ) -ATTRS( 4 ) -ATTRS( 5 ) -ATTRS( 6 ) -ATTRS( 7 ) -ATTRS( 8 ) -ATTRS( 9 ) -ATTRS( 10 ) -ATTRS( 11 ) -ATTRS( 12 ) -ATTRS( 13 ) -ATTRS( 14 ) -ATTRS( 15 ) - -void brw_exec_generic_attr_table_init( brw_attrfv_func (*tab)[4] ) -{ - INIT( tab, 0 ); - INIT( tab, 1 ); - INIT( tab, 2 ); - INIT( tab, 3 ); - INIT( tab, 4 ); - INIT( tab, 5 ); - INIT( tab, 6 ); - INIT( tab, 7 ); - INIT( tab, 8 ); - INIT( tab, 9 ); - INIT( tab, 10 ); - INIT( tab, 11 ); - INIT( tab, 12 ); - INIT( tab, 13 ); - INIT( tab, 14 ); - INIT( tab, 15 ); -} - -/* These can be made efficient with codegen. Further, by adding more - * logic to do_choose(), the double-dispatch for legacy entrypoints - * like glVertex3f() can be removed. - */ -#define DISPATCH_ATTRFV( ATTR, COUNT, P ) \ -do { \ - GET_CURRENT_CONTEXT( ctx ); \ - struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec; \ - exec->vtx.tabfv[ATTR][COUNT-1]( P ); \ -} while (0) - -#define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V ) -#define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V ) -#define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V ) -#define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V ) - -#define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) ) - -#define DISPATCH_ATTR2F( ATTR, S,T ) \ -do { \ - GLfloat v[2]; \ - v[0] = S; v[1] = T; \ - DISPATCH_ATTR2FV( ATTR, v ); \ -} while (0) -#define DISPATCH_ATTR3F( ATTR, S,T,R ) \ -do { \ - GLfloat v[3]; \ - v[0] = S; v[1] = T; v[2] = R; \ - DISPATCH_ATTR3FV( ATTR, v ); \ -} while (0) -#define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \ -do { \ - GLfloat v[4]; \ - v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \ - DISPATCH_ATTR4FV( ATTR, v ); \ -} while (0) - - -static void GLAPIENTRY brw_Vertex2f( GLfloat x, GLfloat y ) -{ - DISPATCH_ATTR2F( BRW_ATTRIB_POS, x, y ); -} - -static void GLAPIENTRY brw_Vertex2fv( const GLfloat *v ) -{ - DISPATCH_ATTR2FV( BRW_ATTRIB_POS, v ); -} - -static void GLAPIENTRY brw_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( BRW_ATTRIB_POS, x, y, z ); -} - -static void GLAPIENTRY brw_Vertex3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( BRW_ATTRIB_POS, v ); -} - -static void GLAPIENTRY brw_Vertex4f( GLfloat x, GLfloat y, GLfloat z, - GLfloat w ) -{ - DISPATCH_ATTR4F( BRW_ATTRIB_POS, x, y, z, w ); -} - -static void GLAPIENTRY brw_Vertex4fv( const GLfloat *v ) -{ - DISPATCH_ATTR4FV( BRW_ATTRIB_POS, v ); -} - -static void GLAPIENTRY brw_TexCoord1f( GLfloat x ) -{ - DISPATCH_ATTR1F( BRW_ATTRIB_TEX0, x ); -} - -static void GLAPIENTRY brw_TexCoord1fv( const GLfloat *v ) -{ - DISPATCH_ATTR1FV( BRW_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY brw_TexCoord2f( GLfloat x, GLfloat y ) -{ - DISPATCH_ATTR2F( BRW_ATTRIB_TEX0, x, y ); -} - -static void GLAPIENTRY brw_TexCoord2fv( const GLfloat *v ) -{ - DISPATCH_ATTR2FV( BRW_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY brw_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( BRW_ATTRIB_TEX0, x, y, z ); -} - -static void GLAPIENTRY brw_TexCoord3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( BRW_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY brw_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, - GLfloat w ) -{ - DISPATCH_ATTR4F( BRW_ATTRIB_TEX0, x, y, z, w ); -} - -static void GLAPIENTRY brw_TexCoord4fv( const GLfloat *v ) -{ - DISPATCH_ATTR4FV( BRW_ATTRIB_TEX0, v ); -} - -static void GLAPIENTRY brw_Normal3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( BRW_ATTRIB_NORMAL, x, y, z ); -} - -static void GLAPIENTRY brw_Normal3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( BRW_ATTRIB_NORMAL, v ); -} - -static void GLAPIENTRY brw_FogCoordfEXT( GLfloat x ) -{ - DISPATCH_ATTR1F( BRW_ATTRIB_FOG, x ); -} - -static void GLAPIENTRY brw_FogCoordfvEXT( const GLfloat *v ) -{ - DISPATCH_ATTR1FV( BRW_ATTRIB_FOG, v ); -} - -static void GLAPIENTRY brw_Color3f( GLfloat x, GLfloat y, GLfloat z ) -{ - DISPATCH_ATTR3F( BRW_ATTRIB_COLOR0, x, y, z ); -} - -static void GLAPIENTRY brw_Color3fv( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( BRW_ATTRIB_COLOR0, v ); -} - -static void GLAPIENTRY brw_Color4f( GLfloat x, GLfloat y, GLfloat z, - GLfloat w ) -{ - DISPATCH_ATTR4F( BRW_ATTRIB_COLOR0, x, y, z, w ); -} - -static void GLAPIENTRY brw_Color4fv( const GLfloat *v ) -{ - DISPATCH_ATTR4FV( BRW_ATTRIB_COLOR0, v ); -} - -static void GLAPIENTRY brw_SecondaryColor3fEXT( GLfloat x, GLfloat y, - GLfloat z ) -{ - DISPATCH_ATTR3F( BRW_ATTRIB_COLOR1, x, y, z ); -} - -static void GLAPIENTRY brw_SecondaryColor3fvEXT( const GLfloat *v ) -{ - DISPATCH_ATTR3FV( BRW_ATTRIB_COLOR1, v ); -} - -static void GLAPIENTRY brw_MultiTexCoord1f( GLenum target, GLfloat x ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR1F( attr, x ); -} - -static void GLAPIENTRY brw_MultiTexCoord1fv( GLenum target, - const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR1FV( attr, v ); -} - -static void GLAPIENTRY brw_MultiTexCoord2f( GLenum target, GLfloat x, - GLfloat y ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR2F( attr, x, y ); -} - -static void GLAPIENTRY brw_MultiTexCoord2fv( GLenum target, - const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR2FV( attr, v ); -} - -static void GLAPIENTRY brw_MultiTexCoord3f( GLenum target, GLfloat x, - GLfloat y, GLfloat z) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR3F( attr, x, y, z ); -} - -static void GLAPIENTRY brw_MultiTexCoord3fv( GLenum target, - const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR3FV( attr, v ); -} - -static void GLAPIENTRY brw_MultiTexCoord4f( GLenum target, GLfloat x, - GLfloat y, GLfloat z, - GLfloat w ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR4F( attr, x, y, z, w ); -} - -static void GLAPIENTRY brw_MultiTexCoord4fv( GLenum target, - const GLfloat *v ) -{ - GLuint attr = (target & 0x7) + BRW_ATTRIB_TEX0; - DISPATCH_ATTR4FV( attr, v ); -} - - -static void GLAPIENTRY brw_VertexAttrib1fNV( GLuint index, GLfloat x ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR1F( index, x ); -} - -static void GLAPIENTRY brw_VertexAttrib1fvNV( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR1FV( index, v ); -} - -static void GLAPIENTRY brw_VertexAttrib2fNV( GLuint index, GLfloat x, - GLfloat y ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR2F( index, x, y ); -} - -static void GLAPIENTRY brw_VertexAttrib2fvNV( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR2FV( index, v ); -} - -static void GLAPIENTRY brw_VertexAttrib3fNV( GLuint index, GLfloat x, - GLfloat y, GLfloat z ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR3F( index, x, y, z ); -} - -static void GLAPIENTRY brw_VertexAttrib3fvNV( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR3FV( index, v ); -} - -static void GLAPIENTRY brw_VertexAttrib4fNV( GLuint index, GLfloat x, - GLfloat y, GLfloat z, - GLfloat w ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR4F( index, x, y, z, w ); -} - -static void GLAPIENTRY brw_VertexAttrib4fvNV( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR4FV( index, v ); -} - - -/* - * XXX adjust index - */ - -static void GLAPIENTRY brw_VertexAttrib1fARB( GLuint index, GLfloat x ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR1F( index, x ); -} - -static void GLAPIENTRY brw_VertexAttrib1fvARB( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR1FV( index, v ); -} - -static void GLAPIENTRY brw_VertexAttrib2fARB( GLuint index, GLfloat x, - GLfloat y ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR2F( index, x, y ); -} - -static void GLAPIENTRY brw_VertexAttrib2fvARB( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR2FV( index, v ); -} - -static void GLAPIENTRY brw_VertexAttrib3fARB( GLuint index, GLfloat x, - GLfloat y, GLfloat z ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR3F( index, x, y, z ); -} - -static void GLAPIENTRY brw_VertexAttrib3fvARB( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR3FV( index, v ); -} - -static void GLAPIENTRY brw_VertexAttrib4fARB( GLuint index, GLfloat x, - GLfloat y, GLfloat z, - GLfloat w ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR4F( index, x, y, z, w ); -} - -static void GLAPIENTRY brw_VertexAttrib4fvARB( GLuint index, - const GLfloat *v ) -{ - if (index >= BRW_ATTRIB_FIRST_MATERIAL) index = ERROR_ATTRIB; - DISPATCH_ATTR4FV( index, v ); -} - - -/* Install the generic versions of the 2nd level dispatch - * functions. Some of these have a codegen alternative. - */ -void brw_exec_vtx_generic_init( struct brw_exec_context *exec ) -{ - GLvertexformat *vfmt = &exec->vtxfmt; - - vfmt->Color3f = brw_Color3f; - vfmt->Color3fv = brw_Color3fv; - vfmt->Color4f = brw_Color4f; - vfmt->Color4fv = brw_Color4fv; - vfmt->FogCoordfEXT = brw_FogCoordfEXT; - vfmt->FogCoordfvEXT = brw_FogCoordfvEXT; - vfmt->MultiTexCoord1fARB = brw_MultiTexCoord1f; - vfmt->MultiTexCoord1fvARB = brw_MultiTexCoord1fv; - vfmt->MultiTexCoord2fARB = brw_MultiTexCoord2f; - vfmt->MultiTexCoord2fvARB = brw_MultiTexCoord2fv; - vfmt->MultiTexCoord3fARB = brw_MultiTexCoord3f; - vfmt->MultiTexCoord3fvARB = brw_MultiTexCoord3fv; - vfmt->MultiTexCoord4fARB = brw_MultiTexCoord4f; - vfmt->MultiTexCoord4fvARB = brw_MultiTexCoord4fv; - vfmt->Normal3f = brw_Normal3f; - vfmt->Normal3fv = brw_Normal3fv; - vfmt->SecondaryColor3fEXT = brw_SecondaryColor3fEXT; - vfmt->SecondaryColor3fvEXT = brw_SecondaryColor3fvEXT; - vfmt->TexCoord1f = brw_TexCoord1f; - vfmt->TexCoord1fv = brw_TexCoord1fv; - vfmt->TexCoord2f = brw_TexCoord2f; - vfmt->TexCoord2fv = brw_TexCoord2fv; - vfmt->TexCoord3f = brw_TexCoord3f; - vfmt->TexCoord3fv = brw_TexCoord3fv; - vfmt->TexCoord4f = brw_TexCoord4f; - vfmt->TexCoord4fv = brw_TexCoord4fv; - vfmt->Vertex2f = brw_Vertex2f; - vfmt->Vertex2fv = brw_Vertex2fv; - vfmt->Vertex3f = brw_Vertex3f; - vfmt->Vertex3fv = brw_Vertex3fv; - vfmt->Vertex4f = brw_Vertex4f; - vfmt->Vertex4fv = brw_Vertex4fv; - vfmt->VertexAttrib1fNV = brw_VertexAttrib1fNV; - vfmt->VertexAttrib1fvNV = brw_VertexAttrib1fvNV; - vfmt->VertexAttrib2fNV = brw_VertexAttrib2fNV; - vfmt->VertexAttrib2fvNV = brw_VertexAttrib2fvNV; - vfmt->VertexAttrib3fNV = brw_VertexAttrib3fNV; - vfmt->VertexAttrib3fvNV = brw_VertexAttrib3fvNV; - vfmt->VertexAttrib4fNV = brw_VertexAttrib4fNV; - vfmt->VertexAttrib4fvNV = brw_VertexAttrib4fvNV; - vfmt->VertexAttrib1fARB = brw_VertexAttrib1fARB; - vfmt->VertexAttrib1fvARB = brw_VertexAttrib1fvARB; - vfmt->VertexAttrib2fARB = brw_VertexAttrib2fARB; - vfmt->VertexAttrib2fvARB = brw_VertexAttrib2fvARB; - vfmt->VertexAttrib3fARB = brw_VertexAttrib3fARB; - vfmt->VertexAttrib3fvARB = brw_VertexAttrib3fvARB; - vfmt->VertexAttrib4fARB = brw_VertexAttrib4fARB; - vfmt->VertexAttrib4fvARB = brw_VertexAttrib4fvARB; -} diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index 86464b2ec5f..3925dcf37b8 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -39,11 +39,7 @@ #include "macros.h" #include "mtypes.h" - - - - - +#define FILE_DEBUG_FLAG DEBUG_FALLBACKS static GLboolean do_check_fallback(struct brw_context *brw) { @@ -55,22 +51,29 @@ static GLboolean do_check_fallback(struct brw_context *brw) if (brw->metaops.active) return GL_FALSE; - if (brw->intel.no_rast) + if (brw->intel.no_rast) { + DBG("FALLBACK: rasterization disabled\n"); return GL_TRUE; - + } + /* _NEW_BUFFERS */ if (ctx->DrawBuffer->_ColorDrawBufferMask[0] != BUFFER_BIT_FRONT_LEFT && - ctx->DrawBuffer->_ColorDrawBufferMask[0] != BUFFER_BIT_BACK_LEFT) + ctx->DrawBuffer->_ColorDrawBufferMask[0] != BUFFER_BIT_BACK_LEFT) { + DBG("FALLBACK: draw buffer %d: 0x%08x\n", + ctx->DrawBuffer->_ColorDrawBufferMask[0]); return GL_TRUE; + } /* _NEW_RENDERMODE * * XXX: need to save/restore RenderMode in metaops state, or * somehow move to a new attribs pointer: */ - if (ctx->RenderMode != GL_RENDER) + if (ctx->RenderMode != GL_RENDER) { + DBG("FALLBACK: render mode\n"); return GL_TRUE; + } /* _NEW_TEXTURE: */ @@ -79,8 +82,10 @@ static GLboolean do_check_fallback(struct brw_context *brw) if (texUnit->_ReallyEnabled) { struct intel_texture_object *intelObj = intel_texture_object(texUnit->_Current); struct gl_texture_image *texImage = intelObj->base.Image[0][intelObj->firstLevel]; - if (texImage->Border) + if (texImage->Border) { + DBG("FALLBACK: texture border\n"); return GL_TRUE; + } } } @@ -88,6 +93,7 @@ static GLboolean do_check_fallback(struct brw_context *brw) */ if (brw->attribs.Stencil->Enabled && !brw->intel.hw_stencil) { + DBG("FALLBACK: stencil\n"); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index ad29316a42a..b344dd7d271 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -48,167 +48,6 @@ #include "brw_defines.h" - - -static const struct gl_texture_format * -brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat, - GLenum srcFormat, GLenum srcType ) -{ - switch ( internalFormat ) { - case 4: - case GL_RGBA: - case GL_COMPRESSED_RGBA: - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) - return &_mesa_texformat_argb4444; - else if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) - return &_mesa_texformat_argb1555; - else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || - (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) || - (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8)) - return &_mesa_texformat_rgba8888_rev; - else - return &_mesa_texformat_argb8888; - - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return &_mesa_texformat_argb8888; - - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - /* Broadwater doesn't support RGB888 textures, so these must be - * stored as ARGB. - */ - return &_mesa_texformat_argb8888; - - case 3: - case GL_COMPRESSED_RGB: - case GL_RGB: - if (srcFormat == GL_RGB && - srcType == GL_UNSIGNED_SHORT_5_6_5) - return &_mesa_texformat_rgb565; - else - return &_mesa_texformat_argb8888; - - - case GL_RGB5: - case GL_RGB5_A1: - return &_mesa_texformat_argb1555; - - case GL_R3_G3_B2: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB4: - return &_mesa_texformat_argb4444; - - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; - - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; - - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; - - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; - - case GL_YCBCR_MESA: - if (srcType == GL_UNSIGNED_SHORT_8_8_MESA || - srcType == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; - else - return &_mesa_texformat_ycbcr_rev; - - case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; - case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; - - case GL_RGB_S3TC: - case GL_RGB4_S3TC: - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; - - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; - - case GL_RGBA_S3TC: - case GL_RGBA4_S3TC: - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; - - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; - - case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT16: - case GL_DEPTH_COMPONENT24: - case GL_DEPTH_COMPONENT32: - return &_mesa_texformat_z16; - - case GL_SRGB_EXT: - case GL_SRGB8_EXT: - case GL_SRGB_ALPHA_EXT: - case GL_SRGB8_ALPHA8_EXT: - case GL_SLUMINANCE_EXT: - case GL_SLUMINANCE8_EXT: - case GL_SLUMINANCE_ALPHA_EXT: - case GL_SLUMINANCE8_ALPHA8_EXT: - case GL_COMPRESSED_SRGB_EXT: - case GL_COMPRESSED_SRGB_ALPHA_EXT: - case GL_COMPRESSED_SLUMINANCE_EXT: - case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - return &_mesa_texformat_srgba8; - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return &_mesa_texformat_srgb_dxt1; - - default: - fprintf(stderr, "unexpected texture format %s in %s\n", - _mesa_lookup_enum_by_nr(internalFormat), - __FUNCTION__); - return NULL; - } - - return NULL; /* never get here */ -} - - -void brwInitTextureFuncs( struct dd_function_table *functions ) -{ - functions->ChooseTextureFormat = brwChooseTextureFormat; -} - void brw_FrameBufferTexInit( struct brw_context *brw ) { struct intel_context *intel = &brw->intel; diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index e306c9cf106..d9e88962521 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -37,6 +37,8 @@ #include "intel_tex_layout.h" #include "macros.h" +#define FILE_DEBUG_FLAG DEBUG_MIPTREE + GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt ) { /* XXX: these vary depending on image format: diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 1f7158f7a78..6bafa44b82b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -810,6 +810,7 @@ static void emit_kil( struct brw_wm_compile *c, brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0[i], brw_imm_f(0)); brw_set_predicate_control_flag_value(p, 0xff); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_AND(p, r0uw, brw_flag_reg(), r0uw); brw_pop_insn_state(p); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 4b273fefe92..e738086fefb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -324,6 +324,20 @@ static void emit_fb_write(struct brw_wm_compile *c, nr += 8; brw_pop_insn_state(p); } + + if (c->key.source_depth_to_render_target) + { + if (c->key.computes_depth) { + src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1); + brw_MOV(p, brw_message_reg(nr), src0); + } else { + src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + brw_MOV(p, brw_message_reg(nr), src0); + } + + nr += 2; + } + fire_fb_write(c, 0, nr); } diff --git a/src/mesa/drivers/dri/i965/bufmgr.h b/src/mesa/drivers/dri/i965/bufmgr.h index b31c2e6d9bc..c7051b963f6 100644 --- a/src/mesa/drivers/dri/i965/bufmgr.h +++ b/src/mesa/drivers/dri/i965/bufmgr.h @@ -183,9 +183,4 @@ void bmFinishFenceLock( struct intel_context *, unsigned fence ); void bm_fake_NotifyContendedLockTake( struct intel_context * ); -extern int INTEL_DEBUG; -#define DEBUG_BUFMGR 0x10000000 - -#define DBG(...) do { if (INTEL_DEBUG & DEBUG_BUFMGR) _mesa_printf(__VA_ARGS__); } while(0) - #endif diff --git a/src/mesa/drivers/dri/i965/bufmgr_fake.c b/src/mesa/drivers/dri/i965/bufmgr_fake.c index 65760c40d47..4315b272e47 100644 --- a/src/mesa/drivers/dri/i965/bufmgr_fake.c +++ b/src/mesa/drivers/dri/i965/bufmgr_fake.c @@ -50,6 +50,7 @@ #define BM_NO_BACKING_STORE 0x2000 #define BM_NO_FENCE_SUBDATA 0x4000 +#define FILE_DEBUG_FLAG DEBUG_BUFMGR static int check_fenced( struct intel_context *intel ); diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 7a6293b5578..ce0d4402b4c 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -31,6 +31,7 @@ #include "intel_decode.h" #include "bufmgr.h" +#define FILE_DEBUG_FLAG DEBUG_BATCH static void intel_batchbuffer_reset( struct intel_batchbuffer *batch ) { diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index 31fe20fb2ad..374022e64af 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -43,8 +43,7 @@ #include "bufmgr.h" - - +#define FILE_DEBUG_FLAG DEBUG_BLIT /* * Copy the back buffer to the front buffer. diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 49431b2a0b2..b825078761b 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -239,6 +239,9 @@ static const struct dri_debug_control debug_control[] = { "wm", DEBUG_WM }, { "vs", DEBUG_VS }, { "bat", DEBUG_BATCH }, + { "blit", DEBUG_BLIT}, + { "mip", DEBUG_MIPTREE}, + { "reg", DEBUG_REGION}, { NULL, 0 } }; @@ -644,7 +647,10 @@ static void intelContendedLock( struct intel_context *intel, GLuint flags ) /* Lost context? */ if (sarea->ctxOwner != me) { - DBG("Lost Context: sarea->ctxOwner %x me %x\n", sarea->ctxOwner, me); + if (INTEL_DEBUG & DEBUG_BUFMGR) { + fprintf(stderr, "Lost Context: sarea->ctxOwner %x me %x\n", + sarea->ctxOwner, me); + } sarea->ctxOwner = me; intel->vtbl.lost_hardware( intel ); } @@ -653,7 +659,10 @@ static void intelContendedLock( struct intel_context *intel, GLuint flags ) * between contexts which all share a local buffer manager. */ if (sarea->texAge != my_bufmgr) { - DBG("Lost Textures: sarea->texAge %x my_bufmgr %x\n", sarea->ctxOwner, my_bufmgr); + if (INTEL_DEBUG & DEBUG_BUFMGR) { + fprintf(stderr, "Lost Textures: sarea->texAge %x my_bufmgr %x\n", + sarea->ctxOwner, my_bufmgr); + } sarea->texAge = my_bufmgr; bm_fake_NotifyContendedLockTake( intel ); } diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index 5848d0c1ba0..fa35f3fbe57 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -353,6 +353,15 @@ extern int INTEL_DEBUG; #define DEBUG_URB 0x20000 #define DEBUG_VS 0x40000 #define DEBUG_BATCH 0x80000 +#define DEBUG_BUFMGR 0x100000 +#define DEBUG_BLIT 0x200000 +#define DEBUG_REGION 0x400000 +#define DEBUG_MIPTREE 0x800000 + +#define DBG(...) do { \ + if (INTEL_DEBUG & FILE_DEBUG_FLAG) \ + _mesa_printf(__VA_ARGS__); \ +} while(0) /* ================================================================ * intel_context.c: diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 268a982a97f..09c85101888 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -32,6 +32,8 @@ #include "enums.h" #include "imports.h" +#define FILE_DEBUG_FLAG DEBUG_MIPTREE + static GLenum target_to_target( GLenum target ) { switch (target) { diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c index 3bdf2fb4790..dc2e266a3d7 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c @@ -40,6 +40,7 @@ #include "intel_blit.h" #include "intel_regions.h" +#define FILE_DEBUG_FLAG DEBUG_PIXEL static struct intel_region * copypix_src_region(struct intel_context *intel, GLenum type) diff --git a/src/mesa/drivers/dri/i965/intel_regions.c b/src/mesa/drivers/dri/i965/intel_regions.c index b78eba898ff..9c92ab47775 100644 --- a/src/mesa/drivers/dri/i965/intel_regions.c +++ b/src/mesa/drivers/dri/i965/intel_regions.c @@ -45,6 +45,8 @@ #include "bufmgr.h" #include "imports.h" +#define FILE_DEBUG_FLAG DEBUG_REGION + /* XXX: Thread safety? */ GLubyte *intel_region_map(struct intel_context *intel, struct intel_region *region) diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c index 4523969bfa5..e98e9bbfc46 100644 --- a/src/mesa/drivers/dri/i965/intel_tex.c +++ b/src/mesa/drivers/dri/i965/intel_tex.c @@ -289,6 +289,7 @@ intel_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) void intelInitTextureFuncs( struct dd_function_table *functions ) { functions->NewTextureObject = intelNewTextureObject; + functions->ChooseTextureFormat = intelChooseTextureFormat; functions->TexImage1D = intelTexImage1D; functions->TexImage2D = intelTexImage2D; functions->TexImage3D = intelTexImage3D; diff --git a/src/mesa/drivers/dri/i965/intel_tex.h b/src/mesa/drivers/dri/i965/intel_tex.h index e389d521461..d38325d5384 100644 --- a/src/mesa/drivers/dri/i965/intel_tex.h +++ b/src/mesa/drivers/dri/i965/intel_tex.h @@ -34,9 +34,14 @@ void intelInitTextureFuncs( struct dd_function_table *functions ); +const struct gl_texture_format *intelChooseTextureFormat(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type); GLuint intel_finalize_mipmap_tree( struct intel_context *intel, struct gl_texture_object *tObj ); +int intel_compressed_num_bytes(GLuint mesaFormat); #endif diff --git a/src/mesa/drivers/dri/i965/intel_tex_format.c b/src/mesa/drivers/dri/i965/intel_tex_format.c new file mode 120000 index 00000000000..3415f754705 --- /dev/null +++ b/src/mesa/drivers/dri/i965/intel_tex_format.c @@ -0,0 +1 @@ +../intel/intel_tex_format.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c b/src/mesa/drivers/dri/i965/intel_tex_validate.c index 8c05e7cdabc..bd59c84dbdd 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_validate.c +++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c @@ -122,30 +122,6 @@ static void intel_texture_invalidate_cb( struct intel_context *intel, intel_texture_invalidate( (struct intel_texture_object *) ptr ); } -#include "texformat.h" -static GLuint intel_compressed_num_bytes(GLenum mesaFormat) -{ - GLuint bytes = 0; - - switch (mesaFormat) { - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - bytes = 2; - break; - - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: - bytes = 4; - - default: - break; - } - - return bytes; -} - /* */ GLuint intel_finalize_mipmap_tree( struct intel_context *intel, diff --git a/src/mesa/drivers/dri/i965/server/intel_dri.c b/src/mesa/drivers/dri/i965/server/intel_dri.c index a2043afb47a..effdd26448a 120000 --- a/src/mesa/drivers/dri/i965/server/intel_dri.c +++ b/src/mesa/drivers/dri/i965/server/intel_dri.c @@ -1 +1 @@ -../intel/server/intel_dri.c
\ No newline at end of file +../../intel/server/intel_dri.c
\ No newline at end of file |