-I. \
-I$(TOP)/src/mesa/pipe \
-I$(TOP)/src/mesa \
- -I$(TOP)/include
+ -I$(TOP)/include \
+ $(DRIVER_INCLUDES)
##### RULES #####
##### TARGETS #####
-default:: depend symlinks $(LIBNAME)
+default: depend symlinks $(LIBNAME)
$(LIBNAME): $(OBJECTS) Makefile $(TOP)/src/mesa/pipe/Makefile.template
- $(TOP)/bin/mklib -o $@ -static $(OBJECTS)
+ $(TOP)/bin/mklib -o $@ -static $(OBJECTS) $(DRIVER_LIBS)
depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
# Remove .o and backup files
-clean:
+clean::
-rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-rm -f depend depend.bak
i915_vbuf_render_destroy( struct vbuf_render *render )
{
struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- free(i915_render);
+ FREE(i915_render);
}
ps = pipe->winsys->surface_alloc(pipe->winsys);
if (ps) {
assert(ps->refcount);
+ assert(ps->winsys);
pipe->winsys->buffer_reference(pipe->winsys, &ps->buffer, tex->buffer);
ps->format = pt->format;
ps->cpp = pt->cpp;
* 2nd mipmap out past the width of its parent.
*/
if (pt->first_level != pt->last_level) {
- unsigned mip1_width = align(minify(pt->width[0]), align_w)
+ unsigned mip1_width = align_int(minify(pt->width[0]), align_w)
+ minify(minify(pt->width[0]));
if (mip1_width > pt->width[0])
/* Pitch must be a whole number of dwords, even though we
* express it in texels.
*/
- tex->pitch = align(tex->pitch * pt->cpp, 4) / pt->cpp;
+ tex->pitch = align_int(tex->pitch * pt->cpp, 4) / pt->cpp;
tex->total_height = 0;
for ( level = pt->first_level ; level <= pt->last_level ; level++ ) {
if (pt->compressed)
img_height = MAX2(1, height/4);
else
- img_height = align(height, align_h);
+ img_height = align_int(height, align_h);
/* Because the images are packed better, the final offset
/* Layout_below: step right after second mipmap.
*/
if (level == pt->first_level + 1) {
- x += align(width, align_w);
+ x += align_int(width, align_w);
}
else {
y += img_height;
for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
if (tex->image_offset[i])
- free(tex->image_offset[i]);
+ FREE(tex->image_offset[i]);
- free(tex);
+ FREE(tex);
}
*pt = NULL;
}
typedef unsigned long long uint64;
+#if defined(__MSC__)
+
+typedef unsigned short uint16_t;
+typedef long int32_t;
+typedef unsigned long uint32_t;
+typedef long long int64_t;
+typedef unsigned long long uint64_t;
+
+#if defined(_WIN64)
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+
+#else
+#include <stdint.h>
+#endif
+
+
#define TRUE 1
#define FALSE 0
return (f >> shift) & mask;
}
+/* XXX: The bit layout needs to be revised, can't currently encode 10-bit components. */
+
#define pf_swizzle_x(f) pf_get(f, 2, 0x7) /**< PIPE_FORMAT_COMP_ */
#define pf_swizzle_y(f) pf_get(f, 5, 0x7) /**< PIPE_FORMAT_COMP_ */
#define pf_swizzle_z(f) pf_get(f, 8, 0x7) /**< PIPE_FORMAT_COMP_ */
#define TGSI_SEMANTIC_FOG 3
#define TGSI_SEMANTIC_PSIZE 4
#define TGSI_SEMANTIC_GENERIC 5
-#define TGSI_SEMANTIC_COUNT 6 /**< number of semantic values */
+#define TGSI_SEMANTIC_NORMAL 6
+#define TGSI_SEMANTIC_COUNT 7 /**< number of semantic values */
struct tgsi_declaration_semantic
{
#define CALLOC_STRUCT(T) (struct T *) CALLOC(1, sizeof(struct T))
+/**
+ * Return a pointer aligned to next multiple of N bytes.
+ */
+static INLINE void *
+align_pointer( void *unaligned, uint alignment )
+{
+ if (sizeof(void *) == 64) {
+ union {
+ void *p;
+ uint64 u;
+ } pu;
+ pu.p = unaligned;
+ pu.u = (pu.u + alignment - 1) & ~(uint64) (alignment - 1);
+ return pu.p;
+ }
+ else {
+ /* 32-bit pointers */
+ union {
+ void *p;
+ uint u;
+ } pu;
+ pu.p = unaligned;
+ pu.u = (pu.u + alignment - 1) & ~(alignment - 1);
+ return pu.p;
+ }
+}
/**
* Return memory on given byte alignment
(void) posix_memalign(& mem, alignment, bytes);
return mem;
#else
- typedef unsigned long int uintptr_t;
- uintptr_t ptr, buf;
+ char *ptr, *buf;
assert( alignment > 0 );
- ptr = (uintptr_t) MALLOC(bytes + alignment + sizeof(void *));
+ ptr = (char *) MALLOC(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
- buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
- *(uintptr_t *)(buf - sizeof(void *)) = ptr;
+ buf = (char *) align_pointer( ptr + sizeof(void *), alignment );
+ *(char **)(buf - sizeof(void *)) = ptr;
- return (void *) buf;
+ return buf;
#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
static INLINE void *
align16( void *unaligned )
{
- if (sizeof(void *) == 64) {
- union {
- void *p;
- uint64 u;
- } pu;
- pu.p = unaligned;
- pu.u = (pu.u + 15) & ~15;
- return pu.p;
- }
- else {
- /* 32-bit pointers */
- union {
- void *p;
- uint u;
- } pu;
- pu.p = unaligned;
- pu.u = (pu.u + 15) & ~15;
- return pu.p;
- }
+ return align_pointer( unaligned, 16 );
}
+static INLINE int align_int(int x, int align)
+{
+ return (x + align - 1) & ~(align - 1);
+}
+
+
+
#if defined(__MSC__) && defined(__WIN32__)
static INLINE unsigned ffs( unsigned u )
{
/** allocate a new surface (no context dependency) */
struct pipe_surface *(*surface_alloc)(struct pipe_winsys *ws);
- /** allocate storage for a pipe_surface */
+ /**
+ * Allocate storage for a pipe_surface.
+ * Returns 0 if succeeds.
+ */
int (*surface_alloc_storage)(struct pipe_winsys *ws,
struct pipe_surface *surf,
unsigned width, unsigned height,
if (setup->softpipe->rasterizer->origin_lower_left) {
/* y=0=bottom */
const int winHeight = setup->softpipe->framebuffer.cbufs[0]->height;
- setup->coef[0].a0[1] = winHeight - 1;
+ setup->coef[0].a0[1] = (float) (winHeight - 1);
setup->coef[0].dady[1] = -1.0;
}
else {
machine->InterpCoefs = quad->coef;
/* Compute X, Y, Z, W vals for this quad */
- setup_pos_vector(quad->posCoef, quad->x0, quad->y0, &machine->QuadPos);
+ setup_pos_vector(quad->posCoef, (float) quad->x0, (float) quad->y0, &machine->QuadPos);
/* run shader */
#if defined(__i386__) || defined(__386__)
stipple1 = softpipe->poly_stipple.stipple[y1 % 32];
#if 1
+ {
const int col0 = quad->x0 % 32;
if ((stipple0 & (bit31 >> col0)) == 0)
quad->mask &= ~MASK_TOP_LEFT;
if ((stipple1 & (bit30 >> col0)) == 0)
quad->mask &= ~MASK_BOTTOM_RIGHT;
+ }
#else
/* We'd like to use this code, but we'd need to redefine
* MASK_TOP_LEFT to be (1 << 1) and MASK_TOP_RIGHT to be (1 << 0),
ps = pipe->winsys->surface_alloc(pipe->winsys);
if (ps) {
assert(ps->refcount);
+ assert(ps->winsys);
pipe->winsys->buffer_reference(pipe->winsys, &ps->buffer, spt->buffer);
ps->format = pt->format;
ps->cpp = pt->cpp;
pipe->winsys->buffer_reference(pipe->winsys, &spt->buffer, NULL);
- free(spt);
+ FREE(spt);
}
*pt = NULL;
}
else {
for (i = 0; i < TILE_SIZE; i++) {
for (j = 0; j < TILE_SIZE; j++) {
- tile->data.depth16[i][j] = clear_value;
+ tile->data.depth16[i][j] = (ushort) clear_value;
}
}
}
r = g = b = a = 0;
}
- tc->clear_color[0] = r / 255.0;
- tc->clear_color[1] = g / 255.0;
- tc->clear_color[2] = b / 255.0;
- tc->clear_color[3] = a / 255.0;
+ tc->clear_color[0] = r / 255.0f;
+ tc->clear_color[1] = g / 255.0f;
+ tc->clear_color[2] = b / 255.0f;
+ tc->clear_color[3] = a / 255.0f;
#if TILE_CLEAR_OPTIMIZATION
/* set flags to indicate all the tiles are cleared */
immediate = tgsi_default_immediate();
- header_bodysize_grow( header );
+ header_bodysize_grow( header );
return immediate;
}
struct tgsi_header *header,
unsigned maxsize )
{
- unsigned size = 0, i;
+ unsigned size = 0, i;
struct tgsi_immediate *immediate;
if( maxsize <= size )
if32 = (struct tgsi_immediate_float32 *) &tokens[size];
size++;
- *if32 = tgsi_build_immediate_float32(
+ *if32 = tgsi_build_immediate_float32(
full_imm->u.ImmediateFloat32[i].Float,
immediate,
header );
if (!strb->surface) {
strb->surface = pipe->winsys->surface_alloc(pipe->winsys);
assert(strb->surface);
+ assert(strb->surface->refcount);
+ assert(strb->surface->winsys);
if (!strb->surface)
return GL_FALSE;
}
#ifndef ST_PUBLIC_H
#define ST_PUBLIC_H
+#include "GL/gl.h"
+#include "GL/internal/glcore.h" /* for __GLcontextModes */
+
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"