summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/Makefile1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h22
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c72
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.h16
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_current.c103
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_fallback.c346
-rw-r--r--src/mesa/drivers/dri/i965/brw_metaops.c69
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_constval.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_tnl.c40
-rw-r--r--src/mesa/drivers/dri/i965/brw_vtbl.c10
15 files changed, 98 insertions, 612 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile
index 8ec422509fe..02fb93486e4 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -34,7 +34,6 @@ DRIVER_SOURCES = \
brw_context.c \
brw_curbe.c \
brw_draw.c \
- brw_draw_current.c \
brw_draw_upload.c \
brw_eu.c \
brw_eu_debug.c \
diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h
index c3967c8c614..49b2770a514 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.h
+++ b/src/mesa/drivers/dri/i965/brw_clip.h
@@ -116,7 +116,7 @@ struct brw_clip_compile {
GLuint last_mrf;
GLuint header_position_offset;
- GLuint offset[BRW_ATTRIB_MAX];
+ GLuint offset[VERT_ATTRIB_MAX];
};
#define ATTR_SIZE (4*4)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index b9256d5185e..263110bf5e0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -34,8 +34,6 @@
#include "brw_aub.h"
#include "brw_defines.h"
#include "brw_draw.h"
-#include "brw_exec.h"
-#include "brw_save.h"
#include "brw_vs.h"
#include "imports.h"
#include "intel_tex.h"
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index e2279ca276b..0a61926ee84 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -214,7 +214,7 @@ struct brw_vs_prog_data {
GLuint total_grf;
GLuint outputs_written;
- GLuint64EXT inputs_read;
+ GLuint inputs_read;
/* Used for calculating urb partitions:
*/
@@ -381,10 +381,10 @@ struct brw_cached_batch_item {
-/* Protect against a future where BRW_ATTRIB_MAX > 32. Wouldn't life
+/* Protect against a future where VERT_ATTRIB_MAX > 32. Wouldn't life
* be easier if C allowed arrays of packed elements?
*/
-#define ATTRIB_BIT_DWORDS ((BRW_ATTRIB_MAX+31)/32)
+#define ATTRIB_BIT_DWORDS ((VERT_ATTRIB_MAX+31)/32)
struct brw_vertex_element {
const struct gl_client_array *glarray;
@@ -400,8 +400,8 @@ struct brw_vertex_element {
struct brw_vertex_info {
- GLuint64EXT varying; /* varying:1[BRW_ATTRIB_MAX] */
- GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[BRW_ATTRIB_MAX] */
+ GLuint varying; /* varying:1[VERT_ATTRIB_MAX] */
+ GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */
};
@@ -448,14 +448,13 @@ struct brw_context
struct brw_cached_batch_item *cached_batch_items;
struct {
- /* Fallback values for inputs not supplied:
- */
- struct gl_client_array current_values[BRW_ATTRIB_MAX];
/* Arrays with buffer objects to copy non-bufferobj arrays into
* for upload:
*/
- struct gl_client_array vbo_array[BRW_ATTRIB_MAX];
+ struct gl_client_array vbo_array[VERT_ATTRIB_MAX];
+
+ struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
#define BRW_NR_UPLOAD_BUFS 17
#define BRW_UPLOAD_INIT_SIZE (128*1024)
@@ -468,11 +467,6 @@ struct brw_context
GLuint wrap;
} upload;
- /* Currenly bound arrays, including fallbacks to current_values
- * above:
- */
- struct brw_vertex_element inputs[BRW_ATTRIB_MAX];
-
/* Summary of size and varying of active arrays, so we can check
* for changes to this state:
*/
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 1bc39762bca..63cb079ec9a 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -35,7 +35,6 @@
#include "brw_draw.h"
#include "brw_defines.h"
-#include "brw_attrib.h"
#include "brw_context.h"
#include "brw_aub.h"
#include "brw_state.h"
@@ -45,7 +44,8 @@
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
-
+#include "tnl/tnl.h"
+#include "vbo/vbo_context.h"
@@ -143,7 +143,7 @@ static void brw_emit_cliprect( struct brw_context *brw,
static void brw_emit_prim( struct brw_context *brw,
- const struct vbo_prim *prim )
+ const struct _mesa_prim *prim )
{
struct brw_3d_primitive prim_packet;
@@ -170,34 +170,9 @@ static void brw_emit_prim( struct brw_context *brw,
}
}
-
-
-static void update_current_size( struct gl_client_array *array)
-{
- const GLfloat *ptr = (const GLfloat *)array->Ptr;
-
- assert(array->StrideB == 0);
- assert(array->Type == GL_FLOAT || array->Type == GL_UNSIGNED_BYTE);
-
- if (ptr[3] != 1.0)
- array->Size = 4;
- else if (ptr[2] != 0.0)
- array->Size = 3;
- else if (ptr[1] != 0.0)
- array->Size = 2;
- else
- array->Size = 1;
-}
-
-
-
-/* Fill in any gaps in passed arrays with pointers to current
- * attributes:
- */
static void brw_merge_inputs( struct brw_context *brw,
const struct gl_client_array *arrays[])
{
- struct gl_client_array *current_values = brw->vb.current_values;
struct brw_vertex_element *inputs = brw->vb.inputs;
struct brw_vertex_info old = brw->vb.info;
GLuint i;
@@ -205,17 +180,11 @@ static void brw_merge_inputs( struct brw_context *brw,
memset(inputs, 0, sizeof(*inputs));
memset(&brw->vb.info, 0, sizeof(brw->vb.info));
- for (i = 0; i < BRW_ATTRIB_MAX; i++) {
- if (arrays[i] && arrays[i]->Enabled)
- {
- brw->vb.inputs[i].glarray = arrays[i];
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ brw->vb.inputs[i].glarray = arrays[i];
+
+ if (arrays[i]->StrideB != 0)
brw->vb.info.varying |= 1 << i;
- }
- else
- {
- brw->vb.inputs[i].glarray = &current_values[i];
- update_current_size(&current_values[i]);
- }
brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2);
}
@@ -229,8 +198,9 @@ static void brw_merge_inputs( struct brw_context *brw,
brw->state.dirty.brw |= BRW_NEW_INPUT_VARYING;
}
+
static GLboolean check_fallbacks( struct brw_context *brw,
- const struct vbo_prim *prim,
+ const struct _mesa_prim *prim,
GLuint nr_prims )
{
GLuint i;
@@ -284,7 +254,7 @@ static GLboolean check_fallbacks( struct brw_context *brw,
static GLboolean brw_try_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
- const struct vbo_prim *prim,
+ const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
@@ -297,11 +267,11 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
if (ctx->NewState)
_mesa_update_state( ctx );
-
+
/* Bind all inputs, derive varying and size information:
*/
brw_merge_inputs( brw, arrays );
-
+
/* Have to validate state quite late. Will rebuild tnl_program,
* which depends on varying information.
*
@@ -318,10 +288,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
}
{
- assert(intel->locked);
-
-
-
/* Set the first primitive early, ahead of validate_state:
*/
brw_set_prim(brw, prim[0].mode);
@@ -413,7 +379,7 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
void brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
- const struct vbo_prim *prim,
+ const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
@@ -430,7 +396,7 @@ void brw_draw_prims( GLcontext *ctx,
* fragmented. Clear out all heaps and start from scratch by
* faking a contended lock event: (done elsewhere)
*/
- if (!retval && bmError(intel)) {
+ if (!retval && !intel->Fallback && bmError(intel)) {
DBG("retrying\n");
/* Then try a second time only to upload textures and draw the
* primitives:
@@ -443,9 +409,7 @@ void brw_draw_prims( GLcontext *ctx,
* swrast to do the drawing.
*/
if (!retval) {
- brw_fallback();
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
- brw_unfallback();
}
if (intel->aub_file && (INTEL_DEBUG & DEBUG_SYNC)) {
@@ -464,8 +428,13 @@ static void brw_invalidate_vbo_cb( struct intel_context *intel, void *ptr )
void brw_draw_init( struct brw_context *brw )
{
GLcontext *ctx = &brw->intel.ctx;
+ struct vbo_context *vbo = vbo_context(ctx);
GLuint i;
+ /* Register our drawing function:
+ */
+ vbo->draw_prims = brw_draw_prims;
+
brw->vb.upload.size = BRW_UPLOAD_INIT_SIZE;
for (i = 0; i < BRW_NR_UPLOAD_BUFS; i++) {
@@ -487,9 +456,6 @@ void brw_draw_init( struct brw_context *brw )
NULL,
GL_DYNAMIC_DRAW_ARB,
brw->vb.upload.vbo[0] );
-
-
- brw_init_current_values(ctx, brw->vb.current_values);
}
void brw_draw_destroy( struct brw_context *brw )
diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h
index b68cd861155..0f7b7383102 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.h
+++ b/src/mesa/drivers/dri/i965/brw_draw.h
@@ -29,18 +29,18 @@
#define BRW_DRAW_H
#include "mtypes.h" /* for GLcontext... */
-#include "brw_attrib.h"
+#include "vbo/vbo.h"
struct brw_context;
-GLboolean brw_draw_prims( GLcontext *ctx,
- const struct gl_client_array *arrays[],
- const struct vbo_prim *prims,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index );
+void brw_draw_prims( GLcontext *ctx,
+ const struct gl_client_array *arrays[],
+ const struct _mesa_prim *prims,
+ GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ GLuint min_index,
+ GLuint max_index );
void brw_draw_init( struct brw_context *brw );
void brw_draw_destroy( struct brw_context *brw );
diff --git a/src/mesa/drivers/dri/i965/brw_draw_current.c b/src/mesa/drivers/dri/i965/brw_draw_current.c
deleted file mode 100644
index 98d930738e5..00000000000
--- a/src/mesa/drivers/dri/i965/brw_draw_current.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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 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 TUNGSTEN GRAPHICS 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.
- *
- **************************************************************************/
-
-#include <stdlib.h>
-
-#include "glheader.h"
-#include "context.h"
-#include "state.h"
-#include "api_validate.h"
-#include "enums.h"
-
-#include "brw_context.h"
-#include "brw_draw.h"
-
-#include "bufmgr.h"
-#include "intel_buffer_objects.h"
-
-
-void brw_init_current_values(GLcontext *ctx,
- struct gl_client_array *arrays)
-{
- GLuint i;
-
- memset(arrays, 0, sizeof(*arrays) * BRW_ATTRIB_MAX);
-
- /* Set up a constant (StrideB == 0) array for each current
- * attribute:
- */
- for (i = 0; i < BRW_ATTRIB_MAX; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- switch (i) {
- case BRW_ATTRIB_MAT_FRONT_SHININESS:
- case BRW_ATTRIB_MAT_BACK_SHININESS:
- case BRW_ATTRIB_INDEX:
- case BRW_ATTRIB_EDGEFLAG:
- cl->Size = 1;
- break;
- case BRW_ATTRIB_MAT_FRONT_INDEXES:
- case BRW_ATTRIB_MAT_BACK_INDEXES:
- cl->Size = 3;
- break;
- default:
- /* This is fixed for the material attributes, for others will
- * be determined at runtime:
- */
- if (i >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
- cl->Size = 4;
- else
- cl->Size = 1;
- break;
- }
-
- switch (i) {
- case BRW_ATTRIB_EDGEFLAG:
- cl->Type = GL_UNSIGNED_BYTE;
- cl->Ptr = (const void *)&ctx->Current.EdgeFlag;
- break;
- case BRW_ATTRIB_INDEX:
- cl->Type = GL_FLOAT;
- cl->Ptr = (const void *)&ctx->Current.Index;
- break;
- default:
- cl->Type = GL_FLOAT;
- if (i < BRW_ATTRIB_FIRST_MATERIAL)
- cl->Ptr = (const void *)ctx->Current.Attrib[i];
- else
- cl->Ptr = (const void *)ctx->Light.Material.Attrib[i - BRW_ATTRIB_FIRST_MATERIAL];
- break;
- }
-
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->Flags = 0;
- cl->BufferObj = ctx->Array.NullBufferObj;
- }
-}
-
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 4d930c6c9e7..dfb598acdf6 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -35,7 +35,6 @@
#include "brw_draw.h"
#include "brw_defines.h"
-#include "brw_attrib.h"
#include "brw_context.h"
#include "brw_aub.h"
#include "brw_state.h"
@@ -337,7 +336,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
vbo_array->Enabled = 1;
vbo_array->Normalized = array->Normalized;
vbo_array->_MaxElement = array->_MaxElement; /* ? */
- vbo_array->Flags = array->Flags; /* ? */
vbo_array->BufferObj = vbo;
{
@@ -380,7 +378,6 @@ interleaved_vbo_array( struct brw_context *brw,
vbo_array->Enabled = 1;
vbo_array->Normalized = array->Normalized;
vbo_array->_MaxElement = array->_MaxElement;
- vbo_array->Flags = array->Flags; /* ? */
vbo_array->BufferObj = uploaded_array->BufferObj;
return vbo_array;
@@ -400,10 +397,10 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
const void *ptr = NULL;
GLuint interleave = 0;
- struct brw_vertex_element *enabled[BRW_ATTRIB_MAX];
+ struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
GLuint nr_enabled = 0;
- struct brw_vertex_element *upload[BRW_ATTRIB_MAX];
+ struct brw_vertex_element *upload[VERT_ATTRIB_MAX];
GLuint nr_uploads = 0;
@@ -568,7 +565,7 @@ static GLuint element_size( GLenum type )
static void rebase_indices_to_vbo_indices( struct brw_context *brw,
- const struct vbo_index_buffer *index_buffer,
+ const struct _mesa_index_buffer *index_buffer,
struct gl_buffer_object **vbo_return,
GLuint *offset_return )
{
@@ -642,7 +639,7 @@ static void rebase_indices_to_vbo_indices( struct brw_context *brw,
void brw_upload_indices( struct brw_context *brw,
- const struct vbo_index_buffer *index_buffer)
+ const struct _mesa_index_buffer *index_buffer)
{
struct intel_context *intel = &brw->intel;
GLuint ib_size = get_size(index_buffer->type) * index_buffer->count;
diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c
index aab30b6863e..86464b2ec5f 100644
--- a/src/mesa/drivers/dri/i965/brw_fallback.c
+++ b/src/mesa/drivers/dri/i965/brw_fallback.c
@@ -30,8 +30,6 @@
#include "tnl/tnl.h"
#include "context.h"
#include "brw_context.h"
-#include "brw_exec.h"
-#include "brw_save.h"
#include "brw_fallback.h"
#include "glheader.h"
@@ -40,294 +38,6 @@
#include "imports.h"
#include "macros.h"
#include "mtypes.h"
-#include "dispatch.h"
-
-
-typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
-
-
-/* Wrapper functions in case glVertexAttrib*fvNV doesn't exist */
-static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib2fvNV(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib3fvNV(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib4fvNV(ctx->Exec, (target, v));
-}
-
-static attr_func vert_attrfunc[4] = {
- VertexAttrib1fvNV,
- VertexAttrib2fvNV,
- VertexAttrib3fvNV,
- VertexAttrib4fvNV
-};
-
-#if 0
-static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib1fvARB(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib2fvARB(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib3fvARB(ctx->Exec, (target, v));
-}
-
-static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- CALL_VertexAttrib4fvARB(ctx->Exec, (target, v));
-}
-
-
-static attr_func vert_attrfunc_arb[4] = {
- VertexAttrib1fvARB,
- VertexAttrib2fvARB,
- VertexAttrib3fvARB,
- VertexAttrib4fvARB
-};
-#endif
-
-
-
-
-
-
-static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v )
-{
- switch (target) {
- case BRW_ATTRIB_MAT_FRONT_SHININESS:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SHININESS, v ));
- break;
- case BRW_ATTRIB_MAT_BACK_SHININESS:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SHININESS, v ));
- break;
- }
-}
-
-
-static void mat_attr3fv( GLcontext *ctx, GLint target, const GLfloat *v )
-{
- switch (target) {
- case BRW_ATTRIB_MAT_FRONT_INDEXES:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_COLOR_INDEXES, v ));
- break;
- case BRW_ATTRIB_MAT_BACK_INDEXES:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_COLOR_INDEXES, v ));
- break;
- }
-}
-
-
-static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v )
-{
- switch (target) {
- case BRW_ATTRIB_MAT_FRONT_EMISSION:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_EMISSION, v ));
- break;
- case BRW_ATTRIB_MAT_BACK_EMISSION:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_EMISSION, v ));
- break;
- case BRW_ATTRIB_MAT_FRONT_AMBIENT:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_AMBIENT, v ));
- break;
- case BRW_ATTRIB_MAT_BACK_AMBIENT:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_AMBIENT, v ));
- break;
- case BRW_ATTRIB_MAT_FRONT_DIFFUSE:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_DIFFUSE, v ));
- break;
- case BRW_ATTRIB_MAT_BACK_DIFFUSE:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_DIFFUSE, v ));
- break;
- case BRW_ATTRIB_MAT_FRONT_SPECULAR:
- CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SPECULAR, v ));
- break;
- case BRW_ATTRIB_MAT_BACK_SPECULAR:
- CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SPECULAR, v ));
- break;
- }
-}
-
-
-static attr_func mat_attrfunc[4] = {
- mat_attr1fv,
- NULL,
- mat_attr3fv,
- mat_attr4fv
-};
-
-
-static void index_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- (void) target;
- CALL_Indexf(ctx->Exec, (v[0]));
-}
-
-static void edgeflag_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
-{
- (void) target;
- CALL_EdgeFlag(ctx->Exec, ((GLboolean)(v[0] == 1.0)));
-}
-
-struct loopback_attr {
- GLint target;
- GLint sz;
- attr_func func;
-};
-
-/* Don't emit ends and begins on wrapped primitives. Don't replay
- * wrapped vertices. If we get here, it's probably because the the
- * precalculated wrapping is wrong.
- */
-static void loopback_prim( GLcontext *ctx,
- const GLfloat *buffer,
- const struct vbo_prim *prim,
- GLuint wrap_count,
- GLuint vertex_size,
- const struct loopback_attr *la, GLuint nr )
-{
- GLint start = prim->start;
- GLint end = start + prim->count;
- const GLfloat *data;
- GLint j;
- GLuint k;
-
- if (0)
- _mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
- _mesa_lookup_enum_by_nr(prim->mode),
- prim->begin ? "begin" : "..",
- prim->end ? "end" : "..",
- start,
- end);
-
- if (prim->begin) {
- CALL_Begin(GET_DISPATCH(), ( prim->mode ));
- }
- else {
- assert(start == 0);
- start += wrap_count;
- }
-
- data = buffer + start * vertex_size;
-
- for (j = start ; j < end ; j++) {
- const GLfloat *tmp = data + la[0].sz;
-
- for (k = 1 ; k < nr ; k++) {
- la[k].func( ctx, la[k].target, tmp );
- tmp += la[k].sz;
- }
-
- /* Fire the vertex
- */
- la[0].func( ctx, BRW_ATTRIB_POS, data );
- data = tmp;
- }
-
- if (prim->end) {
- CALL_End(GET_DISPATCH(), ());
- }
-}
-
-/* Primitives generated by DrawArrays/DrawElements/Rectf may be
- * caught here. If there is no primitive in progress, execute them
- * normally, otherwise need to track and discard the generated
- * primitives.
- */
-static void loopback_weak_prim( GLcontext *ctx,
- const struct vbo_prim *prim )
-{
- /* Use the prim_weak flag to ensure that if this primitive
- * wraps, we don't mistake future vertex_lists for part of the
- * surrounding primitive.
- *
- * While this flag is set, we are simply disposing of data
- * generated by an operation now known to be a noop.
- */
- if (prim->begin)
- ctx->Driver.CurrentExecPrimitive |= BRW_SAVE_PRIM_WEAK;
- if (prim->end)
- ctx->Driver.CurrentExecPrimitive &= ~BRW_SAVE_PRIM_WEAK;
-}
-
-
-void brw_loopback_vertex_list( GLcontext *ctx,
- const GLfloat *buffer,
- const GLubyte *attrsz,
- const struct vbo_prim *prim,
- GLuint prim_count,
- GLuint wrap_count,
- GLuint vertex_size)
-{
- struct loopback_attr la[BRW_ATTRIB_MAX];
- GLuint i, nr = 0;
-
- for (i = 0 ; i <= BRW_ATTRIB_TEX7 ; i++) {
- if (attrsz[i]) {
- la[nr].target = i;
- la[nr].sz = attrsz[i];
- la[nr].func = vert_attrfunc[attrsz[i]-1];
- nr++;
- }
- }
-
- for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ;
- i <= BRW_ATTRIB_MAT_BACK_INDEXES ;
- i++) {
- if (attrsz[i]) {
- la[nr].target = i;
- la[nr].sz = attrsz[i];
- la[nr].func = mat_attrfunc[attrsz[i]-1];
- nr++;
- }
- }
-
- if (attrsz[BRW_ATTRIB_EDGEFLAG]) {
- la[nr].target = BRW_ATTRIB_EDGEFLAG;
- la[nr].sz = attrsz[BRW_ATTRIB_EDGEFLAG];
- la[nr].func = edgeflag_attr1fv;
- nr++;
- }
-
- if (attrsz[BRW_ATTRIB_INDEX]) {
- la[nr].target = BRW_ATTRIB_INDEX;
- la[nr].sz = attrsz[BRW_ATTRIB_INDEX];
- la[nr].func = index_attr1fv;
- nr++;
- }
-
- /* XXX ARB vertex attribs */
-
- for (i = 0 ; i < prim_count ; i++) {
- if ((prim[i].mode & BRW_SAVE_PRIM_WEAK) &&
- (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END))
- {
- loopback_weak_prim( ctx, &prim[i] );
- }
- else
- {
- loopback_prim( ctx, buffer, &prim[i], wrap_count, vertex_size, la, nr );
- }
- }
-}
-
@@ -402,62 +112,6 @@ const struct brw_tracked_state brw_check_fallback = {
-/* If there is a fallback, fallback to software rasterization and
- * transformation together. There is never a requirement to have
- * software t&l but hardware rasterization.
- *
- * Further, all fallbacks are based on GL state, not on eg. primitive
- * or vertex data.
- */
-
-static void do_fallback( struct brw_context *brw,
- GLboolean fallback )
-{
- GLcontext *ctx = &brw->intel.ctx;
-
- /* flush:
- */
- ctx->Driver.Flush( ctx );
-
- if (fallback) {
- _swsetup_Wakeup( ctx );
- _tnl_wakeup_exec( ctx );
-
- /* Need this because tnl_wakeup_exec does too much:
- */
- brw_save_wakeup(ctx);
- brw_save_fallback(ctx, GL_TRUE);
- }
- else {
- /* Flush vertices and copy-to-current:
- */
- FLUSH_CURRENT(ctx, 0);
-
- _swrast_flush( ctx );
-
- brw_exec_wakeup(ctx);
-
- /* Need this because tnl_wakeup_exec does too much:
- */
- brw_save_wakeup(ctx);
- brw_save_fallback(ctx, GL_FALSE);
- }
-}
-
-
-void brw_fallback( GLcontext *ctx )
-{
- struct brw_context *brw = brw_context(ctx);
- do_fallback(brw, 1);
-}
-
-
-void brw_unfallback( GLcontext *ctx )
-{
- struct brw_context *brw = brw_context(ctx);
- do_fallback(brw, 0);
-}
-
/* Not used:
*/
void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode )
diff --git a/src/mesa/drivers/dri/i965/brw_metaops.c b/src/mesa/drivers/dri/i965/brw_metaops.c
index d8b6069cfcf..2d4c84f6128 100644
--- a/src/mesa/drivers/dri/i965/brw_metaops.c
+++ b/src/mesa/drivers/dri/i965/brw_metaops.c
@@ -46,7 +46,6 @@
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_draw.h"
-#include "brw_attrib.h"
#include "brw_fallback.h"
#define INIT(brw, STRUCT, ATTRIB) \
@@ -302,8 +301,8 @@ static void meta_draw_quad(struct intel_context *intel,
struct brw_context *brw = brw_context(&intel->ctx);
struct gl_client_array pos_array;
struct gl_client_array color_array;
- struct gl_client_array *attribs[BRW_ATTRIB_MAX];
- struct vbo_prim prim[1];
+ struct gl_client_array *attribs[VERT_ATTRIB_MAX];
+ struct _mesa_prim prim[1];
GLfloat pos[4][3];
GLubyte color[4];
@@ -353,29 +352,29 @@ static void meta_draw_quad(struct intel_context *intel,
/* Ignoring texture coords.
*/
- memset(attribs, 0, BRW_ATTRIB_MAX * sizeof(*attribs));
-
- attribs[BRW_ATTRIB_POS] = &pos_array;
- attribs[BRW_ATTRIB_POS]->Ptr = 0;
- attribs[BRW_ATTRIB_POS]->Type = GL_FLOAT;
- attribs[BRW_ATTRIB_POS]->Enabled = 1;
- attribs[BRW_ATTRIB_POS]->Size = 3;
- attribs[BRW_ATTRIB_POS]->StrideB = 3 * sizeof(GLfloat);
- attribs[BRW_ATTRIB_POS]->Stride = 3 * sizeof(GLfloat);
- attribs[BRW_ATTRIB_POS]->_MaxElement = 4;
- attribs[BRW_ATTRIB_POS]->Normalized = 0;
- attribs[BRW_ATTRIB_POS]->BufferObj = brw->metaops.vbo;
-
- attribs[BRW_ATTRIB_COLOR0] = &color_array;
- attribs[BRW_ATTRIB_COLOR0]->Ptr = (const GLubyte *)sizeof(pos);
- attribs[BRW_ATTRIB_COLOR0]->Type = GL_UNSIGNED_BYTE;
- attribs[BRW_ATTRIB_COLOR0]->Enabled = 1;
- attribs[BRW_ATTRIB_COLOR0]->Size = 4;
- attribs[BRW_ATTRIB_COLOR0]->StrideB = 0;
- attribs[BRW_ATTRIB_COLOR0]->Stride = 0;
- attribs[BRW_ATTRIB_COLOR0]->_MaxElement = 1;
- attribs[BRW_ATTRIB_COLOR0]->Normalized = 1;
- attribs[BRW_ATTRIB_COLOR0]->BufferObj = brw->metaops.vbo;
+ memset(attribs, 0, VERT_ATTRIB_MAX * sizeof(*attribs));
+
+ attribs[VERT_ATTRIB_POS] = &pos_array;
+ attribs[VERT_ATTRIB_POS]->Ptr = 0;
+ attribs[VERT_ATTRIB_POS]->Type = GL_FLOAT;
+ attribs[VERT_ATTRIB_POS]->Enabled = 1;
+ attribs[VERT_ATTRIB_POS]->Size = 3;
+ attribs[VERT_ATTRIB_POS]->StrideB = 3 * sizeof(GLfloat);
+ attribs[VERT_ATTRIB_POS]->Stride = 3 * sizeof(GLfloat);
+ attribs[VERT_ATTRIB_POS]->_MaxElement = 4;
+ attribs[VERT_ATTRIB_POS]->Normalized = 0;
+ attribs[VERT_ATTRIB_POS]->BufferObj = brw->metaops.vbo;
+
+ attribs[VERT_ATTRIB_COLOR0] = &color_array;
+ attribs[VERT_ATTRIB_COLOR0]->Ptr = (const GLubyte *)sizeof(pos);
+ attribs[VERT_ATTRIB_COLOR0]->Type = GL_UNSIGNED_BYTE;
+ attribs[VERT_ATTRIB_COLOR0]->Enabled = 1;
+ attribs[VERT_ATTRIB_COLOR0]->Size = 4;
+ attribs[VERT_ATTRIB_COLOR0]->StrideB = 0;
+ attribs[VERT_ATTRIB_COLOR0]->Stride = 0;
+ attribs[VERT_ATTRIB_COLOR0]->_MaxElement = 1;
+ attribs[VERT_ATTRIB_COLOR0]->Normalized = 1;
+ attribs[VERT_ATTRIB_COLOR0]->BufferObj = brw->metaops.vbo;
/* Just ignoring texture coordinates for now.
*/
@@ -390,18 +389,12 @@ static void meta_draw_quad(struct intel_context *intel,
prim[0].start = 0;
prim[0].count = 4;
- if (!brw_draw_prims(&brw->intel.ctx,
- (const struct gl_client_array **)attribs,
- prim, 1,
- NULL,
- 0,
- 4 ))
- {
- /* This should not be possible:
- */
- _mesa_printf("brw_draw_prims failed in metaops!\n");
- assert(0);
- }
+ brw_draw_prims(&brw->intel.ctx,
+ (const struct gl_client_array **)attribs,
+ prim, 1,
+ NULL,
+ 0,
+ 4 );
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index e5a28b96e32..74c9d88e464 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -54,12 +54,11 @@ static void do_vs_prog( struct brw_context *brw,
c.vp = vp;
c.prog_data.outputs_written = vp->program.Base.OutputsWritten;
- c.prog_data.inputs_read = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
- vp->program.Base.InputsRead);
+ c.prog_data.inputs_read = vp->program.Base.InputsRead;
if (c.key.copy_edgeflag) {
c.prog_data.outputs_written |= 1<<VERT_RESULT_EDGE;
- c.prog_data.inputs_read |= 1<<BRW_ATTRIB_EDGEFLAG;
+ c.prog_data.inputs_read |= 1<<VERT_ATTRIB_EDGEFLAG;
}
if (0)
diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c
index 502d8283970..528e164db8c 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_constval.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c
@@ -162,6 +162,7 @@ static GLuint get_input_size(struct brw_context *brw,
GLuint sizes_dword = brw->vb.info.sizes[attr/16];
GLuint sizes_bits = (sizes_dword>>((attr%16)*2)) & 0x3;
return sizes_bits + 1;
+/* return brw->vb.inputs[attr].glarray->Size; */
}
/* Calculate sizes of vertex program outputs. Size is the largest
@@ -176,8 +177,6 @@ static void calc_wm_input_sizes( struct brw_context *brw )
struct tracker t;
GLuint insn;
GLuint i;
- GLuint64EXT inputs = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
- vp->program.Base.InputsRead);
memset(&t, 0, sizeof(t));
@@ -185,8 +184,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
if (brw->attribs.Light->Model.TwoSide)
t.twoside = 1;
- for (i = 0; i < BRW_ATTRIB_MAX; i++)
- if (inputs & (1<<i))
+ for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ if (vp->program.Base.InputsRead & (1<<i))
set_active_component(&t, PROGRAM_INPUT, i,
szflag[get_input_size(brw, i)]);
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index da9d3bacb0e..ffdb843e85f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -77,7 +77,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
/* Allocate input regs:
*/
c->nr_inputs = 0;
- for (i = 0; i < BRW_ATTRIB_MAX; i++) {
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
if (c->prog_data.inputs_read & (1<<i)) {
c->nr_inputs++;
c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0);
@@ -791,7 +791,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
if (c->key.copy_edgeflag) {
brw_MOV(p,
get_reg(c, PROGRAM_OUTPUT, VERT_RESULT_EDGE),
- get_reg(c, PROGRAM_INPUT, BRW_ATTRIB_EDGEFLAG));
+ get_reg(c, PROGRAM_INPUT, VERT_ATTRIB_EDGEFLAG));
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
index 1df111f6457..dc580998e37 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
@@ -146,9 +146,13 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
}
/* BRW_NEW_INPUT_VARYING */
- for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_INDEX ; i++)
- if (brw->vb.info.varying & (1<<i))
- key->light_material_mask |= 1<<(i-BRW_ATTRIB_MAT_FRONT_AMBIENT);
+
+ /* For these programs, material values are stuffed into the
+ * generic slots:
+ */
+ for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
+ if (brw->vb.info.varying & (1<<(VERT_ATTRIB_GENERIC0 + i)))
+ key->light_material_mask |= 1<<i;
for (i = 0; i < MAX_LIGHTS; i++) {
struct gl_light *light = &brw->attribs.Light->Light[i];
@@ -374,12 +378,6 @@ static void release_temps( struct tnl_program *p )
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
- /* Cram the material flags into the generic range. We'll translate
- * them back later.
- */
- if (input >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
- input -= BRW_ATTRIB_MAT_FRONT_AMBIENT;
-
assert(input < 32);
p->program->Base.InputsRead |= (1<<input);
@@ -646,7 +644,7 @@ static void emit_passthrough( struct tnl_program *p,
static struct ureg get_eye_position( struct tnl_program *p )
{
if (is_undef(p->eye_position)) {
- struct ureg pos = register_input( p, BRW_ATTRIB_POS );
+ struct ureg pos = register_input( p, VERT_ATTRIB_POS );
struct ureg modelview[4];
p->eye_position = reserve_temp(p);
@@ -709,7 +707,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
static struct ureg get_eye_normal( struct tnl_program *p )
{
if (is_undef(p->eye_normal)) {
- struct ureg normal = register_input(p, BRW_ATTRIB_NORMAL );
+ struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
struct ureg mvinv[3];
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2,
@@ -742,7 +740,7 @@ static struct ureg get_eye_normal( struct tnl_program *p )
static void build_hpos( struct tnl_program *p )
{
- struct ureg pos = register_input( p, BRW_ATTRIB_POS );
+ struct ureg pos = register_input( p, VERT_ATTRIB_POS );
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
struct ureg mvp[4];
@@ -786,9 +784,9 @@ static struct ureg get_material( struct tnl_program *p, GLuint side,
GLuint attrib = material_attrib(side, property);
if (p->color_materials & (1<<attrib))
- return register_input(p, BRW_ATTRIB_COLOR0);
+ return register_input(p, VERT_ATTRIB_COLOR0);
else if (p->materials & (1<<attrib))
- return register_input( p, attrib + BRW_ATTRIB_MAT_FRONT_AMBIENT );
+ return register_input( p, attrib + _TNL_ATTRIB_MAT_FRONT_AMBIENT );
else
return register_param3( p, STATE_MATERIAL, side, property );
}
@@ -1156,7 +1154,7 @@ static void build_fog( struct tnl_program *p )
input = swizzle1(get_eye_position(p), Z);
}
else {
- input = swizzle1(register_input(p, BRW_ATTRIB_FOG), X);
+ input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
}
if (p->state->fog_option &&
@@ -1298,7 +1296,7 @@ static void build_texture_transform( struct tnl_program *p )
for (j = 0; j < 4; j++) {
switch (modes[j]) {
case TXG_OBJ_LINEAR: {
- struct ureg obj = register_input(p, BRW_ATTRIB_POS);
+ struct ureg obj = register_input(p, VERT_ATTRIB_POS);
struct ureg plane =
register_param3(p, STATE_TEXGEN, i,
STATE_TEXGEN_OBJECT_S + j);
@@ -1347,7 +1345,7 @@ static void build_texture_transform( struct tnl_program *p )
}
if (copy_mask) {
- struct ureg in = register_input(p, BRW_ATTRIB_TEX0+i);
+ struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i);
emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in );
}
}
@@ -1356,7 +1354,7 @@ static void build_texture_transform( struct tnl_program *p )
struct ureg texmat[4];
struct ureg in = (!is_undef(out_texgen) ?
out_texgen :
- register_input(p, BRW_ATTRIB_TEX0+i));
+ register_input(p, VERT_ATTRIB_TEX0+i));
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i,
0, 3, STATE_MATRIX, texmat );
@@ -1372,7 +1370,7 @@ static void build_texture_transform( struct tnl_program *p )
release_temps(p);
}
else {
- emit_passthrough(p, BRW_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
+ emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
}
}
}
@@ -1424,10 +1422,10 @@ static void build_tnl_program( struct tnl_program *p )
build_lighting(p);
else {
if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
- emit_passthrough(p, BRW_ATTRIB_COLOR0, VERT_RESULT_COL0);
+ emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
- emit_passthrough(p, BRW_ATTRIB_COLOR1, VERT_RESULT_COL1);
+ emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 4896882034b..a5738e57747 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -46,8 +46,6 @@
#include "brw_state.h"
#include "brw_draw.h"
-#include "brw_exec.h"
-#include "brw_save.h"
#include "brw_state.h"
#include "brw_aub.h"
#include "brw_fallback.h"
@@ -68,9 +66,6 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
- brw_exec_destroy( ctx );
- brw_save_destroy( ctx );
-
brw_ProgramCacheDestroy( ctx );
}
@@ -165,10 +160,7 @@ static GLuint brw_flush_cmd( void )
static void brw_invalidate_state( struct intel_context *intel, GLuint new_state )
{
- GLcontext *ctx = &intel->ctx;
-
- brw_exec_invalidate_state(ctx, new_state);
- brw_save_invalidate_state(ctx, new_state);
+ /* nothing */
}