tgsi: add support for new SQRT opcode

This commit is contained in:
Brian Paul 2013-02-01 11:15:43 -07:00
parent d276a40e15
commit ad30e4545b
4 changed files with 18 additions and 1 deletions

View file

@ -342,6 +342,16 @@ micro_rsq(union tgsi_exec_channel *dst,
dst->f[3] = 1.0f / sqrtf(fabsf(src->f[3]));
}
static void
micro_sqrt(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
dst->f[0] = sqrtf(fabsf(src->f[0]));
dst->f[1] = sqrtf(fabsf(src->f[1]));
dst->f[2] = sqrtf(fabsf(src->f[2]));
dst->f[3] = sqrtf(fabsf(src->f[3]));
}
static void
micro_seq(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
@ -3562,6 +3572,10 @@ exec_instruction(
exec_vector_trinary(mach, inst, micro_cnd, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
break;
case TGSI_OPCODE_SQRT:
exec_vector_unary(mach, inst, micro_sqrt, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
break;
case TGSI_OPCODE_DP2A:
exec_dp2a(mach, inst);
break;

View file

@ -441,6 +441,8 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
return 1;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return PIPE_MAX_SAMPLERS;
case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
return 1;
default:
return 0;
}

View file

@ -57,7 +57,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 2, 0, 0, 0, 0, COMP, "SUB", TGSI_OPCODE_SUB },
{ 1, 3, 0, 0, 0, 0, COMP, "LRP", TGSI_OPCODE_LRP },
{ 1, 3, 0, 0, 0, 0, COMP, "CND", TGSI_OPCODE_CND },
{ 0, 0, 0, 0, 0, 0, NONE, "", 20 }, /* removed */
{ 1, 1, 0, 0, 0, 0, REPL, "SQRT", TGSI_OPCODE_SQRT },
{ 1, 3, 0, 0, 0, 0, REPL, "DP2A", TGSI_OPCODE_DP2A },
{ 0, 0, 0, 0, 0, 0, NONE, "", 22 }, /* removed */
{ 0, 0, 0, 0, 0, 0, NONE, "", 23 }, /* removed */

View file

@ -60,6 +60,7 @@ OP13(MAD)
OP12(SUB)
OP13(LRP)
OP13(CND)
OP11(SQRT)
OP13(DP2A)
OP11(FRC)
OP13(CLAMP)