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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hal.c

?? nVidia開發的圖形語言 Cg
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************\
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.
\****************************************************************************/

//
// hal.c
//

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "slglobals.h"

static void InitHAL_HAL(slHAL *);
static int GetCapsBit_HAL(int bitNumber);
static int GetConnectorUses_HAL(int cid, int pid);
static int GetConnectorRegister_HAL(int cid, int ByIndex, int ratom, Binding *fBind);
static int GetFloatSuffixBase_HAL(SourceLoc *loc, int suffix);
static int GetSizeof_HAL(Type *fType);
static int GetAlignment_HAL(Type *fType);
static int CheckDeclarators_HAL(SourceLoc *loc, const dtype *fDtype);
static int CheckDefinition_HAL(SourceLoc *loc, int name, const Type *fType);
static int CheckStatement_HAL(SourceLoc *loc, stmt *fstmt);
static int CheckInternalFunction_HAL(Symbol *fSymb, int *group);
static int IsNumericBase_HAL(int fBase);
static int IsIntegralBase_HAL(int fBase);
static int IsTexobjBase_HAL(int fBase);
static int IsValidRuntimeBase_HAL(int fBase);
static int IsValidScalarCast_HAL(int toBase, int fromBase, int Explicit);
static int IsValidOperator_HAL(SourceLoc *loc, int name, int op, int suobp);
static int GetBinOpBase_HAL(int lop, int lbase, int rbase, int llen, int rlen);
static int ConvertConstant_HAL(const scalar_constant *fval, int fbase, int tbase,
                    expr **fexpr);
static int BindUniformUnbound_HAL(SourceLoc *loc, Symbol *fSymb, Binding *lBind);
static int BindUniformPragma_HAL(SourceLoc *loc, Symbol *fSymb, Binding *lBind,
                    const Binding *fBind);
static int BindVaryingSemantic_HAL(SourceLoc *loc, Symbol *fSymb, int semantic,
                    Binding *fBind, int IsOutVal);
static int BindVaryingPragma_HAL(SourceLoc *loc, Symbol *fSymb, Binding *lBind,
                    const Binding *fBind, int IsOutVal);
static int BindVaryingUnbound_HAL(SourceLoc *loc, Symbol *fSymb, int name, int connector,
                    Binding *fBind, int IsOutVal);
static int PrintCodeHeader_HAL(FILE *out);
static int GenerateCode_HAL(SourceLoc *loc, Scope *fScope, Symbol *program);

///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// Profile Manager: //////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

/*
 * RegisterProfile() - Add a profile to the list of available profiles.
 *
 */

slProfile *RegisterProfile(int (*InitHAL)(slHAL *), const char *name, int id)
{
    slProfile *lProfile;

    lProfile = (slProfile *) malloc(sizeof(slProfile));
    lProfile->next = Cg->allProfiles;
    lProfile->InitHAL = InitHAL;
    lProfile->name = AddAtom(atable, name);
    lProfile->id = id;
    Cg->allProfiles = lProfile;
    return lProfile;
} // RegisterProfile

/*
 * EnumerateProfiles()
 *
 */

slProfile *EnumerateProfiles(int index)
{
    slProfile *lProfile;
    
    lProfile = Cg->allProfiles;
    while (index-- > 0 && lProfile)
        lProfile = lProfile->next;
    return lProfile;
} // EnumerateProfiles

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// Default Language HAL ////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

/*
 * InitHAL()
 *
 */

int InitHAL(const char *profileName, const char *entryName)
{
    slProfile *lProfile;
    int result;

    Cg->theHAL = (slHAL *) malloc(sizeof(slHAL));
    InitHAL_HAL(Cg->theHAL);
    Cg->theHAL->profileName = AddAtom(atable, profileName);
    Cg->theHAL->entryName = AddAtom(atable, entryName);
    lProfile = Cg->allProfiles;
    while (lProfile) {
        if (Cg->theHAL->profileName == lProfile->name) {
            Cg->theHAL->InitHAL = lProfile->InitHAL;
            Cg->theHAL->pid = lProfile->id;
            result = Cg->theHAL->InitHAL(Cg->theHAL);
            return result;
        }
        lProfile = lProfile->next;
    }
    printf(OPENSL_TAG ": unknown profile \"%s\".\n", profileName);
    return 0;
} // InitHAL

/*
 * InitHAL_HAL();
 *
 */

static void InitHAL_HAL(slHAL *fHAL)
{
    // Initialize default function members:

    fHAL->InitHAL = NULL;
    fHAL->FreeHAL = NULL;
    fHAL->RegisterNames = NULL;
    fHAL->GetCapsBit = GetCapsBit_HAL;
    fHAL->GetConnectorID = NULL;
    fHAL->GetConnectorAtom = NULL;
    fHAL->GetConnectorUses = GetConnectorUses_HAL;
    fHAL->GetConnectorRegister = GetConnectorRegister_HAL;
    fHAL->GetFloatSuffixBase = GetFloatSuffixBase_HAL;
    fHAL->GetSizeof = GetSizeof_HAL;
    fHAL->GetAlignment = GetAlignment_HAL;
    fHAL->CheckDeclarators = CheckDeclarators_HAL;
    fHAL->CheckDefinition = CheckDefinition_HAL;
    fHAL->CheckStatement = CheckStatement_HAL;
    fHAL->CheckInternalFunction = CheckInternalFunction_HAL;
    fHAL->IsNumericBase = IsNumericBase_HAL;
    fHAL->IsTexobjBase = IsTexobjBase_HAL;
    fHAL->IsIntegralBase = IsIntegralBase_HAL;
    fHAL->IsValidRuntimeBase = IsValidRuntimeBase_HAL;
    fHAL->IsValidScalarCast = IsValidScalarCast_HAL;
    fHAL->IsValidOperator = IsValidOperator_HAL;
    fHAL->GetBinOpBase = GetBinOpBase_HAL;
    fHAL->ConvertConstant = ConvertConstant_HAL;
    fHAL->BindUniformUnbound = BindUniformUnbound_HAL;
    fHAL->BindUniformPragma = BindUniformPragma_HAL;
    fHAL->BindVaryingSemantic = BindVaryingSemantic_HAL;
    fHAL->BindVaryingPragma = BindVaryingPragma_HAL;
    fHAL->BindVaryingUnbound = BindVaryingUnbound_HAL;
    fHAL->PrintCodeHeader = PrintCodeHeader_HAL;
    fHAL->GenerateCode = GenerateCode_HAL;

    // Initialize default data members:

    // Defined when profile is registered:

    fHAL->vendor = "None";
    fHAL->version = "0.0";

    fHAL->profileName = 0;
    fHAL->pid = 0;
    fHAL->entryName = 0;

    fHAL->semantics = NULL;
    fHAL->numSemantics = 0;

    fHAL->incid = CID_NONE_ID;
    fHAL->inputCRegs = NULL;
    fHAL->numInputCRegs = 0;

    fHAL->nextUnboundVinReg = 0;
    fHAL->lastUnboundVinReg = -1;

    fHAL->outcid = CID_NONE_ID;
    fHAL->outputCRegs = NULL;
    fHAL->numOutputCRegs = 0;

    fHAL->nextUnboundVoutReg = 0;
    fHAL->lastUnboundVoutReg = -1;

    // Defined by compiler front end:

    fHAL->globalScope = NULL;
    fHAL->varyingIn = NULL;
    fHAL->varyingOut = NULL;
    fHAL->uniformParam = NULL;
    fHAL->uniformGlobal = NULL;
    fHAL->uniforms = NULL;

    fHAL->constantBindings = NULL;
    fHAL->defaultBindings = NULL;

    // Define default comment start string:

    fHAL->comment = "#";

    // Pointer to profile specific struct:

    fHAL->localData = NULL;

} // InitHAL_HAL

/*
 * AddConstantBinding() - Add a constant binding to the program.
 *
 */

void AddConstantBinding(Binding *fBind)
{
    BindingList *lBindList, *nBindList;

    nBindList = (BindingList *) malloc(sizeof(BindingList));
    nBindList->next = NULL;
    nBindList->binding = fBind;
    lBindList = Cg->theHAL->constantBindings;
    if (lBindList) {
        while (lBindList->next)
            lBindList = lBindList->next;
        lBindList->next = nBindList;
    } else {
        Cg->theHAL->constantBindings = nBindList;
    }
} // AddConstantBinding

/*
 * AddDefaultBinding() - Add a default binding to the program.
 *
 */

void AddDefaultBinding(Binding *fBind)
{
    BindingList *lBindList, *nBindList;

    nBindList = (BindingList *) malloc(sizeof(BindingList));
    nBindList->next = NULL;
    nBindList->binding = fBind;
    lBindList = Cg->theHAL->defaultBindings;
    if (lBindList) {
        while (lBindList->next)
            lBindList = lBindList->next;
        lBindList->next = nBindList;
    } else {
        Cg->theHAL->defaultBindings = nBindList;
    }
} // AddDefaultBinding

/*
 * LookupConnectorHAL() - Lookup a connector descriptor by cid.
 *
 */

ConnectorDescriptor *LookupConnectorHAL(ConnectorDescriptor *connectors, int cid, int num)
{
    int ii;

    for (ii = 0; ii < num; ii++) {
        if (cid == connectors[ii].cid)
            return &connectors[ii];
    }
    return NULL;
} // LookupConnectorHAL

/*
 * SetSymbolConnectorBindingHAL()
 *
 */

void SetSymbolConnectorBindingHAL(Binding *fBind, ConnectorRegisters *fConn)
{
    BindingConnector *tBind;

    tBind = &fBind->conn;
    tBind->properties = BIND_IS_BOUND;
    tBind->kind = BK_CONNECTOR;
    if (fConn->properties & REG_WRITE_REQUIRED)
        tBind->properties |= BIND_WRITE_REQUIRED;
    // tBind->gname set elsewhere
    // tBind->lname set elsewhere
    tBind->base = fConn->base;
    tBind->size = fConn->size;
    tBind->rname = fConn->name;
    tBind->regno = fConn->regno;
} // SetSymbolConnectorBindingHAL

/*
 * GetCapsBit_HAL() - Return an integer value representing the capabilities of this profile.
 *
 */

static int GetCapsBit_HAL(int bitNumber)
{
    return 0;
} // GetCapsBit_HAL

/*
 * GetConnectorUses_HAL() - Return a connectors capabilities for this profile.
 *
 */

static int GetConnectorUses_HAL(int cid, int pid)
{
    return CONNECTOR_IS_USELESS;
} // GetConnectorUses_HAL

/*
 * GetConnectorRegister_HAL() - Return the hw register number for "ratom" in connector "cid".
 *
 */

static int GetConnectorRegister_HAL(int cid, int ByIndex, int ratom, Binding *fBind)
{
    return 0;
} // GetConnectorRegister_HAL

/*
 * GetFloatSuffixBase_HAL() - Check for profile-specific limitations of floating point
 *         suffixes and return the base for this suffix.
 *
 */

static int GetFloatSuffixBase_HAL(SourceLoc *loc, int suffix)
{
    switch (suffix) {
    case ' ':
        return TYPE_BASE_CFLOAT;
    case 'f':
        return TYPE_BASE_FLOAT;
    default:
        SemanticError(loc, ERROR_C_UNSUPPORTED_FP_SUFFIX, suffix);
        return TYPE_BASE_UNDEFINED_TYPE;
    }
} // GetFloatSuffixBase_HAL

/*
 * GetSizeof_HAL() - Return a profile specific size for this scalar, vector, or matrix type.
 *         Used for defining struct member offsets for use by code generator.
 */

static int GetSizeof_HAL(Type *fType)
{
    int category, size, alignment, len, len2;

    if (fType) {
        category = GetCategory(fType);
        switch (category) {
        case TYPE_CATEGORY_SCALAR:
        case TYPE_CATEGORY_STRUCT:
        case TYPE_CATEGORY_CONNECTOR:
            size = fType->co.size;
            break;
        case TYPE_CATEGORY_ARRAY:
            if (IsVector(fType, &len)) {
                size = len;
            } else if (IsMatrix(fType, &len, &len2)) {
                if (len2 > len) {
                    size = len*4;
                } else {
                    size = len2*4;
                }
            } else {
                size = Cg->theHAL->GetSizeof(fType->arr.eltype);
                alignment = Cg->theHAL->GetAlignment(fType->arr.eltype);
                size = ((size + alignment - 1)/alignment)*alignment*fType->arr.numels;
            }
            break;
        case TYPE_CATEGORY_FUNCTION:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费av| 日本欧美在线观看| 久久久久久久久久久久久夜| 91精品国产福利在线观看| 欧美亚洲禁片免费| 欧美系列在线观看| 欧美精品久久天天躁| 欧美最猛性xxxxx直播| 欧美综合久久久| 欧美麻豆精品久久久久久| 在线成人av网站| 精品国产乱码久久久久久夜甘婷婷| 4438x成人网最大色成网站| 777亚洲妇女| 久久亚洲精品小早川怜子| 久久精品视频在线看| 欧美经典三级视频一区二区三区| 中文字幕一区二区在线播放| 亚洲欧美日韩综合aⅴ视频| 亚洲综合无码一区二区| 日本美女视频一区二区| 激情综合网激情| 97久久精品人人做人人爽50路| 99久久久无码国产精品| 欧美性一区二区| 精品美女一区二区三区| 日本一区二区动态图| 亚洲乱码国产乱码精品精的特点 | 日本一区二区不卡视频| 国产精品萝li| 亚洲国产成人porn| 国产一区二区三区免费观看| 99riav一区二区三区| 欧美系列一区二区| 国产夜色精品一区二区av| 亚洲情趣在线观看| 久久99热国产| 色欧美日韩亚洲| 日韩欧美高清dvd碟片| 国产精品全国免费观看高清| 午夜精品一区在线观看| 韩国三级在线一区| 在线观看日产精品| 久久久久久久久久久电影| 亚洲国产日韩a在线播放性色| 久久不见久久见免费视频1| 丁香婷婷综合激情五月色| 欧美午夜不卡在线观看免费| 久久精品人人做| 偷拍一区二区三区四区| av高清不卡在线| 亚洲精品在线三区| 天堂午夜影视日韩欧美一区二区| av在线播放成人| 337p日本欧洲亚洲大胆精品| 亚洲国产日产av| 91一区二区三区在线播放| 日韩精品一区国产麻豆| 一区二区三区中文在线观看| 高清国产一区二区| 91精品国产色综合久久久蜜香臀| 亚洲精品日韩一| 成人丝袜高跟foot| 日韩精品一区二区三区老鸭窝| 亚洲影院免费观看| 不卡一区二区在线| 久久精品一区二区三区av| 日韩福利视频网| 欧美精品日韩一本| 亚洲一区二区三区自拍| 色呦呦日韩精品| 国产欧美日韩激情| 欧美午夜精品一区二区三区| 18成人在线视频| 在线电影院国产精品| 久久综合九色综合欧美亚洲| 日韩欧美国产综合一区| 日韩国产精品大片| 欧美一区二区三区免费在线看| 午夜精品久久久久久久久| 欧美色图12p| 日韩中文字幕一区二区三区| 67194成人在线观看| 日韩和欧美一区二区三区| 欧美精品精品一区| 老司机一区二区| 久久久蜜桃精品| 成人毛片视频在线观看| 日韩一区欧美一区| 在线观看一区二区精品视频| 亚洲高清免费视频| 欧美一区二区日韩| 国产一本一道久久香蕉| 国产精品久久网站| 在线影院国内精品| 美女在线观看视频一区二区| 国产黄人亚洲片| 狠狠色丁香九九婷婷综合五月| 欧美伊人久久久久久久久影院| 午夜欧美大尺度福利影院在线看| 日韩一级视频免费观看在线| 免费亚洲电影在线| 亚洲国产精品99久久久久久久久| 91浏览器入口在线观看| 亚洲韩国精品一区| 精品国产一区二区国模嫣然| 不卡区在线中文字幕| 亚洲国产一区二区在线播放| 欧美成人乱码一区二区三区| 成人aa视频在线观看| 日韩精品一卡二卡三卡四卡无卡| 国产三级精品三级| 欧美在线综合视频| 国产真实乱偷精品视频免| 亚洲欧美日本在线| 日韩视频一区二区| 色八戒一区二区三区| 免费观看在线色综合| 亚洲另类在线视频| 久久久午夜电影| 欧美日韩视频在线观看一区二区三区 | 国产一区二区不卡| 一区二区三区在线观看国产 | 国内成+人亚洲+欧美+综合在线 | 午夜精品影院在线观看| 国产欧美综合在线| 欧美一级一区二区| 91精彩视频在线| 粗大黑人巨茎大战欧美成人| 日韩高清在线不卡| 亚洲男人的天堂网| 久久综合久色欧美综合狠狠| 欧美日韩一区国产| 不卡av免费在线观看| 久久精品国产精品亚洲综合| 亚洲永久精品大片| 国产精品初高中害羞小美女文| 26uuu成人网一区二区三区| 欧美性大战xxxxx久久久| 99精品一区二区| 成人中文字幕在线| 国产最新精品精品你懂的| 天天亚洲美女在线视频| 一区二区三区日韩欧美| 亚洲欧美另类久久久精品2019| 精品黑人一区二区三区久久| 91精品久久久久久久久99蜜臂| 在线视频欧美精品| 91麻豆免费看| 六月丁香综合在线视频| 亚洲一区二区三区激情| 91福利国产精品| 亚洲成a人v欧美综合天堂| 一区二区三区四区亚洲| 亚洲视频一二区| 亚洲色图视频免费播放| 国产精品电影院| 亚洲蜜臀av乱码久久精品蜜桃| 日韩毛片精品高清免费| 中文字幕av资源一区| 国产日韩高清在线| 国产视频一区二区在线| 国产精品伦理在线| 日韩毛片在线免费观看| 一级特黄大欧美久久久| 亚洲3atv精品一区二区三区| 午夜精品久久久久影视| 日精品一区二区| 精品影院一区二区久久久| 国产一区不卡在线| 成人免费视频网站在线观看| 99热国产精品| 在线国产电影不卡| 欧美一区二区网站| 精品国产区一区| 国产精品久久久久久久裸模| 亚洲精品欧美二区三区中文字幕| 亚洲最快最全在线视频| 日韩国产欧美三级| 国产不卡视频一区二区三区| 99久久免费视频.com| 欧美午夜理伦三级在线观看| 精品欧美一区二区在线观看| 久久久蜜桃精品| 亚洲一区在线免费观看| 日韩中文字幕1| 丁香网亚洲国际| 欧美日韩视频在线第一区| 日韩精品一区二区在线| 自拍av一区二区三区| 日本不卡在线视频| 成人黄色a**站在线观看| 欧美精品自拍偷拍| 国产精品无人区| 日韩成人一区二区| av不卡在线播放| 亚洲精品一区二区三区香蕉| 亚洲精品乱码久久久久久久久| 久久国产婷婷国产香蕉| 91免费观看视频在线|