summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aapoint.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.h9
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c1
-rw-r--r--src/gallium/auxiliary/indices/SConscript6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer.h8
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c12
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c2
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c2
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_execmem.c6
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt79
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c61
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.h4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c238
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.h2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c79
-rw-r--r--src/gallium/auxiliary/translate/translate.c2
-rw-r--r--src/gallium/auxiliary/util/Makefile2
-rw-r--r--src/gallium/auxiliary/util/SConscript1
-rw-r--r--src/gallium/auxiliary/util/u_clear.h60
-rw-r--r--src/gallium/auxiliary/util/u_debug.c83
-rw-r--r--src/gallium/auxiliary/util/u_debug.h14
-rw-r--r--src/gallium/auxiliary/util/u_debug_stack.c5
-rw-r--r--src/gallium/auxiliary/util/u_debug_symbol.c250
-rw-r--r--src/gallium/auxiliary/util/u_debug_symbol.h53
-rw-r--r--src/gallium/auxiliary/util/u_double_list.h3
-rw-r--r--src/gallium/auxiliary/util/u_math.h28
-rw-r--r--src/gallium/auxiliary/util/u_pack_color.h30
-rw-r--r--src/gallium/auxiliary/util/u_stream_stdc.c2
-rw-r--r--src/gallium/auxiliary/util/u_string.h2
-rw-r--r--src/gallium/auxiliary/util/u_tile.c16
-rw-r--r--src/gallium/auxiliary/util/u_time.c12
-rw-r--r--src/gallium/auxiliary/util/u_time.h6
35 files changed, 865 insertions, 229 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index 5008086cf2..3133abe5dc 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -286,7 +286,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
ctx->emit_instruction(ctx, &newInst);
#endif
- /* SGT t0.y, t0.xxxx, t0.wwww; # bool b = d > 1 (NOTE t0.w == 1) */
+ /* SGT t0.y, t0.xxxx, tex.wwww; # bool b = d > 1 (NOTE tex.w == 1) */
newInst = tgsi_default_full_instruction();
newInst.Instruction.Opcode = TGSI_OPCODE_SGT;
newInst.Instruction.NumDstRegs = 1;
diff --git a/src/gallium/auxiliary/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h
index c143cf2372..554f4ac3c1 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.h
+++ b/src/gallium/auxiliary/draw/draw_vertex.h
@@ -87,18 +87,17 @@ struct vertex_info
} attrib[PIPE_MAX_SHADER_INPUTS];
};
-static INLINE int
+static INLINE size_t
draw_vinfo_size( const struct vertex_info *a )
{
- return ((const char *)&a->attrib[a->num_attribs] -
- (const char *)a);
+ return offsetof(const struct vertex_info, attrib[a->num_attribs]);
}
static INLINE int
draw_vinfo_compare( const struct vertex_info *a,
const struct vertex_info *b )
{
- unsigned sizea = draw_vinfo_size( a );
+ size_t sizea = draw_vinfo_size( a );
return memcmp( a, b, sizea );
}
@@ -106,7 +105,7 @@ static INLINE void
draw_vinfo_copy( struct vertex_info *dst,
const struct vertex_info *src )
{
- unsigned size = draw_vinfo_size( src );
+ size_t size = draw_vinfo_size( src );
memcpy( dst, src, size );
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index b3200df811..dbbc33fffa 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -151,6 +151,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
output[slot][1],
output[slot][2],
output[slot][3]);
+ assert(!util_is_inf_or_nan(output[slot][0]));
}
#endif
diff --git a/src/gallium/auxiliary/indices/SConscript b/src/gallium/auxiliary/indices/SConscript
index e5f7ee9484..712e215534 100644
--- a/src/gallium/auxiliary/indices/SConscript
+++ b/src/gallium/auxiliary/indices/SConscript
@@ -1,17 +1,19 @@
Import('*')
+from sys import executable as python_cmd
+
env.CodeGenerate(
target = 'u_indices_gen.c',
script = 'u_indices_gen.py',
source = [],
- command = 'python $SCRIPT > $TARGET'
+ command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'u_unfilled_gen.c',
script = 'u_unfilled_gen.py',
source = [],
- command = 'python $SCRIPT > $TARGET'
+ command = python_cmd + ' $SCRIPT > $TARGET'
)
indices = env.ConvenienceLibrary(
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 2a1315922a..92b6fd0056 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -158,7 +158,7 @@ pb_map(struct pb_buffer *buf,
assert(buf);
if(!buf)
return NULL;
- assert(p_atomic_read(&buf->base.reference.count) > 0);
+ assert(pipe_is_referenced(&buf->base.reference));
return buf->vtbl->map(buf, flags);
}
@@ -169,7 +169,7 @@ pb_unmap(struct pb_buffer *buf)
assert(buf);
if(!buf)
return;
- assert(p_atomic_read(&buf->base.reference.count) > 0);
+ assert(pipe_is_referenced(&buf->base.reference));
buf->vtbl->unmap(buf);
}
@@ -185,7 +185,7 @@ pb_get_base_buffer( struct pb_buffer *buf,
offset = 0;
return;
}
- assert(p_atomic_read(&buf->base.reference.count) > 0);
+ assert(pipe_is_referenced(&buf->base.reference));
assert(buf->vtbl->get_base_buffer);
buf->vtbl->get_base_buffer(buf, base_buf, offset);
assert(*base_buf);
@@ -221,7 +221,7 @@ pb_destroy(struct pb_buffer *buf)
assert(buf);
if(!buf)
return;
- assert(p_atomic_read(&buf->base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.reference));
buf->vtbl->destroy(buf);
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 1bdf7a0b2d..2cd0b8a8cd 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -36,7 +36,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <unistd.h>
#include <sched.h>
#endif
@@ -115,7 +115,7 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
{
struct fenced_buffer_list *fenced_list = fenced_buf->list;
- assert(p_atomic_read(&fenced_buf->base.base.reference.count));
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
assert(fenced_buf->fence);
@@ -137,7 +137,7 @@ _fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
{
struct fenced_buffer_list *fenced_list = fenced_buf->list;
- assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
assert(!fenced_buf->fence);
#ifdef DEBUG
assert(fenced_buf->head.prev);
@@ -181,7 +181,7 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
* FIXME!!!
*/
- if(!p_atomic_read(&fenced_buf->base.base.reference.count))
+ if(!pipe_is_referenced(&fenced_buf->base.base.reference))
_fenced_buffer_destroy(fenced_buf);
}
@@ -257,7 +257,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
struct fenced_buffer_list *fenced_list = fenced_buf->list;
pipe_mutex_lock(fenced_list->mutex);
- assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
if (fenced_buf->fence) {
struct pb_fence_ops *ops = fenced_list->ops;
if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
@@ -573,7 +573,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
/* Wait on outstanding fences */
while (fenced_list->numDelayed) {
pipe_mutex_unlock(fenced_list->mutex);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
sched_yield();
#endif
_fenced_buffer_list_check_free(fenced_list, 1);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 010a2ecc1f..35358430b4 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -112,7 +112,7 @@ _pb_cache_buffer_destroy(struct pb_cache_buffer *buf)
LIST_DEL(&buf->head);
assert(mgr->numDelayed);
--mgr->numDelayed;
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
pb_reference(&buf->buffer, NULL);
FREE(buf);
}
@@ -153,7 +153,7 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
struct pb_cache_manager *mgr = buf->mgr;
pipe_mutex_lock(mgr->mutex);
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
_pb_cache_buffer_list_check_free(mgr);
@@ -310,7 +310,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
return NULL;
}
- assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
+ assert(pipe_is_referenced(&buf->buffer->base.reference));
assert(pb_check_alignment(desc->alignment, buf->buffer->base.alignment));
assert(pb_check_usage(desc->usage, buf->buffer->base.usage));
assert(buf->buffer->base.size >= size);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 478682dbee..f1a05be46e 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -208,7 +208,7 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf)
{
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
pb_debug_buffer_check(buf);
@@ -315,7 +315,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
return NULL;
}
- assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
+ assert(pipe_is_referenced(&buf->buffer->base.reference));
assert(pb_check_alignment(real_desc.alignment, buf->buffer->base.alignment));
assert(pb_check_usage(real_desc.usage, buf->buffer->base.usage));
assert(buf->buffer->base.size >= real_size);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index fb18dcc5dc..5a342fbf3b 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -97,7 +97,7 @@ mm_buffer_destroy(struct pb_buffer *buf)
struct mm_buffer *mm_buf = mm_buffer(buf);
struct mm_pb_manager *mm = mm_buf->mgr;
- assert(p_atomic_read(&mm_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&mm_buf->base.base.reference));
pipe_mutex_lock(mm->mutex);
u_mmFreeMem(mm_buf->block);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index 75b95e132e..07fd1a22d9 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
@@ -108,7 +108,7 @@ pool_buffer_destroy(struct pb_buffer *buf)
struct pool_buffer *pool_buf = pool_buffer(buf);
struct pool_pb_manager *pool = pool_buf->mgr;
- assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&pool_buf->base.base.reference));
pipe_mutex_lock(pool->mutex);
LIST_ADD(&pool_buf->head, &pool->free);
@@ -216,7 +216,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
pipe_mutex_unlock(pool->mutex);
pool_buf = LIST_ENTRY(struct pool_buffer, item, head);
- assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&pool_buf->base.base.reference));
pipe_reference_init(&pool_buf->base.base.reference, 1);
pool_buf->base.base.alignment = desc->alignment;
pool_buf->base.base.usage = desc->usage;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index a431fd5211..724aaadb43 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -202,7 +202,7 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf)
pipe_mutex_lock(mgr->mutex);
- assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+ assert(!pipe_is_referenced(&buf->base.base.reference));
buf->mapCount = 0;
diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 1f0923b683..01811d5011 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -42,7 +42,7 @@
#endif
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
/*
@@ -118,7 +118,7 @@ rtasm_exec_free(void *addr)
}
-#else /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#else /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
/*
* Just use regular memory.
@@ -138,4 +138,4 @@ rtasm_exec_free(void *addr)
}
-#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
index 5b21a2be0b..a3f4947c73 100644
--- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
+++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
@@ -262,7 +262,7 @@ TGSI Instruction Specification
dst.w = round(src.w)
-1.3.10 EXPBASE2 - Exponent Base 2
+1.3.10 EXPBASE2 - Exponential Base 2
dst.x = pow(2.0, src.x)
dst.y = pow(2.0, src.x)
@@ -382,9 +382,7 @@ TGSI Instruction Specification
1.5.7 KILP - Predicated Discard
- if (cc.x || cc.y || cc.z || cc.w)
- discard
- endif
+ discard
1.5.8 LG2 - Logarithm Base 2
@@ -548,7 +546,7 @@ TGSI Instruction Specification
1.6.3 BRA - Branch
- TBD
+ pc = target
1.6.4 CAL - Subroutine Call
@@ -1038,3 +1036,74 @@ TGSI Instruction Specification
Alias for ARR.
+
+2 Explanation of symbols used
+==============================
+
+
+2.1 Functions
+--------------
+
+
+ abs(x) Absolute value of x.
+ |x|
+ (x < 0.0) ? -x : x
+
+ ceil(x) Ceiling of x.
+
+ clamp(x,y,z) Clamp x between y and z.
+ (x < y) ? y : (x > z) ? z : x
+
+ cos(x) Cosine of x.
+
+ floor(x) Floor of x.
+
+ lg2(x) Logarithm base 2 of x.
+
+ max(x,y) Maximum of x and y.
+ (x > y) ? x : y
+
+ min(x,y) Minimum of x and y.
+ (x < y) ? x : y
+
+ partialx(x) Derivative of x relative to fragment's X.
+
+ partialy(x) Derivative of x relative to fragment's Y.
+
+ pop() Pop from stack.
+
+ pow(x,y) Raise x to power of y.
+
+ push(x) Push x on stack.
+
+ round(x) Round x.
+
+ sin(x) Sine of x.
+
+ sqrt(x) Square root of x.
+
+ trunc(x) Truncate x.
+
+
+2.2 Keywords
+-------------
+
+
+ discard Discard fragment.
+
+ dst First destination register.
+
+ dst0 First destination register.
+
+ pc Program counter.
+
+ src First source register.
+
+ src0 First source register.
+
+ src1 Second source register.
+
+ src2 Third source register.
+
+ target Label of target instruction.
+
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index ba807e498f..e8bd7cda3b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -123,6 +123,53 @@
#define UPDATE_EXEC_MASK(MACH) \
MACH->ExecMask = MACH->CondMask & MACH->LoopMask & MACH->ContMask & MACH->FuncMask
+
+static const union tgsi_exec_channel ZeroVec =
+ { { 0.0, 0.0, 0.0, 0.0 } };
+
+
+#ifdef DEBUG
+static void
+check_inf_or_nan(const union tgsi_exec_channel *chan)
+{
+ assert(!util_is_inf_or_nan(chan->f[0]));
+ assert(!util_is_inf_or_nan(chan->f[1]));
+ assert(!util_is_inf_or_nan(chan->f[2]));
+ assert(!util_is_inf_or_nan(chan->f[3]));
+}
+#endif
+
+
+#ifdef DEBUG
+static void
+print_chan(const char *msg, const union tgsi_exec_channel *chan)
+{
+ debug_printf("%s = {%f, %f, %f, %f}\n",
+ msg, chan->f[0], chan->f[1], chan->f[2], chan->f[3]);
+}
+#endif
+
+
+#ifdef DEBUG
+static void
+print_temp(const struct tgsi_exec_machine *mach, uint index)
+{
+ const struct tgsi_exec_vector *tmp = &mach->Temps[index];
+ int i;
+ debug_printf("Temp[%u] =\n", index);
+ for (i = 0; i < 4; i++) {
+ debug_printf(" %c: { %f, %f, %f, %f }\n",
+ "XYZW"[i],
+ tmp->xyzw[i].f[0],
+ tmp->xyzw[i].f[1],
+ tmp->xyzw[i].f[2],
+ tmp->xyzw[i].f[3]);
+ }
+}
+#endif
+
+
+
/**
* Initialize machine state by expanding tokens to full instructions,
* allocating temporary storage, setting up constants, etc.
@@ -278,6 +325,12 @@ tgsi_exec_machine_init(
mach->Temps[TEMP_3_I].xyzw[TEMP_3_C].f[i] = 3.0f;
mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C].f[i] = 0.5f;
}
+
+#ifdef DEBUG
+ /* silence warnings */
+ (void) print_chan;
+ (void) print_temp;
+#endif
}
@@ -1281,6 +1334,10 @@ store_dest(
union tgsi_exec_channel *dst;
uint execmask = mach->ExecMask;
+#ifdef DEBUG
+ check_inf_or_nan(chan);
+#endif
+
switch (reg->DstRegister.File) {
case TGSI_FILE_NULL:
dst = &null;
@@ -1643,7 +1700,7 @@ exec_tex(struct tgsi_exec_machine *mach,
lodBias = 0.0;
fetch_texel(mach->Samplers[unit],
- &r[0], NULL, NULL, lodBias, /* S, T, P, BIAS */
+ &r[0], &ZeroVec, &ZeroVec, lodBias, /* S, T, P, BIAS */
&r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
break;
@@ -1847,7 +1904,7 @@ exec_instruction(
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ARL:
- /* TGSI_OPCODE_FLOOR */
+ case TGSI_OPCODE_FLOOR:
/* TGSI_OPCODE_FLR */
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
FETCH( &r[0], 0, chan_index );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 4ffd4efbff..0b4b2a6fb6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -205,8 +205,8 @@ struct tgsi_exec_machine
const float (*Consts)[4];
struct tgsi_exec_vector *Inputs;
struct tgsi_exec_vector *Outputs;
- const struct tgsi_token *Tokens;
- unsigned Processor;
+ const struct tgsi_token *Tokens; /**< Declarations, instructions */
+ unsigned Processor; /**< TGSI_PROCESSOR_x */
/* GEOMETRY processor only. */
unsigned *Primitives;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 2b8a6f0fb1..37f2b66d1f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -30,125 +30,125 @@
static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{
- { 1, 1, 0, 0, "ARL" },
- { 1, 1, 0, 0, "MOV" },
- { 1, 1, 0, 0, "LIT" },
- { 1, 1, 0, 0, "RCP" },
- { 1, 1, 0, 0, "RSQ" },
- { 1, 1, 0, 0, "EXP" },
- { 1, 1, 0, 0, "LOG" },
- { 1, 2, 0, 0, "MUL" },
- { 1, 2, 0, 0, "ADD" },
- { 1, 2, 0, 0, "DP3" },
- { 1, 2, 0, 0, "DP4" },
- { 1, 2, 0, 0, "DST" },
- { 1, 2, 0, 0, "MIN" },
- { 1, 2, 0, 0, "MAX" },
- { 1, 2, 0, 0, "SLT" },
- { 1, 2, 0, 0, "SGE" },
- { 1, 3, 0, 0, "MAD" },
- { 1, 2, 0, 0, "SUB" },
- { 1, 3, 0, 0, "LERP" },
- { 1, 3, 0, 0, "CND" },
- { 1, 3, 0, 0, "CND0" },
- { 1, 3, 0, 0, "DOT2ADD" },
- { 1, 2, 0, 0, "INDEX" },
- { 1, 1, 0, 0, "NEGATE" },
- { 1, 1, 0, 0, "FRAC" },
- { 1, 3, 0, 0, "CLAMP" },
- { 1, 1, 0, 0, "FLOOR" },
- { 1, 1, 0, 0, "ROUND" },
- { 1, 1, 0, 0, "EXPBASE2" },
- { 1, 1, 0, 0, "LOGBASE2" },
- { 1, 2, 0, 0, "POWER" },
- { 1, 2, 0, 0, "CROSSPRODUCT" },
- { 1, 2, 0, 0, "MULTIPLYMATRIX" },
- { 1, 1, 0, 0, "ABS" },
- { 1, 1, 0, 0, "RCC" },
- { 1, 2, 0, 0, "DPH" },
- { 1, 1, 0, 0, "COS" },
- { 1, 1, 0, 0, "DDX" },
- { 1, 1, 0, 0, "DDY" },
- { 0, 0, 0, 0, "KILP" },
- { 1, 1, 0, 0, "PK2H" },
- { 1, 1, 0, 0, "PK2US" },
- { 1, 1, 0, 0, "PK4B" },
- { 1, 1, 0, 0, "PK4UB" },
- { 1, 2, 0, 0, "RFL" },
- { 1, 2, 0, 0, "SEQ" },
- { 1, 2, 0, 0, "SFL" },
- { 1, 2, 0, 0, "SGT" },
- { 1, 1, 0, 0, "SIN" },
- { 1, 2, 0, 0, "SLE" },
- { 1, 2, 0, 0, "SNE" },
- { 1, 2, 0, 0, "STR" },
- { 1, 2, 1, 0, "TEX" },
- { 1, 4, 1, 0, "TXD" },
- { 1, 2, 1, 0, "TXP" },
- { 1, 1, 0, 0, "UP2H" },
- { 1, 1, 0, 0, "UP2US" },
- { 1, 1, 0, 0, "UP4B" },
- { 1, 1, 0, 0, "UP4UB" },
- { 1, 3, 0, 0, "X2D" },
- { 1, 1, 0, 0, "ARA" },
- { 1, 1, 0, 0, "ARR" },
- { 0, 1, 0, 0, "BRA" },
- { 0, 0, 0, 1, "CAL" },
- { 0, 0, 0, 0, "RET" },
- { 1, 1, 0, 0, "SSG" },
- { 1, 3, 0, 0, "CMP" },
- { 1, 1, 0, 0, "SCS" },
- { 1, 2, 1, 0, "TXB" },
- { 1, 1, 0, 0, "NRM" },
- { 1, 2, 0, 0, "DIV" },
- { 1, 2, 0, 0, "DP2" },
- { 1, 2, 1, 0, "TXL" },
- { 0, 0, 0, 0, "BRK" },
- { 0, 1, 0, 1, "IF" },
- { 0, 0, 0, 0, "LOOP" },
- { 0, 1, 0, 0, "REP" },
- { 0, 0, 0, 1, "ELSE" },
- { 0, 0, 0, 0, "ENDIF" },
- { 0, 0, 0, 0, "ENDLOOP" },
- { 0, 0, 0, 0, "ENDREP" },
- { 0, 1, 0, 0, "PUSHA" },
- { 1, 0, 0, 0, "POPA" },
- { 1, 1, 0, 0, "CEIL" },
- { 1, 1, 0, 0, "I2F" },
- { 1, 1, 0, 0, "NOT" },
- { 1, 1, 0, 0, "TRUNC" },
- { 1, 2, 0, 0, "SHL" },
- { 1, 2, 0, 0, "SHR" },
- { 1, 2, 0, 0, "AND" },
- { 1, 2, 0, 0, "OR" },
- { 1, 2, 0, 0, "MOD" },
- { 1, 2, 0, 0, "XOR" },
- { 1, 3, 0, 0, "SAD" },
- { 1, 2, 1, 0, "TXF" },
- { 1, 2, 1, 0, "TXQ" },
- { 0, 0, 0, 0, "CONT" },
- { 0, 0, 0, 0, "EMIT" },
- { 0, 0, 0, 0, "ENDPRIM" },
- { 0, 0, 0, 1, "BGNLOOP2" },
- { 0, 0, 0, 0, "BGNSUB" },
- { 0, 0, 0, 1, "ENDLOOP2" },
- { 0, 0, 0, 0, "ENDSUB" },
- { 1, 1, 0, 0, "NOISE1" },
- { 1, 1, 0, 0, "NOISE2" },
- { 1, 1, 0, 0, "NOISE3" },
- { 1, 1, 0, 0, "NOISE4" },
- { 0, 0, 0, 0, "NOP" },
- { 1, 2, 0, 0, "M4X3" },
- { 1, 2, 0, 0, "M3X4" },
- { 1, 2, 0, 0, "M3X3" },
- { 1, 2, 0, 0, "M3X2" },
- { 1, 1, 0, 0, "NRM4" },
- { 0, 1, 0, 0, "CALLNZ" },
- { 0, 1, 0, 0, "IFC" },
- { 0, 1, 0, 0, "BREAKC" },
- { 0, 1, 0, 0, "KIL" },
- { 0, 0, 0, 0, "END" },
- { 1, 1, 0, 0, "SWZ" }
+ { 1, 1, 0, 0, "ARL", NULL, NULL },
+ { 1, 1, 0, 0, "MOV", NULL, NULL },
+ { 1, 1, 0, 0, "LIT", NULL, NULL },
+ { 1, 1, 0, 0, "RCP", "RECIP", NULL },
+ { 1, 1, 0, 0, "RSQ", "RECIPSQRT", NULL },
+ { 1, 1, 0, 0, "EXP", "EXPP", NULL },
+ { 1, 1, 0, 0, "LOG", NULL, NULL },
+ { 1, 2, 0, 0, "MUL", NULL, NULL },
+ { 1, 2, 0, 0, "ADD", NULL, NULL },
+ { 1, 2, 0, 0, "DP3", "DOT3", NULL },
+ { 1, 2, 0, 0, "DP4", "DOT4", NULL },
+ { 1, 2, 0, 0, "DST", NULL, NULL },
+ { 1, 2, 0, 0, "MIN", NULL, NULL },
+ { 1, 2, 0, 0, "MAX", NULL, NULL },
+ { 1, 2, 0, 0, "SLT", "SETLT", NULL },
+ { 1, 2, 0, 0, "SGE", "SETGE", NULL },
+ { 1, 3, 0, 0, "MAD", "MADD", NULL },
+ { 1, 2, 0, 0, "SUB", NULL, NULL },
+ { 1, 3, 0, 0, "LRP", "LERP", NULL },
+ { 1, 3, 0, 0, "CND", NULL, NULL },
+ { 1, 3, 0, 0, "CND0", NULL, NULL },
+ { 1, 3, 0, 0, "DP2A", "DP2ADD", "DOT2ADD" },
+ { 1, 2, 0, 0, "INDEX", NULL, NULL },
+ { 1, 1, 0, 0, "NEGATE", NULL, NULL },
+ { 1, 1, 0, 0, "FRC", "FRAC", NULL },
+ { 1, 3, 0, 0, "CLAMP", NULL, NULL },
+ { 1, 1, 0, 0, "FLR", "FLOOR", NULL },
+ { 1, 1, 0, 0, "ROUND", NULL, NULL },
+ { 1, 1, 0, 0, "EX2", "EXPBASE2", NULL },
+ { 1, 1, 0, 0, "LG2", "LOGBASE2", "LOGP" },
+ { 1, 2, 0, 0, "POW", "POWER", NULL },
+ { 1, 2, 0, 0, "XPD", "CRS", "CROSSPRODUCT" },
+ { 1, 2, 0, 0, "M4X4", "MULTIPLYMATRIX", NULL },
+ { 1, 1, 0, 0, "ABS", NULL, NULL },
+ { 1, 1, 0, 0, "RCC", NULL, NULL },
+ { 1, 2, 0, 0, "DPH", NULL, NULL },
+ { 1, 1, 0, 0, "COS", NULL, NULL },
+ { 1, 1, 0, 0, "DDX", "DSX", NULL },
+ { 1, 1, 0, 0, "DDY", "DSY", NULL },
+ { 0, 0, 0, 0, "KILP", NULL, NULL },
+ { 1, 1, 0, 0, "PK2H", NULL, NULL },
+ { 1, 1, 0, 0, "PK2US", NULL, NULL },
+ { 1, 1, 0, 0, "PK4B", NULL, NULL },
+ { 1, 1, 0, 0, "PK4UB", NULL, NULL },
+ { 1, 2, 0, 0, "RFL", NULL, NULL },
+ { 1, 2, 0, 0, "SEQ", NULL, NULL },
+ { 1, 2, 0, 0, "SFL", NULL, NULL },
+ { 1, 2, 0, 0, "SGT", NULL, NULL },
+ { 1, 1, 0, 0, "SIN", NULL, NULL },
+ { 1, 2, 0, 0, "SLE", NULL, NULL },
+ { 1, 2, 0, 0, "SNE", NULL, NULL },
+ { 1, 2, 0, 0, "STR", NULL, NULL },
+ { 1, 2, 1, 0, "TEX", "TEXLD", NULL },
+ { 1, 4, 1, 0, "TXD", "TEXLDD", NULL },
+ { 1, 2, 1, 0, "TXP", NULL, NULL },
+ { 1, 1, 0, 0, "UP2H", NULL, NULL },
+ { 1, 1, 0, 0, "UP2US", NULL, NULL },
+ { 1, 1, 0, 0, "UP4B", NULL, NULL },
+ { 1, 1, 0, 0, "UP4UB", NULL, NULL },
+ { 1, 3, 0, 0, "X2D", NULL, NULL },
+ { 1, 1, 0, 0, "ARA", NULL, NULL },
+ { 1, 1, 0, 0, "ARR", "MOVA", NULL },
+ { 0, 1, 0, 0, "BRA", NULL, NULL },
+ { 0, 0, 0, 1, "CAL", "CALL", NULL },
+ { 0, 0, 0, 0, "RET", NULL, NULL },
+ { 1, 1, 0, 0, "SGN", "SSG", NULL },
+ { 1, 3, 0, 0, "CMP", NULL, NULL },
+ { 1, 1, 0, 0, "SCS", "SINCOS", NULL },
+ { 1, 2, 1, 0, "TXB", "TEXLDB", NULL },
+ { 1, 1, 0, 0, "NRM", NULL, NULL },
+ { 1, 2, 0, 0, "DIV", NULL, NULL },
+ { 1, 2, 0, 0, "DP2", NULL, NULL },
+ { 1, 2, 1, 0, "TXL", NULL, NULL },
+ { 0, 0, 0, 0, "BRK", "BREAK", NULL },
+ { 0, 1, 0, 1, "IF", NULL, NULL },
+ { 0, 0, 0, 0, "LOOP", NULL, NULL },
+ { 0, 1, 0, 0, "REP", NULL, NULL },
+ { 0, 0, 0, 1, "ELSE", NULL, NULL },
+ { 0, 0, 0, 0, "ENDIF", NULL, NULL },
+ { 0, 0, 0, 0, "ENDLOOP", NULL, NULL },
+ { 0, 0, 0, 0, "ENDREP", NULL, NULL },
+ { 0, 1, 0, 0, "PUSHA", NULL, NULL },
+ { 1, 0, 0, 0, "POPA", NULL, NULL },
+ { 1, 1, 0, 0, "CEIL", NULL, NULL },
+ { 1, 1, 0, 0, "I2F", NULL, NULL },
+ { 1, 1, 0, 0, "NOT", NULL, NULL },
+ { 1, 1, 0, 0, "INT", "TRUNC", NULL },
+ { 1, 2, 0, 0, "SHL", NULL, NULL },
+ { 1, 2, 0, 0, "SHR", NULL, NULL },
+ { 1, 2, 0, 0, "AND", NULL, NULL },
+ { 1, 2, 0, 0, "OR", NULL, NULL },
+ { 1, 2, 0, 0, "MOD", NULL, NULL },
+ { 1, 2, 0, 0, "XOR", NULL, NULL },
+ { 1, 3, 0, 0, "SAD", NULL, NULL },
+ { 1, 2, 1, 0, "TXF", NULL, NULL },
+ { 1, 2, 1, 0, "TXQ", NULL, NULL },
+ { 0, 0, 0, 0, "CONT", NULL, NULL },
+ { 0, 0, 0, 0, "EMIT", NULL, NULL },
+ { 0, 0, 0, 0, "ENDPRIM", NULL, NULL },
+ { 0, 0, 0, 1, "BGNLOOP2", NULL, NULL },
+ { 0, 0, 0, 0, "BGNSUB", NULL, NULL },
+ { 0, 0, 0, 1, "ENDLOOP2", NULL, NULL },
+ { 0, 0, 0, 0, "ENDSUB", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE1", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE2", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE3", NULL, NULL },
+ { 1, 1, 0, 0, "NOISE4", NULL, NULL },
+ { 0, 0, 0, 0, "NOP", NULL, NULL },
+ { 1, 2, 0, 0, "M4X3", NULL, NULL },
+ { 1, 2, 0, 0, "M3X4", NULL, NULL },
+ { 1, 2, 0, 0, "M3X3", NULL, NULL },
+ { 1, 2, 0, 0, "M3X2", NULL, NULL },
+ { 1, 1, 0, 0, "NRM4", NULL, NULL },
+ { 0, 1, 0, 0, "CALLNZ", NULL, NULL },
+ { 0, 1, 0, 0, "IFC", NULL, NULL },
+ { 0, 1, 0, 0, "BREAKC", NULL, NULL },
+ { 0, 1, 0, 0, "KIL", "TEXKILL", NULL },
+ { 0, 0, 0, 0, "END", NULL, NULL },
+ { 1, 1, 0, 0, "SWZ", NULL, NULL }
};
const struct tgsi_opcode_info *
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h
index 7230bdaae3..077e25acd7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -41,6 +41,8 @@ struct tgsi_opcode_info
boolean is_tex;
boolean is_branch;
const char *mnemonic;
+ const char *alt_mnemonic1;
+ const char *alt_mnemonic2;
};
const struct tgsi_opcode_info *
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 58fe07c11d..a40fcab212 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -358,9 +358,9 @@ parse_register_dst(
/* Parse source register operand.
* <register_src> ::= <register_file_bracket_index> `]' |
- * <register_file_bracket> <register_dst> `]' |
- * <register_file_bracket> <register_dst> `+' <uint> `]' |
- * <register_file_bracket> <register_dst> `-' <uint> `]'
+ * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `]' |
+ * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `+' <uint> `]' |
+ * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `-' <uint> `]'
*/
static boolean
parse_register_src(
@@ -368,11 +368,13 @@ parse_register_src(
uint *file,
int *index,
uint *ind_file,
- int *ind_index )
+ int *ind_index,
+ uint *ind_comp)
{
const char *cur;
uint uindex;
+ *ind_comp = TGSI_SWIZZLE_X;
if (!parse_register_file_bracket( ctx, file ))
return FALSE;
eat_opt_white( &ctx->cur );
@@ -381,6 +383,32 @@ parse_register_src(
if (!parse_register_dst( ctx, ind_file, ind_index ))
return FALSE;
eat_opt_white( &ctx->cur );
+
+ if (*ctx->cur == '.') {
+ ctx->cur++;
+ eat_opt_white(&ctx->cur);
+
+ switch (uprcase(*ctx->cur)) {
+ case 'X':
+ *ind_comp = TGSI_SWIZZLE_X;
+ break;
+ case 'Y':
+ *ind_comp = TGSI_SWIZZLE_Y;
+ break;
+ case 'Z':
+ *ind_comp = TGSI_SWIZZLE_Z;
+ break;
+ case 'W':
+ *ind_comp = TGSI_SWIZZLE_W;
+ break;
+ default:
+ report_error(ctx, "Expected indirect register swizzle component `x', `y', `z' or `w'");
+ return FALSE;
+ }
+ ctx->cur++;
+ eat_opt_white(&ctx->cur);
+ }
+
if (*ctx->cur == '+' || *ctx->cur == '-') {
boolean negate;
@@ -561,7 +589,9 @@ parse_src_operand(
int index;
uint ind_file;
int ind_index;
+ uint ind_comp;
uint swizzle[4];
+ boolean parsed_ext_negate_paren = FALSE;
boolean parsed_swizzle;
boolean parsed_extswizzle;
@@ -574,10 +604,17 @@ parse_src_operand(
src->SrcRegisterExtMod.Negate = 1;
eat_opt_white( &cur );
ctx->cur = cur;
+ parsed_ext_negate_paren = TRUE;
+ }
+ else if (*cur == '|') {
+ cur++;
+ src->SrcRegisterExtMod.Negate = 1;
+ src->SrcRegisterExtMod.Absolute = 1;
+ eat_opt_white(&cur);
+ ctx->cur = cur;
}
}
-
- if (*ctx->cur == '|') {
+ else if (*ctx->cur == '|') {
ctx->cur++;
eat_opt_white( &ctx->cur );
src->SrcRegisterExtMod.Absolute = 1;
@@ -635,7 +672,7 @@ parse_src_operand(
}
}
- if (!parse_register_src( ctx, &file, &index, &ind_file, &ind_index ))
+ if (!parse_register_src(ctx, &file, &index, &ind_file, &ind_index, &ind_comp))
return FALSE;
src->SrcRegister.File = file;
src->SrcRegister.Index = index;
@@ -643,6 +680,10 @@ parse_src_operand(
src->SrcRegister.Indirect = 1;
src->SrcRegisterInd.File = ind_file;
src->SrcRegisterInd.Index = ind_index;
+ src->SrcRegisterInd.SwizzleX = ind_comp;
+ src->SrcRegisterInd.SwizzleY = ind_comp;
+ src->SrcRegisterInd.SwizzleZ = ind_comp;
+ src->SrcRegisterInd.SwizzleW = ind_comp;
}
/* Parse optional swizzle.
@@ -715,7 +756,7 @@ parse_src_operand(
ctx->cur++;
}
- if (src->SrcRegisterExtMod.Negate) {
+ if (parsed_ext_negate_paren) {
eat_opt_white( &ctx->cur );
if (*ctx->cur != ')') {
report_error( ctx, "Expected `)'" );
@@ -741,6 +782,26 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] =
};
static boolean
+match_inst_mnemonic(const char **pcur,
+ const struct tgsi_opcode_info *info)
+{
+ if (str_match_no_case(pcur, info->mnemonic)) {
+ return TRUE;
+ }
+ if (info->alt_mnemonic1) {
+ if (str_match_no_case(pcur, info->alt_mnemonic1)) {
+ return TRUE;
+ }
+ if (info->alt_mnemonic2) {
+ if (str_match_no_case(pcur, info->alt_mnemonic2)) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+static boolean
parse_instruction(
struct translate_ctx *ctx,
boolean has_label )
@@ -758,7 +819,7 @@ parse_instruction(
const char *cur = ctx->cur;
info = tgsi_get_opcode_info( i );
- if (str_match_no_case( &cur, info->mnemonic )) {
+ if (match_inst_mnemonic(&cur, info)) {
if (str_match_no_case( &cur, "_SATNV" ))
saturate = TGSI_SAT_MINUS_PLUS_ONE;
else if (str_match_no_case( &cur, "_SAT" ))
diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c
index 7678903f75..a9b7253bf4 100644
--- a/src/gallium/auxiliary/translate/translate.c
+++ b/src/gallium/auxiliary/translate/translate.c
@@ -42,6 +42,8 @@ struct translate *translate_create( const struct translate_key *key )
translate = translate_sse2_create( key );
if (translate)
return translate;
+#else
+ (void)translate;
#endif
return translate_generic_create( key );
diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile
index d68bdeadcc..5035e9cc13 100644
--- a/src/gallium/auxiliary/util/Makefile
+++ b/src/gallium/auxiliary/util/Makefile
@@ -5,6 +5,8 @@ LIBNAME = util
C_SOURCES = \
u_debug.c \
+ u_debug_symbol.c \
+ u_debug_stack.c \
u_blit.c \
u_cache.c \
u_draw_quad.c \
diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript
index 0f15c632c3..8317263bb8 100644
--- a/src/gallium/auxiliary/util/SConscript
+++ b/src/gallium/auxiliary/util/SConscript
@@ -10,6 +10,7 @@ util = env.ConvenienceLibrary(
'u_debug_memory.c',
'u_debug_profile.c',
'u_debug_stack.c',
+ 'u_debug_symbol.c',
'u_draw_quad.c',
'u_gen_mipmap.c',
'u_handle_table.c',
diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
new file mode 100644
index 0000000000..7c16b32cf9
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_clear.h
@@ -0,0 +1,60 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/* Authors:
+ * Michel Dänzer
+ */
+
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_pack_color.h"
+
+
+/**
+ * Clear the given buffers to the specified values.
+ * No masking, no scissor (clear entire buffer).
+ */
+static INLINE void
+util_clear(struct pipe_context *pipe,
+ struct pipe_framebuffer_state *framebuffer, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil)
+{
+ if (buffers & PIPE_CLEAR_COLOR) {
+ struct pipe_surface *ps = framebuffer->cbufs[0];
+ unsigned color;
+
+ util_pack_color(rgba, ps->format, &color);
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
+ }
+
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ struct pipe_surface *ps = framebuffer->zsbuf;
+
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
+ util_pack_z_stencil(ps->format, depth, stencil));
+ }
+}
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index f96e27e09f..96a2222f9b 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -169,18 +169,18 @@ void debug_print_blob( const char *name,
#endif
-void _debug_break(void)
+#ifndef debug_break
+void debug_break(void)
{
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
- __asm("int3");
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
- _asm {int 3};
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ DebugBreak();
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
EngDebugBreak();
#else
abort();
#endif
}
+#endif
#ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
@@ -715,78 +715,85 @@ struct bmp_rgb_quad {
uint8_t rgbAlpha;
};
-void
+void
debug_dump_surface_bmp(const char *filename,
struct pipe_surface *surface)
{
+ struct pipe_transfer *transfer;
+ struct pipe_texture *texture = surface->texture;
+ struct pipe_screen *screen = texture->screen;
+
+ transfer = screen->get_tex_transfer(screen, texture, surface->face,
+ surface->level, surface->zslice,
+ PIPE_TRANSFER_READ, 0, 0, surface->width,
+ surface->height);
+
+ debug_dump_transfer_bmp(filename, transfer);
+
+ screen->tex_transfer_destroy(transfer);
+}
+
+void
+debug_dump_transfer_bmp(const char *filename,
+ struct pipe_transfer *transfer)
+{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- struct pipe_texture *texture;
- struct pipe_screen *screen;
struct util_stream *stream;
- struct pipe_transfer *transfer;
struct bmp_file_header bmfh;
struct bmp_info_header bmih;
float *rgba;
unsigned x, y;
- if (!surface)
+ if (!transfer)
goto error1;
- rgba = MALLOC(surface->width*4*sizeof(float));
+ rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float));
if(!rgba)
goto error1;
-
+
bmfh.bfType = 0x4d42;
- bmfh.bfSize = 14 + 40 + surface->height*surface->width*4;
+ bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4;
bmfh.bfReserved1 = 0;
bmfh.bfReserved2 = 0;
bmfh.bfOffBits = 14 + 40;
-
+
bmih.biSize = 40;
- bmih.biWidth = surface->width;
- bmih.biHeight = surface->height;
+ bmih.biWidth = transfer->width;
+ bmih.biHeight = transfer->height;
bmih.biPlanes = 1;
bmih.biBitCount = 32;
bmih.biCompression = 0;
- bmih.biSizeImage = surface->height*surface->width*4;
+ bmih.biSizeImage = transfer->height*transfer->width*4;
bmih.biXPelsPerMeter = 0;
bmih.biYPelsPerMeter = 0;
bmih.biClrUsed = 0;
bmih.biClrImportant = 0;
-
+
stream = util_stream_create(filename, bmfh.bfSize);
if(!stream)
goto error2;
-
+
util_stream_write(stream, &bmfh, 14);
util_stream_write(stream, &bmih, 40);
- texture = surface->texture;
- screen = texture->screen;
-
- transfer = screen->get_tex_transfer(screen, texture, surface->face,
- surface->level, surface->zslice,
- PIPE_TRANSFER_READ, 0, 0, surface->width,
- surface->height);
+ pipe_get_tile_rgba(transfer, 0, 0,
+ transfer->width, transfer->height,
+ rgba);
- y = surface->height;
+ y = transfer->height;
while(y--) {
- pipe_get_tile_rgba(transfer,
- 0, y, surface->width, 1,
- rgba);
- for(x = 0; x < surface->width; ++x)
+ float *ptr = rgba + (transfer->width * y * 4);
+ for(x = 0; x < transfer->width; ++x)
{
struct bmp_rgb_quad pixel;
- pixel.rgbRed = float_to_ubyte(rgba[x*4 + 0]);
- pixel.rgbGreen = float_to_ubyte(rgba[x*4 + 1]);
- pixel.rgbBlue = float_to_ubyte(rgba[x*4 + 2]);
- pixel.rgbAlpha = float_to_ubyte(rgba[x*4 + 3]);
+ pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]);
+ pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]);
+ pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]);
+ pixel.rgbAlpha = 255;
util_stream_write(stream, &pixel, 4);
- }
+ }
}
- screen->tex_transfer_destroy(transfer);
-
util_stream_close(stream);
error2:
FREE(rgba);
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 7c829707b2..8d703e47fc 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -125,19 +125,16 @@ void debug_print_format(const char *msg, unsigned fmt );
#endif
-void _debug_break(void);
-
-
/**
* Hard-coded breakpoint.
*/
#ifdef DEBUG
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
+#if (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) && defined(PIPE_CC_GCC)
#define debug_break() __asm("int3")
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-#define debug_break() do { _asm {int 3} } while(0)
+#elif defined(PIPE_CC_MSVC)
+#define debug_break() __debugbreak()
#else
-#define debug_break() _debug_break()
+void debug_break(void);
#endif
#else /* !DEBUG */
#define debug_break() ((void)0)
@@ -338,6 +335,7 @@ debug_profile_stop(void);
#ifdef DEBUG
struct pipe_surface;
+struct pipe_transfer;
void debug_dump_image(const char *prefix,
unsigned format, unsigned cpp,
unsigned width, unsigned height,
@@ -347,6 +345,8 @@ void debug_dump_surface(const char *prefix,
struct pipe_surface *surface);
void debug_dump_surface_bmp(const char *filename,
struct pipe_surface *surface);
+void debug_dump_transfer_bmp(const char *filename,
+ struct pipe_transfer *transfer);
#else
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
#define debug_dump_surface(prefix, surface) ((void)0)
diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
index 76068a6509..e9891fde8a 100644
--- a/src/gallium/auxiliary/util/u_debug_stack.c
+++ b/src/gallium/auxiliary/util/u_debug_stack.c
@@ -33,6 +33,7 @@
*/
#include "u_debug.h"
+#include "u_debug_symbol.h"
#include "u_debug_stack.h"
@@ -49,7 +50,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
#if defined(PIPE_CC_GCC)
frame_pointer = ((const void **)__builtin_frame_address(1));
-#elif defined(PIPE_CC_MSVC)
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
__asm {
mov frame_pointer, ebp
}
@@ -91,7 +92,7 @@ debug_backtrace_dump(const struct debug_stack_frame *backtrace,
for(i = 0; i < nr_frames; ++i) {
if(!backtrace[i].function)
break;
- debug_printf("\t%p\n", backtrace[i].function);
+ debug_symbol_print(backtrace[i].function);
}
}
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c
new file mode 100644
index 0000000000..811931f81b
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_debug_symbol.c
@@ -0,0 +1,250 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Symbol lookup.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "pipe/p_compiler.h"
+
+#include "u_debug.h"
+#include "u_debug_symbol.h"
+
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+
+#include <windows.h>
+#include <stddef.h>
+#include <imagehlp.h>
+
+/*
+ * TODO: Cleanup code.
+ * TODO: Support x86_64
+ */
+
+static BOOL bSymInitialized = FALSE;
+
+static HMODULE hModule_Imagehlp = NULL;
+
+typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL);
+static PFNSYMINITIALIZE pfnSymInitialize = NULL;
+
+static
+BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymInitialize || (pfnSymInitialize = (PFNSYMINITIALIZE) GetProcAddress(hModule_Imagehlp, "SymInitialize")))
+ )
+ return pfnSymInitialize(hProcess, UserSearchPath, fInvadeProcess);
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMCLEANUP)(HANDLE);
+static PFNSYMCLEANUP pfnSymCleanup = NULL;
+
+static
+BOOL WINAPI j_SymCleanup(HANDLE hProcess)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymCleanup || (pfnSymCleanup = (PFNSYMCLEANUP) GetProcAddress(hModule_Imagehlp, "SymCleanup")))
+ )
+ return pfnSymCleanup(hProcess);
+ else
+ return FALSE;
+}
+
+typedef DWORD (WINAPI *PFNSYMSETOPTIONS)(DWORD);
+static PFNSYMSETOPTIONS pfnSymSetOptions = NULL;
+
+static
+DWORD WINAPI j_SymSetOptions(DWORD SymOptions)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymSetOptions || (pfnSymSetOptions = (PFNSYMSETOPTIONS) GetProcAddress(hModule_Imagehlp, "SymSetOptions")))
+ )
+ return pfnSymSetOptions(SymOptions);
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
+static PFNSYMUNDNAME pfnSymUnDName = NULL;
+
+static
+BOOL WINAPI j_SymUnDName(PIMAGEHLP_SYMBOL Symbol, PSTR UnDecName, DWORD UnDecNameLength)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymUnDName || (pfnSymUnDName = (PFNSYMUNDNAME) GetProcAddress(hModule_Imagehlp, "SymUnDName")))
+ )
+ return pfnSymUnDName(Symbol, UnDecName, UnDecNameLength);
+ else
+ return FALSE;
+}
+
+typedef PFUNCTION_TABLE_ACCESS_ROUTINE PFNSYMFUNCTIONTABLEACCESS;
+static PFNSYMFUNCTIONTABLEACCESS pfnSymFunctionTableAccess = NULL;
+
+static
+PVOID WINAPI j_SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymFunctionTableAccess || (pfnSymFunctionTableAccess = (PFNSYMFUNCTIONTABLEACCESS) GetProcAddress(hModule_Imagehlp, "SymFunctionTableAccess")))
+ )
+ return pfnSymFunctionTableAccess(hProcess, AddrBase);
+ else
+ return NULL;
+}
+
+typedef PGET_MODULE_BASE_ROUTINE PFNSYMGETMODULEBASE;
+static PFNSYMGETMODULEBASE pfnSymGetModuleBase = NULL;
+
+static
+DWORD WINAPI j_SymGetModuleBase(HANDLE hProcess, DWORD dwAddr)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymGetModuleBase || (pfnSymGetModuleBase = (PFNSYMGETMODULEBASE) GetProcAddress(hModule_Imagehlp, "SymGetModuleBase")))
+ )
+ return pfnSymGetModuleBase(hProcess, dwAddr);
+ else
+ return 0;
+}
+
+typedef BOOL (WINAPI *PFNSTACKWALK)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
+static PFNSTACKWALK pfnStackWalk = NULL;
+
+static
+BOOL WINAPI j_StackWalk(
+ DWORD MachineType,
+ HANDLE hProcess,
+ HANDLE hThread,
+ LPSTACKFRAME StackFrame,
+ PVOID ContextRecord,
+ PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
+ PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
+ PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
+ PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
+)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnStackWalk || (pfnStackWalk = (PFNSTACKWALK) GetProcAddress(hModule_Imagehlp, "StackWalk")))
+ )
+ return pfnStackWalk(
+ MachineType,
+ hProcess,
+ hThread,
+ StackFrame,
+ ContextRecord,
+ ReadMemoryRoutine,
+ FunctionTableAccessRoutine,
+ GetModuleBaseRoutine,
+ TranslateAddress
+ );
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_SYMBOL);
+static PFNSYMGETSYMFROMADDR pfnSymGetSymFromAddr = NULL;
+
+static
+BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymGetSymFromAddr || (pfnSymGetSymFromAddr = (PFNSYMGETSYMFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetSymFromAddr")))
+ )
+ return pfnSymGetSymFromAddr(hProcess, Address, Displacement, Symbol);
+ else
+ return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMGETLINEFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_LINE);
+static PFNSYMGETLINEFROMADDR pfnSymGetLineFromAddr = NULL;
+
+static
+BOOL WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
+{
+ if(
+ (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+ (pfnSymGetLineFromAddr || (pfnSymGetLineFromAddr = (PFNSYMGETLINEFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetLineFromAddr")))
+ )
+ return pfnSymGetLineFromAddr(hProcess, dwAddr, pdwDisplacement, Line);
+ else
+ return FALSE;
+}
+
+
+static INLINE boolean
+debug_symbol_print_imagehlp(const void *addr)
+{
+ HANDLE hProcess;
+ BYTE symbolBuffer[1024];
+ PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
+ DWORD dwDisplacement = 0; // Displacement of the input address, relative to the start of the symbol
+
+ hProcess = GetCurrentProcess();
+
+ pSymbol->SizeOfStruct = sizeof(symbolBuffer);
+ pSymbol->MaxNameLength = sizeof(symbolBuffer) - offsetof(IMAGEHLP_SYMBOL, Name);
+
+ if(!bSymInitialized) {
+ j_SymSetOptions(/* SYMOPT_UNDNAME | */ SYMOPT_LOAD_LINES);
+ if(j_SymInitialize(hProcess, NULL, TRUE))
+ bSymInitialized = TRUE;
+ }
+
+ if(!j_SymGetSymFromAddr(hProcess, (DWORD)addr, &dwDisplacement, pSymbol))
+ return FALSE;
+
+ debug_printf("\t%s\n", pSymbol->Name);
+
+ return TRUE;
+
+}
+#endif
+
+
+void
+debug_symbol_print(const void *addr)
+{
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+ if(debug_symbol_print_imagehlp(addr))
+ return;
+#endif
+
+ debug_printf("\t%p\n", addr);
+}
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.h b/src/gallium/auxiliary/util/u_debug_symbol.h
new file mode 100644
index 0000000000..021586987b
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_debug_symbol.h
@@ -0,0 +1,53 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef U_DEBUG_SYMBOL_H_
+#define U_DEBUG_SYMBOL_H_
+
+
+/**
+ * @file
+ * Symbol lookup.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void
+debug_symbol_print(const void *addr);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_DEBUG_SYMBOL_H_ */
diff --git a/src/gallium/auxiliary/util/u_double_list.h b/src/gallium/auxiliary/util/u_double_list.h
index d108d92e52..53bb1342dd 100644
--- a/src/gallium/auxiliary/util/u_double_list.h
+++ b/src/gallium/auxiliary/util/u_double_list.h
@@ -95,5 +95,8 @@ struct list_head
#define LIST_ENTRY(__type, __item, __field) \
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
+#define LIST_IS_EMPTY(__list) \
+ ((__list)->next == (__list))
+
#endif /*_U_DOUBLE_LIST_H_*/
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 1ecde7a912..e5003af01d 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -319,11 +319,33 @@ util_iround(float f)
-#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
+/**
+ * Test if x is NaN or +/- infinity.
+ */
+static INLINE boolean
+util_is_inf_or_nan(float x)
+{
+ union fi tmp;
+ tmp.f = x;
+ return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
+}
+
+
/**
* Find first bit set in word. Least significant bit is 1.
* Return 0 if no bits set.
*/
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+static INLINE
+unsigned long ffs( unsigned long u )
+{
+ unsigned long i;
+ if(_BitScanForward(&i, u))
+ return i + 1;
+ else
+ return 0;
+}
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE
unsigned ffs( unsigned u )
{
@@ -339,9 +361,7 @@ unsigned ffs( unsigned u )
return i;
}
-#endif
-
-#ifdef __MINGW32__
+#elif defined(__MINGW32__)
#define ffs __builtin_ffs
#endif
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index e0e8aa8e9f..eda883b3b9 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -434,12 +434,42 @@ util_pack_z(enum pipe_format format, double z)
if (z == 1.0)
return 0xffffff00;
return ((uint) (z * 0xffffff)) << 8;
+ case PIPE_FORMAT_S8_UNORM:
+ /* this case can get it via util_pack_z_stencil() */
+ return 0;
default:
debug_print_format("gallium: unhandled format in util_pack_z()", format);
assert(0);
return 0;
}
}
+
+
+/**
+ * Pack Z and/or stencil values into a 32-bit value described by format.
+ * Note: it's assumed that z is in [0,1] and s in [0,255]
+ */
+static INLINE uint
+util_pack_z_stencil(enum pipe_format format, double z, uint s)
+{
+ unsigned packed = util_pack_z(format, z);
+
+ switch (format) {
+ case PIPE_FORMAT_S8Z24_UNORM:
+ packed |= s << 24;
+ break;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ packed |= s;
+ break;
+ case PIPE_FORMAT_S8_UNORM:
+ packed |= s;
+ break;
+ default:
+ break;
+ }
+
+ return packed;
+}
/**
diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c
index 0ead45a749..d8f648e5dd 100644
--- a/src/gallium/auxiliary/util/u_stream_stdc.c
+++ b/src/gallium/auxiliary/util/u_stream_stdc.c
@@ -32,7 +32,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS)
#include <stdio.h>
diff --git a/src/gallium/auxiliary/util/u_string.h b/src/gallium/auxiliary/util/u_string.h
index 08c89bbf77..cc7992d739 100644
--- a/src/gallium/auxiliary/util/u_string.h
+++ b/src/gallium/auxiliary/util/u_string.h
@@ -130,7 +130,7 @@ static INLINE char *
util_strstr(const char *haystack, const char *needle)
{
const char *p = haystack;
- int len = strlen(needle);
+ size_t len = strlen(needle);
for (; (p = util_strchr(p, *needle)) != 0; p++) {
if (util_strncmp(p, needle, len) == 0) {
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index d31ca9c029..f0a5a339eb 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -957,6 +957,7 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
case PIPE_FORMAT_Z32_FLOAT:
@@ -1069,6 +1070,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
/*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
/*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
default:
@@ -1198,6 +1200,20 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
}
break;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ {
+ uint *pDest = (uint *) (map + y * pt->stride + x*4);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit Z to 24-bit Z (0 stencil) */
+ pDest[j] = ptrc[j] << 8;
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
case PIPE_FORMAT_Z16_UNORM:
{
ushort *pDest = (ushort *) (map + y * pt->stride + x*2);
diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c
index 357d9360c9..8afe4fccf7 100644
--- a/src/gallium/auxiliary/util/u_time.c
+++ b/src/gallium/auxiliary/util/u_time.c
@@ -35,7 +35,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <sys/time.h>
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
#include <windows.h>
@@ -77,7 +77,7 @@ util_time_get_frequency(void)
void
util_time_get(struct util_time *t)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
gettimeofday(&t->tv, NULL);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
LONGLONG temp;
@@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1,
int64_t usecs,
struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -124,7 +124,7 @@ int64_t
util_time_diff(const struct util_time *t1,
const struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
return (t2->tv.tv_usec - t1->tv.tv_usec) +
(t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -144,7 +144,7 @@ util_time_micros( void )
util_time_get(&t1);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
util_time_get_frequency();
@@ -166,7 +166,7 @@ static INLINE int
util_time_compare(const struct util_time *t1,
const struct util_time *t2)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
if (t1->tv.tv_sec < t2->tv.tv_sec)
return -1;
else if(t1->tv.tv_sec > t2->tv.tv_sec)
diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h
index 4346ce1fa4..6bca6077a2 100644
--- a/src/gallium/auxiliary/util/u_time.h
+++ b/src/gallium/auxiliary/util/u_time.h
@@ -38,7 +38,7 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <time.h> /* timeval */
#include <unistd.h> /* usleep */
#endif
@@ -58,7 +58,7 @@ extern "C" {
*/
struct util_time
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
struct timeval tv;
#else
int64_t counter;
@@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start,
const struct util_time *end,
const struct util_time *curr);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#define util_time_sleep usleep
#else
void