亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? constfold.c

?? cg編譯器
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/****************************************************************************\
Copyright (c) 2002, NVIDIA Corporation.

NVIDIA Corporation("NVIDIA") supplies this software to you in
consideration of your agreement to the following terms, and your use,
installation, modification or redistribution of this NVIDIA software
constitutes acceptance of these terms.  If you do not agree with these
terms, please do not use, install, modify or redistribute this NVIDIA
software.

In consideration of your agreement to abide by the following terms, and
subject to these terms, NVIDIA grants you a personal, non-exclusive
license, under NVIDIA's copyrights in this original NVIDIA software (the
"NVIDIA Software"), to use, reproduce, modify and redistribute the
NVIDIA Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the NVIDIA Software, you must
retain the copyright notice of NVIDIA, this notice and the following
text and disclaimers in all such redistributions of the NVIDIA Software.
Neither the name, trademarks, service marks nor logos of NVIDIA
Corporation may be used to endorse or promote products derived from the
NVIDIA Software without specific prior written permission from NVIDIA.
Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder. 

THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
PRODUCTS.

IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\****************************************************************************/

//
// constfold.c
//

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
//#include <string.h>

#include "slglobals.h"

#if 0
#define DB(X)   X
#else
#define DB(X)
#endif

// IsConstant(expr *)
// return true iff the argument is a constant
static int IsConstant(expr *fexpr)
{
    return fexpr && fexpr->common.kind == CONST_N;
} // IsConstant

// IsConstList(expr *)
// return true iff the argument is a constant or a list of constants
static int IsConstList(expr *fexpr)
{
    while (fexpr &&
           fexpr->common.kind == BINARY_N &&
           fexpr->bin.op == EXPR_LIST_OP
    ) {
        if (!IsConstant(fexpr->bin.left)) return 0;
        if (!(fexpr = fexpr->bin.right)) return 1;
    }
    return fexpr && fexpr->common.kind == CONST_N;
} // IsConstList

// NewConst
// create a new blank constant node we can fill in
// This is a bit of a hack, as the opcode field is really redundant with
// the type info in the node, so we just create an opcode that's as close
// as possible to what we want -- which sometimes may not exist (vectors
// other than float
static expr *NewConst(int base, int len)
{
    float       tmp[4] = { 0, 0, 0, 0 };
    opcode      op = FCONST_OP;

    // This is a bit of a hack -- we use NewFConstNodeV to allocate a node
    // even for non-FCONST_V nodes.  It turns out that it works out ok.
    if (runtime_ops[base]) op = runtime_ops[base]->const_opcode;
    if (len) op++;
    return (expr *)NewFConstNodeV(op, tmp, len, base);
}

// GetConstVal
// get the actual value from a constant node
static scalar_constant *GetConstVal(expr *constexpr) {
    if (!constexpr || constexpr->common.kind != CONST_N) return 0;
    return constexpr->co.val;
} // GetConstVal

typedef struct constlist_iter {
    expr        *curr, *rest;
    int         i, lim;
} constlist_iter;

static void InitConstList_iter(constlist_iter *iter, expr *fexpr)
{
    iter->curr = 0;
    iter->rest = fexpr;
    iter->i = iter->lim = 0;
} // InitConstList_iter

static scalar_constant *ConstListNext(constlist_iter *iter) {
    if (iter->i >= iter->lim) {
        do {
            if (!iter->rest) return 0;
            if (iter->rest->common.kind == BINARY_N &&
                iter->rest->bin.op == EXPR_LIST_OP
            ) {
                iter->curr = iter->rest->bin.left;
                iter->rest = iter->rest->bin.right;
            } else if (iter->rest->common.kind == CONST_N) {
                iter->curr = iter->rest;
                iter->rest = 0;
            } else {
                iter->rest = 0;
                return 0;
            }
        } while (!iter->curr || iter->curr->common.kind != CONST_N);
        iter->i = 0;
        iter->lim = SUBOP_GET_S(iter->curr->co.subop);
    }
    return &iter->curr->co.val[iter->i++];
} // ConstListNext

DB(
static void pconst(scalar_constant *v, int type) {
    switch(type) {
    case TYPE_BASE_BOOLEAN:
        printf("%c", v->i ? 'T' : 'F');
        break;
    case TYPE_BASE_INT:
    case TYPE_BASE_CINT:
        printf("%d", v->i);
        break;
    default:
        printf("%g", v->f);
        break;
    }
}

static void DumpConstList(expr *fexpr, int type) {
    constlist_iter      iter;
    int                 first = 1;
    scalar_constant     *v;

    InitConstList_iter(&iter, fexpr);
    printf("(");
    while ((v = ConstListNext(&iter))) {
        if (first) first = 0;
        else printf(", ");
        pconst(v, type);
    }
    printf(")");
}
)

/*
 * FoldConstants() - Fold this expression if possible.
 *
 */

expr *FoldConstants(expr *fexpr)
{
    return PostApplyToNodes(ConstantFoldNode, fexpr, 0, 0);
}


// ConstantFoldNode
// all the real work is done here
expr *ConstantFoldNode(expr *fexpr, void *_arg1, int arg2)
{
    expr *rv = fexpr;
    int base, target;
    int len;
    int i;
    scalar_constant *a1, *a2;
    void (*unfn)(scalar_constant *, const scalar_constant *) = 0;
    void (*binfn)(scalar_constant *, const scalar_constant *, const scalar_constant *) = 0;
    void (*shfn)(scalar_constant *, const scalar_constant *, int) = 0;
    int (*cmpfn)(const scalar_constant *, const scalar_constant *) = 0;
    int op_offset, a1_mask, a2_mask;
    if (!fexpr) return fexpr;
    switch(fexpr->common.kind) {
    case UNARY_N:
        base = SUBOP_GET_T(fexpr->un.subop);
        len = SUBOP_GET_S(fexpr->un.subop);
        if (fexpr->un.op == VECTOR_V_OP && IsConstList(fexpr->un.arg)) {
            constlist_iter      iter;
            DB (printf("fold VECTOR_V_OP[%d:%d]", len, base);
                DumpConstList(fexpr->un.arg, base);
                printf(" -> ");)
            InitConstList_iter(&iter, fexpr->un.arg);
            rv = NewConst(base, len);
            for (i=0; i<len; i++) {
                rv->co.val[i] = *ConstListNext(&iter);
                DB (if (i) printf(", ");
                    pconst(&rv->co.val[i], base);)
            }
            DB(printf("\n");)
            return rv;
        }
        if (!IsConstant(fexpr->un.arg)) break;
        if (!runtime_ops[base]) break;
        a1 = GetConstVal(fexpr->un.arg);
        switch (fexpr->un.op) {
        case SWIZZLE_Z_OP: {
            int mask = SUBOP_GET_MASK(fexpr->un.subop);
            len = SUBOP_GET_S2(fexpr->un.subop);
            DB (printf("fold SWIZ[%d:%d].", len, base);
                for (i=0; i<len; i++)
                    putchar("xyzw"[(mask>>(i*2))&3]);
                DumpConstList(fexpr->un.arg, base);
                printf(" -> ");)
            rv = NewConst(base, len);
            for (i=0; i==0 || i<len; i++) {
                rv->co.val[i] = a1[mask&3];
                mask >>= 2;
                DB (if (i) printf(", ");
                    pconst(&rv->co.val[i], base);)
            }
            DB(printf("\n");)
            break; }
        case SWIZMAT_Z_OP:
            break;
        case CAST_CS_OP:
        case CAST_CV_OP:
            target = SUBOP_GET_T2(fexpr->un.subop);
            DB (printf("fold CAST[%d:%d->%d]", len, base, target);
                DumpConstList(fexpr->un.arg, base);
                printf(" -> ");)
            unfn = runtime_ops[base]->cvtTo[target];
            if (!unfn && runtime_ops[target])
                unfn = runtime_ops[target]->cvtFrom[base];
            base = target;
            goto normal_unop;
        case CAST_CM_OP:
            break;
        case NEG_OP:
        case NEG_V_OP:
            DB (printf("fold NEG[%d:%d]", len, base);
                DumpConstList(fexpr->un.arg, base);
                printf(" -> ");)
            unfn = runtime_ops[base]->op_neg;
        normal_unop:
            if (!unfn) {
                DB(printf("no function, abort\n");)
                break;
            }
            rv = NewConst(base, len);
            for (i=0; i==0 || i<len; i++) {
                unfn(&rv->co.val[i], &a1[i]);
                DB (if (i) printf(", ");
                    pconst(&rv->co.val[i], base);)
            }
            DB(printf("\n");)
            break;
        case POS_OP:
        case POS_V_OP:
            rv = fexpr->un.arg;
            break;
        case NOT_OP:
        case NOT_V_OP:
            DB (printf("fold NOT[%d:%d]", len, base);
                DumpConstList(fexpr->un.arg, base);
                printf(" -> ");)
            unfn = runtime_ops[base]->op_not;
            goto normal_unop;
        case BNOT_OP:
        case BNOT_V_OP:
            DB (printf("fold BNOT[%d:%d]", len, base);
                DumpConstList(fexpr->un.arg, base);
                printf(" -> ");)
            unfn = runtime_ops[base]->op_bnot;
            goto normal_unop;
            break;
        default:
            break;
        }
        break;
    case BINARY_N:
        if (!IsConstant(fexpr->bin.left) ||
            !IsConstant(fexpr->bin.right)
        )
            break;
        base = SUBOP_GET_T(fexpr->bin.subop);
        if (!runtime_ops[base]) break;
        len = SUBOP_GET_S(fexpr->bin.subop);
        a1 = GetConstVal(fexpr->bin.left);
        a2 = GetConstVal(fexpr->bin.right);
        switch(fexpr->bin.op) {
        case MEMBER_SELECTOR_OP:
        case ARRAY_INDEX_OP:
        case FUN_CALL_OP:
        case FUN_BUILTIN_OP:
        case FUN_ARG_OP:
        case EXPR_LIST_OP:
            break;
        case MUL_OP:
        case MUL_V_OP:
        case MUL_SV_OP:
        case MUL_VS_OP:
            DB (printf("fold MUL");)
            binfn = runtime_ops[base]->op_mul;
            op_offset = fexpr->bin.op - MUL_OP;
        normal_binop:
            DB (printf("[%d:%d]", len, base);
                DumpConstList(fexpr->bin.left, base);
                DumpConstList(fexpr->bin.right, base);
                printf(" -> ");)
            if (!binfn) {
                DB(printf("no function, abort\n");)
                break;
            }
            rv = NewConst(base, len);
            // set a1_mask to all 0s or all 1s, depending on whether a1
            // (left arg) is scalar (all 0s) or vector (all 1s).  a2_mask
            // is set according to a2.  This is dependent on the ordering
            // of the OFFSET_ tags in supprt.h
            a1_mask = 0 - (op_offset&1);
            a2_mask = 0 - (((op_offset>>1)^op_offset)&1);
            for (i=0; i==0 || i<len; i++) {
                binfn(&rv->co.val[i], &a1[i & a1_mask], &a2[i & a2_mask]);
                DB (if (i) printf(", ");
                    pconst(&rv->co.val[i], base);)
            }
            DB(printf("\n");)
            break;
        case DIV_OP:
        case DIV_V_OP:
        case DIV_SV_OP:
        case DIV_VS_OP:
            DB (printf("fold DIV");)
            binfn = runtime_ops[base]->op_div;
            op_offset = fexpr->bin.op - DIV_OP;
            goto normal_binop;
        case MOD_OP:
        case MOD_V_OP:
        case MOD_SV_OP:
        case MOD_VS_OP:
            DB (printf("fold MOD");)
            binfn = runtime_ops[base]->op_mod;
            op_offset = fexpr->bin.op - MOD_OP;
            goto normal_binop;
        case ADD_OP:
        case ADD_V_OP:
        case ADD_SV_OP:
        case ADD_VS_OP:
            DB (printf("fold ADD");)
            binfn = runtime_ops[base]->op_add;
            op_offset = fexpr->bin.op - ADD_OP;
            goto normal_binop;
        case SUB_OP:
        case SUB_V_OP:
        case SUB_SV_OP:
        case SUB_VS_OP:
            DB (printf("fold SUB");)
            binfn = runtime_ops[base]->op_sub;
            op_offset = fexpr->bin.op - SUB_OP;
            goto normal_binop;
        case SHL_OP:
        case SHL_V_OP:
            DB (printf("fold SHL");)
            shfn = runtime_ops[base]->op_shl;
        normal_shiftop:
            DB (printf("[%d:%d]", len, base);
                DumpConstList(fexpr->bin.left, base);
                DumpConstList(fexpr->bin.right, TYPE_BASE_CINT);
                printf(" -> ");)
            if (!shfn) {
                DB(printf("no function, abort\n");)
                break;
            }
            rv = NewConst(base, len);
            for (i=0; i==0 || i<len; i++) {
                shfn(&rv->co.val[i], &a1[i], a2->i);
                DB (if (i) printf(", ");
                    pconst(&rv->co.val[i], base);)
            }
            DB(printf("\n");)
            break;
        case SHR_OP:
        case SHR_V_OP:
            DB (printf("fold SHR");)
            shfn = runtime_ops[base]->op_shr;
            goto normal_shiftop;
        case LT_OP:
        case LT_V_OP:
        case LT_SV_OP:
        case LT_VS_OP:
            DB (printf("fold LT");)
            cmpfn = runtime_ops[base]->op_lt;
            op_offset = fexpr->bin.op - LT_OP;
        normal_cmpop:
            DB (printf("[%d:%d]", len, base);
                DumpConstList(fexpr->bin.left, base);
                DumpConstList(fexpr->bin.right, TYPE_BASE_CINT);
                printf(" -> ");)
            if (!cmpfn) {
                DB(printf("no function, abort\n");)
                break;
            }
            rv = NewConst(TYPE_BASE_BOOLEAN, len);
            // set a1_mask to all 0s or all 1s, depending on whether a1
            // (left arg) is scalar (all 0s) or vector (all 1s).  a2_mask
            // is set according to a2.  This is dependent on the ordering
            // of the OFFSET_ tags in supprt.h
            a1_mask = 0 - (op_offset&1);
            a2_mask = 0 - (((op_offset>>1)^op_offset)&1);
            for (i=0; i==0 || i<len; i++) {
                rv->co.val[i].i = cmpfn(&a1[i & a1_mask], &a2[i & a2_mask]);
                DB (if (i) printf(", ");
                    pconst(&rv->co.val[i], TYPE_BASE_BOOLEAN);)
            }
            DB(printf("\n");)
            break;
        case GT_OP:
        case GT_V_OP:
        case GT_SV_OP:
        case GT_VS_OP:
            cmpfn = runtime_ops[base]->op_gt;
            op_offset = fexpr->bin.op - GT_OP;
            goto normal_cmpop;
        case LE_OP:
        case LE_V_OP:
        case LE_SV_OP:
        case LE_VS_OP:
            cmpfn = runtime_ops[base]->op_le;
            op_offset = fexpr->bin.op - LE_OP;
            goto normal_cmpop;
        case GE_OP:
        case GE_V_OP:
        case GE_SV_OP:

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄页毛片网站| 美女一区二区久久| 日韩国产欧美在线视频| 国产乱码一区二区三区| 99久久免费精品| 91精品国产全国免费观看| 久久久久久久久久久电影| 亚洲欧美成人一区二区三区| 首页亚洲欧美制服丝腿| 国产福利91精品一区| 欧美在线综合视频| 久久影院电视剧免费观看| 亚洲精品欧美激情| 国精产品一区一区三区mba桃花| 99久久久国产精品免费蜜臀| 制服丝袜激情欧洲亚洲| 国产调教视频一区| 亚洲成人中文在线| 国产91露脸合集magnet| 欧美日韩1区2区| 日本一区二区久久| 日韩高清不卡一区二区| 波多野结衣中文一区| 日韩欧美中文字幕制服| 亚洲精品日韩一| 国产东北露脸精品视频| 3d动漫精品啪啪1区2区免费 | 日精品一区二区| 国产91色综合久久免费分享| 91精品国产欧美一区二区18| 成人欧美一区二区三区黑人麻豆| 日韩av中文字幕一区二区三区| 成人网男人的天堂| 3751色影院一区二区三区| 亚洲三级在线看| 国产一区中文字幕| 欧美日本一区二区在线观看| 国产精品国产三级国产普通话99| 麻豆精品一区二区av白丝在线| 色琪琪一区二区三区亚洲区| 国产日韩av一区二区| 免费观看日韩av| 欧美日韩另类国产亚洲欧美一级| 国产精品福利一区二区三区| 狠狠狠色丁香婷婷综合激情 | 久久国产尿小便嘘嘘| 91福利精品视频| 中文字幕日韩一区二区| 国产激情偷乱视频一区二区三区 | 国产激情91久久精品导航| 日韩一区二区影院| 午夜精品爽啪视频| 欧美无乱码久久久免费午夜一区| 国产精品国产精品国产专区不片| 国产成人午夜视频| 337p粉嫩大胆噜噜噜噜噜91av | 精品卡一卡二卡三卡四在线| 日韩精品久久理论片| 欧美日韩精品专区| 亚洲国产一区视频| 欧美亚洲一区三区| 亚洲一区二区高清| 欧美午夜精品一区二区蜜桃| 亚洲综合色丁香婷婷六月图片| 色综合视频在线观看| 亚洲免费在线播放| 91丨九色丨尤物| 亚洲私人黄色宅男| 91在线观看视频| 亚洲欧美偷拍卡通变态| 91麻豆免费看片| 亚洲毛片av在线| 在线欧美日韩精品| 午夜电影一区二区三区| 欧美日韩国产综合视频在线观看| 亚洲妇女屁股眼交7| 欧美日韩久久不卡| 日产国产欧美视频一区精品 | 国产东北露脸精品视频| 国产欧美一区二区精品性色超碰| 国产福利精品导航| 中文字幕一区在线| 欧美中文字幕一区二区三区 | 精品电影一区二区| 国产一区二区日韩精品| 国产午夜精品一区二区三区嫩草| 国产精品白丝av| 国产精品国产馆在线真实露脸| 91猫先生在线| 日韩制服丝袜av| 精品国产成人在线影院| 国产成a人亚洲精品| 中文字幕一区二区三区精华液| 色88888久久久久久影院野外| 亚洲一区二区三区四区在线免费观看 | 精品美女一区二区| 国产91丝袜在线播放| 亚洲欧美视频在线观看视频| 欧美日韩在线观看一区二区| 久久精品国产精品青草| 国产欧美精品一区二区色综合 | 日本女人一区二区三区| 精品国精品国产| 成人av电影在线网| 亚洲国产综合色| 久久中文娱乐网| 色综合久久精品| 美女视频免费一区| 中文文精品字幕一区二区| 色素色在线综合| 久久国产精品色婷婷| 中文字幕亚洲综合久久菠萝蜜| 欧美日韩国产精选| 国产成人精品影视| 亚洲一区二区在线视频| 久久综合久久久久88| 色综合天天视频在线观看| 麻豆精品视频在线观看| 亚洲欧洲av在线| 91精品国产入口| 97久久久精品综合88久久| 青青草国产成人av片免费| 亚洲欧洲一区二区三区| 91精品免费在线观看| 成人av动漫在线| 麻豆久久久久久| 亚洲综合在线第一页| 久久影院视频免费| 欧美日韩国产综合久久| 成人毛片在线观看| 青草国产精品久久久久久| 亚洲色图一区二区| 久久影音资源网| 欧美日韩视频在线第一区 | 一区二区三区欧美| 2023国产精品| 91精品国产综合久久婷婷香蕉| 不卡免费追剧大全电视剧网站| 另类欧美日韩国产在线| 亚洲夂夂婷婷色拍ww47| 亚洲国产高清不卡| 精品国精品国产| 欧美精品xxxxbbbb| 色综合av在线| 成人激情开心网| 国产一区二区视频在线| 日韩不卡一区二区| 亚洲一区二区三区不卡国产欧美| 中日韩免费视频中文字幕| 日韩欧美精品三级| 欧美日韩一区二区三区四区五区 | 亚洲综合丝袜美腿| 国产精品第五页| 国产亚洲短视频| 亚洲精品一线二线三线 | 久久精品国产精品青草| 天堂成人免费av电影一区| 亚洲精品视频免费看| 中文字幕一区二区三区色视频| 国产三级欧美三级日产三级99| 91精品国产综合久久香蕉的特点| 欧美亚洲图片小说| 在线免费观看日本一区| 色综合久久久久久久久久久| 99热99精品| 成人黄色在线视频| 国产成人8x视频一区二区| 国产精品资源在线看| 国产一区二区网址| 韩国毛片一区二区三区| 精品在线一区二区| 裸体一区二区三区| 美日韩一区二区| 久久99久久99精品免视看婷婷| 蜜桃一区二区三区四区| 蜜臀av一区二区三区| 奇米色777欧美一区二区| 日韩和欧美一区二区三区| 亚洲成av人片一区二区梦乃| 亚洲一级二级在线| 亚洲午夜精品在线| 性做久久久久久| 日韩成人免费在线| 蜜桃视频一区二区三区在线观看| 日本特黄久久久高潮| 久久精品国产一区二区| 国产一区二区三区久久久| 国产精品一区二区免费不卡| 国产精品一区二区久久不卡| 国产成人精品免费一区二区| 成人精品国产免费网站| 99热这里都是精品| 在线观看av一区二区| 欧美日韩免费视频| 91精品国产91久久久久久一区二区 | 亚洲国产中文字幕| 香蕉加勒比综合久久| 日本成人在线电影网| 久久精品国产亚洲5555| 国产乱国产乱300精品|