aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-06-09 09:35:09 +0200
committerChristian König <[email protected]>2011-06-09 09:35:09 +0200
commit003401f95c9b59471c22368b7da16fe7a951e490 (patch)
treed21fa0197ff27b8a38bd8b1d795b74d816db8b26 /src/gallium/auxiliary
parent00b4e48560f4d576b7b1924257322f5167e58c8d (diff)
parentd302804debeed13ced27fce222110c629e55d6f9 (diff)
Merge remote-tracking branch 'origin/master' into pipe-video
Conflicts: src/gallium/tests/unit/u_format_test.c src/gallium/winsys/r600/drm/r600_hw_context.c
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/Makefile2
-rw-r--r--src/gallium/auxiliary/SConscript2
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c89
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c62
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_variant.c (renamed from src/gallium/auxiliary/draw/draw_vs_varient.c)0
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.h4
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c2
-rw-r--r--src/gallium/auxiliary/util/u_debug.h2
-rw-r--r--src/gallium/auxiliary/util/u_format_r11g11b10f.h24
-rw-r--r--src/gallium/auxiliary/util/u_linkage.h2
-rw-r--r--src/gallium/auxiliary/util/u_math.h34
-rw-r--r--src/gallium/auxiliary/util/u_staging.c2
-rw-r--r--src/gallium/auxiliary/util/u_staging.h2
15 files changed, 161 insertions, 72 deletions
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index a30accaa6ff..e37cf21416a 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -44,7 +44,7 @@ C_SOURCES = \
draw/draw_vs_exec.c \
draw/draw_vs_ppc.c \
draw/draw_vs_sse.c \
- draw/draw_vs_varient.c \
+ draw/draw_vs_variant.c \
indices/u_indices_gen.c \
indices/u_unfilled_gen.c \
os/os_misc.c \
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index 6176f0ae2a8..58d78afe133 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -88,7 +88,7 @@ source = [
'draw/draw_vs_exec.c',
'draw/draw_vs_ppc.c',
'draw/draw_vs_sse.c',
- 'draw/draw_vs_varient.c',
+ 'draw/draw_vs_variant.c',
#'indices/u_indices.c',
#'indices/u_unfilled_indices.c',
'indices/u_indices_gen.c',
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index d99f94edc43..f8196bb476f 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -128,8 +128,8 @@ boolean draw_init(struct draw_context *draw)
ASSIGN_4V( draw->plane[4], 0, 0, 1, 1 ); /* yes these are correct */
ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */
draw->nr_planes = 6;
- draw->clip_xy = 1;
- draw->clip_z = 1;
+ draw->clip_xy = TRUE;
+ draw->clip_z = TRUE;
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index a1b8fc38880..56c26f57cce 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -435,6 +435,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
return variant;
}
+
static void
generate_vs(struct draw_llvm *llvm,
LLVMBuilderRef builder,
@@ -464,8 +465,7 @@ generate_vs(struct draw_llvm *llvm,
tgsi_dump(tokens, 0);
}
- if (llvm->draw->num_sampler_views &&
- llvm->draw->num_samplers)
+ if (llvm->draw->num_sampler_views && llvm->draw->num_samplers)
sampler = draw_sampler;
lp_build_tgsi_soa(llvm->gallivm,
@@ -480,8 +480,7 @@ generate_vs(struct draw_llvm *llvm,
sampler,
&llvm->draw->vs.vertex_shader->info);
- if(clamp_vertex_color)
- {
+ if (clamp_vertex_color) {
LLVMValueRef out;
unsigned chan, attrib;
struct lp_build_context bld;
@@ -489,8 +488,8 @@ generate_vs(struct draw_llvm *llvm,
lp_build_context_init(&bld, llvm->gallivm, vs_type);
for (attrib = 0; attrib < info->num_outputs; ++attrib) {
- for(chan = 0; chan < NUM_CHANNELS; ++chan) {
- if(outputs[attrib][chan]) {
+ for (chan = 0; chan < NUM_CHANNELS; ++chan) {
+ if (outputs[attrib][chan]) {
switch (info->output_semantic_name[attrib]) {
case TGSI_SEMANTIC_COLOR:
case TGSI_SEMANTIC_BCOLOR:
@@ -505,6 +504,7 @@ generate_vs(struct draw_llvm *llvm,
}
}
+
#if DEBUG_STORE
static void print_vectorf(LLVMBuilderRef builder,
LLVMValueRef vec)
@@ -523,6 +523,7 @@ static void print_vectorf(LLVMBuilderRef builder,
}
#endif
+
static void
generate_fetch(struct gallivm_state *gallivm,
LLVMValueRef vbuffers_ptr,
@@ -566,6 +567,7 @@ generate_fetch(struct gallivm_state *gallivm,
*res = draw_llvm_translate_from(gallivm, vbuffer_ptr, velem->src_format);
}
+
static LLVMValueRef
aos_to_soa(struct gallivm_state *gallivm,
LLVMValueRef val0,
@@ -609,6 +611,7 @@ aos_to_soa(struct gallivm_state *gallivm,
return res;
}
+
static void
soa_to_aos(struct gallivm_state *gallivm,
LLVMValueRef soa[NUM_CHANNELS],
@@ -645,6 +648,7 @@ soa_to_aos(struct gallivm_state *gallivm,
}
}
+
static void
convert_to_soa(struct gallivm_state *gallivm,
LLVMValueRef (*aos)[NUM_CHANNELS],
@@ -672,6 +676,7 @@ convert_to_soa(struct gallivm_state *gallivm,
}
}
+
static void
store_aos(struct gallivm_state *gallivm,
LLVMValueRef io_ptr,
@@ -748,6 +753,7 @@ store_aos(struct gallivm_state *gallivm,
#endif
}
+
static void
store_aos_array(struct gallivm_state *gallivm,
LLVMValueRef io_ptr,
@@ -796,6 +802,7 @@ store_aos_array(struct gallivm_state *gallivm,
store_aos(gallivm, io3_ptr, attr_index, aos[3], clipmask3);
}
+
static void
convert_to_aos(struct gallivm_state *gallivm,
LLVMValueRef io,
@@ -813,8 +820,8 @@ convert_to_aos(struct gallivm_state *gallivm,
for (attrib = 0; attrib < num_outputs; ++attrib) {
LLVMValueRef soa[4];
LLVMValueRef aos[4];
- for(chan = 0; chan < NUM_CHANNELS; ++chan) {
- if(outputs[attrib][chan]) {
+ for (chan = 0; chan < NUM_CHANNELS; ++chan) {
+ if (outputs[attrib][chan]) {
LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
lp_build_name(out, "output%u.%c", attrib, "xyzw"[chan]);
/*lp_build_printf(builder, "output %d : %d ",
@@ -822,8 +829,10 @@ convert_to_aos(struct gallivm_state *gallivm,
LLVMConstInt(LLVMInt32Type(), chan, 0));
print_vectorf(builder, out);*/
soa[chan] = out;
- } else
+ }
+ else {
soa[chan] = 0;
+ }
}
soa_to_aos(gallivm, soa, aos);
store_aos_array(gallivm,
@@ -838,7 +847,8 @@ convert_to_aos(struct gallivm_state *gallivm,
#endif
}
-/*
+
+/**
* Stores original vertex positions in clip coordinates
* There is probably a more efficient way to do this, 4 floats at once
* rather than extracting each element one by one.
@@ -880,7 +890,7 @@ store_clip(struct gallivm_state *gallivm,
clip_ptr2 = draw_jit_header_clip(gallivm, io2_ptr);
clip_ptr3 = draw_jit_header_clip(gallivm, io3_ptr);
- for (i = 0; i<4; i++){
+ for (i = 0; i<4; i++) {
clip0_ptr = LLVMBuildGEP(builder, clip_ptr0, indices, 2, ""); /* x0 */
clip1_ptr = LLVMBuildGEP(builder, clip_ptr1, indices, 2, ""); /* x1 */
clip2_ptr = LLVMBuildGEP(builder, clip_ptr2, indices, 2, ""); /* x2 */
@@ -901,7 +911,9 @@ store_clip(struct gallivm_state *gallivm,
}
-/* Equivalent of _mm_set1_ps(a)
+
+/**
+ * Equivalent of _mm_set1_ps(a)
*/
static LLVMValueRef
vec4f_from_scalar(struct gallivm_state *gallivm,
@@ -912,7 +924,7 @@ vec4f_from_scalar(struct gallivm_state *gallivm,
LLVMValueRef res = LLVMGetUndef(LLVMVectorType(float_type, 4));
int i;
- for(i = 0; i < 4; ++i) {
+ for (i = 0; i < 4; ++i) {
LLVMValueRef index = lp_build_const_int32(gallivm, i);
res = LLVMBuildInsertElement(gallivm->builder, res, a,
index, i == 3 ? name : "");
@@ -921,7 +933,8 @@ vec4f_from_scalar(struct gallivm_state *gallivm,
return res;
}
-/*
+
+/**
* Transforms the outputs for viewport mapping
*/
static void
@@ -942,7 +955,7 @@ generate_viewport(struct draw_llvm *llvm,
LLVMBuildStore(builder, out3, outputs[0][3]);
/* Viewport Mapping */
- for (i=0; i<3; i++){
+ for (i=0; i<3; i++) {
LLVMValueRef out = LLVMBuildLoad(builder, outputs[0][i], ""); /*x0 x1 x2 x3*/
LLVMValueRef scale;
LLVMValueRef trans;
@@ -973,7 +986,7 @@ generate_viewport(struct draw_llvm *llvm,
}
-/*
+/**
* Returns clipmask as 4xi32 bitmask for the 4 vertices
*/
static LLVMValueRef
@@ -992,9 +1005,7 @@ generate_clipmask(struct gallivm_state *gallivm,
LLVMValueRef zero, shift;
LLVMValueRef pos_x, pos_y, pos_z, pos_w;
LLVMValueRef plane1, planes, plane_ptr, sum;
-
unsigned i;
-
struct lp_type f32_type = lp_type_float_vec(32);
mask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
@@ -1009,7 +1020,7 @@ generate_clipmask(struct gallivm_state *gallivm,
pos_w = LLVMBuildLoad(builder, outputs[0][3], ""); /*w0 w1 w2 w3*/
/* Cliptest, for hardwired planes */
- if (clip_xy){
+ if (clip_xy) {
/* plane 1 */
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_x , pos_w);
temp = shift;
@@ -1037,15 +1048,15 @@ generate_clipmask(struct gallivm_state *gallivm,
mask = LLVMBuildOr(builder, mask, test, "");
}
- if (clip_z){
+ if (clip_z) {
temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 16);
- if (clip_halfz){
+ if (clip_halfz) {
/* plane 5 */
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, pos_z);
test = LLVMBuildAnd(builder, test, temp, "");
mask = LLVMBuildOr(builder, mask, test, "");
}
- else{
+ else {
/* plane 5 */
test = LLVMBuildFAdd(builder, pos_z, pos_w, "");
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
@@ -1059,7 +1070,7 @@ generate_clipmask(struct gallivm_state *gallivm,
mask = LLVMBuildOr(builder, mask, test, "");
}
- if (clip_user){
+ if (clip_user) {
LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_ptr);
LLVMValueRef indices[3];
temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 32);
@@ -1105,7 +1116,8 @@ generate_clipmask(struct gallivm_state *gallivm,
return mask;
}
-/*
+
+/**
* Returns boolean if any clipping has occurred
* Used zero/non-zero i32 value to represent boolean
*/
@@ -1119,7 +1131,7 @@ clipmask_bool(struct gallivm_state *gallivm,
LLVMValueRef temp;
int i;
- for (i=0; i<4; i++){
+ for (i=0; i<4; i++) {
temp = LLVMBuildExtractElement(builder, clipmask,
lp_build_const_int32(gallivm, i) , "");
ret = LLVMBuildOr(builder, ret, temp, "");
@@ -1128,6 +1140,7 @@ clipmask_bool(struct gallivm_state *gallivm,
LLVMBuildStore(builder, ret, ret_ptr);
}
+
static void
draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
{
@@ -1172,8 +1185,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
variant->function = LLVMAddFunction(gallivm->module, "draw_llvm_shader",
func_type);
LLVMSetFunctionCallConv(variant->function, LLVMCCallConv);
- for(i = 0; i < Elements(arg_types); ++i)
- if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+ for (i = 0; i < Elements(arg_types); ++i)
+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
LLVMAddAttribute(LLVMGetParam(variant->function, i), LLVMNoAliasAttribute);
context_ptr = LLVMGetParam(variant->function, 0);
@@ -1271,7 +1284,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
store_clip(gallivm, io, outputs);
/* do cliptest */
- if (enable_cliptest){
+ if (enable_cliptest) {
/* allocate clipmask, assign it integer type */
clipmask = generate_clipmask(gallivm, outputs,
variant->key.clip_xy,
@@ -1283,12 +1296,12 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
/* return clipping boolean value for function */
clipmask_bool(gallivm, clipmask, ret_ptr);
}
- else{
+ else {
clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
}
/* do viewport mapping */
- if (!bypass_viewport){
+ if (!bypass_viewport) {
generate_viewport(llvm, builder, outputs, context_ptr);
}
@@ -1308,7 +1321,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
* Translate the LLVM IR into machine code.
*/
#ifdef DEBUG
- if(LLVMVerifyFunction(variant->function, LLVMPrintMessageAction)) {
+ if (LLVMVerifyFunction(variant->function, LLVMPrintMessageAction)) {
lp_debug_dump_value(variant->function);
assert(0);
}
@@ -1375,8 +1388,8 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
variant->function_elts = LLVMAddFunction(gallivm->module, "draw_llvm_shader_elts", func_type);
LLVMSetFunctionCallConv(variant->function_elts, LLVMCCallConv);
- for(i = 0; i < Elements(arg_types); ++i)
- if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+ for (i = 0; i < Elements(arg_types); ++i)
+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
LLVMAddAttribute(LLVMGetParam(variant->function_elts, i),
LLVMNoAliasAttribute);
@@ -1483,7 +1496,7 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
store_clip(gallivm, io, outputs);
/* do cliptest */
- if (enable_cliptest){
+ if (enable_cliptest) {
/* allocate clipmask, assign it integer type */
clipmask = generate_clipmask(gallivm, outputs,
variant->key.clip_xy,
@@ -1495,12 +1508,12 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
/* return clipping boolean value for function */
clipmask_bool(gallivm, clipmask, ret_ptr);
}
- else{
+ else {
clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
}
/* do viewport mapping */
- if (!bypass_viewport){
+ if (!bypass_viewport) {
generate_viewport(llvm, builder, outputs, context_ptr);
}
@@ -1523,7 +1536,7 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
* Translate the LLVM IR into machine code.
*/
#ifdef DEBUG
- if(LLVMVerifyFunction(variant->function_elts, LLVMPrintMessageAction)) {
+ if (LLVMVerifyFunction(variant->function_elts, LLVMPrintMessageAction)) {
lp_debug_dump_value(variant->function_elts);
assert(0);
}
@@ -1595,6 +1608,7 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
return key;
}
+
void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
@@ -1609,7 +1623,6 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
assert(sampler_idx < PIPE_MAX_VERTEX_SAMPLERS);
-
jit_tex = &draw->llvm->jit_context.textures[sampler_idx];
jit_tex->width = width;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index a10d8e9edc0..b49502cec48 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -163,6 +163,7 @@ static void interp( const struct clip_stage *clip,
*/
static void emit_poly( struct draw_stage *stage,
struct vertex_header **inlist,
+ const boolean *edgeflags,
unsigned n,
const struct prim_header *origPrim)
{
@@ -181,6 +182,9 @@ static void emit_poly( struct draw_stage *stage,
edge_last = DRAW_PIPE_EDGE_FLAG_1;
}
+ if (!edgeflags[0])
+ edge_first = 0;
+
/* later stages may need the determinant, but only the sign matters */
header.det = origPrim->det;
header.flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle;
@@ -199,7 +203,11 @@ static void emit_poly( struct draw_stage *stage,
header.v[2] = inlist[0]; /* the provoking vertex */
}
- if (i == n-1)
+ if (!edgeflags[i-1]) {
+ header.flags &= ~edge_middle;
+ }
+
+ if (i == n - 1 && edgeflags[i])
header.flags |= edge_last;
if (0) {
@@ -248,15 +256,33 @@ do_clip_tri( struct draw_stage *stage,
unsigned tmpnr = 0;
unsigned n = 3;
unsigned i;
+ boolean aEdges[MAX_CLIPPED_VERTICES];
+ boolean bEdges[MAX_CLIPPED_VERTICES];
+ boolean *inEdges = aEdges;
+ boolean *outEdges = bEdges;
inlist[0] = header->v[0];
inlist[1] = header->v[1];
inlist[2] = header->v[2];
+ /*
+ * Note: at this point we can't just use the per-vertex edge flags.
+ * We have to observe the edge flag bits set in header->flags which
+ * were set during primitive decomposition. Put those flags into
+ * an edge flags array which parallels the vertex array.
+ * Later, in the 'unfilled' pipeline stage we'll draw the edge if both
+ * the header.flags bit is set AND the per-vertex edgeflag field is set.
+ */
+ inEdges[0] = !!(header->flags & DRAW_PIPE_EDGE_FLAG_0);
+ inEdges[1] = !!(header->flags & DRAW_PIPE_EDGE_FLAG_1);
+ inEdges[2] = !!(header->flags & DRAW_PIPE_EDGE_FLAG_2);
+
while (clipmask && n >= 3) {
const unsigned plane_idx = ffs(clipmask)-1;
+ const boolean is_user_clip_plane = plane_idx >= 6;
const float *plane = clipper->plane[plane_idx];
struct vertex_header *vert_prev = inlist[0];
+ boolean *edge_prev = &inEdges[0];
float dp_prev = dot4( vert_prev->clip, plane );
unsigned outcount = 0;
@@ -266,9 +292,11 @@ do_clip_tri( struct draw_stage *stage,
if (n >= MAX_CLIPPED_VERTICES)
return;
inlist[n] = inlist[0]; /* prevent rotation of vertices */
+ inEdges[n] = inEdges[0];
for (i = 1; i <= n; i++) {
struct vertex_header *vert = inlist[i];
+ boolean *edge = &inEdges[i];
float dp = dot4( vert->clip, plane );
@@ -276,11 +304,13 @@ do_clip_tri( struct draw_stage *stage,
assert(outcount < MAX_CLIPPED_VERTICES);
if (outcount >= MAX_CLIPPED_VERTICES)
return;
+ outEdges[outcount] = *edge_prev;
outlist[outcount++] = vert_prev;
}
if (DIFFERENT_SIGNS(dp, dp_prev)) {
struct vertex_header *new_vert;
+ boolean *new_edge;
assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
if (tmpnr >= MAX_CLIPPED_VERTICES + 1)
@@ -290,6 +320,8 @@ do_clip_tri( struct draw_stage *stage,
assert(outcount < MAX_CLIPPED_VERTICES);
if (outcount >= MAX_CLIPPED_VERTICES)
return;
+
+ new_edge = &outEdges[outcount];
outlist[outcount++] = new_vert;
if (IS_NEGATIVE(dp)) {
@@ -299,10 +331,22 @@ do_clip_tri( struct draw_stage *stage,
float t = dp / (dp - dp_prev);
interp( clipper, new_vert, t, vert, vert_prev );
- /* Force edgeflag true in this case:
+ /* Whether or not to set edge flag for the new vert depends
+ * on whether it's a user-defined clipping plane. We're
+ * copying NVIDIA's behaviour here.
*/
- new_vert->edgeflag = 1;
- } else {
+ if (is_user_clip_plane) {
+ /* we want to see an edge along the clip plane */
+ *new_edge = TRUE;
+ new_vert->edgeflag = TRUE;
+ }
+ else {
+ /* we don't want to see an edge along the frustum clip plane */
+ *new_edge = *edge_prev;
+ new_vert->edgeflag = FALSE;
+ }
+ }
+ else {
/* Coming back in.
*/
float t = dp_prev / (dp_prev - dp);
@@ -311,10 +355,12 @@ do_clip_tri( struct draw_stage *stage,
/* Copy starting vert's edgeflag:
*/
new_vert->edgeflag = vert_prev->edgeflag;
+ *new_edge = *edge_prev;
}
}
vert_prev = vert;
+ edge_prev = edge;
dp_prev = dp;
}
@@ -325,6 +371,12 @@ do_clip_tri( struct draw_stage *stage,
outlist = tmp;
n = outcount;
}
+ {
+ boolean *tmp = inEdges;
+ inEdges = outEdges;
+ outEdges = tmp;
+ }
+
}
/* If flat-shading, copy provoking vertex color to polygon vertex[0]
@@ -353,7 +405,7 @@ do_clip_tri( struct draw_stage *stage,
/* Emit the polygon as triangles to the setup stage:
*/
- emit_poly( stage, inlist, n, header );
+ emit_poly( stage, inlist, inEdges, n, header );
}
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_variant.c
index d8f030f61eb..d8f030f61eb 100644
--- a/src/gallium/auxiliary/draw/draw_vs_varient.c
+++ b/src/gallium/auxiliary/draw/draw_vs_variant.c
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index ad514463de0..5ad32d9182c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -105,7 +105,7 @@ analyse_tex(struct analysis_context *ctx,
if (info->num_texs < Elements(info->tex)) {
struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs];
- bool indirect = FALSE;
+ boolean indirect = FALSE;
unsigned readmask = 0;
tex_info->target = inst->Texture.Texture;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 9d5553f0ea0..e3a4915d03c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -65,7 +65,7 @@ struct ureg_src
/* Very similar to a tgsi_dst_register, removing unsupported fields
* and adding a Saturate flag. It's easier to push saturate into the
- * destination register than to try and create a _SAT varient of each
+ * destination register than to try and create a _SAT variant of each
* instruction function.
*/
struct ureg_dst
@@ -434,7 +434,7 @@ ureg_fixup_label(struct ureg_program *ureg,
/* Generic instruction emitter. Use if you need to pass the opcode as
- * a parameter, rather than using the emit_OP() varients below.
+ * a parameter, rather than using the emit_OP() variants below.
*/
void
ureg_insn(struct ureg_program *ureg,
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index a4c399052fd..528f344a0f7 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -770,7 +770,7 @@ void util_blitter_copy_region(struct blitter_context *blitter,
/* Check if we can sample from and render to the surfaces. */
/* (assuming copying a stencil buffer is not possible) */
- if ((!ignore_stencil && is_stencil) ||
+ if ((!ignore_stencil && is_stencil) ||
!screen->is_format_supported(screen, dst->format, dst->target,
dst->nr_samples, bind) ||
!screen->is_format_supported(screen, src->format, src->target,
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index c47c13c64cf..b5ea4050633 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -192,7 +192,7 @@ void _debug_assert_fail(const char *expr,
*/
#ifdef DEBUG
#define debug_checkpoint_full() \
- _debug_printf("%s:%u:%s", __FILE__, __LINE__, __FUNCTION__)
+ _debug_printf("%s:%u:%s\n", __FILE__, __LINE__, __FUNCTION__)
#else
#define debug_checkpoint_full() \
((void)0)
diff --git a/src/gallium/auxiliary/util/u_format_r11g11b10f.h b/src/gallium/auxiliary/util/u_format_r11g11b10f.h
index c4181d0e34e..8e0572aa7ce 100644
--- a/src/gallium/auxiliary/util/u_format_r11g11b10f.h
+++ b/src/gallium/auxiliary/util/u_format_r11g11b10f.h
@@ -45,14 +45,18 @@
static INLINE unsigned f32_to_uf11(float val)
{
- uint32_t f32 = (*(uint32_t *) &val);
+ union {
+ float f;
+ uint32_t ui;
+ } f32 = {val};
+
uint16_t uf11 = 0;
/* Decode little-endian 32-bit floating-point value */
- int sign = (f32 >> 16) & 0x8000;
+ int sign = (f32.ui >> 16) & 0x8000;
/* Map exponent to the range [-127,128] */
- int exponent = ((f32 >> 23) & 0xff) - 127;
- int mantissa = f32 & 0x007fffff;
+ int exponent = ((f32.ui >> 23) & 0xff) - 127;
+ int mantissa = f32.ui & 0x007fffff;
if (sign) return 0;
@@ -111,14 +115,18 @@ static INLINE float uf11_to_f32(uint16_t val)
static INLINE unsigned f32_to_uf10(float val)
{
- uint32_t f32 = (*(uint32_t *) &val);
+ union {
+ float f;
+ uint32_t ui;
+ } f32 = {val};
+
uint16_t uf10 = 0;
/* Decode little-endian 32-bit floating-point value */
- int sign = (f32 >> 16) & 0x8000;
+ int sign = (f32.ui >> 16) & 0x8000;
/* Map exponent to the range [-127,128] */
- int exponent = ((f32 >> 23) & 0xff) - 127;
- int mantissa = f32 & 0x007fffff;
+ int exponent = ((f32.ui >> 23) & 0xff) - 127;
+ int mantissa = f32.ui & 0x007fffff;
if (sign) return 0;
diff --git a/src/gallium/auxiliary/util/u_linkage.h b/src/gallium/auxiliary/util/u_linkage.h
index 4720e0ee603..43ec917fc81 100644
--- a/src/gallium/auxiliary/util/u_linkage.h
+++ b/src/gallium/auxiliary/util/u_linkage.h
@@ -35,7 +35,7 @@ struct util_semantic_set
unsigned long masks[256 / 8 / sizeof(unsigned long)];
};
-static INLINE bool
+static INLINE boolean
util_semantic_set_contains(struct util_semantic_set *set, unsigned char value)
{
return !!(set->masks[value / (sizeof(long) * 8)] & (1 << (value / (sizeof(long) * 8))));
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 65a99fcb394..0b5284428eb 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -477,6 +477,9 @@ float_to_byte_tex(float f)
static INLINE unsigned
util_logbase2(unsigned n)
{
+#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304)
+ return ((sizeof(unsigned) * 8 - 1) - __builtin_clz(n | 1));
+#else
unsigned pos = 0;
if (n >= 1<<16) { n >>= 16; pos += 16; }
if (n >= 1<< 8) { n >>= 8; pos += 8; }
@@ -484,6 +487,7 @@ util_logbase2(unsigned n)
if (n >= 1<< 2) { n >>= 2; pos += 2; }
if (n >= 1<< 1) { pos += 1; }
return pos;
+#endif
}
@@ -493,17 +497,29 @@ util_logbase2(unsigned n)
static INLINE unsigned
util_next_power_of_two(unsigned x)
{
- unsigned i;
-
- if (x == 0)
- return 1;
+#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304)
+ if (x <= 1)
+ return 1;
- --x;
+ return (1 << ((sizeof(unsigned) * 8) - __builtin_clz(x - 1)));
+#else
+ unsigned val = x;
- for (i = 1; i < sizeof(unsigned) * 8; i <<= 1)
- x |= x >> i;
+ if (x <= 1)
+ return 1;
- return x + 1;
+ if (util_is_power_of_two(x))
+ return x;
+
+ val--;
+ val = (val >> 1) | val;
+ val = (val >> 2) | val;
+ val = (val >> 4) | val;
+ val = (val >> 8) | val;
+ val = (val >> 16) | val;
+ val++;
+ return val;
+#endif
}
@@ -513,7 +529,7 @@ util_next_power_of_two(unsigned x)
static INLINE unsigned
util_bitcount(unsigned n)
{
-#if defined(PIPE_CC_GCC)
+#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304)
return __builtin_popcount(n);
#else
/* K&R classic bitcount.
diff --git a/src/gallium/auxiliary/util/u_staging.c b/src/gallium/auxiliary/util/u_staging.c
index b6bf241a22a..b5e37932e83 100644
--- a/src/gallium/auxiliary/util/u_staging.c
+++ b/src/gallium/auxiliary/util/u_staging.c
@@ -55,7 +55,7 @@ util_staging_transfer_init(struct pipe_context *pipe,
unsigned level,
unsigned usage,
const struct pipe_box *box,
- bool direct, struct util_staging_transfer *tx)
+ boolean direct, struct util_staging_transfer *tx)
{
struct pipe_screen *pscreen = pipe->screen;
diff --git a/src/gallium/auxiliary/util/u_staging.h b/src/gallium/auxiliary/util/u_staging.h
index 49839d25439..ddbb33443e4 100644
--- a/src/gallium/auxiliary/util/u_staging.h
+++ b/src/gallium/auxiliary/util/u_staging.h
@@ -55,7 +55,7 @@ util_staging_transfer_init(struct pipe_context *pipe,
unsigned level,
unsigned usage,
const struct pipe_box *box,
- bool direct, struct util_staging_transfer *tx);
+ boolean direct, struct util_staging_transfer *tx);
void
util_staging_transfer_destroy(struct pipe_context *pipe, struct pipe_transfer *ptx);