aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-08-13 16:07:11 +0100
committerKeith Whitwell <[email protected]>2007-08-13 16:23:44 +0100
commit40a86b20478024ca7c55400019c536cb5ff631d1 (patch)
tree624d3f33b07dfba4328b0c7746af5f58fd496292 /src/mesa/pipe/i915simple
parentd46779103b38aeab61701759ed7a0b30cc71c0ef (diff)
Start breaking the #include dependencies between pipe drivers and mesa.
Pipe drivers shouldn't really know much about mesa and certainly shouldn't be #including files from src/mesa/main and the like. I've also (in i915simple especially) moved over from GL types to more conventional int/unsigned usage. This probably isn't really the ultimate desired set of types to use - possibly C99 would be better. It may even be that a subset of the GL types is preferable.
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_blit.c40
-rw-r--r--src/mesa/pipe/i915simple/i915_blit.h26
-rw-r--r--src/mesa/pipe/i915simple/i915_clear.c6
-rw-r--r--src/mesa/pipe/i915simple/i915_context.c27
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h18
-rw-r--r--src/mesa/pipe/i915simple/i915_debug.c194
-rw-r--r--src/mesa/pipe/i915simple/i915_debug_fp.c39
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_emit.c33
-rw-r--r--src/mesa/pipe/i915simple/i915_regions.c64
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c6
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c14
-rw-r--r--src/mesa/pipe/i915simple/i915_state_dynamic.c86
-rw-r--r--src/mesa/pipe/i915simple/i915_state_emit.c8
-rw-r--r--src/mesa/pipe/i915simple/i915_state_fragprog.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c35
-rw-r--r--src/mesa/pipe/i915simple/i915_state_inlines.h6
-rw-r--r--src/mesa/pipe/i915simple/i915_surface.c22
-rw-r--r--src/mesa/pipe/i915simple/i915_tex_layout.c146
-rw-r--r--src/mesa/pipe/i915simple/i915_tex_layout.h4
-rw-r--r--src/mesa/pipe/i915simple/i915_winsys.h2
20 files changed, 371 insertions, 407 deletions
diff --git a/src/mesa/pipe/i915simple/i915_blit.c b/src/mesa/pipe/i915simple/i915_blit.c
index 4fc216dd33b..5044cf17f76 100644
--- a/src/mesa/pipe/i915simple/i915_blit.c
+++ b/src/mesa/pipe/i915simple/i915_blit.c
@@ -28,7 +28,7 @@
#include <stdio.h>
-#include "mtypes.h"
+//#include "mtypes.h"
#include "i915_context.h"
#include "i915_winsys.h"
@@ -40,15 +40,15 @@
void
i915_fill_blit(struct i915_context *i915,
- GLuint cpp,
- GLshort dst_pitch,
+ unsigned cpp,
+ short dst_pitch,
struct pipe_buffer_handle *dst_buffer,
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLuint color)
+ unsigned dst_offset,
+ short x, short y,
+ short w, short h,
+ unsigned color)
{
- GLuint BR13, CMD;
+ unsigned BR13, CMD;
BATCH_LOCALS;
dst_pitch *= cpp;
@@ -86,18 +86,18 @@ i915_fill_blit(struct i915_context *i915,
void
i915_copy_blit( struct i915_context *i915,
- GLuint cpp,
- GLshort src_pitch,
+ unsigned cpp,
+ short src_pitch,
struct pipe_buffer_handle *src_buffer,
- GLuint src_offset,
- GLshort dst_pitch,
+ unsigned src_offset,
+ short dst_pitch,
struct pipe_buffer_handle *dst_buffer,
- GLuint dst_offset,
- GLshort src_x, GLshort src_y,
- GLshort dst_x, GLshort dst_y,
- GLshort w, GLshort h )
+ unsigned dst_offset,
+ short src_x, short src_y,
+ short dst_x, short dst_y,
+ short w, short h )
{
- GLuint CMD, BR13;
+ unsigned CMD, BR13;
int dst_y2 = dst_y + h;
int dst_x2 = dst_x + w;
BATCH_LOCALS;
@@ -116,13 +116,13 @@ i915_copy_blit( struct i915_context *i915,
case 1:
case 2:
case 3:
- BR13 = (((GLint) dst_pitch) & 0xffff) |
+ BR13 = (((int) dst_pitch) & 0xffff) |
(0xCC << 16) | (1 << 24);
CMD = XY_SRC_COPY_BLT_CMD;
break;
case 4:
BR13 =
- (((GLint) dst_pitch) & 0xffff) |
+ (((int) dst_pitch) & 0xffff) |
(0xCC << 16) | (1 << 24) | (1 << 25);
CMD =
(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
@@ -151,7 +151,7 @@ i915_copy_blit( struct i915_context *i915,
OUT_BATCH((dst_y2 << 16) | dst_x2);
OUT_RELOC(dst_buffer, I915_BUFFER_ACCESS_WRITE, dst_offset);
OUT_BATCH((src_y << 16) | src_x);
- OUT_BATCH(((GLint) src_pitch & 0xffff));
+ OUT_BATCH(((int) src_pitch & 0xffff));
OUT_RELOC(src_buffer, I915_BUFFER_ACCESS_READ, src_offset);
ADVANCE_BATCH();
}
diff --git a/src/mesa/pipe/i915simple/i915_blit.h b/src/mesa/pipe/i915simple/i915_blit.h
index b1131a005c3..7ea4e979eca 100644
--- a/src/mesa/pipe/i915simple/i915_blit.h
+++ b/src/mesa/pipe/i915simple/i915_blit.h
@@ -31,24 +31,24 @@
#include "i915_context.h"
extern void i915_copy_blit(struct i915_context *i915,
- GLuint cpp,
- GLshort src_pitch,
+ unsigned cpp,
+ short src_pitch,
struct pipe_buffer_handle *src_buffer,
- GLuint src_offset,
- GLshort dst_pitch,
+ unsigned src_offset,
+ short dst_pitch,
struct pipe_buffer_handle *dst_buffer,
- GLuint dst_offset,
- GLshort srcx, GLshort srcy,
- GLshort dstx, GLshort dsty,
- GLshort w, GLshort h );
+ unsigned dst_offset,
+ short srcx, short srcy,
+ short dstx, short dsty,
+ short w, short h );
extern void i915_fill_blit(struct i915_context *i915,
- GLuint cpp,
- GLshort dst_pitch,
+ unsigned cpp,
+ short dst_pitch,
struct pipe_buffer_handle *dst_buffer,
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h, GLuint color);
+ unsigned dst_offset,
+ short x, short y,
+ short w, short h, unsigned color);
#endif
diff --git a/src/mesa/pipe/i915simple/i915_clear.c b/src/mesa/pipe/i915simple/i915_clear.c
index 11aa55b64be..a4dba1a7646 100644
--- a/src/mesa/pipe/i915simple/i915_clear.c
+++ b/src/mesa/pipe/i915simple/i915_clear.c
@@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "i915_context.h"
#include "i915_state.h"
-#include "colormac.h"
+//#include "colormac.h"
/**
@@ -42,9 +42,9 @@
*/
void
i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- GLuint clearValue)
+ unsigned clearValue)
{
- GLint x, y, w, h;
+ int x, y, w, h;
x = 0;
y = 0;
diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c
index 199352cd704..8a8582e0b20 100644
--- a/src/mesa/pipe/i915simple/i915_context.c
+++ b/src/mesa/pipe/i915simple/i915_context.c
@@ -25,7 +25,7 @@
*
**************************************************************************/
-#include "main/imports.h" /* CALLOC */
+//#include "main/imports.h" /* CALLOC */
#include "i915_context.h"
#include "i915_winsys.h"
#include "i915_state.h"
@@ -36,6 +36,7 @@
#include "pipe/draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
+#include "pipe/p_util.h"
/**
@@ -43,13 +44,13 @@
* If we find texture and drawable support differs, add a selector
* parameter or another function.
*/
-static const GLuint *
+static const unsigned *
i915_supported_formats(struct pipe_context *pipe,
-// GLuint type,
- GLuint *numFormats)
+// unsigned type,
+ unsigned *numFormats)
{
#if 0
- static const GLuint tex_supported[] = {
+ static const unsigned tex_supported[] = {
PIPE_FORMAT_U_R8_G8_B8_A8,
PIPE_FORMAT_U_A8_R8_G8_B8,
PIPE_FORMAT_U_R5_G6_B5,
@@ -65,14 +66,14 @@ i915_supported_formats(struct pipe_context *pipe,
/* Actually a lot more than this - add later:
*/
- static const GLuint render_supported[] = {
+ static const unsigned render_supported[] = {
PIPE_FORMAT_U_A8_R8_G8_B8,
PIPE_FORMAT_U_R5_G6_B5,
};
/*
*/
- static const GLuint z_stencil_supported[] = {
+ static const unsigned z_stencil_supported[] = {
PIPE_FORMAT_U_Z16,
PIPE_FORMAT_U_Z32,
PIPE_FORMAT_S8_Z24,
@@ -96,7 +97,7 @@ i915_supported_formats(struct pipe_context *pipe,
return NULL;
}
#else
- static const GLuint render_supported[] = {
+ static const unsigned render_supported[] = {
PIPE_FORMAT_U_A8_R8_G8_B8,
PIPE_FORMAT_U_R5_G6_B5,
PIPE_FORMAT_S8_Z24,
@@ -111,8 +112,8 @@ i915_supported_formats(struct pipe_context *pipe,
* We might want to return max texture levels instead...
*/
static void
-i915_max_texture_size(struct pipe_context *pipe, GLuint textureType,
- GLuint *maxWidth, GLuint *maxHeight, GLuint *maxDepth)
+i915_max_texture_size(struct pipe_context *pipe, unsigned textureType,
+ unsigned *maxWidth, unsigned *maxHeight, unsigned *maxDepth)
{
switch (textureType) {
case PIPE_TEXTURE_1D:
@@ -160,9 +161,9 @@ static void i915_draw_vb( struct pipe_context *pipe,
static void
i915_draw_vertices(struct pipe_context *pipe,
- GLuint mode,
- GLuint numVertex, const GLfloat *verts,
- GLuint numAttribs, const GLuint attribs[])
+ unsigned mode,
+ unsigned numVertex, const float *verts,
+ unsigned numAttribs, const unsigned attribs[])
{
struct i915_context *i915 = i915_context( pipe );
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 93b5e2546c3..d69657daa9f 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -82,10 +82,10 @@ struct i915_cache_context;
*/
struct i915_state
{
- GLuint immediate[I915_MAX_IMMEDIATE];
- GLuint dynamic[I915_MAX_DYNAMIC];
+ unsigned immediate[I915_MAX_IMMEDIATE];
+ unsigned dynamic[I915_MAX_DYNAMIC];
- GLuint id; /* track lost context events */
+ unsigned id; /* track lost context events */
};
@@ -113,15 +113,15 @@ struct i915_context
struct pipe_stencil_state stencil;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
- GLuint dirty;
+ unsigned dirty;
- GLuint *batch_start;
+ unsigned *batch_start;
struct i915_state current;
- GLuint hardware_dirty;
+ unsigned hardware_dirty;
- GLuint debug;
- GLuint pci_id;
+ unsigned debug;
+ unsigned pci_id;
struct {
unsigned is_i945:1;
@@ -179,7 +179,7 @@ unsigned *i915_passthrough_program( unsigned *dwords );
* i915_clear.c:
*/
void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
- GLuint clearValue);
+ unsigned clearValue);
/***********************************************************************
diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/mesa/pipe/i915simple/i915_debug.c
index 89257e9409d..8b7e3628f30 100644
--- a/src/mesa/pipe/i915simple/i915_debug.c
+++ b/src/mesa/pipe/i915simple/i915_debug.c
@@ -25,7 +25,7 @@
*
**************************************************************************/
-#include "imports.h"
+//#include "imports.h"
#include "i915_reg.h"
#include "i915_context.h"
@@ -35,15 +35,15 @@
#define PRINTF( ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ )
-static GLboolean debug( struct debug_stream *stream, const char *name, GLuint len )
+static boolean debug( struct debug_stream *stream, const char *name, unsigned len )
{
- GLuint i;
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned i;
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
if (len == 0) {
PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
assert(0);
- return GL_FALSE;
+ return FALSE;
}
if (stream->print_addresses)
@@ -55,13 +55,13 @@ static GLboolean debug( struct debug_stream *stream, const char *name, GLuint le
PRINTF("\t0x%08x\n", ptr[i]);
PRINTF("\n");
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
- return GL_TRUE;
+ return TRUE;
}
-static const char *get_prim_name( GLuint val )
+static const char *get_prim_name( unsigned val )
{
switch (val & PRIM3D_MASK) {
case PRIM3D_TRILIST: return "TRILIST"; break;
@@ -80,13 +80,13 @@ static const char *get_prim_name( GLuint val )
}
}
-static GLboolean debug_prim( struct debug_stream *stream, const char *name,
- GLboolean dump_floats,
- GLuint len )
+static boolean debug_prim( struct debug_stream *stream, const char *name,
+ boolean dump_floats,
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
const char *prim = get_prim_name( ptr[0] );
- GLuint i;
+ unsigned i;
@@ -94,7 +94,7 @@ static GLboolean debug_prim( struct debug_stream *stream, const char *name,
PRINTF("\t0x%08x\n", ptr[0]);
for (i = 1; i < len; i++) {
if (dump_floats)
- PRINTF("\t0x%08x // %f\n", ptr[i], *(GLfloat *)&ptr[i]);
+ PRINTF("\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]);
else
PRINTF("\t0x%08x\n", ptr[i]);
}
@@ -102,22 +102,22 @@ static GLboolean debug_prim( struct debug_stream *stream, const char *name,
PRINTF("\n");
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_program( struct debug_stream *stream, const char *name, GLuint len )
+static boolean debug_program( struct debug_stream *stream, const char *name, unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
if (len == 0) {
PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
assert(0);
- return GL_FALSE;
+ return FALSE;
}
if (stream->print_addresses)
@@ -126,16 +126,16 @@ static GLboolean debug_program( struct debug_stream *stream, const char *name, G
PRINTF("%s (%d dwords):\n", name, len);
i915_disassemble_program( stream, ptr, len );
- stream->offset += len * sizeof(GLuint);
- return GL_TRUE;
+ stream->offset += len * sizeof(unsigned);
+ return TRUE;
}
-static GLboolean debug_chain( struct debug_stream *stream, const char *name, GLuint len )
+static boolean debug_chain( struct debug_stream *stream, const char *name, unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
- GLuint old_offset = stream->offset + len * sizeof(GLuint);
- GLuint i;
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
+ unsigned old_offset = stream->offset + len * sizeof(unsigned);
+ unsigned i;
PRINTF("%s (%d dwords):\n", name, len);
for (i = 0; i < len; i++)
@@ -151,17 +151,17 @@ static GLboolean debug_chain( struct debug_stream *stream, const char *name, GLu
old_offset, stream->offset );
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_variable_length_prim( struct debug_stream *stream )
+static boolean debug_variable_length_prim( struct debug_stream *stream )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
const char *prim = get_prim_name( ptr[0] );
- GLuint i, len;
+ unsigned i, len;
- GLushort *idx = (GLushort *)(ptr+1);
+ ushort *idx = (ushort *)(ptr+1);
for (i = 0; idx[i] != 0xffff; i++)
;
@@ -172,8 +172,8 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream )
PRINTF("\t0x%08x\n", ptr[i]);
PRINTF("\n");
- stream->offset += len * sizeof(GLuint);
- return GL_TRUE;
+ stream->offset += len * sizeof(unsigned);
+ return TRUE;
}
@@ -202,13 +202,13 @@ do { \
} \
} while (0)
-static GLboolean debug_load_immediate( struct debug_stream *stream,
+static boolean debug_load_immediate( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
- GLuint bits = (ptr[0] >> 4) & 0xff;
- GLuint j = 0;
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
+ unsigned bits = (ptr[0] >> 4) & 0xff;
+ unsigned j = 0;
PRINTF("%s (%d dwords, flags: %x):\n", name, len, bits);
PRINTF("\t0x%08x\n", ptr[j++]);
@@ -302,20 +302,20 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
assert(j == len);
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_load_indirect( struct debug_stream *stream,
+static boolean debug_load_indirect( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
- GLuint bits = (ptr[0] >> 8) & 0x3f;
- GLuint i, j = 0;
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
+ unsigned bits = (ptr[0] >> 8) & 0x3f;
+ unsigned i, j = 0;
PRINTF("%s (%d dwords):\n", name, len);
PRINTF("\t0x%08x\n", ptr[j++]);
@@ -362,13 +362,13 @@ static GLboolean debug_load_indirect( struct debug_stream *stream,
assert(j == len);
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
- return GL_TRUE;
+ return TRUE;
}
static void BR13( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x\n", val);
FLAG(val, 30, "clipping enable");
@@ -379,7 +379,7 @@ static void BR13( struct debug_stream *stream,
static void BR22( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x\n", val);
BITS(val, 31, 16, "dest y1");
@@ -387,7 +387,7 @@ static void BR22( struct debug_stream *stream,
}
static void BR23( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x\n", val);
BITS(val, 31, 16, "dest y2");
@@ -395,13 +395,13 @@ static void BR23( struct debug_stream *stream,
}
static void BR09( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x -- dest address\n", val);
}
static void BR26( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x\n", val);
BITS(val, 31, 16, "src y1");
@@ -409,29 +409,29 @@ static void BR26( struct debug_stream *stream,
}
static void BR11( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x\n", val);
BITS(val, 15, 0, "src pitch");
}
static void BR12( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x -- src address\n", val);
}
static void BR16( struct debug_stream *stream,
- GLuint val )
+ unsigned val )
{
PRINTF("\t0x%08x -- color\n", val);
}
-static GLboolean debug_copy_blit( struct debug_stream *stream,
+static boolean debug_copy_blit( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -445,16 +445,16 @@ static GLboolean debug_copy_blit( struct debug_stream *stream,
BR11(stream, ptr[j++]);
BR12(stream, ptr[j++]);
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_color_blit( struct debug_stream *stream,
+static boolean debug_color_blit( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -466,16 +466,16 @@ static GLboolean debug_color_blit( struct debug_stream *stream,
BR09(stream, ptr[j++]);
BR16(stream, ptr[j++]);
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_modes4( struct debug_stream *stream,
+static boolean debug_modes4( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -487,16 +487,16 @@ static GLboolean debug_modes4( struct debug_stream *stream,
BITS(ptr[j], 7, 0, "stencil write mask");
j++;
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_map_state( struct debug_stream *stream,
+static boolean debug_map_state( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -539,16 +539,16 @@ static GLboolean debug_map_state( struct debug_stream *stream,
}
}
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_sampler_state( struct debug_stream *stream,
+static boolean debug_sampler_state( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -599,16 +599,16 @@ static GLboolean debug_sampler_state( struct debug_stream *stream,
}
}
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_dest_vars( struct debug_stream *stream,
+static boolean debug_dest_vars( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -634,16 +634,16 @@ static GLboolean debug_dest_vars( struct debug_stream *stream,
j++;
}
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean debug_buf_info( struct debug_stream *stream,
+static boolean debug_buf_info( struct debug_stream *stream,
const char *name,
- GLuint len )
+ unsigned len )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
int j = 0;
PRINTF("%s (%d dwords):\n", name, len);
@@ -664,15 +664,15 @@ static GLboolean debug_buf_info( struct debug_stream *stream,
PRINTF("\t0x%08x -- buffer base address\n", ptr[j++]);
- stream->offset += len * sizeof(GLuint);
+ stream->offset += len * sizeof(unsigned);
assert(j == len);
- return GL_TRUE;
+ return TRUE;
}
-static GLboolean i915_debug_packet( struct debug_stream *stream )
+static boolean i915_debug_packet( struct debug_stream *stream )
{
- GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
- GLuint cmd = *ptr;
+ unsigned *ptr = (unsigned *)(stream->ptr + stream->offset);
+ unsigned cmd = *ptr;
switch (((cmd >> 29) & 0x7)) {
case 0x0:
@@ -685,7 +685,7 @@ static GLboolean i915_debug_packet( struct debug_stream *stream )
return debug(stream, "MI_FLUSH", 1);
case 0xA:
debug(stream, "MI_BATCH_BUFFER_END", 1);
- return GL_FALSE;
+ return FALSE;
case 0x22:
return debug(stream, "MI_LOAD_REGISTER_IMM", 3);
case 0x31:
@@ -816,12 +816,12 @@ static GLboolean i915_debug_packet( struct debug_stream *stream )
void
i915_dump_batchbuffer( struct i915_context *i915,
- GLuint *start,
- GLuint *end )
+ unsigned *start,
+ unsigned *end )
{
struct debug_stream stream;
- GLuint bytes = (end - start) * 4;
- GLboolean done = GL_FALSE;
+ unsigned bytes = (end - start) * 4;
+ boolean done = FALSE;
stream.offset = 0;
diff --git a/src/mesa/pipe/i915simple/i915_debug_fp.c b/src/mesa/pipe/i915simple/i915_debug_fp.c
index c54d36f2941..a108f1ad4f0 100644
--- a/src/mesa/pipe/i915simple/i915_debug_fp.c
+++ b/src/mesa/pipe/i915simple/i915_debug_fp.c
@@ -25,15 +25,12 @@
*
**************************************************************************/
-#include <stdio.h>
#include "i915_reg.h"
#include "i915_debug.h"
#include "pipe/p_winsys.h"
-//#include "i915_fpc.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_print.h"
+#include "pipe/p_util.h"
+
@@ -126,7 +123,7 @@ static const char *regname[0x8] = {
};
static void
-print_reg_type_nr(struct debug_stream *stream, GLuint type, GLuint nr)
+print_reg_type_nr(struct debug_stream *stream, unsigned type, unsigned nr)
{
switch (type) {
case REG_TYPE_T:
@@ -173,7 +170,7 @@ print_reg_type_nr(struct debug_stream *stream, GLuint type, GLuint nr)
static void
-print_reg_neg_swizzle(struct debug_stream *stream, GLuint reg)
+print_reg_neg_swizzle(struct debug_stream *stream, unsigned reg)
{
int i;
@@ -215,20 +212,20 @@ print_reg_neg_swizzle(struct debug_stream *stream, GLuint reg)
static void
-print_src_reg(struct debug_stream *stream, GLuint dword)
+print_src_reg(struct debug_stream *stream, unsigned dword)
{
- GLuint nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK;
- GLuint type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK;
+ unsigned nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK;
+ unsigned type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK;
print_reg_type_nr(stream, type, nr);
print_reg_neg_swizzle(stream, dword);
}
static void
-print_dest_reg(struct debug_stream *stream, GLuint dword)
+print_dest_reg(struct debug_stream *stream, unsigned dword)
{
- GLuint nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK;
- GLuint type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK;
+ unsigned nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK;
+ unsigned type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK;
print_reg_type_nr(stream, type, nr);
if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
return;
@@ -251,7 +248,7 @@ print_dest_reg(struct debug_stream *stream, GLuint dword)
static void
print_arith_op(struct debug_stream *stream,
- GLuint opcode, const GLuint * program)
+ unsigned opcode, const unsigned * program)
{
if (opcode != A0_NOP) {
print_dest_reg(stream, program[0]);
@@ -285,7 +282,7 @@ print_arith_op(struct debug_stream *stream,
static void
print_tex_op(struct debug_stream *stream,
- GLuint opcode, const GLuint * program)
+ unsigned opcode, const unsigned * program)
{
print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL);
PRINTF(" = ");
@@ -303,7 +300,7 @@ print_tex_op(struct debug_stream *stream,
static void
print_dcl_op(struct debug_stream *stream,
- GLuint opcode, const GLuint * program)
+ unsigned opcode, const unsigned * program)
{
PRINTF("%s ", opcodes[opcode]);
print_dest_reg(stream,
@@ -314,10 +311,10 @@ print_dcl_op(struct debug_stream *stream,
void
i915_disassemble_program(struct debug_stream *stream,
- const GLuint * program, GLuint sz)
+ const unsigned * program, unsigned sz)
{
- GLuint size = program[0] & 0x1ff;
- GLint i;
+ unsigned size = program[0] & 0x1ff;
+ int i;
PRINTF("\t\tBEGIN\n");
@@ -325,11 +322,11 @@ i915_disassemble_program(struct debug_stream *stream,
program++;
for (i = 1; i < sz; i += 3, program += 3) {
- GLuint opcode = program[0] & (0x1f << 24);
+ unsigned opcode = program[0] & (0x1f << 24);
PRINTF("\t\t");
- if ((GLint) opcode >= A0_NOP && opcode <= A0_SLT)
+ if ((int) opcode >= A0_NOP && opcode <= A0_SLT)
print_arith_op(stream, opcode >> 24, program);
else if (opcode >= T0_TEXLD && opcode <= T0_TEXKILL)
print_tex_op(stream, opcode >> 24, program);
diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/mesa/pipe/i915simple/i915_prim_emit.c
index 5173fc0b38e..5a18d03e50d 100644
--- a/src/mesa/pipe/i915simple/i915_prim_emit.c
+++ b/src/mesa/pipe/i915simple/i915_prim_emit.c
@@ -26,10 +26,11 @@
**************************************************************************/
-#include "imports.h"
-#include "macros.h"
+//#include "imports.h"
+//#include "macros.h"
#include "pipe/draw/draw_private.h"
+#include "pipe/p_util.h"
#include "i915_context.h"
#include "i915_winsys.h"
@@ -59,34 +60,6 @@ static INLINE struct setup_stage *setup_stage( struct draw_stage *stage )
return (struct setup_stage *)stage;
}
-static INLINE unsigned pack_ub4( unsigned char b0,
- unsigned char b1,
- unsigned char b2,
- unsigned char b3 )
-{
- return ((((unsigned int)b0) << 0) |
- (((unsigned int)b1) << 8) |
- (((unsigned int)b2) << 16) |
- (((unsigned int)b3) << 24));
-}
-
-static INLINE unsigned fui( float f )
-{
- union {
- float f;
- unsigned ui;
- } fi;
-
- fi.f = f;
- return fi.ui;
-}
-
-static INLINE unsigned char float_to_ubyte( float f )
-{
- unsigned char ub;
- UNCLAMPED_FLOAT_TO_UBYTE(ub, f);
- return ub;
-}
/* Hardcoded vertex format: xyz/rgba
diff --git a/src/mesa/pipe/i915simple/i915_regions.c b/src/mesa/pipe/i915simple/i915_regions.c
index e27443a58c0..aad4a6a5375 100644
--- a/src/mesa/pipe/i915simple/i915_regions.c
+++ b/src/mesa/pipe/i915simple/i915_regions.c
@@ -44,7 +44,7 @@ i915_region_idle(struct pipe_context *pipe, struct pipe_region *region)
}
-static GLubyte *
+static ubyte *
i915_region_map(struct pipe_context *pipe, struct pipe_region *region)
{
struct i915_context *i915 = i915_context( pipe );
@@ -73,7 +73,7 @@ i915_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
static struct pipe_region *
i915_region_alloc(struct pipe_context *pipe,
- GLuint cpp, GLuint width, GLuint height, GLbitfield flags)
+ unsigned cpp, unsigned width, unsigned height, unsigned flags)
{
struct i915_context *i915 = i915_context( pipe );
struct pipe_region *region = calloc(sizeof(*region), 1);
@@ -117,7 +117,7 @@ i915_region_release(struct pipe_context *pipe, struct pipe_region **region)
if (!*region)
return;
- ASSERT((*region)->refcount > 0);
+ assert((*region)->refcount > 0);
(*region)->refcount--;
if ((*region)->refcount == 0) {
@@ -135,19 +135,19 @@ i915_region_release(struct pipe_context *pipe, struct pipe_region **region)
* XXX Move this into core Mesa?
*/
static void
-_mesa_copy_rect(GLubyte * dst,
- GLuint cpp,
- GLuint dst_pitch,
- GLuint dst_x,
- GLuint dst_y,
- GLuint width,
- GLuint height,
- const GLubyte * src,
- GLuint src_pitch,
- GLuint src_x,
- GLuint src_y)
+_mesa_copy_rect(ubyte * dst,
+ unsigned cpp,
+ unsigned dst_pitch,
+ unsigned dst_x,
+ unsigned dst_y,
+ unsigned width,
+ unsigned height,
+ const ubyte * src,
+ unsigned src_pitch,
+ unsigned src_x,
+ unsigned src_y)
{
- GLuint i;
+ unsigned i;
dst_pitch *= cpp;
src_pitch *= cpp;
@@ -179,10 +179,10 @@ _mesa_copy_rect(GLubyte * dst,
static void
i915_region_data(struct pipe_context *pipe,
struct pipe_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- const void *src, GLuint src_pitch,
- GLuint srcx, GLuint srcy, GLuint width, GLuint height)
+ unsigned dst_offset,
+ unsigned dstx, unsigned dsty,
+ const void *src, unsigned src_pitch,
+ unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
_mesa_copy_rect(pipe->region_map(pipe, dst) + dst_offset,
dst->cpp,
@@ -199,11 +199,11 @@ i915_region_data(struct pipe_context *pipe,
static void
i915_region_copy(struct pipe_context *pipe,
struct pipe_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
+ unsigned dst_offset,
+ unsigned dstx, unsigned dsty,
struct pipe_region *src,
- GLuint src_offset,
- GLuint srcx, GLuint srcy, GLuint width, GLuint height)
+ unsigned src_offset,
+ unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
assert( dst != src );
assert( dst->cpp == src->cpp );
@@ -233,8 +233,8 @@ i915_region_copy(struct pipe_context *pipe,
/* Fill a rectangular sub-region. Need better logic about when to
* push buffers into AGP - will currently do so whenever possible.
*/
-static GLubyte *
-get_pointer(struct pipe_region *dst, GLuint x, GLuint y)
+static ubyte *
+get_pointer(struct pipe_region *dst, unsigned x, unsigned y)
{
return dst->map + (y * dst->pitch + x) * dst->cpp;
}
@@ -243,18 +243,18 @@ get_pointer(struct pipe_region *dst, GLuint x, GLuint y)
static void
i915_region_fill(struct pipe_context *pipe,
struct pipe_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- GLuint width, GLuint height, GLuint value)
+ unsigned dst_offset,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height, unsigned value)
{
if (0) {
- GLuint i, j;
+ unsigned i, j;
(void)pipe->region_map(pipe, dst);
switch (dst->cpp) {
case 1: {
- GLubyte *row = get_pointer(dst, dstx, dsty);
+ ubyte *row = get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
memset(row, value, width);
row += dst->pitch;
@@ -262,7 +262,7 @@ i915_region_fill(struct pipe_context *pipe,
}
break;
case 2: {
- GLushort *row = (GLushort *) get_pointer(dst, dstx, dsty);
+ ushort *row = (ushort *) get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++)
row[j] = value;
@@ -271,7 +271,7 @@ i915_region_fill(struct pipe_context *pipe,
}
break;
case 4: {
- GLuint *row = (GLuint *) get_pointer(dst, dstx, dsty);
+ unsigned *row = (unsigned *) get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++)
row[j] = value;
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 22a5bf68b4c..f874b210160 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -27,7 +27,7 @@
/* Authors: Keith Whitwell <[email protected]>
*/
-#include "imports.h"
+//#include "imports.h"
#include "pipe/draw/draw_context.h"
@@ -122,7 +122,7 @@ static void i915_set_fs_state( struct pipe_context *pipe,
static void i915_set_sampler_state(struct pipe_context *pipe,
- GLuint unit,
+ unsigned unit,
const struct pipe_sampler_state *sampler)
{
struct i915_context *i915 = i915_context(pipe);
@@ -135,7 +135,7 @@ static void i915_set_sampler_state(struct pipe_context *pipe,
static void i915_set_texture_state(struct pipe_context *pipe,
- GLuint unit,
+ unsigned unit,
struct pipe_mipmap_tree *texture)
{
struct i915_context *i915 = i915_context(pipe);
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
index 7d03ed5567b..a01b1936763 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/mesa/pipe/i915simple/i915_state_derived.c
@@ -43,7 +43,7 @@ do { \
} while (0)
-static const GLuint frag_to_vf[FRAG_ATTRIB_MAX] =
+static const unsigned frag_to_vf[FRAG_ATTRIB_MAX] =
{
VF_ATTRIB_POS,
VF_ATTRIB_COLOR0,
@@ -75,12 +75,12 @@ static const GLuint frag_to_vf[FRAG_ATTRIB_MAX] =
*/
static void calculate_vertex_layout( struct i915_context *i915 )
{
-// const GLbitfield inputsRead = i915->fs.inputs_read;
- const GLbitfield inputsRead = (FRAG_BIT_WPOS | FRAG_BIT_COL0);
- GLuint slot_to_vf_attr[VF_ATTRIB_MAX];
- GLbitfield attr_mask = 0x0;
- GLuint nr_attrs = 0;
- GLuint i;
+// const unsigned inputsRead = i915->fs.inputs_read;
+ const unsigned inputsRead = (FRAG_BIT_WPOS | FRAG_BIT_COL0);
+ unsigned slot_to_vf_attr[VF_ATTRIB_MAX];
+ unsigned attr_mask = 0x0;
+ unsigned nr_attrs = 0;
+ unsigned i;
memset(slot_to_vf_attr, 0, sizeof(slot_to_vf_attr));
diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/mesa/pipe/i915simple/i915_state_dynamic.c
index 8d5a3988905..84bff17b2f9 100644
--- a/src/mesa/pipe/i915simple/i915_state_dynamic.c
+++ b/src/mesa/pipe/i915simple/i915_state_dynamic.c
@@ -25,16 +25,17 @@
*
**************************************************************************/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
+//#include "glheader.h"
+//#include "context.h"
+//#include "macros.h"
+//#include "enums.h"
#include "i915_batch.h"
#include "i915_state_inlines.h"
#include "i915_context.h"
#include "i915_reg.h"
#include "i915_state.h"
+#include "pipe/p_util.h"
#define FILE_DEBUG_FLAG DEBUG_STATE
@@ -50,9 +51,9 @@
*/
static inline void set_dynamic_indirect( struct i915_context *i915,
- GLuint offset,
- const GLuint *src,
- GLuint dwords )
+ unsigned offset,
+ const unsigned *src,
+ unsigned dwords )
{
int i;
@@ -68,12 +69,12 @@ static inline void set_dynamic_indirect( struct i915_context *i915,
*/
static void upload_MODES4( struct i915_context *i915 )
{
- GLuint modes4 = 0;
+ unsigned modes4 = 0;
/* I915_NEW_STENCIL */
{
- GLint testmask = i915->stencil.value_mask[0] & 0xff;
- GLint writemask = i915->stencil.write_mask[0] & 0xff;
+ int testmask = i915->stencil.value_mask[0] & 0xff;
+ int writemask = i915->stencil.write_mask[0] & 0xff;
modes4 |= (_3DSTATE_MODES_4_CMD |
ENABLE_STENCIL_TEST_MASK |
@@ -110,20 +111,20 @@ const struct i915_tracked_state i915_upload_MODES4 = {
static void upload_BFO( struct i915_context *i915 )
{
- GLuint bf[2];
+ unsigned bf[2];
memset( bf, 0, sizeof(bf) );
/* _NEW_STENCIL
*/
if (i915->stencil.back_enabled) {
- GLint test = i915_translate_compare_func(i915->stencil.back_func);
- GLint fop = i915_translate_stencil_op(i915->stencil.back_fail_op);
- GLint dfop = i915_translate_stencil_op(i915->stencil.back_zfail_op);
- GLint dpop = i915_translate_stencil_op(i915->stencil.back_zpass_op);
- GLint ref = i915->stencil.ref_value[1] & 0xff;
- GLint tmask = i915->stencil.value_mask[1] & 0xff;
- GLint wmask = i915->stencil.write_mask[1] & 0xff;
+ int test = i915_translate_compare_func(i915->stencil.back_func);
+ int fop = i915_translate_stencil_op(i915->stencil.back_fail_op);
+ int dfop = i915_translate_stencil_op(i915->stencil.back_zfail_op);
+ int dpop = i915_translate_stencil_op(i915->stencil.back_zpass_op);
+ int ref = i915->stencil.ref_value[1] & 0xff;
+ int tmask = i915->stencil.value_mask[1] & 0xff;
+ int wmask = i915->stencil.write_mask[1] & 0xff;
bf[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
BFO_ENABLE_STENCIL_FUNCS |
@@ -172,23 +173,20 @@ const struct i915_tracked_state i915_upload_BFO = {
static void upload_BLENDCOLOR( struct i915_context *i915 )
{
- GLuint bc[2];
+ unsigned bc[2];
memset( bc, 0, sizeof(bc) );
/* I915_NEW_BLEND {_COLOR}
*/
{
- const GLfloat *color = i915->blend_color.color;
- GLubyte r, g, b, a;
+ const float *color = i915->blend_color.color;
- UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, color[ACOMP]);
-
- bc[0] = (_3DSTATE_CONST_BLEND_COLOR_CMD);
- bc[1] = (a << 24) | (r << 16) | (g << 8) | b;
+ bc[0] = _3DSTATE_CONST_BLEND_COLOR_CMD;
+ bc[1] = pack_ui32_float4( color[0],
+ color[1],
+ color[2],
+ color[3] );
}
set_dynamic_indirect( i915,
@@ -208,25 +206,21 @@ const struct i915_tracked_state i915_upload_BLENDCOLOR = {
static void upload_IAB( struct i915_context *i915 )
{
- GLuint iab = 0;
+ unsigned iab = 0;
{
- GLuint eqRGB = i915->blend.rgb_func;
- GLuint srcRGB = i915->blend.rgb_src_factor;
- GLuint dstRGB = i915->blend.rgb_dst_factor;
+ unsigned eqRGB = i915->blend.rgb_func;
+ unsigned srcRGB = i915->blend.rgb_src_factor;
+ unsigned dstRGB = i915->blend.rgb_dst_factor;
- GLuint eqA = i915->blend.alpha_func;
- GLuint srcA = i915->blend.alpha_src_factor;
- GLuint dstA = i915->blend.alpha_dst_factor;
+ unsigned eqA = i915->blend.alpha_func;
+ unsigned srcA = i915->blend.alpha_src_factor;
+ unsigned dstA = i915->blend.alpha_dst_factor;
- if (eqA == GL_MIN || eqA == GL_MAX) {
- srcA = dstA = GL_ONE;
- }
+ /* Special handling for MIN/MAX filter modes handled at
+ * state_tracker level.
+ */
- if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
- srcRGB = dstRGB = GL_ONE;
- }
-
if (srcA != srcRGB ||
dstA != dstRGB ||
eqA != eqRGB) {
@@ -268,7 +262,7 @@ const struct i915_tracked_state i915_upload_IAB = {
static void upload_DEPTHSCALE( struct i915_context *i915 )
{
- union { GLfloat f; GLuint u; } ds[2];
+ union { float f; unsigned u; } ds[2];
memset( ds, 0, sizeof(ds) );
@@ -304,7 +298,7 @@ const struct i915_tracked_state i915_upload_DEPTHSCALE = {
static void upload_STIPPLE( struct i915_context *i915 )
{
- GLuint st[2];
+ unsigned st[2];
st[0] = _3DSTATE_STIPPLE;
st[1] = 0;
@@ -319,8 +313,8 @@ static void upload_STIPPLE( struct i915_context *i915 )
/* I915_NEW_STIPPLE
*/
{
- const GLubyte *mask = (const GLubyte *)i915->poly_stipple.stipple;
- GLubyte p[4];
+ const ubyte *mask = (const ubyte *)i915->poly_stipple.stipple;
+ ubyte p[4];
p[0] = mask[12] & 0xf;
p[1] = mask[8] & 0xf;
diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/mesa/pipe/i915simple/i915_state_emit.c
index 2ce079fbaae..a7ae92d93c8 100644
--- a/src/mesa/pipe/i915simple/i915_state_emit.c
+++ b/src/mesa/pipe/i915simple/i915_state_emit.c
@@ -27,8 +27,8 @@
-#include "glheader.h"
-#include "mtypes.h"
+//#include "glheader.h"
+//#include "mtypes.h"
#include "i915_reg.h"
#include "i915_context.h"
@@ -204,8 +204,8 @@ i915_emit_hardware_state(struct i915_context *i915 )
{
- GLuint i, dwords;
- GLuint *prog = i915_passthrough_program( &dwords );
+ unsigned i, dwords;
+ unsigned *prog = i915_passthrough_program( &dwords );
for (i = 0; i < dwords; i++)
OUT_BATCH( prog[i] );
diff --git a/src/mesa/pipe/i915simple/i915_state_fragprog.c b/src/mesa/pipe/i915simple/i915_state_fragprog.c
index 163883b07ac..51df86e0b12 100644
--- a/src/mesa/pipe/i915simple/i915_state_fragprog.c
+++ b/src/mesa/pipe/i915simple/i915_state_fragprog.c
@@ -28,7 +28,7 @@
#include "i915_reg.h"
#include "i915_context.h"
#include "i915_debug.h"
-
+#include "pipe/p_util.h"
static unsigned passthrough[] =
{
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
index 2f64d9dd901..d06fac2e4cb 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/mesa/pipe/i915simple/i915_state_immediate.c
@@ -29,12 +29,13 @@
* Keith Whitwell <[email protected]>
*/
-#include "macros.h"
+//#include "macros.h"
#include "i915_state_inlines.h"
#include "i915_context.h"
#include "i915_state.h"
#include "i915_reg.h"
+#include "p_util.h"
/* All state expressable with the LOAD_STATE_IMMEDIATE_1 packet.
@@ -51,7 +52,7 @@
*/
static void upload_S2S4(struct i915_context *i915)
{
- GLuint LIS2, LIS4;
+ unsigned LIS2, LIS4;
/* I915_NEW_VERTEX_FORMAT */
LIS2 = 0xffffffff;
@@ -86,7 +87,7 @@ static void upload_S2S4(struct i915_context *i915)
/* I915_NEW_SETUP */
{
- GLint point_size = CLAMP((int) i915->setup.point_size, 1, 0xff);
+ int point_size = CLAMP((int) i915->setup.point_size, 1, 0xff);
LIS4 |= point_size << S4_POINT_WIDTH_SHIFT;
}
@@ -121,15 +122,15 @@ const struct i915_tracked_state i915_upload_S2S4 = {
*/
static void upload_S5( struct i915_context *i915 )
{
- GLuint LIS5 = 0;
+ unsigned LIS5 = 0;
/* I915_NEW_STENCIL */
if (i915->stencil.front_enabled) {
- GLint test = i915_translate_compare_func(i915->stencil.front_func);
- GLint fop = i915_translate_stencil_op(i915->stencil.front_fail_op);
- GLint dfop = i915_translate_stencil_op(i915->stencil.front_zfail_op);
- GLint dpop = i915_translate_stencil_op(i915->stencil.front_zpass_op);
- GLint ref = i915->stencil.ref_value[0] & 0xff;
+ int test = i915_translate_compare_func(i915->stencil.front_func);
+ int fop = i915_translate_stencil_op(i915->stencil.front_fail_op);
+ int dfop = i915_translate_stencil_op(i915->stencil.front_zfail_op);
+ int dpop = i915_translate_stencil_op(i915->stencil.front_zpass_op);
+ int ref = i915->stencil.ref_value[0] & 0xff;
LIS5 |= (S5_STENCIL_TEST_ENABLE |
S5_STENCIL_WRITE_ENABLE |
@@ -184,16 +185,14 @@ const struct i915_tracked_state i915_upload_S5 = {
*/
static void upload_S6( struct i915_context *i915 )
{
- GLuint LIS6 = (S6_COLOR_WRITE_ENABLE |
+ unsigned LIS6 = (S6_COLOR_WRITE_ENABLE |
(2 << S6_TRISTRIP_PV_SHIFT));
/* I915_NEW_ALPHA_TEST
*/
if (i915->alpha_test.enabled) {
int test = i915_translate_compare_func(i915->alpha_test.func);
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, i915->alpha_test.ref);
+ ubyte refByte = float_to_ubyte(i915->alpha_test.ref);
LIS6 |= (S6_ALPHA_TEST_ENABLE |
@@ -205,9 +204,9 @@ static void upload_S6( struct i915_context *i915 )
*/
if (i915->blend.blend_enable)
{
- GLuint funcRGB = i915->blend.rgb_func;
- GLuint srcRGB = i915->blend.rgb_src_factor;
- GLuint dstRGB = i915->blend.rgb_dst_factor;
+ unsigned funcRGB = i915->blend.rgb_func;
+ unsigned srcRGB = i915->blend.rgb_src_factor;
+ unsigned dstRGB = i915->blend.rgb_dst_factor;
LIS6 |= (S6_CBUF_BLEND_ENABLE |
SRC_BLND_FACT(i915_translate_blend_factor(srcRGB)) |
@@ -218,7 +217,7 @@ static void upload_S6( struct i915_context *i915 )
/* I915_NEW_DEPTH
*/
if (i915->depth_test.enabled) {
- GLint func = i915_translate_compare_func(i915->depth_test.func);
+ int func = i915_translate_compare_func(i915->depth_test.func);
LIS6 |= (S6_DEPTH_TEST_ENABLE |
(func << S6_DEPTH_TEST_FUNC_SHIFT));
@@ -243,7 +242,7 @@ const struct i915_tracked_state i915_upload_S6 = {
*/
static void upload_S7( struct i915_context *i915 )
{
- GLfloat LIS7;
+ float LIS7;
/* I915_NEW_SETUP
*/
diff --git a/src/mesa/pipe/i915simple/i915_state_inlines.h b/src/mesa/pipe/i915simple/i915_state_inlines.h
index 28aff0ebd4c..0934ac79a41 100644
--- a/src/mesa/pipe/i915simple/i915_state_inlines.h
+++ b/src/mesa/pipe/i915simple/i915_state_inlines.h
@@ -28,6 +28,7 @@
#ifndef I915_STATE_INLINES_H
#define I915_STATE_INLINES_H
+#include "p_compiler.h"
#include "p_defines.h"
#include "i915_reg.h"
@@ -184,9 +185,9 @@ i915_translate_logic_op(unsigned opcode)
-static INLINE GLboolean i915_validate_vertices( GLuint hw_prim, GLuint nr )
+static INLINE boolean i915_validate_vertices( unsigned hw_prim, unsigned nr )
{
- GLboolean ok;
+ boolean ok;
switch (hw_prim) {
case PRIM3D_POINTLIST:
@@ -226,5 +227,4 @@ static INLINE GLboolean i915_validate_vertices( GLuint hw_prim, GLuint nr )
return ok;
}
-
#endif
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c
index cc0a87012a6..c094cf9ec47 100644
--- a/src/mesa/pipe/i915simple/i915_surface.c
+++ b/src/mesa/pipe/i915simple/i915_surface.c
@@ -28,8 +28,8 @@
#include "i915_context.h"
#include "i915_state.h"
#include "pipe/p_defines.h"
-#include "main/imports.h"
-#include "main/macros.h"
+#include "pipe/p_util.h"
+//#include "main/imports.h"
struct i915_surface
@@ -45,13 +45,13 @@ struct i915_surface
*/
static void
i915_get_tile(struct pipe_surface *ps,
- GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p)
+ unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
- const GLuint *src
- = ((const GLuint *) (ps->region->map + ps->offset))
+ const unsigned *src
+ = ((const unsigned *) (ps->region->map + ps->offset))
+ y * ps->region->pitch + x;
- GLuint i, j;
- GLuint w0 = w;
+ unsigned i, j;
+ unsigned w0 = w;
assert(ps->format == PIPE_FORMAT_U_A8_R8_G8_B8);
@@ -66,9 +66,9 @@ i915_get_tile(struct pipe_surface *ps,
h = ps->height -y;
#endif
for (i = 0; i < h; i++) {
- GLfloat *pRow = p;
+ float *pRow = p;
for (j = 0; j < w; j++) {
- const GLuint pixel = src[j];
+ const unsigned pixel = src[j];
pRow[0] = UBYTE_TO_FLOAT((pixel >> 16) & 0xff);
pRow[1] = UBYTE_TO_FLOAT((pixel >> 8) & 0xff);
pRow[2] = UBYTE_TO_FLOAT((pixel >> 0) & 0xff);
@@ -83,7 +83,7 @@ i915_get_tile(struct pipe_surface *ps,
static void
i915_put_tile(struct pipe_surface *ps,
- GLuint x, GLuint y, GLuint w, GLuint h, const GLfloat *p)
+ unsigned x, unsigned y, unsigned w, unsigned h, const float *p)
{
/* any need to put tiles into i915 surfaces? */
assert(0);
@@ -92,7 +92,7 @@ i915_put_tile(struct pipe_surface *ps,
static struct pipe_surface *
-i915_surface_alloc(struct pipe_context *pipe, GLuint format)
+i915_surface_alloc(struct pipe_context *pipe, unsigned format)
{
struct i915_surface *surf = CALLOC_STRUCT(i915_surface);
diff --git a/src/mesa/pipe/i915simple/i915_tex_layout.c b/src/mesa/pipe/i915simple/i915_tex_layout.c
index d0c58de6913..ec1fb9532d2 100644
--- a/src/mesa/pipe/i915simple/i915_tex_layout.c
+++ b/src/mesa/pipe/i915simple/i915_tex_layout.c
@@ -30,13 +30,17 @@
* Michel Dänzer <[email protected]>
*/
-#include "macros.h"
+//#include "macros.h"
#include "pipe/p_state.h"
#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
+
#include "i915_tex_layout.h"
+#include "i915_debug.h"
-static GLuint minify( GLuint d )
+static unsigned minify( unsigned d )
{
return MAX2(1, d>>1);
}
@@ -49,11 +53,11 @@ static int align(int value, int alignment)
static void
i915_miptree_set_level_info(struct pipe_mipmap_tree *mt,
- GLuint level,
- GLuint nr_images,
- GLuint x, GLuint y, GLuint w, GLuint h, GLuint d)
+ unsigned level,
+ unsigned nr_images,
+ unsigned x, unsigned y, unsigned w, unsigned h, unsigned d)
{
- assert(level < MAX_TEXTURE_LEVELS);
+ assert(level < PIPE_MAX_TEXTURE_LEVELS);
mt->level[level].width = w;
mt->level[level].height = h;
@@ -76,14 +80,14 @@ i915_miptree_set_level_info(struct pipe_mipmap_tree *mt,
assert(nr_images);
assert(!mt->level[level].image_offset);
- mt->level[level].image_offset = (GLuint *) malloc(nr_images * sizeof(GLuint));
+ mt->level[level].image_offset = (unsigned *) malloc(nr_images * sizeof(unsigned));
mt->level[level].image_offset[0] = 0;
}
static void
i915_miptree_set_image_offset(struct pipe_mipmap_tree *mt,
- GLuint level, GLuint img, GLuint x, GLuint y)
+ unsigned level, unsigned img, unsigned x, unsigned y)
{
if (img == 0 && level == 0)
assert(x == 0 && y == 0);
@@ -102,12 +106,12 @@ i915_miptree_set_image_offset(struct pipe_mipmap_tree *mt,
static void
i945_miptree_layout_2d( struct pipe_mipmap_tree *mt )
{
- GLint align_h = 2, align_w = 4;
- GLuint level;
- GLuint x = 0;
- GLuint y = 0;
- GLuint width = mt->width0;
- GLuint height = mt->height0;
+ int align_h = 2, align_w = 4;
+ unsigned level;
+ unsigned x = 0;
+ unsigned y = 0;
+ unsigned width = mt->width0;
+ unsigned height = mt->height0;
mt->pitch = mt->width0;
@@ -117,7 +121,7 @@ i945_miptree_layout_2d( struct pipe_mipmap_tree *mt )
* 2nd mipmap out past the width of its parent.
*/
if (mt->first_level != mt->last_level) {
- GLuint mip1_width = align(minify(mt->width0), align_w)
+ unsigned mip1_width = align(minify(mt->width0), align_w)
+ minify(minify(mt->width0));
if (mip1_width > mt->width0)
@@ -131,7 +135,7 @@ i945_miptree_layout_2d( struct pipe_mipmap_tree *mt )
mt->total_height = 0;
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
- GLuint img_height;
+ unsigned img_height;
i915_miptree_set_level_info(mt, level, 1, x, y, width, height, 1);
@@ -161,7 +165,7 @@ i945_miptree_layout_2d( struct pipe_mipmap_tree *mt )
}
-static const GLint initial_offsets[6][2] = {
+static const int initial_offsets[6][2] = {
{0, 0},
{0, 2},
{1, 0},
@@ -170,7 +174,7 @@ static const GLint initial_offsets[6][2] = {
{1, 3}
};
-static const GLint step_offsets[6][2] = {
+static const int step_offsets[6][2] = {
{0, 2},
{0, 2},
{-1, 2},
@@ -180,16 +184,16 @@ static const GLint step_offsets[6][2] = {
};
-GLboolean
+boolean
i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
- GLint level;
+ int level;
switch (mt->target) {
- case GL_TEXTURE_CUBE_MAP:{
- const GLuint dim = mt->width0;
- GLuint face;
- GLuint lvlWidth = mt->width0, lvlHeight = mt->height0;
+ case PIPE_TEXTURE_CUBE: {
+ const unsigned dim = mt->width0;
+ unsigned face;
+ unsigned lvlWidth = mt->width0, lvlHeight = mt->height0;
assert(lvlWidth == lvlHeight); /* cubemap images are square */
@@ -208,17 +212,12 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
}
for (face = 0; face < 6; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
+ unsigned x = initial_offsets[face][0] * dim;
+ unsigned y = initial_offsets[face][1] * dim;
+ unsigned d = dim;
for (level = mt->first_level; level <= mt->last_level; level++) {
i915_miptree_set_image_offset(mt, level, face, x, y);
-
- if (d == 0)
- _mesa_printf("cube mipmap %d/%d (%d..%d) is 0x0\n",
- face, level, mt->first_level, mt->last_level);
-
d >>= 1;
x += step_offsets[face][0] * d;
y += step_offsets[face][1] * d;
@@ -226,11 +225,11 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
}
break;
}
- case GL_TEXTURE_3D:{
- GLuint width = mt->width0;
- GLuint height = mt->height0;
- GLuint depth = mt->depth0;
- GLuint stack_height = 0;
+ case PIPE_TEXTURE_3D:{
+ unsigned width = mt->width0;
+ unsigned height = mt->height0;
+ unsigned depth = mt->depth0;
+ unsigned stack_height = 0;
/* Calculate the size of a single slice.
*/
@@ -255,7 +254,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
*/
depth = mt->depth0;
for (level = mt->first_level; level <= mt->last_level; level++) {
- GLuint i;
+ unsigned i;
for (i = 0; i < depth; i++)
i915_miptree_set_image_offset(mt, level, i,
0, i * stack_height);
@@ -273,9 +272,9 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
}
default:{
- GLuint width = mt->width0;
- GLuint height = mt->height0;
- GLuint img_height;
+ unsigned width = mt->width0;
+ unsigned height = mt->height0;
+ unsigned img_height;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
@@ -304,20 +303,20 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
*/
- return GL_TRUE;
+ return TRUE;
}
-GLboolean
+boolean
i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
- GLint level;
+ int level;
switch (mt->target) {
- case GL_TEXTURE_CUBE_MAP:{
- const GLuint dim = mt->width0;
- GLuint face;
- GLuint lvlWidth = mt->width0, lvlHeight = mt->height0;
+ case PIPE_TEXTURE_CUBE:{
+ const unsigned dim = mt->width0;
+ unsigned face;
+ unsigned lvlWidth = mt->width0, lvlHeight = mt->height0;
assert(lvlWidth == lvlHeight); /* cubemap images are square */
@@ -344,9 +343,9 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
for (face = 0; face < 6; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
+ unsigned x = initial_offsets[face][0] * dim;
+ unsigned y = initial_offsets[face][1] * dim;
+ unsigned d = dim;
if (dim == 4 && face >= 4) {
y = mt->total_height - 4;
@@ -365,18 +364,18 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
switch (d) {
case 4:
switch (face) {
- case FACE_POS_X:
- case FACE_NEG_X:
+ case PIPE_TEX_FACE_POS_X:
+ case PIPE_TEX_FACE_NEG_X:
x += step_offsets[face][0] * d;
y += step_offsets[face][1] * d;
break;
- case FACE_POS_Y:
- case FACE_NEG_Y:
+ case PIPE_TEX_FACE_POS_Y:
+ case PIPE_TEX_FACE_NEG_Y:
y += 12;
x -= 8;
break;
- case FACE_POS_Z:
- case FACE_NEG_Z:
+ case PIPE_TEX_FACE_POS_Z:
+ case PIPE_TEX_FACE_NEG_Z:
y = mt->total_height - 4;
x = (face - 4) * 8;
break;
@@ -400,13 +399,13 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
}
break;
}
- case GL_TEXTURE_3D:{
- GLuint width = mt->width0;
- GLuint height = mt->height0;
- GLuint depth = mt->depth0;
- GLuint pack_x_pitch, pack_x_nr;
- GLuint pack_y_pitch;
- GLuint level;
+ case PIPE_TEXTURE_3D:{
+ unsigned width = mt->width0;
+ unsigned height = mt->height0;
+ unsigned depth = mt->depth0;
+ unsigned pack_x_pitch, pack_x_nr;
+ unsigned pack_y_pitch;
+ unsigned level;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
@@ -416,10 +415,10 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
pack_x_nr = 1;
for (level = mt->first_level; level <= mt->last_level; level++) {
- GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6;
- GLint x = 0;
- GLint y = 0;
- GLint q, j;
+ unsigned nr_images = mt->target == PIPE_TEXTURE_3D ? depth : 6;
+ int x = 0;
+ int y = 0;
+ int q, j;
i915_miptree_set_level_info(mt, level, nr_images,
0, mt->total_height,
@@ -455,13 +454,14 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
break;
}
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_RECTANGLE_ARB:
+ case PIPE_TEXTURE_1D:
+ case PIPE_TEXTURE_2D:
+// case PIPE_TEXTURE_RECTANGLE:
i945_miptree_layout_2d(mt);
break;
default:
- _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()");
+ assert(0);
+ return FALSE;
}
/*
@@ -470,6 +470,6 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
*/
- return GL_TRUE;
+ return TRUE;
}
diff --git a/src/mesa/pipe/i915simple/i915_tex_layout.h b/src/mesa/pipe/i915simple/i915_tex_layout.h
index b1555f1dd88..e0337863815 100644
--- a/src/mesa/pipe/i915simple/i915_tex_layout.h
+++ b/src/mesa/pipe/i915simple/i915_tex_layout.h
@@ -6,10 +6,10 @@ struct pipe_context;
struct pipe_mipmap_tree;
-extern GLboolean
+extern boolean
i915_miptree_layout(struct pipe_context *, struct pipe_mipmap_tree *);
-extern GLboolean
+extern boolean
i945_miptree_layout(struct pipe_context *, struct pipe_mipmap_tree *);
diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/mesa/pipe/i915simple/i915_winsys.h
index 803ee9073c2..10a82830354 100644
--- a/src/mesa/pipe/i915simple/i915_winsys.h
+++ b/src/mesa/pipe/i915simple/i915_winsys.h
@@ -28,7 +28,7 @@
#ifndef I915_WINSYS_H
#define I915_WINSYS_H
-#include "main/mtypes.h"
+//#include "main/mtypes.h"
/* This is the interface that softpipe requires any window system
* hosting it to implement. This is the only include file in softpipe