diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2007-03-13 18:29:05 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2007-03-13 18:29:05 +0000 |
commit | 06b53cde4217b326db5ba3ecee1871c7c5c6751d (patch) | |
tree | d9a1bb59dff663bf385236e929961dd596e55feb | |
parent | 402ff99f15bd36e8454a1e3eea9d0085fe3154af (diff) |
trivial/tri.c works
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_state.c | 64 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_state.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_state_fp.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_state_fp_inputs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_batchbuffer.h | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_buffers.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_context.c | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_context.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_state.c | 28 |
10 files changed, 80 insertions, 86 deletions
diff --git a/src/mesa/drivers/dri/i915tex/i915_context.h b/src/mesa/drivers/dri/i915tex/i915_context.h index 68530d7d5d..2af65a1151 100644 --- a/src/mesa/drivers/dri/i915tex/i915_context.h +++ b/src/mesa/drivers/dri/i915tex/i915_context.h @@ -38,7 +38,6 @@ #define I915_NEW_INPUT_SIZES (INTEL_NEW_DRIVER0<<0) #define I915_NEW_VERTEX_FORMAT (INTEL_NEW_DRIVER0<<1) -#define I915_NEW_FRAGMENT_PROGRAM (INTEL_NEW_DRIVER0<<2) diff --git a/src/mesa/drivers/dri/i915tex/i915_state.c b/src/mesa/drivers/dri/i915tex/i915_state.c index 4c02ec2858..f16c0aa003 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state.c +++ b/src/mesa/drivers/dri/i915tex/i915_state.c @@ -28,57 +28,14 @@ #include "glheader.h" #include "context.h" -#include "macros.h" -#include "enums.h" -#include "dd.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" - -#include "texmem.h" - -#include "intel_fbo.h" -#include "intel_screen.h" -#include "intel_batchbuffer.h" +#include "intel_state.h" #include "i915_context.h" -#include "i915_reg.h" +#include "i915_state.h" #define FILE_DEBUG_FLAG DEBUG_STATE - -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - 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 (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 NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(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. - - **********************************************************************/ - /* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - */ -#include "intel_context.h" -#include "i915_state.h" /* This is used to initialize intel->state.atoms[]. We could use this * list directly except for a single atom, i915_constants, which @@ -91,11 +48,15 @@ const struct intel_tracked_state *atoms[] = &i915_check_fallback, &i915_invarient_state, + + &intel_update_viewport, + &intel_update_render_index, + /* */ /* &i915_fp_choose_prog, */ - /* Scan VB: Or scan VP ?? + /* Scan VB: */ /* &i915_vb_output_sizes, */ @@ -110,15 +71,17 @@ const struct intel_tracked_state *atoms[] = /* Calculate vertex format, program t_vertex.c, etc: */ - &i915_fp_inputs, + &i915_vertex_format, /* Immediate state. Don't make any effort to combine packets yet. */ - &i915_upload_S0S1, + &i915_upload_MODES4, &i915_upload_S2S4, &i915_upload_S5, &i915_upload_S6, + &i915_upload_IAB, + &i915_upload_BLENDCOLOR, /* Other state. This will eventually be able to emit itself either * to the batchbuffer directly, or as indirect state. Indirect @@ -128,10 +91,7 @@ const struct intel_tracked_state *atoms[] = &i915_upload_maps, /* must do before samplers */ &i915_upload_samplers, - &i915_upload_MODES4, &i915_upload_BFO, - &i915_upload_BLENDCOLOR, - &i915_upload_IAB, &i915_upload_buffers, @@ -141,6 +101,8 @@ const struct intel_tracked_state *atoms[] = &i915_upload_scissor, + &i915_upload_S0S1, + NULL, /* i915_constants */ }; diff --git a/src/mesa/drivers/dri/i915tex/i915_state.h b/src/mesa/drivers/dri/i915tex/i915_state.h index e4f26674a8..4b9012566a 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state.h +++ b/src/mesa/drivers/dri/i915tex/i915_state.h @@ -42,7 +42,7 @@ void i915_destroy_state( struct i915_context *i915 ); const struct intel_tracked_state i915_check_fallback; const struct intel_tracked_state i915_fp_upload_constants; const struct intel_tracked_state i915_fp_compile_and_upload; -const struct intel_tracked_state i915_fp_inputs; +const struct intel_tracked_state i915_vertex_format; const struct intel_tracked_state i915_invarient_state; const struct intel_tracked_state i915_upload_BFO; const struct intel_tracked_state i915_upload_BLENDCOLOR; diff --git a/src/mesa/drivers/dri/i915tex/i915_state_fp.c b/src/mesa/drivers/dri/i915tex/i915_state_fp.c index 2b9b2e0b9d..a74ed02ace 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state_fp.c +++ b/src/mesa/drivers/dri/i915tex/i915_state_fp.c @@ -49,8 +49,16 @@ static void i915_upload_fp( struct intel_context *intel ) struct i915_fragment_program *fp = i915->fragment_program; GLuint i; - assert (&i915->fragment_program->Base == intel->state.FragmentProgram->_Current); + if (&fp->Base != intel->state.FragmentProgram->_Current) { + i915->fragment_program = (struct i915_fragment_program *) + intel->state.FragmentProgram->_Current; + fp = i915->fragment_program; + /* This is stupid + */ + intel->state.dirty.intel |= INTEL_NEW_FRAGMENT_PROGRAM; + } + /* As the compiled program depends only on the original program * text (??? for now at least ???), there is no need for a compiled * program cache, just store the compiled version with the original diff --git a/src/mesa/drivers/dri/i915tex/i915_state_fp_inputs.c b/src/mesa/drivers/dri/i915tex/i915_state_fp_inputs.c index 65dc10ec28..b3084c9df1 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state_fp_inputs.c +++ b/src/mesa/drivers/dri/i915tex/i915_state_fp_inputs.c @@ -195,7 +195,7 @@ static void i915_calculate_vertex_format( struct intel_context *intel ) const struct intel_tracked_state i915_vertex_format = { .dirty = { .mesa = 0, - .intel = (I915_NEW_FRAGMENT_PROGRAM + .intel = (INTEL_NEW_FRAGMENT_PROGRAM /* | INTEL_NEW_VB_OUTPUT_SIZES */ ), .extra = 0 diff --git a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h index 84c3e83ba9..2be573320c 100644 --- a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h @@ -112,22 +112,30 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch, #define BEGIN_BATCH(n, flags) do { \ assert(!intel->prim.flush); \ intel_batchbuffer_require_space(intel->batch, (n)*4, flags); \ + _mesa_printf("BEGIN_BATCH(%d,%d) in %s\n", n, flags, __FUNCTION__); \ } while (0) -#define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d) +#define OUT_BATCH(d) do { \ + _mesa_printf("OUT_BATCH(0x%08x)\n", d); \ + intel_batchbuffer_emit_dword(intel->batch, d); \ +} while (0) #define OUT_BATCH_F(fl) do { \ fi_type fi; \ fi.f = fl; \ + _mesa_printf("OUT_BATCH_F(%f)\n", fl); \ intel_batchbuffer_emit_dword(intel->batch, fi.i); \ } while (0) -#define OUT_RELOC(buf,flags,mask,delta) do { \ - assert((delta) >= 0); \ +#define OUT_RELOC(buf,flags,mask,delta) do { \ + assert((delta) >= 0); \ + _mesa_printf("OUT_RELOC( buf %p offset %x )\n", buf, delta); \ intel_batchbuffer_emit_reloc(intel->batch, buf, flags, mask, delta); \ } while (0) -#define ADVANCE_BATCH() do { } while(0) +#define ADVANCE_BATCH() do { \ + _mesa_printf("ADVANCE_BATCH()\n"); \ +} while(0) #endif diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c index 039632fcce..a3f52f6752 100644 --- a/src/mesa/drivers/dri/i915tex/intel_buffers.c +++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c @@ -573,6 +573,20 @@ intelClear(GLcontext *ctx, GLbitfield mask) } } + { + const GLfloat *color = intel->ctx.Color.ClearColor; + GLubyte clear[4]; + + CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); + + /* compute both 32 and 16-bit clear values */ + intel->ClearColor8888 = INTEL_PACKCOLOR8888(clear[0], clear[1], + clear[2], clear[3]); + intel->ClearColor565 = INTEL_PACKCOLOR565(clear[0], clear[1], clear[2]); + } intelFlush(ctx); /* XXX intelClearWithBlit also does this */ diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c index 2ae59083ca..f2c009b75c 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/src/mesa/drivers/dri/i915tex/intel_context.c @@ -60,6 +60,7 @@ #include "intel_buffer_objects.h" #include "intel_fbo.h" #include "intel_metaops.h" +#include "intel_state.h" #include "vblank.h" #include "utils.h" @@ -349,28 +350,6 @@ intelInitDriverFunctions(struct dd_function_table *functions) } -static void intel_attribs_init( struct intel_context *intel ) -{ - GLcontext *ctx = &intel->ctx; - - intel->state.Color = &ctx->Color; - intel->state.Depth = &ctx->Depth; - intel->state.Fog = &ctx->Fog; - intel->state.Hint = &ctx->Hint; - intel->state.Light = &ctx->Light; - intel->state.Line = &ctx->Line; - intel->state.Point = &ctx->Point; - intel->state.Polygon = &ctx->Polygon; - intel->state.Scissor = &ctx->Scissor; - intel->state.Stencil = &ctx->Stencil; - intel->state.Texture = &ctx->Texture; - intel->state.Transform = &ctx->Transform; - intel->state.Viewport = &ctx->Viewport; - intel->state.VertexProgram = &ctx->VertexProgram; - intel->state.FragmentProgram = &ctx->FragmentProgram; - intel->state.PolygonStipple = &ctx->PolygonStipple[0]; -} - GLboolean intelInitContext(struct intel_context *intel, @@ -502,7 +481,7 @@ intelInitContext(struct intel_context *intel, intel_bufferobj_init(intel); intel_fbo_init(intel); - intel_attribs_init(intel); + intel_state_init(intel); intel_metaops_init(intel); intel_idx_init(intel); diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h index 4d85606763..5486f63a1d 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.h +++ b/src/mesa/drivers/dri/i915tex/intel_context.h @@ -422,10 +422,6 @@ extern void intelInitDriverFunctions(struct dd_function_table *functions); void intel_lost_hardware( struct intel_context *intel ); -/* ================================================================ - * intel_state.c: - */ -extern void intel_emit_state( struct intel_context *intel ); /*====================================================================== * Inline conversion functions. diff --git a/src/mesa/drivers/dri/i915tex/intel_state.c b/src/mesa/drivers/dri/i915tex/intel_state.c index 176dc598c0..573c6bdc16 100644 --- a/src/mesa/drivers/dri/i915tex/intel_state.c +++ b/src/mesa/drivers/dri/i915tex/intel_state.c @@ -80,6 +80,12 @@ void intel_emit_state( struct intel_context *intel ) if (state->intel == 0) return; + if (!intel->metaops.active) { + intel->state.DrawBuffer = intel->ctx.DrawBuffer; + intel->state.ReadBuffer = intel->ctx.ReadBuffer; + intel->state.RenderMode = intel->ctx.RenderMode; + intel->state._ColorDrawBufferMask0 = intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]; + } if (INTEL_DEBUG) { /* Debug version which enforces various sanity checks on the @@ -127,3 +133,25 @@ void intel_emit_state( struct intel_context *intel ) } + +void intel_state_init( struct intel_context *intel ) +{ + GLcontext *ctx = &intel->ctx; + + intel->state.Color = &ctx->Color; + intel->state.Depth = &ctx->Depth; + intel->state.Fog = &ctx->Fog; + intel->state.Hint = &ctx->Hint; + intel->state.Light = &ctx->Light; + intel->state.Line = &ctx->Line; + intel->state.Point = &ctx->Point; + intel->state.Polygon = &ctx->Polygon; + intel->state.Scissor = &ctx->Scissor; + intel->state.Stencil = &ctx->Stencil; + intel->state.Texture = &ctx->Texture; + intel->state.Transform = &ctx->Transform; + intel->state.Viewport = &ctx->Viewport; + intel->state.VertexProgram = &ctx->VertexProgram; + intel->state.FragmentProgram = &ctx->FragmentProgram; + intel->state.PolygonStipple = &ctx->PolygonStipple[0]; +} |