diff options
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 39 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_parse.c | 11 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_parse.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 18 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 |
5 files changed, 61 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index fbb9aa0e63..f7a1bb74a9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -264,6 +264,12 @@ static void micro_rcp(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { +#if 0 /* for debugging */ + assert(src->f[0] != 0.0f); + assert(src->f[1] != 0.0f); + assert(src->f[2] != 0.0f); + assert(src->f[3] != 0.0f); +#endif dst->f[0] = 1.0f / src->f[0]; dst->f[1] = 1.0f / src->f[1]; dst->f[2] = 1.0f / src->f[2]; @@ -284,6 +290,12 @@ static void micro_rsq(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { +#if 0 /* for debugging */ + assert(src->f[0] != 0.0f); + assert(src->f[1] != 0.0f); + assert(src->f[2] != 0.0f); + assert(src->f[3] != 0.0f); +#endif dst->f[0] = 1.0f / sqrtf(fabsf(src->f[0])); dst->f[1] = 1.0f / sqrtf(fabsf(src->f[1])); dst->f[2] = 1.0f / sqrtf(fabsf(src->f[2])); @@ -450,12 +462,20 @@ static const union tgsi_exec_channel ZeroVec = { { 0.0, 0.0, 0.0, 0.0 } }; -#define CHECK_INF_OR_NAN(chan) do {\ - 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]));\ - } while (0) +/** + * Assert that none of the float values in 'chan' are infinite or NaN. + * NaN and Inf may occur normally during program execution and should + * not lead to crashes, etc. But when debugging, it's helpful to catch + * them. + */ +static INLINE 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])); +} #ifdef DEBUG @@ -1219,8 +1239,9 @@ store_dest(struct tgsi_exec_machine *mach, int offset = 0; /* indirection offset */ int index; - if (dst_datatype == TGSI_EXEC_DATA_FLOAT) { - CHECK_INF_OR_NAN(chan); + /* for debugging */ + if (0 && dst_datatype == TGSI_EXEC_DATA_FLOAT) { + check_inf_or_nan(chan); } /* There is an extra source register that indirectly subscripts @@ -1478,7 +1499,7 @@ emit_primitive(struct tgsi_exec_machine *mach) } /* - * Fetch a four texture samples using STR texture coordinates. + * Fetch four texture samples using STR texture coordinates. */ static void fetch_texel( struct tgsi_sampler *sampler, diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index fd37fc3079..7e19e1fe36 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -284,3 +284,14 @@ tgsi_dup_tokens(const struct tgsi_token *tokens) memcpy(new_tokens, tokens, bytes); return new_tokens; } + + +/** + * Allocate memory for num_tokens tokens. + */ +struct tgsi_token * +tgsi_alloc_tokens(unsigned num_tokens) +{ + unsigned bytes = num_tokens * sizeof(struct tgsi_token); + return (struct tgsi_token *) MALLOC(bytes); +} diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 8150e3cd29..b45ccee2f6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -130,6 +130,10 @@ tgsi_num_tokens(const struct tgsi_token *tokens); struct tgsi_token * tgsi_dup_tokens(const struct tgsi_token *tokens); +struct tgsi_token * +tgsi_alloc_tokens(unsigned num_tokens); + + #if defined __cplusplus } #endif diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 60a1cb1af4..27960bac22 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -104,6 +104,8 @@ struct ureg_program struct { unsigned index; + unsigned semantic_name; + unsigned semantic_index; } gs_input[UREG_MAX_INPUT]; unsigned nr_gs_inputs; @@ -326,10 +328,14 @@ ureg_DECL_vs_input( struct ureg_program *ureg, struct ureg_src ureg_DECL_gs_input(struct ureg_program *ureg, - unsigned index) + unsigned index, + unsigned semantic_name, + unsigned semantic_index) { if (ureg->nr_gs_inputs < UREG_MAX_INPUT) { ureg->gs_input[ureg->nr_gs_inputs].index = index; + ureg->gs_input[ureg->nr_gs_inputs].semantic_name = semantic_name; + ureg->gs_input[ureg->nr_gs_inputs].semantic_index = semantic_index; ureg->nr_gs_inputs++; } else { set_bad(ureg); @@ -1252,10 +1258,12 @@ static void emit_decls( struct ureg_program *ureg ) } } else { for (i = 0; i < ureg->nr_gs_inputs; i++) { - emit_decl_range(ureg, - TGSI_FILE_INPUT, - ureg->gs_input[i].index, - 1); + emit_decl(ureg, + TGSI_FILE_INPUT, + ureg->gs_input[i].index, + ureg->gs_input[i].semantic_name, + ureg->gs_input[i].semantic_index, + TGSI_INTERPOLATE_CONSTANT); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6198ca3464..6be66d0694 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -161,7 +161,9 @@ ureg_DECL_vs_input( struct ureg_program *, struct ureg_src ureg_DECL_gs_input(struct ureg_program *, - unsigned index); + unsigned index, + unsigned semantic_name, + unsigned semantic_index); struct ureg_src ureg_DECL_system_value(struct ureg_program *, |