summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c27
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h24
-rw-r--r--src/mesa/pipe/softpipe/sp_headers.h24
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c219
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.h78
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_alpha_test.c7
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_blend.c36
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_bufloop.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_colormask.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_coverage.c5
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_depth_test.c15
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c48
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_occlusion.c3
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_output.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stencil.c35
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stipple.c11
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c64
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h5
-rw-r--r--src/mesa/pipe/softpipe/sp_state_blend.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_clip.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c22
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_state_surface.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c127
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.h35
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_layout.c87
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_layout.h2
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_sample.c72
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_sample.h8
30 files changed, 454 insertions, 552 deletions
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index 14ddf0c3060..27744137209 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -35,7 +35,7 @@
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_state.h"
-#include "colormac.h"
+//#include "colormac.h"
/**
@@ -47,7 +47,7 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- GLint x, y, w, h;
+ int x, y, w, h;
softpipe_update_derived(softpipe); /* not needed?? */
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 34ef00f619e..1ea6bbbf7fe 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -29,10 +29,9 @@
* Keith Whitwell <[email protected]>
*/
-#include "main/imports.h"
-#include "main/macros.h"
#include "pipe/draw/draw_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_clear.h"
#include "sp_context.h"
#include "sp_flush.h"
@@ -50,11 +49,11 @@
* If we find texture and drawable support differs, add a selector
* parameter or another function.
*/
-static const GLuint *
-softpipe_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
+static const unsigned *
+softpipe_supported_formats(struct pipe_context *pipe, unsigned *numFormats)
{
#if 0
- static const GLuint supported[] = {
+ static const unsigned supported[] = {
PIPE_FORMAT_U_R8_G8_B8_A8,
PIPE_FORMAT_U_A8_R8_G8_B8,
PIPE_FORMAT_U_R5_G6_B5,
@@ -82,9 +81,9 @@ softpipe_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
static void
-softpipe_max_texture_size(struct pipe_context *pipe, GLuint textureType,
- GLuint *maxWidth, GLuint *maxHeight,
- GLuint *maxDepth)
+softpipe_max_texture_size(struct pipe_context *pipe, unsigned textureType,
+ unsigned *maxWidth, unsigned *maxHeight,
+ unsigned *maxDepth)
{
switch (textureType) {
case PIPE_TEXTURE_1D:
@@ -112,7 +111,7 @@ softpipe_max_texture_size(struct pipe_context *pipe, GLuint textureType,
static void map_surfaces(struct softpipe_context *sp)
{
struct pipe_context *pipe = &sp->pipe;
- GLuint i;
+ unsigned i;
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);
@@ -147,7 +146,7 @@ static void map_surfaces(struct softpipe_context *sp)
static void unmap_surfaces(struct softpipe_context *sp)
{
struct pipe_context *pipe = &sp->pipe;
- GLuint i;
+ unsigned i;
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);
@@ -206,9 +205,9 @@ static void softpipe_draw_vb( struct pipe_context *pipe,
static void
softpipe_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 softpipe_context *softpipe = softpipe_context( pipe );
@@ -230,7 +229,7 @@ static void softpipe_reset_occlusion_counter(struct pipe_context *pipe)
}
/* XXX pipe param should be const */
-static GLuint softpipe_get_occlusion_counter(struct pipe_context *pipe)
+static unsigned softpipe_get_occlusion_counter(struct pipe_context *pipe)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
return softpipe->occlusion_counter;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index a99c083caa5..8887c576c1f 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -31,7 +31,7 @@
#ifndef SP_CONTEXT_H
#define SP_CONTEXT_H
-#include "glheader.h"
+//#include "glheader.h"
#include "pipe/p_state.h"
#include "pipe/p_context.h"
@@ -88,7 +88,7 @@ struct softpipe_context {
struct pipe_stencil_state stencil;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
- GLuint dirty;
+ unsigned dirty;
/* Setup derived state. TODO: this should be passed in the program
* tokens as parameters to DECL instructions.
@@ -103,28 +103,28 @@ struct softpipe_context {
*/
/** Map fragment program attribute to quad/coef array slot */
- GLuint fp_attr_to_slot[PIPE_ATTRIB_MAX];
+ unsigned fp_attr_to_slot[PIPE_ATTRIB_MAX];
/** Map vertex format attribute to a vertex attribute slot */
- GLuint vf_attr_to_slot[PIPE_ATTRIB_MAX];
- GLuint nr_attrs;
- GLuint nr_frag_attrs; /**< number of active fragment attribs */
- GLbitfield attr_mask; /**< bitfield of VF_ATTRIB_ indexes/bits */
+ unsigned vf_attr_to_slot[PIPE_ATTRIB_MAX];
+ unsigned nr_attrs;
+ unsigned nr_frag_attrs; /**< number of active fragment attribs */
+ unsigned attr_mask; /**< bitfield of VF_ATTRIB_ indexes/bits */
- GLboolean need_z; /**< produce quad/fragment Z values? */
- GLboolean need_w; /**< produce quad/fragment W values? */
+ boolean need_z; /**< produce quad/fragment Z values? */
+ boolean need_w; /**< produce quad/fragment W values? */
#if 0
/* Stipple derived state:
*/
- GLubyte stipple_masks[16][16];
+ ubyte stipple_masks[16][16];
#endif
/** Derived from scissor and surface bounds: */
struct pipe_scissor_state cliprect;
- GLuint occlusion_counter;
+ unsigned occlusion_counter;
- GLuint line_stipple_counter;
+ unsigned line_stipple_counter;
/** Software quad rendering pipeline */
struct {
diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/mesa/pipe/softpipe/sp_headers.h
index 68a84621f2c..b7f46cb6583 100644
--- a/src/mesa/pipe/softpipe/sp_headers.h
+++ b/src/mesa/pipe/softpipe/sp_headers.h
@@ -57,9 +57,9 @@
struct setup_coefficient {
- GLfloat a0[NUM_CHANNELS]; /* in an xyzw layout */
- GLfloat dadx[NUM_CHANNELS];
- GLfloat dady[NUM_CHANNELS];
+ float a0[NUM_CHANNELS]; /* in an xyzw layout */
+ float dadx[NUM_CHANNELS];
+ float dady[NUM_CHANNELS];
};
@@ -69,18 +69,18 @@ struct setup_coefficient {
* "Channel-Serial" or "SoA" layout.
*/
struct quad_header {
- GLint x0;
- GLint y0;
- GLuint mask:4;
- GLuint facing:1; /**< Front (0) or back (1) facing? */
- GLuint prim:2; /**< PRIM_POINT, LINE, TRI */
+ int x0;
+ int y0;
+ unsigned mask:4;
+ unsigned facing:1; /**< Front (0) or back (1) facing? */
+ unsigned prim:2; /**< PRIM_POINT, LINE, TRI */
struct {
- GLfloat color[4][QUAD_SIZE]; /* rrrr, gggg, bbbb, aaaa */
- GLfloat depth[QUAD_SIZE];
+ float color[4][QUAD_SIZE]; /* rrrr, gggg, bbbb, aaaa */
+ float depth[QUAD_SIZE];
} outputs;
- GLfloat coverage[QUAD_SIZE]; /** fragment coverage for antialiasing */
+ float coverage[QUAD_SIZE]; /** fragment coverage for antialiasing */
const struct setup_coefficient *coef;
@@ -88,7 +88,7 @@ struct quad_header {
* encoded in fragment program DECL
* statements. */
- GLuint nr_attrs;
+ unsigned nr_attrs;
};
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 7a3d011b7bd..45d09860c3c 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -33,25 +33,26 @@
*/
-#include "imports.h"
-#include "macros.h"
+//#include "imports.h"
+//#include "macros.h"
#include "sp_context.h"
#include "sp_headers.h"
-#include "pipe/draw/draw_private.h"
#include "sp_quad.h"
#include "sp_prim_setup.h"
+#include "pipe/draw/draw_private.h"
+#include "pipe/p_util.h"
/**
* Triangle edge info
*/
struct edge {
- GLfloat dx; /**< X(v1) - X(v0), used only during setup */
- GLfloat dy; /**< Y(v1) - Y(v0), used only during setup */
- GLfloat dxdy; /**< dx/dy */
- GLfloat sx, sy; /**< first sample point coord */
- GLint lines; /**< number of lines on this edge */
+ float dx; /**< X(v1) - X(v0), used only during setup */
+ float dy; /**< Y(v1) - Y(v0), used only during setup */
+ float dxdy; /**< dx/dy */
+ float sx, sy; /**< first sample point coord */
+ int lines; /**< number of lines on this edge */
};
@@ -77,17 +78,17 @@ struct setup_stage {
struct edge etop;
struct edge emaj;
- GLfloat oneoverarea;
+ float oneoverarea;
struct setup_coefficient coef[FRAG_ATTRIB_MAX];
struct quad_header quad;
struct {
- GLint left[2]; /**< [0] = row0, [1] = row1 */
- GLint right[2];
- GLint y;
- GLuint y_flags;
- GLuint mask; /**< mask of MASK_BOTTOM/TOP_LEFT/RIGHT bits */
+ int left[2]; /**< [0] = row0, [1] = row1 */
+ int right[2];
+ int y;
+ unsigned y_flags;
+ unsigned mask; /**< mask of MASK_BOTTOM/TOP_LEFT/RIGHT bits */
} span;
};
@@ -146,7 +147,7 @@ clip_emit_quad(struct setup_stage *setup)
* Emit a quad (pass to next stage). No clipping is done.
*/
static INLINE void
-emit_quad( struct setup_stage *setup, GLint x, GLint y, GLuint mask )
+emit_quad( struct setup_stage *setup, int x, int y, unsigned mask )
{
struct softpipe_context *sp = setup->softpipe;
setup->quad.x0 = x;
@@ -160,7 +161,7 @@ emit_quad( struct setup_stage *setup, GLint x, GLint y, GLuint mask )
* Given an X or Y coordinate, return the block/quad coordinate that it
* belongs to.
*/
-static INLINE GLint block( GLint x )
+static INLINE int block( int x )
{
return x & ~1;
}
@@ -173,10 +174,10 @@ static INLINE GLint block( GLint x )
* this is pretty nasty... may need to rework flush_spans again to
* fix it, if possible.
*/
-static GLuint calculate_mask( struct setup_stage *setup,
- GLint x )
+static unsigned calculate_mask( struct setup_stage *setup,
+ int x )
{
- GLuint mask = 0;
+ unsigned mask = 0;
if (x >= setup->span.left[0] && x < setup->span.right[0])
mask |= MASK_BOTTOM_LEFT;
@@ -199,8 +200,8 @@ static GLuint calculate_mask( struct setup_stage *setup,
*/
static void flush_spans( struct setup_stage *setup )
{
- GLint minleft, maxright;
- GLint x;
+ int minleft, maxright;
+ int x;
switch (setup->span.y_flags) {
case 3:
@@ -249,7 +250,7 @@ static void print_vertex(const struct setup_stage *setup,
}
#endif
-static GLboolean setup_sort_vertices( struct setup_stage *setup,
+static boolean setup_sort_vertices( struct setup_stage *setup,
const struct prim_header *prim )
{
const struct vertex_header *v0 = prim->v[0];
@@ -267,9 +268,9 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
/* determine bottom to top order of vertices */
{
- GLfloat y0 = v0->data[0][1];
- GLfloat y1 = v1->data[0][1];
- GLfloat y2 = v2->data[0][1];
+ float y0 = v0->data[0][1];
+ float y1 = v1->data[0][1];
+ float y2 = v2->data[0][1];
if (y0 <= y1) {
if (y1 <= y2) {
/* y0<=y1<=y2 */
@@ -330,7 +331,7 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
* use the prim->det value because its sign is correct.
*/
{
- const GLfloat area = (setup->emaj.dx * setup->ebot.dy -
+ const float area = (setup->emaj.dx * setup->ebot.dy -
setup->ebot.dx * setup->emaj.dy);
setup->oneoverarea = 1.0 / area;
@@ -346,7 +347,7 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
*/
setup->quad.facing = (prim->det > 0.0) ^ (setup->softpipe->setup.front_winding == PIPE_WINDING_CW);
- return GL_TRUE;
+ return TRUE;
}
@@ -358,8 +359,8 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
* \param i which component of the slot (0..3)
*/
static void const_coeff( struct setup_stage *setup,
- GLuint slot,
- GLuint i )
+ unsigned slot,
+ unsigned i )
{
assert(slot < FRAG_ATTRIB_MAX);
assert(i <= 3);
@@ -378,13 +379,13 @@ static void const_coeff( struct setup_stage *setup,
* for a triangle.
*/
static void tri_linear_coeff( struct setup_stage *setup,
- GLuint slot,
- GLuint i)
+ unsigned slot,
+ unsigned i)
{
- GLfloat botda = setup->vmid->data[slot][i] - setup->vmin->data[slot][i];
- GLfloat majda = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
- GLfloat a = setup->ebot.dy * majda - botda * setup->emaj.dy;
- GLfloat b = setup->emaj.dx * botda - majda * setup->ebot.dx;
+ float botda = setup->vmid->data[slot][i] - setup->vmin->data[slot][i];
+ float majda = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
+ float a = setup->ebot.dy * majda - botda * setup->emaj.dy;
+ float b = setup->emaj.dx * botda - majda * setup->ebot.dx;
assert(slot < FRAG_ATTRIB_MAX);
assert(i <= 3);
@@ -423,19 +424,19 @@ static void tri_linear_coeff( struct setup_stage *setup,
* for a triangle.
*/
static void tri_persp_coeff( struct setup_stage *setup,
- GLuint slot,
- GLuint i )
+ unsigned slot,
+ unsigned i )
{
/* premultiply by 1/w:
*/
- GLfloat mina = setup->vmin->data[slot][i] * setup->vmin->data[0][3];
- GLfloat mida = setup->vmid->data[slot][i] * setup->vmid->data[0][3];
- GLfloat maxa = setup->vmax->data[slot][i] * setup->vmax->data[0][3];
-
- GLfloat botda = mida - mina;
- GLfloat majda = maxa - mina;
- GLfloat a = setup->ebot.dy * majda - botda * setup->emaj.dy;
- GLfloat b = setup->emaj.dx * botda - majda * setup->ebot.dx;
+ float mina = setup->vmin->data[slot][i] * setup->vmin->data[0][3];
+ float mida = setup->vmid->data[slot][i] * setup->vmid->data[0][3];
+ float maxa = setup->vmax->data[slot][i] * setup->vmax->data[0][3];
+
+ float botda = mida - mina;
+ float majda = maxa - mina;
+ float a = setup->ebot.dy * majda - botda * setup->emaj.dy;
+ float b = setup->emaj.dx * botda - majda * setup->ebot.dx;
assert(slot < FRAG_ATTRIB_MAX);
assert(i <= 3);
@@ -455,7 +456,7 @@ static void tri_persp_coeff( struct setup_stage *setup,
static void setup_tri_coefficients( struct setup_stage *setup )
{
const enum interp_mode *interp = setup->softpipe->interp;
- GLuint slot, j;
+ unsigned slot, j;
/* z and w are done by linear interpolation:
*/
@@ -488,25 +489,25 @@ static void setup_tri_coefficients( struct setup_stage *setup )
static void setup_tri_edges( struct setup_stage *setup )
{
- GLfloat vmin_x = setup->vmin->data[0][0] + 0.5;
- GLfloat vmid_x = setup->vmid->data[0][0] + 0.5;
+ float vmin_x = setup->vmin->data[0][0] + 0.5;
+ float vmid_x = setup->vmid->data[0][0] + 0.5;
- GLfloat vmin_y = setup->vmin->data[0][1] - 0.5;
- GLfloat vmid_y = setup->vmid->data[0][1] - 0.5;
- GLfloat vmax_y = setup->vmax->data[0][1] - 0.5;
+ float vmin_y = setup->vmin->data[0][1] - 0.5;
+ float vmid_y = setup->vmid->data[0][1] - 0.5;
+ float vmax_y = setup->vmax->data[0][1] - 0.5;
setup->emaj.sy = ceilf(vmin_y);
- setup->emaj.lines = (GLint) ceilf(vmax_y - setup->emaj.sy);
+ setup->emaj.lines = (int) ceilf(vmax_y - setup->emaj.sy);
setup->emaj.dxdy = setup->emaj.dx / setup->emaj.dy;
setup->emaj.sx = vmin_x + (setup->emaj.sy - vmin_y) * setup->emaj.dxdy;
setup->etop.sy = ceilf(vmid_y);
- setup->etop.lines = (GLint) ceilf(vmax_y - setup->etop.sy);
+ setup->etop.lines = (int) ceilf(vmax_y - setup->etop.sy);
setup->etop.dxdy = setup->etop.dx / setup->etop.dy;
setup->etop.sx = vmid_x + (setup->etop.sy - vmid_y) * setup->etop.dxdy;
setup->ebot.sy = ceilf(vmin_y);
- setup->ebot.lines = (GLint) ceilf(vmid_y - setup->ebot.sy);
+ setup->ebot.lines = (int) ceilf(vmid_y - setup->ebot.sy);
setup->ebot.dxdy = setup->ebot.dx / setup->ebot.dy;
setup->ebot.sx = vmin_x + (setup->ebot.sy - vmin_y) * setup->ebot.dxdy;
}
@@ -519,13 +520,13 @@ static void setup_tri_edges( struct setup_stage *setup )
static void subtriangle( struct setup_stage *setup,
struct edge *eleft,
struct edge *eright,
- GLuint lines )
+ unsigned lines )
{
const struct pipe_scissor_state *cliprect = &setup->softpipe->cliprect;
- GLint y, start_y, finish_y;
- GLint sy = (GLint)eleft->sy;
+ int y, start_y, finish_y;
+ int sy = (int)eleft->sy;
- assert((GLint)eleft->sy == (GLint) eright->sy);
+ assert((int)eleft->sy == (int) eright->sy);
/* clip top/bottom */
start_y = sy;
@@ -552,8 +553,8 @@ static void subtriangle( struct setup_stage *setup,
*
* this is all drowned out by the attribute interpolation anyway.
*/
- GLint left = (GLint)(eleft->sx + y * eleft->dxdy);
- GLint right = (GLint)(eright->sx + y * eright->dxdy);
+ int left = (int)(eleft->sx + y * eleft->dxdy);
+ int right = (int)(eright->sx + y * eright->dxdy);
/* clip left/right */
if (left < cliprect->minx)
@@ -562,7 +563,7 @@ static void subtriangle( struct setup_stage *setup,
right = cliprect->maxx;
if (left < right) {
- GLint _y = sy+y;
+ int _y = sy+y;
if (block(_y) != setup->span.y) {
flush_spans(setup);
setup->span.y = block(_y);
@@ -633,11 +634,11 @@ static void setup_tri( struct draw_stage *stage,
* for a line.
*/
static void
-line_linear_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
+line_linear_coeff(struct setup_stage *setup, unsigned slot, unsigned i)
{
- const GLfloat dz = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
- const GLfloat dadx = dz * setup->emaj.dx * setup->oneoverarea;
- const GLfloat dady = dz * setup->emaj.dy * setup->oneoverarea;
+ const float dz = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
+ const float dadx = dz * setup->emaj.dx * setup->oneoverarea;
+ const float dady = dz * setup->emaj.dy * setup->oneoverarea;
setup->coef[slot].dadx[i] = dadx;
setup->coef[slot].dady[i] = dady;
setup->coef[slot].a0[i]
@@ -652,7 +653,7 @@ line_linear_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
* for a line.
*/
static void
-line_persp_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
+line_persp_coeff(struct setup_stage *setup, unsigned slot, unsigned i)
{
/* XXX to do */
line_linear_coeff(setup, slot, i); /* XXX temporary */
@@ -667,7 +668,7 @@ static INLINE void
setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
{
const enum interp_mode *interp = setup->softpipe->interp;
- GLuint slot, j;
+ unsigned slot, j;
/* use setup->vmin, vmax to point to vertices */
setup->vprovoke = prim->v[1];
@@ -712,13 +713,13 @@ setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
* Plot a pixel in a line segment.
*/
static INLINE void
-plot(struct setup_stage *setup, GLint x, GLint y)
+plot(struct setup_stage *setup, int x, int y)
{
- const GLint iy = y & 1;
- const GLint ix = x & 1;
- const GLint quadX = x - ix;
- const GLint quadY = y - iy;
- const GLint mask = (1 << ix) << (2 * iy);
+ const int iy = y & 1;
+ const int ix = x & 1;
+ const int quadX = x - ix;
+ const int quadY = y - iy;
+ const int mask = (1 << ix) << (2 * iy);
if (quadX != setup->quad.x0 ||
quadY != setup->quad.y0)
@@ -741,10 +742,10 @@ plot(struct setup_stage *setup, GLint x, GLint y)
* Determine whether or not to emit a line fragment by checking
* line stipple pattern.
*/
-static INLINE GLuint
-stipple_test(GLint counter, GLushort pattern, GLint factor)
+static INLINE unsigned
+stipple_test(int counter, ushort pattern, int factor)
{
- GLint b = (counter / factor) & 0xf;
+ int b = (counter / factor) & 0xf;
return (1 << b) & pattern;
}
@@ -761,13 +762,13 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
struct setup_stage *setup = setup_stage( stage );
struct softpipe_context *sp = setup->softpipe;
- GLint x0 = (GLint) v0->data[0][0];
- GLint x1 = (GLint) v1->data[0][0];
- GLint y0 = (GLint) v0->data[0][1];
- GLint y1 = (GLint) v1->data[0][1];
- GLint dx = x1 - x0;
- GLint dy = y1 - y0;
- GLint xstep, ystep;
+ int x0 = (int) v0->data[0][0];
+ int x1 = (int) v1->data[0][0];
+ int y0 = (int) v0->data[0][1];
+ int y1 = (int) v1->data[0][1];
+ int dx = x1 - x0;
+ int dy = y1 - y0;
+ int xstep, ystep;
if (dx == 0 && dy == 0)
return;
@@ -806,10 +807,10 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
if (dx > dy) {
/*** X-major line ***/
- GLint i;
- const GLint errorInc = dy + dy;
- GLint error = errorInc - dx;
- const GLint errorDec = error - dx;
+ int i;
+ const int errorInc = dy + dy;
+ int error = errorInc - dx;
+ const int errorDec = error - dx;
for (i = 0; i < dx; i++) {
if (!sp->setup.line_stipple_enable ||
@@ -833,10 +834,10 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
}
else {
/*** Y-major line ***/
- GLint i;
- const GLint errorInc = dx + dx;
- GLint error = errorInc - dy;
- const GLint errorDec = error - dy;
+ int i;
+ const int errorInc = dx + dx;
+ int error = errorInc - dy;
+ const int errorDec = error - dy;
for (i = 0; i < dy; i++) {
if (!sp->setup.line_stipple_enable ||
@@ -877,12 +878,12 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
{
struct setup_stage *setup = setup_stage( stage );
/*XXX this should be a vertex attrib! */
- const GLfloat halfSize = 0.5 * setup->softpipe->setup.point_size;
- const GLboolean round = setup->softpipe->setup.point_smooth;
+ const float halfSize = 0.5 * setup->softpipe->setup.point_size;
+ const boolean round = setup->softpipe->setup.point_smooth;
const struct vertex_header *v0 = prim->v[0];
- const GLfloat x = v0->data[FRAG_ATTRIB_WPOS][0];
- const GLfloat y = v0->data[FRAG_ATTRIB_WPOS][1];
- GLuint slot, j;
+ const float x = v0->data[FRAG_ATTRIB_WPOS][0];
+ const float y = v0->data[FRAG_ATTRIB_WPOS][1];
+ unsigned slot, j;
/* For points, all interpolants are constant-valued.
* However, for point sprites, we'll need to setup texcoords appropriately.
@@ -912,31 +913,31 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
if (halfSize <= 0.5 && !round) {
/* special case for 1-pixel points */
- const GLint ix = ((GLint) x) & 1;
- const GLint iy = ((GLint) y) & 1;
+ const int ix = ((int) x) & 1;
+ const int iy = ((int) y) & 1;
setup->quad.x0 = x - ix;
setup->quad.y0 = y - iy;
setup->quad.mask = (1 << ix) << (2 * iy);
clip_emit_quad(setup);
}
else {
- const GLint ixmin = block((GLint) (x - halfSize));
- const GLint ixmax = block((GLint) (x + halfSize));
- const GLint iymin = block((GLint) (y - halfSize));
- const GLint iymax = block((GLint) (y + halfSize));
- GLint ix, iy;
+ const int ixmin = block((int) (x - halfSize));
+ const int ixmax = block((int) (x + halfSize));
+ const int iymin = block((int) (y - halfSize));
+ const int iymax = block((int) (y + halfSize));
+ int ix, iy;
if (round) {
/* rounded points */
- const GLfloat rmin = halfSize - 0.7071F; /* 0.7071 = sqrt(2)/2 */
- const GLfloat rmax = halfSize + 0.7071F;
- const GLfloat rmin2 = MAX2(0.0F, rmin * rmin);
- const GLfloat rmax2 = rmax * rmax;
- const GLfloat cscale = 1.0F / (rmax2 - rmin2);
+ const float rmin = halfSize - 0.7071F; /* 0.7071 = sqrt(2)/2 */
+ const float rmax = halfSize + 0.7071F;
+ const float rmin2 = MAX2(0.0F, rmin * rmin);
+ const float rmax2 = rmax * rmax;
+ const float cscale = 1.0F / (rmax2 - rmin2);
for (iy = iymin; iy <= iymax; iy += 2) {
for (ix = ixmin; ix <= ixmax; ix += 2) {
- GLfloat dx, dy, dist2, cover;
+ float dx, dy, dist2, cover;
setup->quad.mask = 0x0;
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.h b/src/mesa/pipe/softpipe/sp_prim_setup.h
index 0180454a8d2..dece42fe457 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.h
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.h
@@ -37,86 +37,12 @@
* all the enabled attributes run contiguously.
*/
-#include "glheader.h"
-#include "imports.h"
-#if 0
-#include "s_tri_public.h"
-#include "s_context.h"
-#endif
+struct draw_stage;
+struct softpipe_context;
extern struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe );
-#if 0 /* UNUSED? */
-struct tri_context;
-struct fp_context;
-struct be_context;
-
-/* Note the rasterizer does not take a GLcontext argument. This is
- * deliberate.
- */
-struct tri_context *tri_create_context( GLcontext *ctx );
-
-void tri_destroy_context( struct tri_context *tri );
-
-void tri_set_fp_context( struct tri_context *tri,
- struct fp_context *fp,
- void (*fp_run)( struct fp_context *fp,
- const struct fp_inputs *,
- struct fp_outputs * ));
-
-
-void tri_set_be_context( struct tri_context *tri,
- struct be_context *be,
- void (*be_run)( struct be_context *be,
- const struct fp_outputs * ));
-
-void tri_set_attribs( struct tri_context *tri,
- const struct attr_info *info,
- GLuint nr_attrib );
-
-void tri_set_backface( struct tri_context *tri,
- GLfloat backface );
-
-void tri_set_scissor( struct tri_context *tri,
- GLint x,
- GLint y,
- GLuint width,
- GLuint height,
- GLboolean enabled );
-
-void tri_set_stipple( struct tri_context *tri,
- const GLuint *pattern,
- GLboolean enabled );
-
-/* Unfilled triangles will be handled elsewhere (higher in the
- * pipeline), as will things like stipple (lower in the pipeline).
- */
-
-void tri_triangle( struct tri_context *tri,
- const struct vertex *v0,
- const struct vertex *v1,
- const struct vertex *v2 );
-
-/* TODO: rasterize_line, rasterize_point??
- * How will linestipple work?
- */
-
-
-#ifdef SETUP_PRIVATE
-
-GLboolean tri_setup( struct tri_context *tri,
- const struct vertex *v0,
- const struct vertex *v1,
- const struct vertex *v2 );
-
-void tri_rasterize( struct tri_context *tri );
-void tri_rasterize_spans( struct tri_context *tri );
-
-#endif
-
-
-#endif
#endif /* SP_PRIM_SETUP_H */
diff --git a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
index 1c519070787..64c1624bd0e 100644
--- a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
@@ -3,20 +3,19 @@
* quad alpha test
*/
-#include "glheader.h"
-#include "imports.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
static void
alpha_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- const GLfloat ref = softpipe->alpha_test.ref;
- GLuint passMask = 0x0, j;
+ const float ref = softpipe->alpha_test.ref;
+ unsigned passMask = 0x0, j;
switch (softpipe->alpha_test.func) {
case PIPE_FUNC_NEVER:
diff --git a/src/mesa/pipe/softpipe/sp_quad_blend.c b/src/mesa/pipe/softpipe/sp_quad_blend.c
index 09d0aa258c7..7e8851d214a 100644
--- a/src/mesa/pipe/softpipe/sp_quad_blend.c
+++ b/src/mesa/pipe/softpipe/sp_quad_blend.c
@@ -30,10 +30,8 @@
* \author Brian Paul
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -101,11 +99,11 @@ do { \
static void
blend_quad(struct quad_stage *qs, struct quad_header *quad)
{
- static const GLfloat zero[4] = { 0, 0, 0, 0 };
- static const GLfloat one[4] = { 1, 1, 1, 1 };
+ static const float zero[4] = { 0, 0, 0, 0 };
+ static const float one[4] = { 1, 1, 1, 1 };
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf);
- GLfloat source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
+ float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
/* get colors from framebuffer */
sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest);
@@ -126,7 +124,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_SRC_ALPHA:
{
- const GLfloat *alpha = quad->outputs.color[3];
+ const float *alpha = quad->outputs.color[3];
VEC4_MUL(source[0], quad->outputs.color[0], alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], alpha); /* G */
VEC4_MUL(source[2], quad->outputs.color[2], alpha); /* B */
@@ -139,7 +137,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_DST_ALPHA:
{
- const GLfloat *alpha = dest[3];
+ const float *alpha = dest[3];
VEC4_MUL(source[0], quad->outputs.color[0], alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], alpha); /* G */
VEC4_MUL(source[2], quad->outputs.color[2], alpha); /* B */
@@ -150,7 +148,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
{
- GLfloat comp[4];
+ float comp[4];
VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */
VEC4_MUL(source[0], quad->outputs.color[0], comp); /* R */
VEC4_SCALAR(comp, softpipe->blend_color.color[1]); /* G */
@@ -161,7 +159,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_CONST_ALPHA:
{
- GLfloat alpha[4];
+ float alpha[4];
VEC4_SCALAR(alpha, softpipe->blend_color.color[3]);
VEC4_MUL(source[0], quad->outputs.color[0], alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], alpha); /* G */
@@ -181,7 +179,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_COLOR:
{
- GLfloat inv_comp[4];
+ float inv_comp[4];
VEC4_SUB(inv_comp, one, quad->outputs.color[0]); /* R */
VEC4_MUL(source[0], quad->outputs.color[0], inv_comp); /* R */
VEC4_SUB(inv_comp, one, quad->outputs.color[1]); /* G */
@@ -192,7 +190,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
{
- GLfloat inv_alpha[4];
+ float inv_alpha[4];
VEC4_SUB(inv_alpha, one, quad->outputs.color[3]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], inv_alpha); /* G */
@@ -201,7 +199,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_DST_ALPHA:
{
- GLfloat inv_alpha[4];
+ float inv_alpha[4];
VEC4_SUB(inv_alpha, one, dest[3]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], inv_alpha); /* G */
@@ -210,7 +208,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_DST_COLOR:
{
- GLfloat inv_comp[4];
+ float inv_comp[4];
VEC4_SUB(inv_comp, one, dest[0]); /* R */
VEC4_MUL(source[0], quad->outputs.color[0], inv_comp); /* R */
VEC4_SUB(inv_comp, one, dest[1]); /* G */
@@ -221,7 +219,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
{
- GLfloat inv_comp[4];
+ float inv_comp[4];
/* R */
VEC4_SCALAR(inv_comp, 1.0 - softpipe->blend_color.color[0]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_comp);
@@ -235,7 +233,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
{
- GLfloat alpha[4], inv_alpha[4];
+ float alpha[4], inv_alpha[4];
VEC4_SCALAR(alpha, 1.0 - softpipe->blend_color.color[3]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], inv_alpha); /* G */
@@ -261,7 +259,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_SRC_ALPHA:
{
- const GLfloat *alpha = quad->outputs.color[3];
+ const float *alpha = quad->outputs.color[3];
VEC4_MUL(source[3], quad->outputs.color[3], alpha); /* A */
}
break;
@@ -283,7 +281,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
{
- GLfloat one_minus_alpha[QUAD_SIZE];
+ float one_minus_alpha[QUAD_SIZE];
VEC4_SUB(one_minus_alpha, one, quad->outputs.color[3]);
VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */
VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */
@@ -309,7 +307,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
{
- GLfloat one_minus_alpha[QUAD_SIZE];
+ float one_minus_alpha[QUAD_SIZE];
VEC4_SUB(one_minus_alpha, one, quad->outputs.color[3]);
VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* A */
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_bufloop.c b/src/mesa/pipe/softpipe/sp_quad_bufloop.c
index c459a9e8b07..ae2fb5ef973 100644
--- a/src/mesa/pipe/softpipe/sp_quad_bufloop.c
+++ b/src/mesa/pipe/softpipe/sp_quad_bufloop.c
@@ -1,7 +1,5 @@
-
-#include "main/glheader.h"
-#include "main/imports.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -15,8 +13,8 @@ static void
cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- GLfloat tmp[4][QUAD_SIZE];
- GLuint i;
+ float tmp[4][QUAD_SIZE];
+ unsigned i;
assert(sizeof(quad->outputs.color) == sizeof(tmp));
assert(softpipe->framebuffer.num_cbufs <= PIPE_MAX_COLOR_BUFS);
diff --git a/src/mesa/pipe/softpipe/sp_quad_colormask.c b/src/mesa/pipe/softpipe/sp_quad_colormask.c
index 5102a000b52..7bb65bf8c80 100644
--- a/src/mesa/pipe/softpipe/sp_quad_colormask.c
+++ b/src/mesa/pipe/softpipe/sp_quad_colormask.c
@@ -30,10 +30,8 @@
* \author Brian Paul
*/
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/macros.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -46,25 +44,25 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf);
- GLfloat dest[4][QUAD_SIZE];
+ float dest[4][QUAD_SIZE];
sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest);
/* R */
if (!(softpipe->blend.colormask & PIPE_MASK_R))
- COPY_4FV(quad->outputs.color[0], dest[0]);
+ COPY_4V(quad->outputs.color[0], dest[0]);
/* G */
if (!(softpipe->blend.colormask & PIPE_MASK_G))
- COPY_4FV(quad->outputs.color[1], dest[1]);
+ COPY_4V(quad->outputs.color[1], dest[1]);
/* B */
if (!(softpipe->blend.colormask & PIPE_MASK_B))
- COPY_4FV(quad->outputs.color[2], dest[2]);
+ COPY_4V(quad->outputs.color[2], dest[2]);
/* A */
if (!(softpipe->blend.colormask & PIPE_MASK_A))
- COPY_4FV(quad->outputs.color[3], dest[3]);
+ COPY_4V(quad->outputs.color[3], dest[3]);
/* pass quad to next stage */
qs->next->run(qs->next, quad);
diff --git a/src/mesa/pipe/softpipe/sp_quad_coverage.c b/src/mesa/pipe/softpipe/sp_quad_coverage.c
index efeb85aab98..8dfec593500 100644
--- a/src/mesa/pipe/softpipe/sp_quad_coverage.c
+++ b/src/mesa/pipe/softpipe/sp_quad_coverage.c
@@ -32,9 +32,8 @@
*/
-#include "main/glheader.h"
-#include "main/macros.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
@@ -51,7 +50,7 @@ coverage_quad(struct quad_stage *qs, struct quad_header *quad)
if ((softpipe->setup.poly_smooth && quad->prim == PRIM_TRI) ||
(softpipe->setup.line_smooth && quad->prim == PRIM_LINE) ||
(softpipe->setup.point_smooth && quad->prim == PRIM_POINT)) {
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
assert(quad->coverage[j] >= 0.0);
assert(quad->coverage[j] <= 1.0);
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
index 28f264b3c4a..5d46e70393d 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
@@ -26,9 +26,8 @@
* \brief Quad depth testing
*/
-#include "main/glheader.h"
-#include "main/imports.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -44,11 +43,11 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *sps = softpipe_surface(softpipe->framebuffer.zbuf);
- GLuint bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
- GLuint qzzzz[QUAD_SIZE]; /**< Z values from the quad */
- GLuint zmask = 0;
- GLuint j;
- GLfloat scale;
+ unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
+ unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */
+ unsigned zmask = 0;
+ unsigned j;
+ float scale;
assert(sps); /* shouldn't get here if there's no zbuffer */
@@ -72,7 +71,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
* Z-fighting errors.
*/
for (j = 0; j < QUAD_SIZE; j++) {
- qzzzz[j] = (GLuint) (quad->outputs.depth[j] * scale);
+ qzzzz[j] = (unsigned) (quad->outputs.depth[j] * scale);
}
/* get zquad from zbuffer */
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index e767d0a470e..edb3245cbae 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -32,8 +32,6 @@
* all the enabled attributes run contiguously.
*/
-#include "main/mtypes.h"
-
#include "pipe/p_util.h"
#include "tgsi/core/tgsi_core.h"
@@ -42,6 +40,8 @@
#include "sp_quad.h"
#include "sp_tex_sample.h"
+#include "main/mtypes.h"
+
#if 0
#if defined __GNUC__
#define ALIGNED_ATTRIBS 1
@@ -73,9 +73,9 @@ struct exec_machine {
const struct setup_coefficient *coef; /**< will point to quad->coef */
#if ALIGNED_ATTRIBS
- GLfloat attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE] __attribute__(( aligned( 16 ) ));
+ float attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE] __attribute__(( aligned( 16 ) ));
#else
- GLfloat attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE];
+ float attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE];
#endif
};
@@ -84,10 +84,10 @@ struct exec_machine {
* Compute quad's attributes values, as constants (GL_FLAT shading).
*/
static INLINE void cinterp( struct exec_machine *exec,
- GLuint attrib,
- GLuint i )
+ unsigned attrib,
+ unsigned i )
{
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
exec->attr[attrib][i][j] = exec->coef[attrib].a0[i];
@@ -104,14 +104,14 @@ static INLINE void cinterp( struct exec_machine *exec,
* INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy
*/
static INLINE void linterp( struct exec_machine *exec,
- GLuint attrib,
- GLuint i )
+ unsigned attrib,
+ unsigned i )
{
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
- const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
- const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
+ const float x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
+ const float y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
exec->attr[attrib][i][j] = (exec->coef[attrib].a0[i] +
exec->coef[attrib].dadx[i] * x +
exec->coef[attrib].dady[i] * y);
@@ -132,16 +132,16 @@ static INLINE void linterp( struct exec_machine *exec,
*
*/
static INLINE void pinterp( struct exec_machine *exec,
- GLuint attrib,
- GLuint i )
+ unsigned attrib,
+ unsigned i )
{
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
- const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
- const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
+ const float x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
+ const float y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
/* FRAG_ATTRIB_WPOS.w here is really 1/w */
- const GLfloat w = 1.0 / exec->attr[FRAG_ATTRIB_WPOS][3][j];
+ const float w = 1.0 / exec->attr[FRAG_ATTRIB_WPOS][3][j];
exec->attr[attrib][i][j] = ((exec->coef[attrib].a0[i] +
exec->coef[attrib].dadx[i] * x +
exec->coef[attrib].dady[i] * y) * w);
@@ -158,9 +158,9 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
struct exec_machine exec;
- const GLfloat fx = quad->x0;
- const GLfloat fy = quad->y0;
- GLuint attr, i;
+ const float fx = quad->x0;
+ const float fy = quad->y0;
+ unsigned attr, i;
exec.coef = quad->coef;
@@ -216,7 +216,7 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
struct tgsi_exec_machine machine;
struct tgsi_exec_vector outputs[FRAG_ATTRIB_MAX + 1];
struct tgsi_exec_vector *aoutputs;
- GLuint i;
+ unsigned i;
#if !ALIGNED_ATTRIBS
struct tgsi_exec_vector inputs[FRAG_ATTRIB_MAX + 1];
@@ -289,7 +289,7 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
}
#else
{
- GLuint attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0];
+ unsigned attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0];
assert(attr);
memcpy(quad->outputs.color,
@@ -318,7 +318,7 @@ static void shade_begin(struct quad_stage *qs)
{
struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
- GLuint i, entry;
+ unsigned i, entry;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
qss->samplers[i].state = &softpipe->sampler[i];
diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c
index 8073f94553a..6b094a5befb 100644
--- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c
+++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c
@@ -32,9 +32,8 @@
*/
-#include "main/glheader.h"
-#include "main/imports.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
diff --git a/src/mesa/pipe/softpipe/sp_quad_output.c b/src/mesa/pipe/softpipe/sp_quad_output.c
index 62f466be5d0..49420c4fe7d 100644
--- a/src/mesa/pipe/softpipe/sp_quad_output.c
+++ b/src/mesa/pipe/softpipe/sp_quad_output.c
@@ -31,20 +31,18 @@
* Attributes are assumed to be 4 floats wide but are packed so that
* all the enabled attributes run contiguously.
*/
-
-#include "glheader.h"
-#include "imports.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
#include "sp_quad.h"
-static void mask_copy( GLfloat (*dest)[4],
- GLfloat (*src)[4],
- GLuint mask )
+static void mask_copy( float (*dest)[4],
+ float (*src)[4],
+ unsigned mask )
{
- GLuint i, j;
+ unsigned i, j;
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
@@ -68,7 +66,7 @@ output_quad(struct quad_stage *qs, struct quad_header *quad)
struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf);
if (quad->mask != MASK_ALL) {
- GLfloat tmp[4][QUAD_SIZE];
+ float tmp[4][QUAD_SIZE];
/* XXX probably add a masked-write function someday */
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c
index 857f1a5989b..47b3b4f0893 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stencil.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c
@@ -4,13 +4,12 @@
*/
-#include "main/glheader.h"
-#include "main/imports.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
#include "sp_quad.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
/** Only 8-bit stencil supported */
@@ -28,12 +27,12 @@
* values and ref value are to be used.
* \return mask indicating which pixels passed the stencil test
*/
-static GLbitfield
-do_stencil_test(const GLubyte stencilVals[QUAD_SIZE], GLuint func,
- GLbitfield ref, GLbitfield valMask)
+static unsigned
+do_stencil_test(const ubyte stencilVals[QUAD_SIZE], unsigned func,
+ unsigned ref, unsigned valMask)
{
- GLbitfield passMask = 0x0;
- GLuint j;
+ unsigned passMask = 0x0;
+ unsigned j;
ref &= valMask;
@@ -105,11 +104,11 @@ do_stencil_test(const GLubyte stencilVals[QUAD_SIZE], GLuint func,
* stencil values
*/
static void
-apply_stencil_op(GLubyte stencilVals[QUAD_SIZE],
- GLbitfield mask, GLuint op, GLubyte ref, GLubyte wrtMask)
+apply_stencil_op(ubyte stencilVals[QUAD_SIZE],
+ unsigned mask, unsigned op, ubyte ref, ubyte wrtMask)
{
- GLuint j;
- GLubyte newstencil[QUAD_SIZE];
+ unsigned j;
+ ubyte newstencil[QUAD_SIZE];
for (j = 0; j < QUAD_SIZE; j++) {
newstencil[j] = stencilVals[j];
@@ -202,9 +201,9 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *s_surf = softpipe_surface(softpipe->framebuffer.sbuf);
- GLuint func, zFailOp, zPassOp, failOp;
- GLubyte ref, wrtMask, valMask;
- GLubyte stencilVals[QUAD_SIZE];
+ unsigned func, zFailOp, zPassOp, failOp;
+ ubyte ref, wrtMask, valMask;
+ ubyte stencilVals[QUAD_SIZE];
/* choose front or back face function, operator, etc */
/* XXX we could do these initializations once per primitive */
@@ -232,7 +231,7 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
/* do the stencil test first */
{
- GLbitfield passMask, failMask;
+ unsigned passMask, failMask;
passMask = do_stencil_test(stencilVals, func, ref, valMask);
failMask = quad->mask & ~passMask;
quad->mask &= passMask;
@@ -246,18 +245,18 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
/* now the pixels that passed the stencil test are depth tested */
if (softpipe->depth_test.enabled) {
- const GLbitfield origMask = quad->mask;
+ const unsigned origMask = quad->mask;
sp_depth_test_quad(qs, quad); /* quad->mask is updated */
/* update stencil buffer values according to z pass/fail result */
if (zFailOp != PIPE_STENCIL_OP_KEEP) {
- const GLbitfield failMask = origMask & ~quad->mask;
+ const unsigned failMask = origMask & ~quad->mask;
apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask);
}
if (zPassOp != PIPE_STENCIL_OP_KEEP) {
- const GLbitfield passMask = origMask & quad->mask;
+ const unsigned passMask = origMask & quad->mask;
apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask);
}
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/mesa/pipe/softpipe/sp_quad_stipple.c
index 6e93bf81f1c..cb127095d70 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stipple.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stipple.c
@@ -3,12 +3,11 @@
* quad polygon stipple stage
*/
-#include "glheader.h"
-#include "imports.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
/**
@@ -19,10 +18,10 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
{
if (quad->prim == PRIM_TRI) {
struct softpipe_context *softpipe = qs->softpipe;
- const GLint col0 = quad->x0 % 32;
- const GLint row0 = quad->y0 % 32;
- const GLuint stipple0 = softpipe->poly_stipple.stipple[row0];
- const GLuint stipple1 = softpipe->poly_stipple.stipple[row0 + 1];
+ const int col0 = quad->x0 % 32;
+ const int row0 = quad->y0 % 32;
+ const unsigned stipple0 = softpipe->poly_stipple.stipple[row0];
+ const unsigned stipple1 = softpipe->poly_stipple.stipple[row0 + 1];
/* XXX there may be a better way to lay out the stored stipple
* values to further simplify this computation.
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 10b7479e975..231ea1ea223 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -54,7 +54,7 @@ sp_region_idle(struct pipe_context *pipe, struct pipe_region *region)
}
-static GLubyte *
+static ubyte *
sp_region_map(struct pipe_context *pipe, struct pipe_region *region)
{
struct softpipe_context *sp = softpipe_context( pipe );
@@ -83,7 +83,7 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
static struct pipe_region *
sp_region_alloc(struct pipe_context *pipe,
- GLuint cpp, GLuint width, GLuint height, GLbitfield flags)
+ unsigned cpp, unsigned width, unsigned height, unsigned flags)
{
struct softpipe_context *sp = softpipe_context( pipe );
struct pipe_region *region = calloc(sizeof(*region), 1);
@@ -112,7 +112,7 @@ sp_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) {
@@ -130,19 +130,19 @@ sp_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;
@@ -174,10 +174,10 @@ _mesa_copy_rect(GLubyte * dst,
static void
sp_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,
@@ -193,11 +193,11 @@ sp_region_data(struct pipe_context *pipe,
static void
sp_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->cpp == src->cpp );
@@ -217,8 +217,8 @@ sp_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;
}
@@ -227,17 +227,17 @@ get_pointer(struct pipe_region *dst, GLuint x, GLuint y)
static void
sp_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)
{
- 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;
@@ -245,7 +245,7 @@ sp_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;
@@ -254,7 +254,7 @@ sp_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/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index 3c572cdb6a4..5adf5930b85 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -31,7 +31,6 @@
#ifndef SP_STATE_H
#define SP_STATE_H
-#include "glheader.h"
#include "pipe/p_state.h"
@@ -69,14 +68,14 @@ void softpipe_set_setup_state( struct pipe_context *,
const struct pipe_setup_state * );
void softpipe_set_sampler_state( struct pipe_context *,
- GLuint unit,
+ unsigned unit,
const struct pipe_sampler_state * );
void softpipe_set_stencil_state( struct pipe_context *,
const struct pipe_stencil_state * );
void softpipe_set_texture_state( struct pipe_context *,
- GLuint unit,
+ unsigned unit,
struct pipe_mipmap_tree * );
void softpipe_set_viewport_state( struct pipe_context *,
diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c
index 8bc22b0efc0..b2e85d86cc0 100644
--- a/src/mesa/pipe/softpipe/sp_state_blend.c
+++ b/src/mesa/pipe/softpipe/sp_state_blend.c
@@ -27,8 +27,6 @@
/* Authors: Keith Whitwell <[email protected]>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_clip.c b/src/mesa/pipe/softpipe/sp_state_clip.c
index 8cf4383d3fa..08c5f06d05d 100644
--- a/src/mesa/pipe/softpipe/sp_state_clip.c
+++ b/src/mesa/pipe/softpipe/sp_state_clip.c
@@ -27,8 +27,6 @@
/* Authors: Keith Whitwell <[email protected]>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
#include "pipe/draw/draw_context.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index e1faaed93ce..0a2cfbb7d1b 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -46,7 +46,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,
@@ -78,27 +78,27 @@ static const GLuint frag_to_vf[FRAG_ATTRIB_MAX] =
*/
static void calculate_vertex_layout( struct softpipe_context *softpipe )
{
- const GLbitfield inputsRead = softpipe->fs.inputs_read;
- GLuint slot_to_vf_attr[VF_ATTRIB_MAX];
- GLbitfield attr_mask = 0x0;
- GLuint i;
+ const unsigned inputsRead = softpipe->fs.inputs_read;
+ unsigned slot_to_vf_attr[VF_ATTRIB_MAX];
+ unsigned attr_mask = 0x0;
+ unsigned i;
/* Need Z if depth test is enabled or the fragment program uses the
* fragment position (XYZW).
*/
if (softpipe->depth_test.enabled ||
(inputsRead & FRAG_ATTRIB_WPOS))
- softpipe->need_z = GL_TRUE;
+ softpipe->need_z = TRUE;
else
- softpipe->need_z = GL_FALSE;
+ softpipe->need_z = FALSE;
/* Need W if we do any perspective-corrected interpolation or the
* fragment program uses the fragment position.
*/
if (inputsRead & FRAG_ATTRIB_WPOS)
- softpipe->need_w = GL_TRUE;
+ softpipe->need_w = TRUE;
else
- softpipe->need_w = GL_FALSE;
+ softpipe->need_w = FALSE;
softpipe->nr_attrs = 0;
@@ -130,7 +130,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
if (inputsRead & (1 << i)) {
assert(i < sizeof(frag_to_vf) / sizeof(frag_to_vf[0]));
EMIT_ATTR(frag_to_vf[i], i, INTERP_PERSPECTIVE);
- softpipe->need_w = GL_TRUE;
+ softpipe->need_w = TRUE;
}
}
@@ -169,7 +169,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
static void
compute_cliprect(struct softpipe_context *sp)
{
- GLint surfWidth, surfHeight;
+ int surfWidth, surfHeight;
if (sp->framebuffer.num_cbufs > 0) {
surfWidth = sp->framebuffer.cbufs[0]->width;
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index 34cf2108348..2e3d0c3d65d 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -29,8 +29,6 @@
* Brian Paul
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
@@ -38,7 +36,7 @@
void
softpipe_set_sampler_state(struct pipe_context *pipe,
- GLuint unit,
+ unsigned unit,
const struct pipe_sampler_state *sampler)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -52,7 +50,7 @@ softpipe_set_sampler_state(struct pipe_context *pipe,
void
softpipe_set_texture_state(struct pipe_context *pipe,
- GLuint unit,
+ unsigned unit,
struct pipe_mipmap_tree *texture)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/mesa/pipe/softpipe/sp_state_surface.c
index 8ce81eb2b04..a534ffb2c2e 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/mesa/pipe/softpipe/sp_state_surface.c
@@ -27,8 +27,6 @@
/* Authors: Keith Whitwell <[email protected]>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
#include "sp_surface.h"
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index 1919947abf6..4152e3510d0 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -29,8 +29,7 @@
#include "sp_state.h"
#include "sp_surface.h"
#include "pipe/p_defines.h"
-#include "main/imports.h"
-#include "main/macros.h"
+#include "pipe/p_util.h"
/**
@@ -48,13 +47,13 @@
/*** PIPE_FORMAT_U_A8_R8_G8_B8 ***/
static void
-a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE])
+a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
+ float (*rrrr)[QUAD_SIZE])
{
- const GLuint *src
- = ((const GLuint *) (sps->surface.region->map + sps->surface.offset))
+ const unsigned *src
+ = ((const unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
- GLuint i, j;
+ unsigned i, j;
assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8);
assert(x < sps->surface.width - 1);
@@ -62,7 +61,7 @@ a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
for (i = 0; i < 2; i++) { /* loop over pixel row */
for (j = 0; j < 2; j++) { /* loop over pixel column */
- const GLuint p = src[j];
+ const unsigned p = src[j];
rrrr[0][i * 2 + j] = UBYTE_TO_FLOAT((p >> 16) & 0xff); /*R*/
rrrr[1][i * 2 + j] = UBYTE_TO_FLOAT((p >> 8) & 0xff); /*G*/
rrrr[2][i * 2 + j] = UBYTE_TO_FLOAT((p ) & 0xff); /*B*/
@@ -73,19 +72,19 @@ a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
}
static void
-a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE])
+a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
+ float (*rrrr)[QUAD_SIZE])
{
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
- GLuint i, j;
+ unsigned i, j;
assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8);
for (i = 0; i < 2; i++) { /* loop over pixel row */
for (j = 0; j < 2; j++) { /* loop over pixel column */
- GLubyte r, g, b, a;
+ ubyte r, g, b, a;
UNCLAMPED_FLOAT_TO_UBYTE(r, rrrr[0][i * 2 + j]); /*R*/
UNCLAMPED_FLOAT_TO_UBYTE(g, rrrr[1][i * 2 + j]); /*G*/
UNCLAMPED_FLOAT_TO_UBYTE(b, rrrr[2][i * 2 + j]); /*B*/
@@ -98,13 +97,13 @@ a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
static void
a8r8g8b8_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);
@@ -119,9 +118,9 @@ a8r8g8b8_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);
@@ -138,18 +137,18 @@ a8r8g8b8_get_tile(struct pipe_surface *ps,
static void
a1r5g5b5_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 GLushort *src
- = ((const GLushort *) (ps->region->map + ps->offset))
+ const ushort *src
+ = ((const ushort *) (ps->region->map + ps->offset))
+ y * ps->region->pitch + x;
- GLuint i, j;
+ unsigned i, j;
assert(ps->format == PIPE_FORMAT_U_A1_R5_G5_B5);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- const GLushort pixel = src[j];
+ const ushort pixel = src[j];
p[0] = ((pixel >> 10) & 0x1f) * (1.0 / 31);
p[1] = ((pixel >> 5) & 0x1f) * (1.0 / 31);
p[2] = ((pixel ) & 0x1f) * (1.0 / 31);
@@ -166,15 +165,15 @@ a1r5g5b5_get_tile(struct pipe_surface *ps,
static void
z16_read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
+ int x, int y, unsigned zzzz[QUAD_SIZE])
{
- const GLushort *src
- = ((const GLushort *) (sps->surface.region->map + sps->surface.offset))
+ const ushort *src
+ = ((const ushort *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z16);
- /* converting GLushort to GLuint: */
+ /* converting ushort to unsigned: */
zzzz[0] = src[0];
zzzz[1] = src[1];
src += sps->surface.region->pitch;
@@ -184,15 +183,15 @@ z16_read_quad_z(struct softpipe_surface *sps,
static void
z16_write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
+ int x, int y, const unsigned zzzz[QUAD_SIZE])
{
- GLushort *dst
- = ((GLushort *) (sps->surface.region->map + sps->surface.offset))
+ ushort *dst
+ = ((ushort *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z16);
- /* converting GLuint to GLushort: */
+ /* converting unsigned to ushort: */
dst[0] = zzzz[0];
dst[1] = zzzz[1];
dst += sps->surface.region->pitch;
@@ -205,10 +204,10 @@ z16_write_quad_z(struct softpipe_surface *sps,
static void
z32_read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
+ int x, int y, unsigned zzzz[QUAD_SIZE])
{
- const GLuint *src
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ const unsigned *src
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z32);
@@ -222,10 +221,10 @@ z32_read_quad_z(struct softpipe_surface *sps,
static void
z32_write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
+ int x, int y, const unsigned zzzz[QUAD_SIZE])
{
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z32);
@@ -242,11 +241,11 @@ z32_write_quad_z(struct softpipe_surface *sps,
static void
s8z24_read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
+ int x, int y, unsigned zzzz[QUAD_SIZE])
{
- static const GLuint mask = 0x00ffffff;
- const GLuint *src
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ static const unsigned mask = 0x00ffffff;
+ const unsigned *src
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -261,11 +260,11 @@ s8z24_read_quad_z(struct softpipe_surface *sps,
static void
s8z24_write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
+ int x, int y, const unsigned zzzz[QUAD_SIZE])
{
- static const GLuint mask = 0xff000000;
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ static const unsigned mask = 0xff000000;
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -280,10 +279,10 @@ s8z24_write_quad_z(struct softpipe_surface *sps,
static void
s8z24_read_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, GLubyte ssss[QUAD_SIZE])
+ int x, int y, ubyte ssss[QUAD_SIZE])
{
- const GLuint *src
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ const unsigned *src
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -297,11 +296,11 @@ s8z24_read_quad_stencil(struct softpipe_surface *sps,
static void
s8z24_write_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, const GLubyte ssss[QUAD_SIZE])
+ int x, int y, const ubyte ssss[QUAD_SIZE])
{
- static const GLuint mask = 0x00ffffff;
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ static const unsigned mask = 0x00ffffff;
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -318,9 +317,9 @@ s8z24_write_quad_stencil(struct softpipe_surface *sps,
static void
s8_read_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, GLubyte ssss[QUAD_SIZE])
+ int x, int y, ubyte ssss[QUAD_SIZE])
{
- const GLubyte *src
+ const ubyte *src
= sps->surface.region->map + sps->surface.offset
+ y * sps->surface.region->pitch + x;
@@ -335,9 +334,9 @@ s8_read_quad_stencil(struct softpipe_surface *sps,
static void
s8_write_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, const GLubyte ssss[QUAD_SIZE])
+ int x, int y, const ubyte ssss[QUAD_SIZE])
{
- GLubyte *dst
+ ubyte *dst
= sps->surface.region->map + sps->surface.offset
+ y * sps->surface.region->pitch + x;
@@ -393,7 +392,7 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
static struct pipe_surface *
-softpipe_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat)
+softpipe_surface_alloc(struct pipe_context *pipe, unsigned pipeFormat)
{
struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface);
if (!sps)
@@ -419,17 +418,17 @@ softpipe_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat)
struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt,
- GLuint face, GLuint level, GLuint zslice)
+ unsigned face, unsigned level, unsigned zslice)
{
struct pipe_surface *ps;
- GLuint offset; /* in bytes */
+ unsigned offset; /* in bytes */
offset = mt->level[level].level_offset;
- if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) {
+ if (mt->target == PIPE_TEXTURE_CUBE) {
offset += mt->level[level].image_offset[face] * mt->cpp;
}
- else if (mt->target == GL_TEXTURE_3D) {
+ else if (mt->target == PIPE_TEXTURE_3D) {
offset += mt->level[level].image_offset[zslice] * mt->cpp;
}
else {
diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/mesa/pipe/softpipe/sp_surface.h
index 00b5edcd928..545983f4317 100644
--- a/src/mesa/pipe/softpipe/sp_surface.h
+++ b/src/mesa/pipe/softpipe/sp_surface.h
@@ -31,7 +31,6 @@
#ifndef SP_SURFACE_H
#define SP_SURFACE_H
-#include "glheader.h"
#include "sp_headers.h"
#include "pipe/p_state.h"
@@ -50,47 +49,47 @@ struct softpipe_surface {
* Functions for read/writing surface data
*/
void (*read_quad_f)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ float (*rgba)[NUM_CHANNELS] );
void (*read_quad_f_swz)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE] );
+ int x, int y,
+ float (*rrrr)[QUAD_SIZE] );
void (*read_quad_ub)( struct softpipe_surface *,
- GLint x, GLint y,
- GLubyte (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ ubyte (*rgba)[NUM_CHANNELS] );
void (*write_quad_f)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ float (*rgba)[NUM_CHANNELS] );
void (*write_quad_f_swz)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE] );
+ int x, int y,
+ float (*rrrr)[QUAD_SIZE] );
void (*write_quad_ub)( struct softpipe_surface *,
- GLint x, GLint y,
- GLubyte (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ ubyte (*rgba)[NUM_CHANNELS] );
void (*read_quad_z)(struct softpipe_surface *,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE]);
+ int x, int y, unsigned zzzz[QUAD_SIZE]);
void (*write_quad_z)(struct softpipe_surface *,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]);
+ int x, int y, const unsigned zzzz[QUAD_SIZE]);
void (*read_quad_stencil)(struct softpipe_surface *,
- GLint x, GLint y, GLubyte ssss[QUAD_SIZE]);
+ int x, int y, ubyte ssss[QUAD_SIZE]);
void (*write_quad_stencil)(struct softpipe_surface *,
- GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]);
+ int x, int y, const ubyte ssss[QUAD_SIZE]);
};
extern struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt,
- GLuint face, GLuint level, GLuint zslice);
+ unsigned face, unsigned level, unsigned zslice);
extern void
diff --git a/src/mesa/pipe/softpipe/sp_tex_layout.c b/src/mesa/pipe/softpipe/sp_tex_layout.c
index fda1b46ab43..0517c01b5d4 100644
--- a/src/mesa/pipe/softpipe/sp_tex_layout.c
+++ b/src/mesa/pipe/softpipe/sp_tex_layout.c
@@ -30,10 +30,10 @@
* Michel Dänzer <[email protected]>
*/
-#include "macros.h"
#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_tex_layout.h"
@@ -43,7 +43,7 @@
* little.
*/
-static GLuint minify( GLuint d )
+static unsigned minify( unsigned d )
{
return MAX2(1, d>>1);
}
@@ -56,11 +56,11 @@ static int align(int value, int alignment)
static void
sp_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;
@@ -83,14 +83,14 @@ sp_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
sp_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);
@@ -109,12 +109,12 @@ sp_miptree_set_image_offset(struct pipe_mipmap_tree *mt,
static void
sp_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;
/* XXX FIX THIS:
@@ -130,7 +130,7 @@ sp_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)
@@ -144,7 +144,7 @@ sp_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;
sp_miptree_set_level_info(mt, level, 1, x, y, width, height, 1);
@@ -174,7 +174,7 @@ sp_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},
@@ -183,7 +183,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},
@@ -194,16 +194,16 @@ static const GLint step_offsets[6][2] = {
-GLboolean
+boolean
softpipe_mipmap_tree_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 */
@@ -230,9 +230,9 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
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;
@@ -286,13 +286,13 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
}
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;
@@ -302,10 +302,10 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
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;
sp_miptree_set_level_info(mt, level, nr_images,
0, mt->total_height,
@@ -341,13 +341,14 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
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:
sp_miptree_layout_2d(mt);
break;
default:
- _mesa_problem(NULL, "Unexpected tex target in sp_miptree_layout()");
+ assert(0);
+ break;
}
/*
@@ -356,6 +357,6 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
*/
- return GL_TRUE;
+ return TRUE;
}
diff --git a/src/mesa/pipe/softpipe/sp_tex_layout.h b/src/mesa/pipe/softpipe/sp_tex_layout.h
index be85e4be584..ea19c13b23f 100644
--- a/src/mesa/pipe/softpipe/sp_tex_layout.h
+++ b/src/mesa/pipe/softpipe/sp_tex_layout.h
@@ -6,7 +6,7 @@ struct pipe_context;
struct pipe_mipmap_tree;
-extern GLboolean
+extern boolean
softpipe_mipmap_tree_layout(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt);
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/mesa/pipe/softpipe/sp_tex_sample.c
index 03fb539e7d6..3130c5cdaeb 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.c
+++ b/src/mesa/pipe/softpipe/sp_tex_sample.c
@@ -33,12 +33,12 @@
*/
-#include "main/macros.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_tex_sample.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "pipe/tgsi/core/tgsi_exec.h"
@@ -49,7 +49,7 @@
* Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0.
* Instead, if x < 0 then FRAC(x) = 1 - true_frac(x).
*/
-#define FRAC(f) ((f) - IFLOOR(f))
+#define FRAC(f) ((f) - ifloor(f))
/**
@@ -80,8 +80,8 @@ lerp_2d(float a, float b,
* Compute the remainder of a divided by b, but be careful with
* negative values so that REPEAT mode works right.
*/
-static INLINE GLint
-repeat_remainder(GLint a, GLint b)
+static INLINE int
+repeat_remainder(int a, int b)
{
if (a >= 0)
return a % b;
@@ -97,15 +97,15 @@ repeat_remainder(GLint a, GLint b)
* \param size the texture image size
* \return integer texture index
*/
-static INLINE GLint
-nearest_texcoord(GLuint wrapMode, float s, GLuint size)
+static INLINE int
+nearest_texcoord(unsigned wrapMode, float s, unsigned size)
{
- GLint i;
+ int i;
switch (wrapMode) {
case PIPE_TEX_WRAP_REPEAT:
/* s limited to [0,1) */
/* i limited to [0,size-1] */
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
i = repeat_remainder(i, size);
return i;
case PIPE_TEX_WRAP_CLAMP:
@@ -116,7 +116,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (s >= 1.0F)
i = size - 1;
else
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
return i;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
{
@@ -129,7 +129,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (s > max)
i = size - 1;
else
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
}
return i;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
@@ -143,14 +143,14 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (s >= max)
i = size;
else
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_REPEAT:
{
const float min = 1.0F / (2.0F * size);
const float max = 1.0F - min;
- const GLint flr = IFLOOR(s);
+ const int flr = ifloor(s);
float u;
if (flr & 1)
u = 1.0F - (s - (float) flr);
@@ -161,7 +161,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u > max)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP:
@@ -174,7 +174,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u >= 1.0F)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
@@ -189,7 +189,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u > max)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
@@ -204,7 +204,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u > max)
i = size;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
default:
@@ -224,14 +224,14 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
* \param a returns blend factor/weight between texture indexes
*/
static INLINE void
-linear_texcoord(GLuint wrapMode, float s, GLuint size,
- GLint *i0, GLint *i1, float *a)
+linear_texcoord(unsigned wrapMode, float s, unsigned size,
+ int *i0, int *i1, float *a)
{
float u;
switch (wrapMode) {
case PIPE_TEX_WRAP_REPEAT:
u = s * size - 0.5F;
- *i0 = repeat_remainder(IFLOOR(u), size);
+ *i0 = repeat_remainder(ifloor(u), size);
*i1 = repeat_remainder(*i0 + 1, size);
break;
case PIPE_TEX_WRAP_CLAMP:
@@ -242,7 +242,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
@@ -253,11 +253,11 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
if (*i0 < 0)
*i0 = 0;
- if (*i1 >= (GLint) size)
+ if (*i1 >= (int) size)
*i1 = size - 1;
break;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
@@ -271,23 +271,23 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
}
break;
case PIPE_TEX_WRAP_MIRROR_REPEAT:
{
- const GLint flr = IFLOOR(s);
+ const int flr = ifloor(s);
if (flr & 1)
u = 1.0F - (s - (float) flr);
else
u = s - (float) flr;
u = (u * size) - 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
if (*i0 < 0)
*i0 = 0;
- if (*i1 >= (GLint) size)
+ if (*i1 >= (int) size)
*i1 = size - 1;
}
break;
@@ -298,7 +298,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
@@ -308,11 +308,11 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
if (*i0 < 0)
*i0 = 0;
- if (*i1 >= (GLint) size)
+ if (*i1 >= (int) size)
*i1 = size - 1;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
@@ -327,7 +327,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
}
break;
@@ -338,7 +338,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
}
-static GLuint
+static unsigned
choose_cube_face(float rx, float ry, float rz, float *newS, float *newT)
{
/*
@@ -353,7 +353,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT)
-rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz
*/
const float arx = FABSF(rx), ary = FABSF(ry), arz = FABSF(rz);
- GLuint face;
+ unsigned face;
float sc, tc, ma;
if (arx > ary && arx > arz) {
@@ -779,16 +779,16 @@ sp_get_samples(struct tgsi_sampler *sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
switch (sampler->texture->target) {
- case GL_TEXTURE_1D:
+ case PIPE_TEXTURE_1D:
sp_get_samples_1d(sampler, s, t, p, lodbias, rgba);
break;
- case GL_TEXTURE_2D:
+ case PIPE_TEXTURE_2D:
sp_get_samples_2d(sampler, s, t, p, lodbias, rgba);
break;
- case GL_TEXTURE_3D:
+ case PIPE_TEXTURE_3D:
sp_get_samples_3d(sampler, s, t, p, lodbias, rgba);
break;
- case GL_TEXTURE_CUBE_MAP:
+ case PIPE_TEXTURE_CUBE:
sp_get_samples_cube(sampler, s, t, p, lodbias, rgba);
break;
default:
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.h b/src/mesa/pipe/softpipe/sp_tex_sample.h
index 43aae872836..404bfd0c365 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.h
+++ b/src/mesa/pipe/softpipe/sp_tex_sample.h
@@ -7,11 +7,11 @@ struct tgsi_sampler;
extern void
sp_get_samples(struct tgsi_sampler *sampler,
- const GLfloat s[QUAD_SIZE],
- const GLfloat t[QUAD_SIZE],
- const GLfloat p[QUAD_SIZE],
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
float lodbias,
- GLfloat rgba[NUM_CHANNELS][QUAD_SIZE]);
+ float rgba[NUM_CHANNELS][QUAD_SIZE]);
#endif /* SP_TEX_SAMPLE_H */