summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/tgsi')
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c2
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c48
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h12
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_info.c4
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c50
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c6
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.h2
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_util.c1
8 files changed, 26 insertions, 99 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c
index 73d1eb26a..5ec2605aa 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -26,7 +26,7 @@
**************************************************************************/
#include "util/u_debug.h"
-#include "pipe/p_format.h"
+#include "util/format/u_formats.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi_build.h"
#include "tgsi_parse.h"
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 5e440353e..abafc6dc0 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -73,18 +73,27 @@
#define TILE_BOTTOM_LEFT 2
#define TILE_BOTTOM_RIGHT 3
+static_assert(alignof(union tgsi_exec_channel) == 16, "");
+static_assert(alignof(struct tgsi_exec_vector) == 16, "");
+static_assert(alignof(struct tgsi_exec_machine) == 16, "");
+
union tgsi_double_channel {
+ alignas(16)
double d[TGSI_QUAD_SIZE];
unsigned u[TGSI_QUAD_SIZE][2];
uint64_t u64[TGSI_QUAD_SIZE];
int64_t i64[TGSI_QUAD_SIZE];
-} ALIGN16;
+};
-struct ALIGN16 tgsi_double_vector {
+struct tgsi_double_vector {
+ alignas(16)
union tgsi_double_channel xy;
union tgsi_double_channel zw;
};
+static_assert(alignof(union tgsi_double_channel) == 16, "");
+static_assert(alignof(struct tgsi_double_vector) == 16, "");
+
static void
micro_abs(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
@@ -399,17 +408,6 @@ micro_dldexp(union tgsi_double_channel *dst,
}
static void
-micro_dfracexp(union tgsi_double_channel *dst,
- union tgsi_exec_channel *dst_exp,
- const union tgsi_double_channel *src)
-{
- dst->d[0] = frexp(src->d[0], &dst_exp->i[0]);
- dst->d[1] = frexp(src->d[1], &dst_exp->i[1]);
- dst->d[2] = frexp(src->d[2], &dst_exp->i[2]);
- dst->d[3] = frexp(src->d[3], &dst_exp->i[3]);
-}
-
-static void
micro_exp2(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
@@ -3559,26 +3557,6 @@ exec_dldexp(struct tgsi_exec_machine *mach,
}
static void
-exec_dfracexp(struct tgsi_exec_machine *mach,
- const struct tgsi_full_instruction *inst)
-{
- union tgsi_double_channel src;
- union tgsi_double_channel dst;
- union tgsi_exec_channel dst_exp;
-
- fetch_double_channel(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_CHAN_Y);
- micro_dfracexp(&dst, &dst_exp, &src);
- if ((inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_XY) == TGSI_WRITEMASK_XY)
- store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_X, TGSI_CHAN_Y);
- if ((inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_ZW) == TGSI_WRITEMASK_ZW)
- store_double_channel(mach, &dst, &inst->Dst[0], inst, TGSI_CHAN_Z, TGSI_CHAN_W);
- for (unsigned chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
- if (inst->Dst[1].Register.WriteMask & (1 << chan))
- store_dest(mach, &dst_exp, &inst->Dst[1], inst, chan);
- }
-}
-
-static void
exec_arg0_64_arg1_32(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst,
micro_dop_sop op)
@@ -5795,10 +5773,6 @@ exec_instruction(
exec_dldexp(mach, inst);
break;
- case TGSI_OPCODE_DFRACEXP:
- exec_dfracexp(mach, inst);
- break;
-
case TGSI_OPCODE_I2D:
exec_t_2_64(mach, inst, micro_i2d, TGSI_EXEC_DATA_FLOAT);
break;
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 80acf6359..6e13618fb 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -73,17 +73,18 @@ extern "C" {
*/
union tgsi_exec_channel
{
+ alignas(16)
float f[TGSI_QUAD_SIZE];
int i[TGSI_QUAD_SIZE];
unsigned u[TGSI_QUAD_SIZE];
-} ALIGN16;
+};
/**
* A vector[RGBA] of channels[4 pixels]
*/
-struct ALIGN16 tgsi_exec_vector
+struct tgsi_exec_vector
{
- union tgsi_exec_channel xyzw[TGSI_NUM_CHANNELS];
+ alignas(16) union tgsi_exec_channel xyzw[TGSI_NUM_CHANNELS];
};
/**
@@ -286,10 +287,11 @@ typedef void (* apply_sample_offset_func)(
/**
* Run-time virtual machine state for executing TGSI shader.
*/
-struct ALIGN16 tgsi_exec_machine
+struct tgsi_exec_machine
{
/* Total = program temporaries + internal temporaries
*/
+ alignas(16)
struct tgsi_exec_vector Temps[TGSI_EXEC_NUM_TEMPS];
unsigned ImmsReserved;
@@ -480,8 +482,6 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
return 1 << PIPE_SHADER_IR_TGSI;
case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
return 1;
- case PIPE_SHADER_CAP_DFRACEXP_DLDEXP_SUPPORTED:
- case PIPE_SHADER_CAP_LDEXP_SUPPORTED:
case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
return 1;
case PIPE_SHADER_CAP_DROUND_SUPPORTED:
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_info.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_info.c
index 477876d7e..8b926baf7 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -201,7 +201,6 @@ tgsi_opcode_infer_type(enum tgsi_opcode opcode)
case TGSI_OPCODE_DSQRT:
case TGSI_OPCODE_DMAD:
case TGSI_OPCODE_DLDEXP:
- case TGSI_OPCODE_DFRACEXP:
case TGSI_OPCODE_DFRAC:
case TGSI_OPCODE_DRSQ:
case TGSI_OPCODE_DTRUNC:
@@ -335,8 +334,5 @@ tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx)
enum tgsi_opcode_type
tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx)
{
- if (dst_idx == 1 && opcode == TGSI_OPCODE_DFRACEXP)
- return TGSI_TYPE_SIGNED;
-
return tgsi_opcode_infer_type(opcode);
}
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c
index 7802f1049..29e337278 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -30,6 +30,7 @@
#include "util/u_prim.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
+#include "util/strtod.h"
#include "tgsi_text.h"
#include "tgsi_build.h"
#include "tgsi_info.h"
@@ -231,52 +232,9 @@ static boolean parse_identifier( const char **pcur, char *ret, size_t len )
static boolean parse_float( const char **pcur, float *val )
{
const char *cur = *pcur;
- boolean integral_part = FALSE;
- boolean fractional_part = FALSE;
-
- if (*cur == '0' && *(cur + 1) == 'x') {
- union fi fi;
- fi.ui = strtoul(cur, NULL, 16);
- *val = fi.f;
- cur += 10;
- goto out;
- }
-
- *val = (float) atof( cur );
- if (*cur == '-' || *cur == '+')
- cur++;
- if (is_digit( cur )) {
- cur++;
- integral_part = TRUE;
- while (is_digit( cur ))
- cur++;
- }
- if (*cur == '.') {
- cur++;
- if (is_digit( cur )) {
- cur++;
- fractional_part = TRUE;
- while (is_digit( cur ))
- cur++;
- }
- }
- if (!integral_part && !fractional_part)
+ *val = _mesa_strtof(cur, (char**)pcur);
+ if (*pcur == cur)
return FALSE;
- if (uprcase( *cur ) == 'E') {
- cur++;
- if (*cur == '-' || *cur == '+')
- cur++;
- if (is_digit( cur )) {
- cur++;
- while (is_digit( cur ))
- cur++;
- }
- else
- return FALSE;
- }
-
-out:
- *pcur = cur;
return TRUE;
}
@@ -288,7 +246,7 @@ static boolean parse_double( const char **pcur, uint32_t *val0, uint32_t *val1)
uint32_t uval[2];
} v;
- v.dval = strtod(cur, (char**)pcur);
+ v.dval = _mesa_strtod(cur, (char**)pcur);
if (*pcur == cur)
return FALSE;
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 398d59b95..b4cfae0e6 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -35,13 +35,13 @@
#include "tgsi/tgsi_info.h"
#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_sanity.h"
+#include "util/glheader.h"
#include "util/u_debug.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_prim.h"
#include "util/u_bitmask.h"
-#include "GL/gl.h"
#include "compiler/shader_info.h"
union tgsi_any_token {
@@ -2131,7 +2131,7 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
if (ureg->domain[0].tokens == error_tokens ||
ureg->domain[1].tokens == error_tokens) {
- debug_printf("%s: error in generated shader\n", __FUNCTION__);
+ debug_printf("%s: error in generated shader\n", __func__);
assert(0);
return NULL;
}
@@ -2139,7 +2139,7 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
if (0) {
- debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
+ debug_printf("%s: emitted shader %d tokens:\n", __func__,
ureg->domain[DOMAIN_DECL].count);
tgsi_dump( tokens, 0 );
}
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 59041e94d..5c4efbe8c 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -29,7 +29,7 @@
#define TGSI_UREG_H
#include "pipe/p_defines.h"
-#include "pipe/p_format.h"
+#include "util/format/u_formats.h"
#include "pipe/p_compiler.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_debug.h"
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_util.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_util.c
index a101cce24..d879d2e26 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -146,7 +146,6 @@ tgsi_util_get_src_usage_mask(enum tgsi_opcode opcode,
case TGSI_OPCODE_DP2:
case TGSI_OPCODE_PK2H:
case TGSI_OPCODE_PK2US:
- case TGSI_OPCODE_DFRACEXP:
case TGSI_OPCODE_F2D:
case TGSI_OPCODE_I2D:
case TGSI_OPCODE_U2D: