Commit 85806cdf authored by Nikolay Sivov's avatar Nikolay Sivov
Browse files

d3d10/effect: Add support for umin/umax/utof in expressions.

parent 9ccbe536
Loading
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
@@ -275,6 +275,16 @@ static void pres_itof(float **args, unsigned int n, const struct preshader_instr
        retval[i] = *(float *)&arg1[i];
}

static void pres_utof(float **args, unsigned int n, const struct preshader_instr *instr)
{
    unsigned int *arg1 = (unsigned int *)args[0];
    float *retval = args[1];
    unsigned int i;

    for (i = 0; i < instr->comp_count; ++i)
        retval[i] = *(float *)&arg1[i];
}

static void pres_ftou(float **args, unsigned int n, const struct preshader_instr *instr)
{
    float *retval = args[1];
@@ -400,6 +410,20 @@ static void pres_bine(float **args, unsigned int n, const struct preshader_instr
    }
}

static void pres_iadd(float **args, unsigned int n, const struct preshader_instr *instr)
{
    int *arg1 = (int *)args[0];
    int *arg2 = (int *)args[1];
    float *retval = args[2];
    unsigned int i;

    for (i = 0; i < instr->comp_count; ++i)
    {
        int v = arg1[instr->scalar ? 0 : i] + arg2[i];
        retval[i] = *(float *)&v;
    }
}

static void pres_udiv(float **args, unsigned int n, const struct preshader_instr *instr)
{
    unsigned int *arg1 = (unsigned int *)args[0];
@@ -427,6 +451,32 @@ static void pres_imax(float **args, unsigned int n, const struct preshader_instr
    }
}

static void pres_umin(float **args, unsigned int n, const struct preshader_instr *instr)
{
    unsigned int *arg1 = (unsigned int *)args[0], *arg2 = (unsigned int *)args[1];
    float *retval = args[2];
    unsigned int i;

    for (i = 0; i < instr->comp_count; ++i)
    {
        unsigned int v = min(arg1[instr->scalar ? 0 : i], arg2[i]);
        retval[i] = *(float *)&v;
    }
}

static void pres_umax(float **args, unsigned int n, const struct preshader_instr *instr)
{
    unsigned int *arg1 = (unsigned int *)args[0], *arg2 = (unsigned int *)args[1];
    float *retval = args[2];
    unsigned int i;

    for (i = 0; i < instr->comp_count; ++i)
    {
        unsigned int v = max(arg1[instr->scalar ? 0 : i], arg2[i]);
        retval[i] = *(float *)&v;
    }
}

static void pres_and(float **args, unsigned int n, const struct preshader_instr *instr)
{
    unsigned int *arg1 = (unsigned int *)args[0];
@@ -481,6 +531,7 @@ static const struct preshader_op_info preshader_ops[] =
    { 0x109, "cos",  pres_cos  },
    { 0x120, "ineg", pres_ineg },
    { 0x130, "itof", pres_itof },
    { 0x131, "utof", pres_utof },
    { 0x133, "ftou", pres_ftou },
    { 0x137, "ftob", pres_ftob },
    { 0x200, "min",  pres_min  },
@@ -492,8 +543,11 @@ static const struct preshader_op_info preshader_ops[] =
    { 0x211, "bige", pres_bige },
    { 0x212, "bieq", pres_bieq },
    { 0x213, "bine", pres_bine },
    { 0x216, "iadd", pres_iadd },
    { 0x21a, "udiv", pres_udiv },
    { 0x21e, "imax", pres_imax },
    { 0x21f, "umin", pres_umin },
    { 0x220, "umax", pres_umax },
    { 0x230, "and",  pres_and  },
    { 0x233, "xor",  pres_xor  },
    { 0x301, "movc", pres_movc },
+198 −178

File changed.

Preview size limit exceeded, changes collapsed.