Fix writemasks on texture arb fp instructions.

Cleanup invarient state emission.
This commit is contained in:
Alan Hourihane
2006-08-18 09:04:48 +00:00
parent c1c282f36a
commit bd87c303e9
11 changed files with 65 additions and 39 deletions

View File

@@ -39,6 +39,7 @@
#define I830_UPLOAD_CTX 0x1
#define I830_UPLOAD_BUFFERS 0x2
#define I830_UPLOAD_STIPPLE 0x4
#define I830_UPLOAD_INVARIENT 0x8
#define I830_UPLOAD_TEX(i) (0x10<<(i))
#define I830_UPLOAD_TEXBLEND(i) (0x100<<(i))
#define I830_UPLOAD_TEX_ALL (0x0f0)

View File

@@ -40,7 +40,8 @@
/* A large amount of state doesn't need to be uploaded.
*/
#define ACTIVE (I830_UPLOAD_TEXBLEND(0) | \
#define ACTIVE (I830_UPLOAD_INVARIENT | \
I830_UPLOAD_TEXBLEND(0) | \
I830_UPLOAD_STIPPLE | \
I830_UPLOAD_CTX | \
I830_UPLOAD_BUFFERS | \

View File

@@ -264,7 +264,7 @@ static void i830_emit_invarient_state( intelContextPtr intel )
{
BATCH_LOCALS;
BEGIN_BATCH( 200 );
BEGIN_BATCH( 40 );
OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(0));
OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(1));
@@ -370,6 +370,9 @@ static GLuint get_state_size( struct i830_hw_state *state )
GLuint sz = 0;
GLuint i;
if (dirty & I830_UPLOAD_INVARIENT)
sz += 40 * sizeof(int);
if (dirty & I830_UPLOAD_CTX)
sz += sizeof(state->Ctx);
@@ -408,6 +411,11 @@ static void i830_emit_state( intelContextPtr intel )
counter = intel->batch.counter;
}
if (dirty & I830_UPLOAD_INVARIENT) {
if (VERBOSE) fprintf(stderr, "I830_UPLOAD_INVARIENT:\n");
i830_emit_invarient_state( intel );
}
if (dirty & I830_UPLOAD_CTX) {
if (VERBOSE) fprintf(stderr, "I830_UPLOAD_CTX:\n");
emit( i830, state->Ctx, sizeof(state->Ctx) );
@@ -514,7 +522,6 @@ void i830InitVtbl( i830ContextPtr i830 )
i830->intel.vtbl.clear_with_tris = i830ClearWithTris;
i830->intel.vtbl.rotate_window = i830RotateWindow;
i830->intel.vtbl.destroy = i830_destroy_context;
i830->intel.vtbl.emit_invarient_state = i830_emit_invarient_state;
i830->intel.vtbl.emit_state = i830_emit_state;
i830->intel.vtbl.lost_hardware = i830_lost_hardware;
i830->intel.vtbl.reduced_primitive_state = i830_reduced_primitive_state;

View File

@@ -45,6 +45,7 @@
#define I915_UPLOAD_PROGRAM 0x8
#define I915_UPLOAD_CONSTANTS 0x10
#define I915_UPLOAD_FOG 0x20
#define I915_UPLOAD_INVARIENT 0x40
#define I915_UPLOAD_TEX(i) (0x00010000<<(i))
#define I915_UPLOAD_TEX_ALL (0x00ff0000)
#define I915_UPLOAD_TEX_0_SHIFT 16

View File

@@ -41,7 +41,8 @@
/* A large amount of state doesn't need to be uploaded.
*/
#define ACTIVE (I915_UPLOAD_PROGRAM | \
#define ACTIVE (I915_UPLOAD_INVARIENT | \
I915_UPLOAD_PROGRAM | \
I915_UPLOAD_STIPPLE | \
I915_UPLOAD_CTX | \
I915_UPLOAD_BUFFERS | \

View File

@@ -201,6 +201,24 @@ GLuint i915_emit_texld( struct i915_fragment_program *p,
GLuint coord,
GLuint op )
{
if (coord != UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord))) {
/* No real way to work around this in the general case - need to
* allocate and declare a new temporary register (a utemp won't
* do). Will fallback for now.
*/
i915_program_error(p, "Can't (yet) swizzle TEX arguments");
return 0;
}
/* Don't worry about saturate as we only support
*/
if (destmask != A0_DEST_CHANNEL_ALL) {
GLuint tmp = i915_get_utemp(p);
i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op );
i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 );
return dest;
}
else {
assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
@@ -210,7 +228,6 @@ GLuint i915_emit_texld( struct i915_fragment_program *p,
*(p->csr++) = (op |
T0_DEST( dest ) |
destmask |
T0_SAMPLER( sampler ));
*(p->csr++) = T1_ADDRESS_REG( coord );
@@ -219,6 +236,7 @@ GLuint i915_emit_texld( struct i915_fragment_program *p,
p->nr_tex_insn++;
return dest;
}
}
GLuint i915_emit_const1f( struct i915_fragment_program *p, GLfloat c0 )

View File

@@ -921,7 +921,8 @@ static void i915_init_packets( i915ContextPtr i915 )
i915->state.active = (I915_UPLOAD_PROGRAM |
I915_UPLOAD_STIPPLE |
I915_UPLOAD_CTX |
I915_UPLOAD_BUFFERS);
I915_UPLOAD_BUFFERS |
I915_UPLOAD_INVARIENT);
}
void i915InitStateFunctions( struct dd_function_table *functions )

View File

@@ -136,7 +136,7 @@ static void i915_emit_invarient_state( intelContextPtr intel )
{
BATCH_LOCALS;
BEGIN_BATCH( 200 );
BEGIN_BATCH( 20 );
OUT_BATCH(_3DSTATE_AA_CMD |
AA_LINE_ECAAR_WIDTH_ENABLE |
@@ -235,6 +235,9 @@ static GLuint get_state_size( struct i915_hw_state *state )
GLuint i;
GLuint sz = 0;
if (dirty & I915_UPLOAD_INVARIENT)
sz += 20 * sizeof(int);
if (dirty & I915_UPLOAD_CTX)
sz += sizeof(state->Ctx);
@@ -286,6 +289,11 @@ static void i915_emit_state( intelContextPtr intel )
if (VERBOSE)
fprintf(stderr, "%s dirty: %x\n", __FUNCTION__, dirty);
if (dirty & I915_UPLOAD_INVARIENT) {
if (VERBOSE) fprintf(stderr, "I915_UPLOAD_INVARIENT:\n");
i915_emit_invarient_state( intel );
}
if (dirty & I915_UPLOAD_CTX) {
if (VERBOSE) fprintf(stderr, "I915_UPLOAD_CTX:\n");
emit( i915, state->Ctx, sizeof(state->Ctx) );
@@ -439,7 +447,6 @@ void i915InitVtbl( i915ContextPtr i915 )
i915->intel.vtbl.clear_with_tris = i915ClearWithTris;
i915->intel.vtbl.rotate_window = i915RotateWindow;
i915->intel.vtbl.destroy = i915_destroy_context;
i915->intel.vtbl.emit_invarient_state = i915_emit_invarient_state;
i915->intel.vtbl.emit_state = i915_emit_state;
i915->intel.vtbl.lost_hardware = i915_lost_hardware;
i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state;

View File

@@ -384,8 +384,8 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv,
intelFlush( &intel->ctx );
LOCK_HARDWARE( intel );
intelWaitForFrameCompletion( intel );
LOCK_HARDWARE( intel );
if (!rect)
{

View File

@@ -279,16 +279,6 @@ void intelInitDriverFunctions( struct dd_function_table *functions )
static void intel_emit_invarient_state( GLcontext *ctx )
{
intelContextPtr intel = INTEL_CONTEXT(ctx);
intel->vtbl.emit_invarient_state( intel );
intel->prim.flush = 0;
/* Make sure this gets to the hardware, even if we have no cliprects:
*/
LOCK_HARDWARE( intel );
intelFlushBatchLocked( intel, GL_TRUE, GL_FALSE, GL_TRUE );
UNLOCK_HARDWARE( intel );
}

View File

@@ -107,7 +107,6 @@ struct intel_context
struct {
void (*destroy)( intelContextPtr intel );
void (*emit_state)( intelContextPtr intel );
void (*emit_invarient_state)( intelContextPtr intel );
void (*lost_hardware)( intelContextPtr intel );
void (*update_texture_state)( intelContextPtr intel );