summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/Makefile.template9
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_vbuf.c2
-rw-r--r--src/mesa/pipe/i915simple/i915_surface.c1
-rw-r--r--src/mesa/pipe/i915simple/i915_texture.c12
-rw-r--r--src/mesa/pipe/p_compiler.h19
-rw-r--r--src/mesa/pipe/p_format.h2
-rw-r--r--src/mesa/pipe/p_shader_tokens.h3
-rw-r--r--src/mesa/pipe/p_util.h64
-rw-r--r--src/mesa/pipe/p_winsys.h5
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stipple.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c1
-rw-r--r--src/mesa/pipe/softpipe/sp_texture.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.c10
-rw-r--r--src/mesa/pipe/tgsi/util/tgsi_build.c6
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--src/mesa/state_tracker/st_public.h3
18 files changed, 98 insertions, 49 deletions
diff --git a/src/mesa/pipe/Makefile.template b/src/mesa/pipe/Makefile.template
index 3cd07660b6..8e84f8eb2d 100644
--- a/src/mesa/pipe/Makefile.template
+++ b/src/mesa/pipe/Makefile.template
@@ -17,7 +17,8 @@ INCLUDES = \
-I. \
-I$(TOP)/src/mesa/pipe \
-I$(TOP)/src/mesa \
- -I$(TOP)/include
+ -I$(TOP)/include \
+ $(DRIVER_INCLUDES)
##### RULES #####
@@ -34,11 +35,11 @@ INCLUDES = \
##### 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)
@@ -54,7 +55,7 @@ tags:
# Remove .o and backup files
-clean:
+clean::
-rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-rm -f depend depend.bak
diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
index d85a6d3c0f..edc62e25e5 100644
--- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c
+++ b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
@@ -202,7 +202,7 @@ static void
i915_vbuf_render_destroy( struct vbuf_render *render )
{
struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- free(i915_render);
+ FREE(i915_render);
}
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c
index e3c3cdd2e4..72a65e0fb4 100644
--- a/src/mesa/pipe/i915simple/i915_surface.c
+++ b/src/mesa/pipe/i915simple/i915_surface.c
@@ -64,6 +64,7 @@ i915_get_tex_surface(struct pipe_context *pipe,
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;
diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/mesa/pipe/i915simple/i915_texture.c
index 44f72e63cc..6b0a4a96f3 100644
--- a/src/mesa/pipe/i915simple/i915_texture.c
+++ b/src/mesa/pipe/i915simple/i915_texture.c
@@ -123,7 +123,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
* 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])
@@ -133,7 +133,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
/* 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++ ) {
@@ -144,7 +144,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
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
@@ -155,7 +155,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
/* 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;
@@ -531,9 +531,9 @@ i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
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;
}
diff --git a/src/mesa/pipe/p_compiler.h b/src/mesa/pipe/p_compiler.h
index 4f2c9ef88a..ab9609deab 100644
--- a/src/mesa/pipe/p_compiler.h
+++ b/src/mesa/pipe/p_compiler.h
@@ -50,6 +50,25 @@ typedef unsigned short ushort;
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
diff --git a/src/mesa/pipe/p_format.h b/src/mesa/pipe/p_format.h
index b1772b352f..9f60cdbb04 100644
--- a/src/mesa/pipe/p_format.h
+++ b/src/mesa/pipe/p_format.h
@@ -97,6 +97,8 @@ static INLINE uint pf_get(pipe_format_rgbazs_t f, uint shift, uint mask)
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_ */
diff --git a/src/mesa/pipe/p_shader_tokens.h b/src/mesa/pipe/p_shader_tokens.h
index e5922b439f..e9d1d66bda 100644
--- a/src/mesa/pipe/p_shader_tokens.h
+++ b/src/mesa/pipe/p_shader_tokens.h
@@ -109,7 +109,8 @@ struct tgsi_declaration_interpolation
#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
{
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 69ec62e307..573fef9b83 100644
--- a/src/mesa/pipe/p_util.h
+++ b/src/mesa/pipe/p_util.h
@@ -111,6 +111,32 @@ REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
#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
@@ -123,19 +149,18 @@ align_malloc(size_t bytes, uint 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) */
}
@@ -169,28 +194,17 @@ align_free(void *ptr)
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 )
{
diff --git a/src/mesa/pipe/p_winsys.h b/src/mesa/pipe/p_winsys.h
index aa9362ec0b..75c6dc7e85 100644
--- a/src/mesa/pipe/p_winsys.h
+++ b/src/mesa/pipe/p_winsys.h
@@ -79,7 +79,10 @@ struct pipe_winsys
/** 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,
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 7847027cae..89f8df945c 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -488,7 +488,7 @@ setup_fragcoord_coeff(struct setup_stage *setup)
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 {
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 921dfbaccb..0001c76a80 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -133,7 +133,7 @@ shade_quad(
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__)
diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/mesa/pipe/softpipe/sp_quad_stipple.c
index 0c42963dfe..8660432259 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stipple.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stipple.c
@@ -36,6 +36,7 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
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;
@@ -48,6 +49,7 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
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),
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index 6c080d5b5c..a580fb3e82 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -50,6 +50,7 @@ softpipe_get_tex_surface(struct pipe_context *pipe,
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;
diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c
index e5e6bfe01b..532bcfcc51 100644
--- a/src/mesa/pipe/softpipe/sp_texture.c
+++ b/src/mesa/pipe/softpipe/sp_texture.c
@@ -126,7 +126,7 @@ softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
pipe->winsys->buffer_reference(pipe->winsys, &spt->buffer, NULL);
- free(spt);
+ FREE(spt);
}
*pt = NULL;
}
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/mesa/pipe/softpipe/sp_tile_cache.c
index 6515ce668c..1974f77459 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.c
+++ b/src/mesa/pipe/softpipe/sp_tile_cache.c
@@ -286,7 +286,7 @@ clear_tile(struct softpipe_cached_tile *tile,
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;
}
}
}
@@ -564,10 +564,10 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue)
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 */
diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.c b/src/mesa/pipe/tgsi/util/tgsi_build.c
index 19b2aad921..67f7d2c2c2 100644
--- a/src/mesa/pipe/tgsi/util/tgsi_build.c
+++ b/src/mesa/pipe/tgsi/util/tgsi_build.c
@@ -365,7 +365,7 @@ tgsi_build_immediate(
immediate = tgsi_default_immediate();
- header_bodysize_grow( header );
+ header_bodysize_grow( header );
return immediate;
}
@@ -415,7 +415,7 @@ tgsi_build_full_immediate(
struct tgsi_header *header,
unsigned maxsize )
{
- unsigned size = 0, i;
+ unsigned size = 0, i;
struct tgsi_immediate *immediate;
if( maxsize <= size )
@@ -433,7 +433,7 @@ tgsi_build_full_immediate(
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 );
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 2d6b3fc749..f02cb3d133 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -93,6 +93,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
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;
}
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index ed5ef1f159..78a8fde82b 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -28,6 +28,9 @@
#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"