Mainly down to the support for legacy TNL processing now.
#define P_UTIL_H
#include "p_compiler.h"
+#include <math.h>
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-
-
-/** Clamp X to [MIN,MAX] */
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
-
-/** Assign X to CLAMP(X, MIN, MAX) */
-#define CLAMP_SELF(x, mn, mx) \
- ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) )
-
-/** Minimum of two values: */
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
-
-/** Maximum of two values: */
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
-
#define Elements(x) sizeof(x)/sizeof(*(x))
union fi {
float_to_ubyte(d) );
}
+#define COPY_4V( DST, SRC ) \
+do { \
+ (DST)[0] = (SRC)[0]; \
+ (DST)[1] = (SRC)[1]; \
+ (DST)[2] = (SRC)[2]; \
+ (DST)[3] = (SRC)[3]; \
+} while (0)
+
+
+static INLINE int ifloor(float f)
+{
+ int ai, bi;
+ double af, bf;
+ union fi u;
+
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = (float) af; ai = u.i;
+ u.f = (float) bf; bi = u.i;
+ return (ai - bi) >> 1;
+}
+
+
+#if defined(__GNUC__) && defined(__i386__)
+static INLINE int iround(float f)
+{
+ int r;
+ __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
+ return r;
+}
+#elif defined(__MSC__) && defined(__WIN32__)
+static INLINE int iround(float f)
+{
+ int r;
+ _asm {
+ fld f
+ fistp r
+ }
+ return r;
+}
+#else
+#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
+#endif
+
+
+/* Could maybe have an inline version of this?
+ */
+#if defined(__GNUC__)
+#define FABSF(x) fabsf(x)
+#else
+#define FABSF(x) ((GLfloat) fabs(x))
+#endif
+
+/* Pretty fast, and accurate.
+ * Based on code from http://www.flipcode.com/totd/
+ */
+static INLINE float LOG2(float val)
+{
+ union fi num;
+ int log_2;
+
+ num.f = val;
+ log_2 = ((num.i >> 23) & 255) - 128;
+ num.i &= ~(255 << 23);
+ num.i += 127 << 23;
+ num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
+ return num.f + log_2;
+}
+
+
#endif
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_state.h"
-#include "colormac.h"
+//#include "colormac.h"
/**
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?? */
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#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"
* 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,
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:
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]);
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]);
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 );
}
/* 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;
#ifndef SP_CONTEXT_H
#define SP_CONTEXT_H
-#include "glheader.h"
+//#include "glheader.h"
#include "pipe/p_state.h"
#include "pipe/p_context.h"
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.
*/
/** 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 {
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];
};
* "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;
* encoded in fragment program DECL
* statements. */
- GLuint nr_attrs;
+ unsigned nr_attrs;
};
*/
-#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 */
};
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;
};
* 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;
* 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;
}
* 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;
*/
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:
}
#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];
/* 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 */
* 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;
*/
setup->quad.facing = (prim->det > 0.0) ^ (setup->softpipe->setup.front_winding == PIPE_WINDING_CW);
- return GL_TRUE;
+ return TRUE;
}
* \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);
* 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);
* 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);
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:
*/
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;
}
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;
*
* 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)
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);
* 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]
* 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 */
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];
* 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)
* 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;
}
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;
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 ||
}
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 ||
{
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.
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;
* 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 */
* 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:
* \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"
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);
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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);
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 */
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;
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 */
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 */
}
-
-#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"
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);
* \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"
{
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);
*/
-#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"
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);
* \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"
{
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 */
* 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 */
* all the enabled attributes run contiguously.
*/
-#include "main/mtypes.h"
-
#include "pipe/p_util.h"
#include "tgsi/core/tgsi_core.h"
#include "sp_quad.h"
#include "sp_tex_sample.h"
+#include "main/mtypes.h"
+
#if 0
#if defined __GNUC__
#define ALIGNED_ATTRIBS 1
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
};
* 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];
* 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);
*
*/
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);
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;
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];
}
#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,
{
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];
*/
-#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"
* 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)) {
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 */
*/
-#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 */
* 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;
* 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];
{
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 */
/* 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;
/* 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);
}
}
* 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"
/**
{
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.
}
-static GLubyte *
+static ubyte *
sp_region_map(struct pipe_context *pipe, struct pipe_region *region)
{
struct softpipe_context *sp = softpipe_context( pipe );
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);
if (!*region)
return;
- ASSERT((*region)->refcount > 0);
+ assert((*region)->refcount > 0);
(*region)->refcount--;
if ((*region)->refcount == 0) {
* 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;
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,
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 );
/* 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;
}
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;
}
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;
}
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;
#ifndef SP_STATE_H
#define SP_STATE_H
-#include "glheader.h"
#include "pipe/p_state.h"
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 *,
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
#include "pipe/draw/draw_context.h"
} 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,
*/
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;
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;
}
}
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;
* Brian Paul
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
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);
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);
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
#include "sp_surface.h"
#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"
/**
/*** 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);
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*/
}
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*/
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);
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);
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);
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;
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;
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);
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);
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);
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);
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);
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);
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;
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;
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)
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 {
#ifndef SP_SURFACE_H
#define SP_SURFACE_H
-#include "glheader.h"
#include "sp_headers.h"
#include "pipe/p_state.h"
* 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
* Michel Dänzer <michel@tungstengraphics.com>
*/
-#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"
* little.
*/
-static GLuint minify( GLuint d )
+static unsigned minify( unsigned d )
{
return MAX2(1, d>>1);
}
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;
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);
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:
* 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)
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);
}
-static const GLint initial_offsets[6][2] = {
+static const int initial_offsets[6][2] = {
{0, 0},
{0, 2},
{1, 0},
{1, 3}
};
-static const GLint step_offsets[6][2] = {
+static const int step_offsets[6][2] = {
{0, 2},
{0, 2},
{-1, 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 */
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;
}
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;
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,
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;
}
/*
mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
*/
- return GL_TRUE;
+ return TRUE;
}
struct pipe_mipmap_tree;
-extern GLboolean
+extern boolean
softpipe_mipmap_tree_layout(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt);
*/
-#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"
* 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))
/**
* 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;
* \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:
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:
{
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:
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);
else if (u > max)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP:
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:
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:
else if (u > max)
i = size;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
default:
* \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:
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
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:
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;
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
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:
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
}
break;
}
-static GLuint
+static unsigned
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) {
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:
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 */
struct tgsi_processor
tgsi_build_processor(
- GLuint processor,
+ unsigned processor,
struct tgsi_header *header );
/*
struct tgsi_declaration
tgsi_build_declaration(
- GLuint file,
- GLuint declare,
- GLuint interpolate,
+ unsigned file,
+ unsigned declare,
+ unsigned interpolate,
struct tgsi_header *header );
struct tgsi_full_declaration
tgsi_default_full_declaration( void );
-GLuint
+unsigned
tgsi_build_full_declaration(
const struct tgsi_full_declaration *full_decl,
struct tgsi_token *tokens,
struct tgsi_header *header,
- GLuint maxsize );
+ unsigned maxsize );
struct tgsi_declaration_range
tgsi_build_declaration_range(
- GLuint first,
- GLuint last,
+ unsigned first,
+ unsigned last,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
struct tgsi_declaration_mask
tgsi_build_declaration_mask(
- GLuint mask,
+ unsigned mask,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
struct tgsi_declaration_interpolation
tgsi_build_declaration_interpolation(
- GLuint interpolate,
+ unsigned interpolate,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
struct tgsi_immediate_float32
tgsi_build_immediate_float32(
- GLfloat value,
+ float value,
struct tgsi_immediate *immediate,
struct tgsi_header *header );
-GLuint
+unsigned
tgsi_build_full_immediate(
const struct tgsi_full_immediate *full_imm,
struct tgsi_token *tokens,
struct tgsi_header *header,
- GLuint maxsize );
+ unsigned maxsize );
/*
* instruction
struct tgsi_instruction
tgsi_build_instruction(
- GLuint opcode,
- GLuint saturate,
- GLuint num_dst_regs,
- GLuint num_src_regs,
+ unsigned opcode,
+ unsigned saturate,
+ unsigned num_dst_regs,
+ unsigned num_src_regs,
struct tgsi_header *header );
struct tgsi_full_instruction
tgsi_default_full_instruction( void );
-GLuint
+unsigned
tgsi_build_full_instruction(
const struct tgsi_full_instruction *full_inst,
struct tgsi_token *tokens,
struct tgsi_header *header,
- GLuint maxsize );
+ unsigned maxsize );
struct tgsi_instruction_ext_nv
tgsi_default_instruction_ext_nv( void );
-GLuint
+unsigned
tgsi_compare_instruction_ext_nv(
struct tgsi_instruction_ext_nv a,
struct tgsi_instruction_ext_nv b );
struct tgsi_instruction_ext_nv
tgsi_build_instruction_ext_nv(
- GLuint precision,
- GLuint cond_dst_index,
- GLuint cond_flow_index,
- GLuint cond_mask,
- GLuint cond_swizzle_x,
- GLuint cond_swizzle_y,
- GLuint cond_swizzle_z,
- GLuint cond_swizzle_w,
- GLuint cond_dst_update,
- GLuint cond_flow_update,
+ unsigned precision,
+ unsigned cond_dst_index,
+ unsigned cond_flow_index,
+ unsigned cond_mask,
+ unsigned cond_swizzle_x,
+ unsigned cond_swizzle_y,
+ unsigned cond_swizzle_z,
+ unsigned cond_swizzle_w,
+ unsigned cond_dst_update,
+ unsigned cond_flow_update,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_instruction_ext_label
tgsi_default_instruction_ext_label( void );
-GLuint
+unsigned
tgsi_compare_instruction_ext_label(
struct tgsi_instruction_ext_label a,
struct tgsi_instruction_ext_label b );
struct tgsi_instruction_ext_label
tgsi_build_instruction_ext_label(
- GLuint label,
+ unsigned label,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_instruction_ext_texture
tgsi_default_instruction_ext_texture( void );
-GLuint
+unsigned
tgsi_compare_instruction_ext_texture(
struct tgsi_instruction_ext_texture a,
struct tgsi_instruction_ext_texture b );
struct tgsi_instruction_ext_texture
tgsi_build_instruction_ext_texture(
- GLuint texture,
+ unsigned texture,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_src_register
tgsi_build_src_register(
- GLuint file,
- GLuint swizzle_x,
- GLuint swizzle_y,
- GLuint swizzle_z,
- GLuint swizzle_w,
- GLuint negate,
- GLuint indirect,
- GLuint dimension,
- GLint index,
+ unsigned file,
+ unsigned swizzle_x,
+ unsigned swizzle_y,
+ unsigned swizzle_z,
+ unsigned swizzle_w,
+ unsigned negate,
+ unsigned indirect,
+ unsigned dimension,
+ int index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_src_register_ext_swz
tgsi_default_src_register_ext_swz( void );
-GLuint
+unsigned
tgsi_compare_src_register_ext_swz(
struct tgsi_src_register_ext_swz a,
struct tgsi_src_register_ext_swz b );
struct tgsi_src_register_ext_swz
tgsi_build_src_register_ext_swz(
- GLuint ext_swizzle_x,
- GLuint ext_swizzle_y,
- GLuint ext_swizzle_z,
- GLuint ext_swizzle_w,
- GLuint negate_x,
- GLuint negate_y,
- GLuint negate_z,
- GLuint negate_w,
- GLuint ext_divide,
+ unsigned ext_swizzle_x,
+ unsigned ext_swizzle_y,
+ unsigned ext_swizzle_z,
+ unsigned ext_swizzle_w,
+ unsigned negate_x,
+ unsigned negate_y,
+ unsigned negate_z,
+ unsigned negate_w,
+ unsigned ext_divide,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_src_register_ext_mod
tgsi_default_src_register_ext_mod( void );
-GLuint
+unsigned
tgsi_compare_src_register_ext_mod(
struct tgsi_src_register_ext_mod a,
struct tgsi_src_register_ext_mod b );
struct tgsi_src_register_ext_mod
tgsi_build_src_register_ext_mod(
- GLuint complement,
- GLuint bias,
- GLuint scale_2x,
- GLuint absolute,
- GLuint negate,
+ unsigned complement,
+ unsigned bias,
+ unsigned scale_2x,
+ unsigned absolute,
+ unsigned negate,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_dimension
tgsi_build_dimension(
- GLuint indirect,
- GLuint index,
+ unsigned indirect,
+ unsigned index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_dst_register
tgsi_build_dst_register(
- GLuint file,
- GLuint mask,
- GLint index,
+ unsigned file,
+ unsigned mask,
+ int index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_dst_register_ext_concode
tgsi_default_dst_register_ext_concode( void );
-GLuint
+unsigned
tgsi_compare_dst_register_ext_concode(
struct tgsi_dst_register_ext_concode a,
struct tgsi_dst_register_ext_concode b );
struct tgsi_dst_register_ext_concode
tgsi_build_dst_register_ext_concode(
- GLuint cc,
- GLuint swizzle_x,
- GLuint swizzle_y,
- GLuint swizzle_z,
- GLuint swizzle_w,
- GLint index,
+ unsigned cc,
+ unsigned swizzle_x,
+ unsigned swizzle_y,
+ unsigned swizzle_z,
+ unsigned swizzle_w,
+ int index,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
struct tgsi_dst_register_ext_modulate
tgsi_default_dst_register_ext_modulate( void );
-GLuint
+unsigned
tgsi_compare_dst_register_ext_modulate(
struct tgsi_dst_register_ext_modulate a,
struct tgsi_dst_register_ext_modulate b );
struct tgsi_dst_register_ext_modulate
tgsi_build_dst_register_ext_modulate(
- GLuint modulate,
+ unsigned modulate,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
void
tgsi_dump(
const struct tgsi_token *tokens,
- GLuint flags );
+ unsigned flags );
#if defined __cplusplus
} // extern "C"
#if !defined TGSI_EXEC_H
#define TGSI_EXEC_H
+#include "pipe/p_compiler.h"
+
#if 0
#include "x86/rtasm/x86sse.h"
#endif
union tgsi_exec_channel
{
- GLfloat f[4];
- GLint i[4];
- GLuint u[4];
+ float f[4];
+ int i[4];
+ unsigned u[4];
};
struct tgsi_exec_vector
struct tgsi_texture_cache_entry
{
int x, y, face, level, zslice;
- GLfloat data[TEX_CACHE_TILE_SIZE][TEX_CACHE_TILE_SIZE][4];
+ float data[TEX_CACHE_TILE_SIZE][TEX_CACHE_TILE_SIZE][4];
};
struct tgsi_sampler
struct pipe_mipmap_tree *texture;
/** Get samples for four fragments in a quad */
void (*get_samples)(struct tgsi_sampler *sampler,
- const GLfloat s[QUAD_SIZE],
- const GLfloat t[QUAD_SIZE],
- const GLfloat p[QUAD_SIZE],
- GLfloat lodbias,
- GLfloat rgba[NUM_CHANNELS][QUAD_SIZE]);
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
+ float lodbias,
+ float rgba[NUM_CHANNELS][QUAD_SIZE]);
void *pipe; /*XXX temporary*/
struct tgsi_texture_cache_entry cache[TEX_CACHE_NUM_ENTRIES];
};
struct tgsi_exec_labels
{
- GLuint labels[128][2];
- GLuint count;
+ unsigned labels[128][2];
+ unsigned count;
};
#define TGSI_EXEC_TEMP_00000000_I 32
{
struct tgsi_exec_cond_regs IfPortion;
struct tgsi_exec_cond_regs ElsePortion;
- GLuint Condition;
- GLboolean WasElse;
+ unsigned Condition;
+ boolean WasElse;
};
/* XXX: This is temporary */
struct tgsi_exec_cond_stack
{
struct tgsi_exec_cond_state States[8];
- GLuint Index; /* into States[] */
+ unsigned Index; /* into States[] */
};
struct tgsi_exec_machine
struct tgsi_sampler *Samplers;
- GLfloat Imms[256][4];
- GLuint ImmLimit;
- GLfloat (*Consts)[4];
+ float Imms[256][4];
+ unsigned ImmLimit;
+ float (*Consts)[4];
const struct tgsi_exec_vector *Inputs;
struct tgsi_exec_vector *Outputs;
struct tgsi_token *Tokens;
- GLuint Processor;
+ unsigned Processor;
- GLuint *Primitives;
+ unsigned *Primitives;
struct tgsi_exec_cond_stack CondStack;
#if XXX_SSE
tgsi_exec_machine_init(
struct tgsi_exec_machine *mach,
struct tgsi_token *tokens,
- GLuint numSamplers,
+ unsigned numSamplers,
struct tgsi_sampler *samplers);
void
struct tgsi_parse_context
{
const struct tgsi_token *Tokens;
- GLuint Position;
+ unsigned Position;
struct tgsi_full_version FullVersion;
struct tgsi_full_header FullHeader;
union tgsi_full_token FullToken;
#define TGSI_PARSE_OK 0
#define TGSI_PARSE_ERROR 1
-GLuint
+unsigned
tgsi_parse_init(
struct tgsi_parse_context *ctx,
const struct tgsi_token *tokens );
tgsi_parse_free(
struct tgsi_parse_context *ctx );
-GLuint
+unsigned
tgsi_parse_end_of_tokens(
struct tgsi_parse_context *ctx );
struct tgsi_version
{
- GLuint MajorVersion : 8;
- GLuint MinorVersion : 8;
- GLuint Padding : 16;
+ unsigned MajorVersion : 8;
+ unsigned MinorVersion : 8;
+ unsigned Padding : 16;
};
struct tgsi_header
{
- GLuint HeaderSize : 8;
- GLuint BodySize : 24;
+ unsigned HeaderSize : 8;
+ unsigned BodySize : 24;
};
#define TGSI_PROCESSOR_FRAGMENT 0
struct tgsi_processor
{
- GLuint Processor : 4; /* TGSI_PROCESSOR_ */
- GLuint Padding : 28;
+ unsigned Processor : 4; /* TGSI_PROCESSOR_ */
+ unsigned Padding : 28;
};
#define TGSI_TOKEN_TYPE_DECLARATION 0
struct tgsi_token
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_ */
- GLuint Size : 8; /* UINT */
- GLuint Padding : 19;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_ */
+ unsigned Size : 8; /* UINT */
+ unsigned Padding : 19;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_FILE_NULL 0
struct tgsi_declaration
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_DECLARATION */
- GLuint Size : 8; /* UINT */
- GLuint File : 4; /* TGSI_FILE_ */
- GLuint Declare : 4; /* TGSI_DECLARE_ */
- GLuint Interpolate : 1; /* BOOL */
- GLuint Padding : 10;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_DECLARATION */
+ unsigned Size : 8; /* UINT */
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned Declare : 4; /* TGSI_DECLARE_ */
+ unsigned Interpolate : 1; /* BOOL */
+ unsigned Padding : 10;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_declaration_range
{
- GLuint First : 16; /* UINT */
- GLuint Last : 16; /* UINT */
+ unsigned First : 16; /* UINT */
+ unsigned Last : 16; /* UINT */
};
struct tgsi_declaration_mask
{
- GLuint Mask : 32; /* UINT */
+ unsigned Mask : 32; /* UINT */
};
#define TGSI_INTERPOLATE_CONSTANT 0
struct tgsi_declaration_interpolation
{
- GLuint Interpolate : 4; /* TGSI_INTERPOLATE_ */
- GLuint Padding : 28;
+ unsigned Interpolate : 4; /* TGSI_INTERPOLATE_ */
+ unsigned Padding : 28;
};
#define TGSI_IMM_FLOAT32 0
struct tgsi_immediate
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_IMMEDIATE */
- GLuint Size : 8; /* UINT */
- GLuint DataType : 4; /* TGSI_IMM_ */
- GLuint Padding : 15;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_IMMEDIATE */
+ unsigned Size : 8; /* UINT */
+ unsigned DataType : 4; /* TGSI_IMM_ */
+ unsigned Padding : 15;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_immediate_float32
{
- GLfloat Float;
+ float Float;
};
/*
struct tgsi_instruction
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
- GLuint Size : 8; /* UINT */
- GLuint Opcode : 8; /* TGSI_OPCODE_ */
- GLuint Saturate : 2; /* TGSI_SAT_ */
- GLuint NumDstRegs : 2; /* UINT */
- GLuint NumSrcRegs : 4; /* UINT */
- GLuint Padding : 3;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
+ unsigned Size : 8; /* UINT */
+ unsigned Opcode : 8; /* TGSI_OPCODE_ */
+ unsigned Saturate : 2; /* TGSI_SAT_ */
+ unsigned NumDstRegs : 2; /* UINT */
+ unsigned NumSrcRegs : 4; /* UINT */
+ unsigned Padding : 3;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_instruction_ext
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */
- GLuint Padding : 27;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */
+ unsigned Padding : 27;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_instruction_ext_nv
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */
- GLuint Precision : 4; /* TGSI_PRECISION_ */
- GLuint CondDstIndex : 4; /* UINT */
- GLuint CondFlowIndex : 4; /* UINT */
- GLuint CondMask : 4; /* TGSI_CC_ */
- GLuint CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint CondDstUpdate : 1; /* BOOL */
- GLuint CondFlowEnable : 1; /* BOOL */
- GLuint Padding : 1;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */
+ unsigned Precision : 4; /* TGSI_PRECISION_ */
+ unsigned CondDstIndex : 4; /* UINT */
+ unsigned CondFlowIndex : 4; /* UINT */
+ unsigned CondMask : 4; /* TGSI_CC_ */
+ unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondDstUpdate : 1; /* BOOL */
+ unsigned CondFlowEnable : 1; /* BOOL */
+ unsigned Padding : 1;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_instruction_ext_label
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
- GLuint Label : 24; /* UINT */
- GLuint Padding : 3;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
+ unsigned Label : 24; /* UINT */
+ unsigned Padding : 3;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_TEXTURE_UNKNOWN 0
struct tgsi_instruction_ext_texture
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
- GLuint Texture : 8; /* TGSI_TEXTURE_ */
- GLuint Padding : 19;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
+ unsigned Texture : 8; /* TGSI_TEXTURE_ */
+ unsigned Padding : 19;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_WRITEMASK_NONE 0x00
struct tgsi_instruction_ext_predicate
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
- GLuint PredDstIndex : 4; /* UINT */
- GLuint PredWriteMask : 4; /* TGSI_WRITEMASK_ */
- GLuint Padding : 19;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
+ unsigned PredDstIndex : 4; /* UINT */
+ unsigned PredWriteMask : 4; /* TGSI_WRITEMASK_ */
+ unsigned Padding : 19;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_src_register
{
- GLuint File : 4; /* TGSI_FILE_ */
- GLuint SwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint SwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint SwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint SwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint Negate : 1; /* BOOL */
- GLuint Indirect : 1; /* BOOL */
- GLuint Dimension : 1; /* BOOL */
- GLint Index : 16; /* SINT */
- GLuint Extended : 1; /* BOOL */
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_src_register_ext
{
- GLuint Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */
- GLuint Padding : 27;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */
+ unsigned Padding : 27;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_src_register_ext_swz
{
- GLuint Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
- GLuint ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint NegateX : 1; /* BOOL */
- GLuint NegateY : 1; /* BOOL */
- GLuint NegateZ : 1; /* BOOL */
- GLuint NegateW : 1; /* BOOL */
- GLuint ExtDivide : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint Padding : 3;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
+ unsigned ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned NegateX : 1; /* BOOL */
+ unsigned NegateY : 1; /* BOOL */
+ unsigned NegateZ : 1; /* BOOL */
+ unsigned NegateW : 1; /* BOOL */
+ unsigned ExtDivide : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned Padding : 3;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_src_register_ext_mod
{
- GLuint Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
- GLuint Complement : 1; /* BOOL */
- GLuint Bias : 1; /* BOOL */
- GLuint Scale2X : 1; /* BOOL */
- GLuint Absolute : 1; /* BOOL */
- GLuint Negate : 1; /* BOOL */
- GLuint Padding : 22;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
+ unsigned Complement : 1; /* BOOL */
+ unsigned Bias : 1; /* BOOL */
+ unsigned Scale2X : 1; /* BOOL */
+ unsigned Absolute : 1; /* BOOL */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Padding : 22;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_dimension
{
- GLuint Indirect : 1; /* BOOL */
- GLuint Dimension : 1; /* BOOL */
- GLuint Padding : 13;
- GLint Index : 16; /* SINT */
- GLuint Extended : 1; /* BOOL */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ unsigned Padding : 13;
+ int Index : 16; /* SINT */
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_dst_register
{
- GLuint File : 4; /* TGSI_FILE_ */
- GLuint WriteMask : 4; /* TGSI_WRITEMASK_ */
- GLuint Indirect : 1; /* BOOL */
- GLuint Dimension : 1; /* BOOL */
- GLint Index : 16; /* SINT */
- GLuint Padding : 5;
- GLuint Extended : 1; /* BOOL */
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned Padding : 5;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_dst_register_ext
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */
- GLuint Padding : 27;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */
+ unsigned Padding : 27;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_dst_register_ext_concode
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
- GLuint CondMask : 4; /* TGSI_CC_ */
- GLuint CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSrcIndex : 4; /* UINT */
- GLuint Padding : 11;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
+ unsigned CondMask : 4; /* TGSI_CC_ */
+ unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSrcIndex : 4; /* UINT */
+ unsigned Padding : 11;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_MODULATE_1X 0
struct tgsi_dst_register_ext_modulate
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
- GLuint Modulate : 4; /* TGSI_MODULATE_ */
- GLuint Padding : 23;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
+ unsigned Modulate : 4; /* TGSI_MODULATE_ */
+ unsigned Padding : 23;
+ unsigned Extended : 1; /* BOOL */
};
/*
struct tgsi_dst_register_ext_predicate
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
- GLuint PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSrcIndex : 4; /* UINT */
- GLuint Negate : 1; /* BOOL */
- GLuint Padding : 14;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
+ unsigned PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSrcIndex : 4; /* UINT */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Padding : 14;
+ unsigned Extended : 1; /* BOOL */
};
#if defined __cplusplus
tgsi_align_128bit(
void *unaligned );
-GLuint
+unsigned
tgsi_util_get_src_register_swizzle(
const struct tgsi_src_register *reg,
- GLuint component );
+ unsigned component );
-GLuint
+unsigned
tgsi_util_get_src_register_extswizzle(
const struct tgsi_src_register_ext_swz *reg,
- GLuint component);
+ unsigned component);
-GLuint
+unsigned
tgsi_util_get_full_src_register_extswizzle(
const struct tgsi_full_src_register *reg,
- GLuint component );
+ unsigned component );
void
tgsi_util_set_src_register_swizzle(
struct tgsi_src_register *reg,
- GLuint swizzle,
- GLuint component );
+ unsigned swizzle,
+ unsigned component );
void
tgsi_util_set_src_register_extswizzle(
struct tgsi_src_register_ext_swz *reg,
- GLuint swizzle,
- GLuint component );
+ unsigned swizzle,
+ unsigned component );
-GLuint
+unsigned
tgsi_util_get_src_register_extnegate(
const struct tgsi_src_register_ext_swz *reg,
- GLuint component );
+ unsigned component );
void
tgsi_util_set_src_register_extnegate(
struct tgsi_src_register_ext_swz *reg,
- GLuint negate,
- GLuint component );
+ unsigned negate,
+ unsigned component );
#define TGSI_UTIL_SIGN_CLEAR 0 /* Force positive */
#define TGSI_UTIL_SIGN_SET 1 /* Force negative */
#define TGSI_UTIL_SIGN_TOGGLE 2 /* Negate */
#define TGSI_UTIL_SIGN_KEEP 3 /* No change */
-GLuint
+unsigned
tgsi_util_get_full_src_register_sign_mode(
const struct tgsi_full_src_register *reg,
- GLuint component );
+ unsigned component );
void
tgsi_util_set_full_src_register_sign_mode(
struct tgsi_full_src_register *reg,
- GLuint sign_mode );
+ unsigned sign_mode );
#if defined __cplusplus
} // extern "C"