On Thu, Jun 9, 2016 at 2:41 PM, Marek Olšák <mar...@gmail.com> wrote: > On Thu, Jun 9, 2016 at 4:43 PM, Brian Paul <bri...@vmware.com> wrote: >> On 06/08/2016 06:48 PM, Dave Airlie wrote: >>> >>> From: Dave Airlie <airl...@redhat.com> >>> >>> This adds support to TGSI for 64-bit integer immediates. >>> >>> Signed-off-by: Dave Airlie <airl...@redhat.com> >>> --- >>> src/gallium/auxiliary/tgsi/tgsi_dump.c | 14 ++ >>> src/gallium/auxiliary/tgsi/tgsi_exec.c | 244 >>> ++++++++++++++++++++++++++++- >>> src/gallium/auxiliary/tgsi/tgsi_parse.c | 2 + >>> src/gallium/auxiliary/tgsi/tgsi_text.c | 44 ++++++ >>> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 45 +++++- >>> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 ++ >>> src/gallium/include/pipe/p_shader_tokens.h | 2 + >>> 7 files changed, 358 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> b/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> index d59b7ff..614bcb2 100644 >>> --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> @@ -254,6 +254,20 @@ dump_imm_data(struct tgsi_iterate_context *iter, >>> i++; >>> break; >>> } >>> + case TGSI_IMM_INT64: { >>> + union di d; >>> + d.i = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >>> + UID( d.i ); >>> + i++; >>> + break; >>> + } >>> + case TGSI_IMM_UINT64: { >>> + union di d; >>> + d.ui = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >>> + UID( d.ui ); >>> + i++; >>> + break; >>> + } >>> case TGSI_IMM_FLOAT32: >>> if (ctx->dump_float_as_hex) >>> HFLT( data[i].Float ); >>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> b/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> index 1457c06..c929475 100644 >>> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> @@ -77,6 +77,8 @@ >>> union tgsi_double_channel { >>> double d[TGSI_QUAD_SIZE]; >>> unsigned u[TGSI_QUAD_SIZE][2]; >>> + uint64_t u64[TGSI_QUAD_SIZE]; >>> + int64_t i64[TGSI_QUAD_SIZE]; >>> }; >>> >>> struct tgsi_double_vector { >>> @@ -692,11 +694,251 @@ micro_u2d(union tgsi_double_channel *dst, >>> dst->d[3] = (double)src->u[3]; >>> } >>> >>> +static void >>> +micro_i64abs(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->i64[0] = src->i64[0] >= 0.0 ? src->i64[0] : -src->i64[0]; >>> + dst->i64[1] = src->i64[1] >= 0.0 ? src->i64[1] : -src->i64[1]; >>> + dst->i64[2] = src->i64[2] >= 0.0 ? src->i64[2] : -src->i64[2]; >>> + dst->i64[3] = src->i64[3] >= 0.0 ? src->i64[3] : -src->i64[3]; >>> +} >>> + >>> +static void >>> +micro_i64sgn(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->i64[0] = src->i64[0] < 0 ? -1 : src->i64[0] > 0 ? 1 : 0; >>> + dst->i64[1] = src->i64[1] < 0 ? -1 : src->i64[1] > 0 ? 1 : 0; >>> + dst->i64[2] = src->i64[2] < 0 ? -1 : src->i64[2] > 0 ? 1 : 0; >>> + dst->i64[3] = src->i64[3] < 0 ? -1 : src->i64[3] > 0 ? 1 : 0; >>> +} >>> + >>> +static void >>> +micro_i64neg(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->i64[0] = -src->i64[0]; >>> + dst->i64[1] = -src->i64[1]; >>> + dst->i64[2] = -src->i64[2]; >>> + dst->i64[3] = -src->i64[3]; >>> +} >>> + >>> +static void >>> +micro_u64seq(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->u[0][0] = src[0].u64[0] == src[1].u64[0] ? ~0U : 0U; >>> + dst->u[1][0] = src[0].u64[1] == src[1].u64[1] ? ~0U : 0U; >>> + dst->u[2][0] = src[0].u64[2] == src[1].u64[2] ? ~0U : 0U; >>> + dst->u[3][0] = src[0].u64[3] == src[1].u64[3] ? ~0U : 0U; >>> +} >> >> >> I haven't been following the 'double' work so dumb questions/comments: >> >> First, could you document the new opcodes in gallium/docs/source/tgsi.rst? >> >> In the case of micro_u64seq(), etc. why doesn't it do >> >> dst->u64[0] = src[0].u64[0] == src[1].u64[0] ? ~0UL : 0U; > > Did you mean ULL? UL is 32 bits on a 32-bit arch.
I think that all the comparisons have to return a boolean, which in TGSI is a 32-bit 0/~0. Otherwise I suspect there's going to be a ton of bugs from doing like "int(64bitint == 5)". -ilia _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev