repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/index.ts
export * from "./Deployer";
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/routes.tsx
<gh_stars>1-10 import React from 'react'; import { ChooseContractPage } from './ChooseContractPage'; import { RouteDefinition } from '../routes.types'; import { CheckContractPage } from './CheckContractPage'; import { PrepareStoragePage } from './PrepareStoragePage'; import { PreviewDeployPage } from './PreviewDeployPage'; import { DeployPage } from './DeployPage'; export const deployerRoutes: RouteDefinition[] = [ { path: "choose-contract", component: () => <ChooseContractPage />, exact: true, }, { path: "check-contract", component: () => <CheckContractPage />, exact: true, }, { path: "prepare-storage", component: () => <PrepareStoragePage />, exact: true, }, { path: "preview", component: () => <PreviewDeployPage />, exact: true, }, { path: "deploy", component: () => <DeployPage />, exact: true, } ]; export const defaultDeployerPage = deployerRoutes[0].path;
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/StorageBuilder/builders/RecordBuilder.tsx
<reponame>uconomy/tezos-builder-suite import { NamePath } from "antd/lib/form/interface"; import React from "react"; import { renderBuilder } from '.'; import { UnwrappedMichelsonObject } from '../../michelsonStorageParser'; import "../StorageBuilder.css"; import { Builder, BuilderProps, extractAnnots } from "./Builder"; function joinName(name: NamePath | undefined, annots: string[] | undefined, rest: any[]) { const res: NamePath = []; if (name) { if (typeof name === 'number' || typeof name === 'string') { res.push(name); } else { res.push(...name); } } else { res.push(extractAnnots(0, annots)); } res.push(...rest); return res; } export const RecordBuilder: React.FC<BuilderProps> = (props) => { const { object, index, itemProps, } = props; return ( <Builder className="record-block" object={object} index={index} itemProps={{ ...itemProps, className: "full-width" }} render={ () => ( <div> {(object as any).args.map((x: UnwrappedMichelsonObject, i: number) => renderBuilder(x, i, { name: joinName(itemProps?.name, object.annots, [extractAnnots(i, x.annots)]), fieldKey: joinName(itemProps?.fieldKey, object.annots, [extractAnnots(i, x.annots)]), rules: [{ required: true }] }))} </div> ) }/> ); }
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/DeployPage/index.ts
<reponame>uconomy/tezos-builder-suite<filename>frontend/src/routes/Deployer/DeployPage/index.ts export * from './DeployPage';
uconomy/tezos-builder-suite
backend/src/domain/contract/index.ts
export * from './contract.types';
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PreviewDeployPage/PreviewDeployPage.tsx
import { Layout, PageHeader, Tabs } from 'antd'; import React, { useCallback } from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from 'react-router-dom'; import { CodeViewer } from "../../../shared/CodeViewer"; import { useDeployState } from "../state"; import "./PreviewDeployPage.css"; import { PreviewViewer } from "./PreviewViewer"; const { Header, Content, } = Layout; const { TabPane, } = Tabs; export const PreviewDeployPage: React.FC = () => { const { t } = useTranslation(); const history = useHistory(); const [contract] = useDeployState('contract'); const [storageContent] = useDeployState('storageContent'); const goBack = useCallback(() => { history.push('prepare-storage'); }, [history]); if (!contract) { goBack(); return null; } return ( <Layout> <Header className="page-header"> <PageHeader title={t(`deployer.titles.preview`, { name: contract.name })} onBack={goBack} /> </Header> <Content className="page-content"> <Tabs defaultActiveKey="1" className="page-tabs"> <TabPane tab={t('deployer.storage.preview')} key="1"> <PreviewViewer /> </TabPane> <TabPane tab={t('deployer.storage.storageContent')} key="2"> <CodeViewer code={JSON.stringify(storageContent, null, 2)} language="json" className="code-viewer" /> </TabPane> <TabPane tab={t('deployer.storage.contractCode')} key="3"> <CodeViewer code={contract.code} fileName={contract.name} className="code-viewer" /> </TabPane> </Tabs> </Content> </Layout> ); }
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/DeployPage/DeployConsole/SignerManager/SignerManager.tsx
<filename>frontend/src/routes/Deployer/DeployPage/DeployConsole/SignerManager/SignerManager.tsx import { UserOutlined, UserSwitchOutlined } from '@ant-design/icons'; import { useQuery } from '@apollo/client'; import { BeaconWallet } from '@taquito/beacon-wallet'; import { TezosToolkit } from '@taquito/taquito'; import { importKey, InMemorySigner } from '@taquito/signer'; import { Button } from 'antd'; import React, { useCallback, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Endpoint, GET_ENDPOINT } from '../../../../../graphql/endpoint'; import { useDeployState } from '../../../state'; import "./SignerManager.css"; import { SignerCard } from './SignerCard'; export const SignerManager: React.FC = () => { const { t } = useTranslation(); const { data, loading, error } = useQuery<{ endpoint: Endpoint }>(GET_ENDPOINT); const [Tezos, setTezosToolkit] = useDeployState('Tezos'); const [wallet, setWallet] = useDeployState('wallet'); const [signer, setSigner] = useDeployState('signer'); const [signWith, setSignedWith] = useDeployState('signWith'); const [opHash] = useDeployState('operationHash'); useEffect(() => { if (Tezos) { return; } if (!data || loading || error) { return; } setTezosToolkit(new TezosToolkit(data.endpoint.url)); }, [Tezos, data, loading, error, setTezosToolkit]); const setupWallet = useCallback(() => { if (wallet) { return; } const w = new BeaconWallet({ name: t('deployer.signer.wallet.name'), disclaimerText: t('deployer.signer.wallet.disclaimerText') }); setSignedWith('wallet'); setWallet(w); }, [wallet, setWallet, setSignedWith, t]); useEffect(() => { if (wallet || signer) { return; } if (!Tezos) { return; } if (!data || loading || error) { return; } const endpoint = data.endpoint; if (endpoint.scope === 'mainnet' || (endpoint.scope === 'testnet' && !endpoint.faucet && !endpoint.signerPrivateKey)) { setupWallet(); } else { if (endpoint.faucet) { const { email, password, mnemonic, secret } = endpoint.faucet; // Mnemonic gets always as string from backend importKey(Tezos, email, password, mnemonic as string, secret); setSigner(email); setSignedWith('faucet'); } else if (endpoint.signerPrivateKey) { const pk = endpoint.signerPrivateKey; Tezos.setProvider({ signer: new InMemorySigner(pk) }); setSigner(`${pk.substring(0, 3)}...${pk.substring(pk.length - 4)}`); setSignedWith('privateKey'); } } }, [t, wallet, signer, Tezos, data, loading, error, setupWallet, setSigner, setSignedWith]); const handleSetupSigner = useCallback(async () => { if (!Tezos || !wallet || !data) { return; } await wallet.requestPermissions({ network: { type: data.endpoint.protocolVersion }, }); const address = await wallet.getPKH(); // Tezos.setWalletProvider(wallet); Tezos.setProvider({ wallet }); setSigner(address); }, [Tezos, wallet, data, setSigner]); if (loading) { return <>{t('loadingEndpointSettings')}</>; } if (error) { return <> <h1>{t('endpointSettingsError')}</h1> <code>{JSON.stringify(error, null, 2)}</code> </>; } return ( <div className="signer-manager"> <SignerCard signer={signer} signWith={signWith} /> { (signWith === 'wallet' && !opHash) && <div className="call-to-action"> { !signer ? <Button type="primary" size="large" onClick={handleSetupSigner} disabled={!!signer} loading={loading || !!error || !Tezos} icon={<UserOutlined />} >{t('deployer.chooseSigner')}</Button> : <Button type="default" size="middle" onClick={handleSetupSigner} loading={loading || !!error || !Tezos} icon={<UserSwitchOutlined />} >{t('deployer.changeSigner')}</Button> } </div> } </div> ); }
uconomy/tezos-builder-suite
frontend/src/shared/Router/RouteComponent/RouterComponent.tsx
import React from "react"; import { RouteDefinition } from "../../../routes/routes.types"; import { Route } from 'react-router-dom'; export const RouteComponent: React.FC<RouteDefinition> = (route) => { const Component = route.component; return ( <Route path={route.path} render={(props: unknown) => ( <Component {...props} {...route} /> )} exact={route.exact} /> ); };
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/ChooseContractPage/ContractsList/index.ts
<gh_stars>1-10 export * from './ContractsList';
uconomy/tezos-builder-suite
backend/src/graphql/context.ts
<reponame>uconomy/tezos-builder-suite<filename>backend/src/graphql/context.ts<gh_stars>1-10 import { Contract } from "../domain/contract"; import { Endpoint } from "../domain/endpoint"; export type ApolloContext = { contracts: Contract[]; endpoint: Endpoint; onDeployCompleted?: (contract: Contract, address: string) => void; };
uconomy/tezos-builder-suite
backend/src/services/contract/contract.service.ts
<reponame>uconomy/tezos-builder-suite<filename>backend/src/services/contract/contract.service.ts import { Contract } from "../../domain/contract"; import { ApolloContext } from "../../graphql/context"; export async function getContracts(context: ApolloContext): Promise<Contract[]> { return context.contracts; } export async function deployCompleted(contract: Contract, address: string, context: ApolloContext): Promise<boolean> { if (context.onDeployCompleted) { context.onDeployCompleted(contract, address); } return true; }
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/DeployPage/DeployConsole/SignerManager/SignerCard/SignerCard.tsx
import React from 'react'; import { UserOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import { ProgressCard } from '../../../../../../shared/ProgressCard'; export interface SignerCardProps { signer?: string; signWith?: 'wallet' | 'faucet' | 'privateKey'; } export const SignerCard: React.FC<SignerCardProps> = (props) => { const { signer, signWith } = props; const { t } = useTranslation(); if (!signer) { return null; } return ( <ProgressCard Icon={UserOutlined} title={t(`deployer.signerWarning.${signWith}`, { signer })} subtitle={t('deployer.signerWarningInfo')} /> ) };
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PreviewDeployPage/index.ts
export * from './PreviewDeployPage';
uconomy/tezos-builder-suite
frontend/src/shared/Tezos/Tezos.tsx
import React from 'react'; import currency from 'currency.js'; import './Tezos.css'; export interface TezosProps { value?: number; className?: string; mutez?: boolean; } const milliTezosOptions = { symbol: 'mꜩ', formatWithSymbol: true, pattern: '# !', negativePattern: '-# !' }; const tezosOptions = { symbol: 'ꜩ', formatWithSymbol: true, pattern: '# !', negativePattern: '-# !', precision: 6, }; export const Tezos = ({ value = 0, mutez, className }: TezosProps) => { let c: currency; if (mutez) { c = new currency(value, milliTezosOptions); } else { c = new currency(value, tezosOptions); } return <span className={`${className} tezos`}>{c.format()}</span> };
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/ChooseContractPage/index.ts
<gh_stars>1-10 export * from './ChooseContractPage';
uconomy/tezos-builder-suite
frontend/src/graphql/contract/contract.mutations.ts
import { gql } from 'graphql-tag'; export const CONTRACT_DEPLOY_COMPLETED = gql` mutation DeloyCompleted($contract: ContractInput!, $address: String!) { deployCompleted(contract: $contract, address: $address) }`;
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/DeployPage/DeployConsole/index.ts
<filename>frontend/src/routes/Deployer/DeployPage/DeployConsole/index.ts export * from './DeployConsole';
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/StorageBuilder/index.ts
<reponame>uconomy/tezos-builder-suite export * from './StorageBuilder';
uconomy/tezos-builder-suite
frontend/src/shared/ProgressCard/index.ts
<gh_stars>1-10 export * from './ProgressCard';
uconomy/tezos-builder-suite
frontend/src/graphql/endpoint/endpoint.queries.ts
<reponame>uconomy/tezos-builder-suite import { gql } from 'graphql-tag'; export type { Endpoint, NetworkType, NetworkScope } from '../../../../backend/src/domain/endpoint'; export const GET_ENDPOINT = gql` query GetEndpoint { endpoint { url scope protocolVersion signerPrivateKey faucet { mnemonic secret amount pkh password email } } }`;
uconomy/tezos-builder-suite
backend/src/index.ts
import express from 'express'; import open from 'open'; import path from 'path'; import { createApolloServer, schema } from './graphql'; import { TezosBuilderSuiteContext, TezosBuilderSuiteOptions } from './types'; import { NetworkScope, NetworkType } from './domain/endpoint'; import { Contract } from "./domain/contract"; import { Endpoint } from "./domain/endpoint"; export { TezosBuilderSuiteOptions, TezosBuilderSuiteContext, NetworkScope, NetworkType, Contract, Endpoint, }; const defaultOptions: TezosBuilderSuiteOptions = { port: 4000, openBrowser: true, }; export async function launchDeployer(context: TezosBuilderSuiteContext, options?: Partial<TezosBuilderSuiteOptions>) { const { port, openBrowser, }: TezosBuilderSuiteOptions = Object.assign({}, defaultOptions, options); const { endpoint, contracts, onDeployCompleted, } = context; const app = express(); // Instance Graphql server const server = await createApolloServer(app, schema, () => ({ endpoint, contracts, onDeployCompleted, })); // Serve frontend bundle app.use(express.static(path.resolve(__dirname, 'frontend'))); app.get('*', function (request, response) { response.sendFile(path.resolve(__dirname, 'frontend', 'index.html')); }); // Server startup await new Promise<void>(resolve => app.listen({ port: port }, () => resolve())); if (openBrowser) { await open(`http://localhost:${port}/`); } console.log(`🚀 Tezos Builder Suite is locally available at http://localhost:${port}/`); }
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PreviewDeployPage/PreviewViewer/index.ts
export * from './PreviewViewer';
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/index.ts
export * from './PrepareStoragePage';
uconomy/tezos-builder-suite
frontend/src/graphql/contract/contract.queries.ts
<filename>frontend/src/graphql/contract/contract.queries.ts import { gql } from 'graphql-tag'; export type { Contract, } from '../../../../backend/src/domain/contract'; export const GET_CONTRACTS = gql` query GetContracts { contracts { name code michelson } }`;
uconomy/tezos-builder-suite
backend/src/graphql/endpoint/endpoint.typedefs.ts
import { gql } from "apollo-server-express"; export const typeDefs = gql` extend type Query { endpoint: Endpoint } type FaucetAccount { mnemonic: String! secret: String! amount: String! pkh: String! password: String email: String! } enum NetworkScope { mainnet testnet sandbox } type Endpoint @key(fields: "url") { url: String! scope: NetworkScope! protocolVersion: String! signerPrivateKey: String faucet: FaucetAccount } `;
uconomy/tezos-builder-suite
backend/src/graphql/contract/contract.resolvers.ts
import contract from "."; import { Contract } from "../../domain/contract"; import { deployCompleted, getContracts } from "../../services/contract"; import { ApolloContext } from "../context"; export const resolvers = { Query: { contracts: (parent: any, args: any, context: ApolloContext): Promise<Contract[]> => { return getContracts(context); }, }, Mutation: { deployCompleted: (parent: any, args: any, context: ApolloContext): Promise<boolean> => { const { contract, address } = args; return deployCompleted(contract, address, context); } } };
uconomy/tezos-builder-suite
backend/src/domain/endpoint/index.ts
export * from './endpoint.types';
uconomy/tezos-builder-suite
backend/src/types.ts
<reponame>uconomy/tezos-builder-suite import { Contract } from "./domain/contract"; import { Endpoint } from "./domain/endpoint"; export type TezosBuilderSuiteOptions = { port: number; openBrowser: boolean; }; export type TezosBuilderSuiteContext = { contracts: Contract[]; endpoint: Endpoint; onDeployCompleted?: (contract: Contract, address: string) => void; };
uconomy/tezos-builder-suite
backend/src/domain/contract/contract.types.ts
export type Contract = { name: string; code: string; michelson: string; }
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/StorageBuilder/builders/BoolBuilder.tsx
<reponame>uconomy/tezos-builder-suite<gh_stars>1-10 import { Switch } from 'antd'; import React from "react"; import "../StorageBuilder.css"; import { Builder, BuilderProps } from "./Builder"; export const BoolBuilder: React.FC<BuilderProps> = (props) => { const { object, index, itemProps, } = props; return ( <Builder object={object} index={index} itemProps={{ ...itemProps, valuePropName: "checked", initialValue: false }}> <Switch/> </Builder> ); }
uconomy/tezos-builder-suite
frontend/src/routes/index.tsx
<gh_stars>1-10 import React from 'react'; import { Deployer } from './Deployer'; import { MenuConfig, RouteDefinition } from './routes.types'; export const routes: RouteDefinition[] = [ { path: "deployer", component: () => <Deployer />, exact: true, } ]; export const menus: MenuConfig = [ { route: routes[0], label: 'deployer.menuTitle', order: 3, } ]; export const defaultPage = "deployer";
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/ChooseContractPage/ContractsList/ContractsList.tsx
import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { List, Avatar } from 'antd'; import { FileTextOutlined } from '@ant-design/icons'; import { Contract } from '../../../../graphql/contract'; import "./ContractsList.css"; const { Item } = List; export interface ContractsListProps { contracts?: Contract[]; onSelect?: (contract: Contract) => void; }; export const ContractsList: React.FC<ContractsListProps> = (props) => { const { contracts, onSelect } = props; const { t } = useTranslation(); const handleSelection = useCallback((contract: Contract) => { if (onSelect) { onSelect(contract); } }, [onSelect]); if (!contracts || !contracts.length) { return ( <>{t('deployer.noContractFound')}</> ) } return ( <List className="contracts-list" bordered itemLayout="horizontal" dataSource={contracts} renderItem={item => ( <Item className="contracts-list-item" onClick={() => handleSelection(item)}> <Item.Meta avatar={<Avatar icon={<FileTextOutlined />} />} title={item.name} description={`${item.code.length} bytes`} /> </Item> )} /> ); }
uconomy/tezos-builder-suite
frontend/src/locales/translation/en/index.ts
import deployer from './deployer.json'; import common from './common.json'; const translation = { deployer, ...common, }; // Leave exports as they are here const _translation = { translation, }; export default _translation;
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/ChooseContractPage/ChooseContractPage.tsx
import React, { useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Layout, PageHeader } from 'antd'; import { useQuery } from '@apollo/client'; import { Contract, GET_CONTRACTS } from "../../../graphql/contract"; import { useHistory } from 'react-router-dom'; import "./ChooseContractPage.css"; import { ContractsList } from "./ContractsList"; import { deployerRoutes } from "../routes"; import { useDeployState } from "../state"; const { Header, Content, } = Layout; export const ChooseContractPage: React.FC = () => { const { t } = useTranslation(); const history = useHistory(); const [selectedContract, setContract] = useDeployState('contract'); const [isComingBack, setIsComingBack] = useState<boolean>(true); const { data, loading, error } = useQuery<{ contracts: Contract[] }>(GET_CONTRACTS); useEffect(() => { setIsComingBack(!!selectedContract); setContract(undefined); // eslint-disable-next-line react-hooks/exhaustive-deps }, [setContract]); const selectContract = useCallback((contract: Contract) => { setContract(contract); history.push(deployerRoutes[1].path); }, [setContract, history]); useEffect(() => { if (isComingBack) { return; } if (!data || !data.contracts || !data.contracts.length || data.contracts.length > 1) { return; } // Yeah, this if is unuseful, but it makes the code much more readable if (data.contracts.length === 1) { selectContract(data.contracts[0]); } }, [isComingBack, data, loading, error, selectContract]); if (loading) { return ( <Layout> <Content className="page-content"> <>{t('deployer.loadingContracts')}</> </Content> </Layout> ); } if (error) { return ( <Layout> <Content className="page-content"> <h1>{t('deployer.errorLoadingContracts')}</h1> <code>{ JSON.stringify(error, null, 2) }</code> </Content> </Layout> ); } return ( <Layout> <Header className="page-header"> <PageHeader title={t(`deployer.titles.selectContract`)} /> </Header> <Content className="page-content"> <ContractsList contracts={data?.contracts} onSelect={selectContract} /> </Content> </Layout> ); }
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/state.ts
import { createGlobalState } from 'react-hooks-global-state'; import { FormInstance } from 'antd'; import { Contract } from '../../graphql/contract'; import { BeaconWallet } from '@taquito/beacon-wallet'; import { TezosToolkit } from '@taquito/taquito'; import { Estimate } from '@taquito/taquito/dist/types/contract/estimate'; export type DeployerState = { contract?: Contract; activeForm?: FormInstance; initialStorage?: any; storageContent?: any; signer?: string; Tezos?: TezosToolkit; wallet?: BeaconWallet; estimates?: Estimate; operationHash?: string; contractAddress?: string; signWith?: 'wallet' | 'faucet' | 'privateKey'; }; const deplyInitialState: DeployerState = { contract: undefined, activeForm: undefined, initialStorage: undefined, storageContent: undefined, signer: undefined, Tezos: undefined, wallet: undefined, estimates: undefined, operationHash: undefined, contractAddress: undefined, signWith: undefined, }; const { useGlobalState } = createGlobalState<DeployerState>(deplyInitialState); export const useDeployState = useGlobalState;
uconomy/tezos-builder-suite
backend/src/graphql/endpoint/endpoint.resolvers.ts
<reponame>uconomy/tezos-builder-suite import { Endpoint } from "../../domain/endpoint"; import { getEndpoint } from "../../services/endpoint"; import { ApolloContext } from "../context"; export const resolvers = { Query: { endpoint: (parent: any, args: any, context: ApolloContext): Promise<Endpoint> => { return getEndpoint(context); }, } };
uconomy/tezos-builder-suite
frontend/src/graphql/index.ts
import { ApolloClient, InMemoryCache, } from "@apollo/client"; export const graphqlClient = new ApolloClient({ uri: 'http://localhost:4000/graphql', cache: new InMemoryCache() });
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/StorageBuilder/builders/OrBuilder.tsx
<reponame>uconomy/tezos-builder-suite import { Select } from 'antd'; import React from "react"; import { renderBuilder } from '.'; import { UnwrappedMichelsonObject } from '../../michelsonStorageParser'; import "../StorageBuilder.css"; import { Builder, BuilderProps } from "./Builder"; export const OrBuilder: React.FC<BuilderProps> = (props) => { const { object, index, itemProps, } = props; const value = (object as unknown as any).args as [UnwrappedMichelsonObject, UnwrappedMichelsonObject]; return ( <Builder object={object} index={index} hidePrim itemProps={{ ...itemProps, className: "full-width" }}> <Select style={{ padding: 0 }} > <Select.Option value={value[0]?.annots?.[0] || 0}> {renderBuilder(value[0], 0)} </Select.Option> <Select.Option value={value[1]?.annots?.[0] || 1}> {console.log("VALUE[1]", value[1])} {renderBuilder(value[1], 1)} </Select.Option> </Select> </Builder> ); }
uconomy/tezos-builder-suite
frontend/src/index.tsx
<filename>frontend/src/index.tsx import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from 'react-router-dom'; import reportWebVitals from './reportWebVitals'; import { ApolloProvider } from '@apollo/client'; import 'antd/dist/antd.css'; import './index.css'; import "./locales"; import { defaultPage, menus, routes } from './routes'; // import { Router } from './shared/Router'; import { AppLayout } from './shared/AppLayout'; import { graphqlClient } from './graphql'; ReactDOM.render( <React.StrictMode> <ApolloProvider client={graphqlClient}> <BrowserRouter> <AppLayout defaultRoute={defaultPage} routerRoot="/" routes={routes} menu={menus} /> </BrowserRouter> </ApolloProvider> </React.StrictMode>, document.getElementById('root') ) // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/Summary/Summary.tsx
<gh_stars>1-10 import { Steps, Button } from 'antd'; import { useTranslation } from 'react-i18next'; import { AimOutlined, SaveOutlined, CheckOutlined } from '@ant-design/icons'; import { useHistory } from 'react-router-dom'; import "./Summary.css"; import { useDeployState } from '../state'; const { Step } = Steps; const orderedSteps = [ 'choose-contract', 'check-contract', 'storage', 'preview', 'deploy' ] export const Summary: React.FC = () => { const [contract] = useDeployState('contract'); const [activeForm] = useDeployState('activeForm'); const [estimates] = useDeployState('estimates'); const { t } = useTranslation(); const history = useHistory(); const renderConfirmContractButton = () => ( <Button type="primary" className="summary-spacer" icon={<AimOutlined />} onClick={() => history.push('prepare-storage')}> {t(`deployer.confirmContract`)} </Button> ); const renderVerifyStorageButton = () => ( <Button type="primary" className="summary-spacer" icon={<SaveOutlined />} disabled={!activeForm} onClick={() => { activeForm?.submit(); }} > {t(`deployer.verifyAndSaveStorage`)} </Button> ); const renderAknowledgeEstimatesButton = () => ( <Button type="primary" className="summary-spacer" icon={<CheckOutlined />} disabled={!estimates} onClick={() => history.push('deploy')} > {t(`deployer.aknowledgeEstimates`)} </Button> ); const step = orderedSteps.findIndex(x => history.location.pathname.endsWith(x)) || 0; return ( <Steps direction="vertical" size="small" current={step}> <Step title={t(`deployer.steps.selectContract`)} description={contract && contract.name} /> <Step title={t(`deployer.steps.checkContract`)} description={step === 1 && renderConfirmContractButton()} /> <Step title={t(`deployer.steps.prepareStorage`)} description={step === 2 && renderVerifyStorageButton()} /> <Step title={t(`deployer.steps.preview`)} description={step === 3 && renderAknowledgeEstimatesButton()} /> <Step title={t(`deployer.steps.deploy`)} /> </Steps> ); }
uconomy/tezos-builder-suite
backend/src/graphql/contract/index.ts
<filename>backend/src/graphql/contract/index.ts import { resolvers } from './contract.resolvers'; import { typeDefs } from './contract.typedefs'; export default { typeDefs, resolvers, };
uconomy/tezos-builder-suite
frontend/src/shared/CodeViewer/CodeViewer.tsx
import React, { useEffect, useState } from 'react'; import Highlight, { defaultProps, Language } from 'prism-react-renderer'; import defaultTheme from 'prism-react-renderer/themes/vsDark'; import './prism-setup'; import './CodeViewer.css'; export type CodeViewerProps = { className?: string; code: string; fileName?: string; language?: string; } export const CodeViewer: React.FC<CodeViewerProps> = ({ language, fileName, code, className }) => { const [_language, setLanguage] = useState(language); useEffect(() => { if (fileName && !language) { if (fileName.endsWith('.jsligo')) { setLanguage("jsligo"); } else if (fileName.endsWith('.mligo')) { setLanguage("cameligo"); } else if (fileName.endsWith('.religo')) { setLanguage("reasonligo"); } else { setLanguage("pascaligo"); } } }, [language, fileName]); return ( <Highlight {...defaultProps} language={_language as Language} code={code} theme={defaultTheme}> {({ className: _className, style, tokens, getLineProps, getTokenProps }) => ( <pre className={`${_className}${className ? ` ${className}` : ''}`} style={style}> {tokens.map((line, i) => ( <div {...getLineProps({ line, key: i })}> <div className="token-line-no">{i + 1}</div> <div className="token-line-content"> {line.map((token, key) => ( <span {...getTokenProps({ token, key })} /> ))} </div> </div> ))} </pre> )} </Highlight> ); }
uconomy/tezos-builder-suite
frontend/src/shared/Tezos/index.ts
export * from './Tezos';
uconomy/tezos-builder-suite
backend/src/graphql/endpoint/index.ts
<filename>backend/src/graphql/endpoint/index.ts import { resolvers } from './endpoint.resolvers'; import { typeDefs } from './endpoint.typedefs'; export default { typeDefs, resolvers, };
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/StorageBuilder/builders/index.tsx
<filename>frontend/src/routes/Deployer/PrepareStoragePage/StorageBuilder/builders/index.tsx import React from 'react'; import { FormItemProps } from 'antd'; import { UnwrappedMichelsonObject } from '../../michelsonStorageParser'; import { MapBuilder } from './MapBuilder'; import { BoolBuilder } from './BoolBuilder'; import { StringBuilder } from './StringBuilder'; import { OrBuilder } from './OrBuilder'; import { UnitBuilder } from './UnitBuilder'; import { IntBuilder } from './IntBuilder'; import { NatBuilder } from './NatBuilder'; import { MutezBuilder } from './MutezBuilder'; import { TimestampBuilder } from './TimestampBuilder'; import { SetBuilder } from './SetBuilder'; import { RecordBuilder } from './RecordBuilder'; export const renderBuilder = (o: UnwrappedMichelsonObject, index: number, itemProps?: FormItemProps) => { switch (o.prim) { case 'unit': return <UnitBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'bool': return <BoolBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'int': return <IntBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'nat': return <NatBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'mutez': return <MutezBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'timestamp': return <TimestampBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'map': case 'big_map': return <MapBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'or': return <OrBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'set': case 'list': return <SetBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> case 'record': return <RecordBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> default: return <StringBuilder key={`storage-${index}`} object={o} index={index} itemProps={itemProps} /> // default: // return <div>Unknown prim {o.prim}</div> } }
uconomy/tezos-builder-suite
frontend/src/graphql/endpoint/index.ts
<gh_stars>1-10 export * from './endpoint.queries';
uconomy/tezos-builder-suite
frontend/src/routes/Deployer/PrepareStoragePage/PrepareStoragePage.tsx
<reponame>uconomy/tezos-builder-suite import React, { useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Layout, PageHeader, Tabs } from 'antd'; import { useHistory } from 'react-router-dom'; import "./PrepareStoragePage.css"; import { useDeployState } from "../state"; import { CodeViewer } from "../../../shared/CodeViewer"; import { MichelsonStorageParser } from "./michelsonStorageParser"; import { StorageBuilder } from "./StorageBuilder"; const { Header, Content, } = Layout; const { TabPane, } = Tabs; export const PrepareStoragePage: React.FC = () => { const { t } = useTranslation(); const history = useHistory(); const [contract] = useDeployState('contract'); const [michelsonStorage, setMichelsonStoage] = useState<MichelsonStorageParser>(); useEffect(() => { if (!contract) { return; } const storage = new MichelsonStorageParser(contract.michelson); setMichelsonStoage(storage); }, [contract]); const goBack = useCallback(() => { history.push('check-contract'); }, [history]); const onFinish = useCallback(() => { history.push('preview'); }, [history]); if (!contract) { history.push('choose-contract'); return null; } const unwrappedMichelson = michelsonStorage?.unwrapStorage(); return ( <Layout> <Header className="page-header"> <PageHeader title={t(`deployer.titles.prepareStorage`, { name: contract.name })} onBack={goBack} /> </Header> <Content className="page-content"> <Tabs defaultActiveKey="1" className="page-tabs"> <TabPane tab={t('deployer.storage.content')} key="1"> <StorageBuilder unwrappedMichelson={unwrappedMichelson} onFinish={onFinish} /> </TabPane> <TabPane tab={t('deployer.storage.jsonMichelson')} key="2"> <CodeViewer code={michelsonStorage?.getMichelsonStorage() || "..."} language="json" className="code-viewer" /> </TabPane> <TabPane tab={t('deployer.storage.unwrappedMichelson')} key="3"> <CodeViewer code={JSON.stringify(unwrappedMichelson || "...", null, 2)} language="json" className="code-viewer" /> </TabPane> <TabPane tab={t('deployer.storage.contractCode')} key="4"> <CodeViewer code={contract.code} fileName={contract.name} className="code-viewer" /> </TabPane> </Tabs> </Content> </Layout> ); }
ggoodman/json-schema-codec-generator
src/stub/schema.ts
<filename>src/stub/schema.ts type JSONPrimitive = boolean | null | number | string; type JSONValue = | JSONPrimitive | JSONValue[] | { [key: string]: JSONValue; }; /** * Core schema meta-schema * @see http://json-schema.org/draft-07/schema# */ export type CoreSchemaMetaSchema = JSONSchema | boolean; export interface JSONSchema { $id?: string; $schema?: string; $ref?: string; $comment?: string; title?: string; description?: string; default?: JSONValue; readOnly?: boolean; writeOnly?: boolean; examples?: JSONValue[]; multipleOf?: number; maximum?: number; exclusiveMaximum?: number; minimum?: number; exclusiveMinimum?: number; maxLength?: NonNegativeInteger; minLength?: NonNegativeIntegerDefault0; pattern?: string; additionalItems?: CoreSchemaMetaSchema; items?: CoreSchemaMetaSchema | SchemaArray; maxItems?: NonNegativeInteger; minItems?: NonNegativeIntegerDefault0; uniqueItems?: boolean; contains?: CoreSchemaMetaSchema; maxProperties?: NonNegativeInteger; minProperties?: NonNegativeIntegerDefault0; required?: StringArray; additionalProperties?: CoreSchemaMetaSchema; definitions?: { [additionalProperties: string]: CoreSchemaMetaSchema; }; properties?: { [additionalProperties: string]: CoreSchemaMetaSchema; }; patternProperties?: { [additionalProperties: string]: CoreSchemaMetaSchema; }; dependencies?: { [additionalProperties: string]: CoreSchemaMetaSchema | StringArray; }; propertyNames?: CoreSchemaMetaSchema; const?: JSONValue; enum?: JSONValue[]; type?: SimpleTypes | SimpleTypes[]; format?: string; contentMediaType?: string; contentEncoding?: string; if?: CoreSchemaMetaSchema; then?: CoreSchemaMetaSchema; else?: CoreSchemaMetaSchema; allOf?: SchemaArray; anyOf?: SchemaArray; oneOf?: SchemaArray; not?: CoreSchemaMetaSchema; } export type NonNegativeInteger = number; export type NonNegativeIntegerDefault0 = NonNegativeInteger & JSONValue; export type SchemaArray = CoreSchemaMetaSchema[]; export type StringArray = string[]; export type SimpleTypes = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
ggoodman/json-schema-codec-generator
src/resolve.ts
<gh_stars>1-10 import resolveSpec, { AsyncOpts } from 'resolve'; export function resolveAsync(spec: string, options: AsyncOpts) { return new Promise<string | undefined>((resolve, reject) => resolveSpec(spec, options, (err, resolved) => { if (err && (err as any).code !== 'MODULE_NOT_FOUND') { return reject(err); } return resolve(resolved); }) ); }
ggoodman/json-schema-codec-generator
src/stub/validator.ts
<gh_stars>1-10 import type { ErrorObject } from "ajv"; export class ValidationError extends Error { static isValidationError(err: unknown): err is ValidationError { return err instanceof this; } readonly validatorErrors: ErrorObject[]; readonly value: unknown; constructor(schemaName: string, value: unknown, validatorErrors: ErrorObject[]) { const errorStrings = validatorErrors.map((err) => { return ` ${err.message} at ${err.instancePath || '#'}, got ${valueToShapeString(err.data)}`; }); super( `Validation for the schema ${JSON.stringify( schemaName )} failed with the following errors:\n${errorStrings.join('\n')}` ); this.value = value; this.validatorErrors = validatorErrors; } } function valueToShapeString(value: unknown) { return JSON.stringify(value, valueToShapeReplacer); } function valueToShapeReplacer(_key: string, value: unknown) { return typeof value === 'object' && value ? value : typeof value; }
ggoodman/json-schema-codec-generator
src/stub/codec.ts
<gh_stars>1-10 import { ValidationError } from './validator'; import type { Codec, ValidateFunction } from './types'; export class CodecImpl<T> implements Codec<T> { Type!: T; constructor( readonly name: string, readonly uri: string, private validateFn: ValidateFunction<T> ) {} /** * Identify function returning the given argument as a value matching the schema. * * This can be useful to use in non-TypeScript code to construct a valid object while * benefitting from suggestions from a TypeScript language service. */ identity(obj: T): T { return obj; } /** * Check if a value matches the schema. */ is(obj: unknown): obj is T { return this.validateFn(obj); } /** * Validate that a value matches the schema and throws if not. */ validate(obj: unknown): T { if (!this.validateFn(obj)) { throw new ValidationError(this.name, obj, this.validateFn.errors || []); } return obj; } }
ggoodman/json-schema-codec-generator
test/index.ts
/// <reference types="jest" /> import Module from 'module'; import { Codec, generateCodecCode } from '../src'; import type { ErrorObject } from '../src/stub/types'; describe('Codec generation', () => { it('will produce the expected code', async () => { const { javaScript, schamaPathsToCodecNames, typeDefinitions } = await generateCodecCode([ { schema: { title: 'A User Object', description: 'A user is a known visitor.', type: 'object', properties: { id: { type: 'string', }, name: { type: 'string', }, }, required: ['id', 'name'], }, uri: 'file:///User.json', preferredName: 'User', }, { schema: { title: 'A Blog Post', description: 'A blog post represents an article associated with an author', type: 'object', properties: { id: { type: 'string', }, title: { type: 'string', }, content: { type: 'string', }, author: { $ref: 'file:///User.json', }, }, required: ['id', 'title', 'content', 'user'], }, uri: 'file:///BlogPost.json', preferredName: 'BlogPost', }, ]); expect(javaScript).toMatchSnapshot(); expect(schamaPathsToCodecNames).toMatchSnapshot(); expect(typeDefinitions).toMatchSnapshot(); }); it('will validate a well-known format from ajv-formats', async () => { const { javaScript, schamaPathsToCodecNames, typeDefinitions } = await generateCodecCode( [ { schema: { title: 'A Bookmark', type: 'object', properties: { url: { type: 'string', format: 'uri', }, name: { type: 'string', }, added_at: { type: 'string', format: 'date-time', }, // To be re-enabled when OpenAPI formats land in ajv-formats // picture: { // type: 'string', // format: 'byte', // } }, required: ['url', 'name', 'added_at'], }, uri: 'file:///Bookmark.json', preferredName: 'Bookmark', }, ], { moduleFormat: 'cjs', validateFormats: true, } ); expect(javaScript).toMatchSnapshot(); expect(schamaPathsToCodecNames).toMatchSnapshot(); expect(typeDefinitions).toMatchSnapshot(); const mod = new Module('schema', module); const instantiate = new Function('module', 'exports', 'require', javaScript); instantiate(mod, mod.exports, require); expect(mod.exports.Codecs).toHaveProperty('Bookmark'); const Bookmark: Codec<any> = mod.exports.Codecs.Bookmark; const now = new Date(); const want = { url: 'https://github.com/ggoodman', name: '<NAME> on GitHub', added_at: now.toISOString(), }; const got = Bookmark.validate({ url: 'https://github.com/ggoodman', name: '<NAME> on GitHub', added_at: now.toISOString(), }); expect(want).toEqual(got); expect( Bookmark.is({ url: 'https://github.com/ggoodman', name: '<NAME> on GitHub', added_at: now.toISOString(), }) ).toEqual(true); await expect(() => Bookmark.validate({ url: 'github.com/ggoodman', name: '<NAME> on GitHub', added_at: now.toISOString(), }) ).toThrowErrorMatchingInlineSnapshot(` "Validation for the schema \\"Bookmark\\" failed with the following errors: must match format \\"uri\\" at /url, got \\"string\\"" `); }); it('will export ValidationError', async () => { const { javaScript, schamaPathsToCodecNames, typeDefinitions } = await generateCodecCode( [ { schema: { title: 'A Bookmark', type: 'object', }, uri: 'file:///Bookmark.json', preferredName: 'Bookmark', }, ], { moduleFormat: 'cjs', validateFormats: true, } ); const mod = new Module('schema', module); const instantiate = new Function('module', 'exports', 'require', javaScript); instantiate(mod, mod.exports, require); { const want = 'function'; const got = typeof mod.exports.ValidationError; expect(got).toEqual(want); } { const want = 'function'; const got = typeof mod.exports.ValidationError.isValidationError; expect(got).toEqual(want); } { const err = new mod.exports.ValidationError('foo', {}, []); const want = true; const got = mod.exports.ValidationError.isValidationError(err); expect(got).toEqual(want); } }); it('exports a ErrorObject type that is compatible with the ajv equivalent', () => { ((_t: import('ajv').ErrorObject) => {})({} as ErrorObject); }); });
ggoodman/json-schema-codec-generator
src/index.ts
import Ajv, { Options } from 'ajv'; import addFormats, { FormatOptions } from 'ajv-formats'; import standaloneCode from 'ajv/dist/standalone'; import * as Esbuild from 'esbuild-wasm'; import { JSONSchema, Parser } from 'json-schema-to-dts'; import { staticFiles } from './generated/embedded'; export { CodecImpl } from './stub/codec'; export type { Codec } from './stub/types'; export { ValidationError } from './stub/validator'; export interface SchemaEntry { uri: string; schema: Exclude<JSONSchema, boolean>; preferredName?: string; } type AnyType = "any" | "JSONValue" | "unknown"; export interface GenerateCodecCodeOptions { anyType?: AnyType; ajvOptions?: Omit<Options, 'allErrors' | 'code' | 'inlineRefs'>; ajvFormatsOptions?: FormatOptions; validateFormats?: boolean; moduleFormat?: Esbuild.Format; } export async function generateCodecCode( schemas: SchemaEntry[], options: GenerateCodecCodeOptions = {} ) { const parser = new Parser(); const ajv = new Ajv({ verbose: true, validateFormats: options.validateFormats, ...(options.ajvOptions ?? {}), allErrors: true, code: { es5: false, // use es6 lines: true, optimize: false, // we'll let rollup do this source: true, }, inlineRefs: false, }); if (options.validateFormats) { addFormats(ajv, options.ajvFormatsOptions); } const moduleFormat = options.moduleFormat || 'cjs'; const exportedNameToSchema: Record<string, JSONSchema> = {}; const uriToExportedName: Record<string, string> = {}; /** * A collection of exported names used to add safety to some risky * regex-based code rewriting of `exports.<symbol> = ` to `export const <symbol> = `. */ const exportedNames = new Set<string>(); const codecDefinitions: string[] = []; const codecInstances: string[] = []; for (const { schema, uri, preferredName } of schemas) { const schemaWithId: JSONSchema = { $id: uri, ...schema }; const name = parser.addSchema(uri, schemaWithId, { preferredName }); if (exportedNames.has(name)) { throw new Error( `Invariant violation: The name ${JSON.stringify(name)} was expored more than once` ); } exportedNames.add(name); uriToExportedName[uri] = name; exportedNameToSchema[name] = schemaWithId; ajv.addSchema(schemaWithId, validatorNameForCodec(name)); codecDefinitions.push(`${name}: Codec<Types.${name}>`); codecInstances.push( `${name}: new CodecImpl<Types.${name}>(${JSON.stringify(name)}, ${JSON.stringify( uri )}, exports.${validatorNameForCodec(name)}) as Codec<Types.${name}>` ); } const { diagnostics, text: schemaTypeDefs } = parser.compile({ topLevel: { hasDeclareKeyword: false, isExported: true, }, anyType: options.anyType ?? 'JSONValue', }); if (diagnostics.length) { throw new Error( `Produced diagnostics while generating type definitions for schemas: ${diagnostics .map((diagnostic) => `${diagnostic.message}`) .join('\n')}` ); } const standaloneValidationCode = standaloneCode(ajv); const bundleResult = await Esbuild.build({ bundle: true, define: { 'process.env.NODE_ENV': JSON.stringify('production'), }, format: moduleFormat, outfile: 'codecs.js', platform: 'neutral', plugins: [ { name: 'resolve', setup(build) { const resolveMap: Record<string, { namespace: string; path: string }> = { './codec': { namespace: 'embedded', path: 'src/codec.ts', }, './validator': { namespace: 'embedded', path: 'src/validator.ts', }, }; build.onResolve({ filter: /.*/ }, async ({ importer, kind, path, resolveDir }) => { // console.log('onResolve[mapped](%O)', { importer, kind, path, resolveDir }); const mapped = resolveMap[path]; if (mapped) { return mapped; } return undefined; }); build.onLoad({ filter: /.*/, namespace: 'embedded' }, ({ namespace, path }) => { const contents = staticFiles[path]; if (contents) { return { contents, loader: 'ts', }; } }); }, }, ], stdin: { contents: ` import { CodecImpl } from './codec'; export * from './validator'; ${standaloneValidationCode} export const Codecs = { ${codecInstances.join(',\n')} } as const; `, loader: 'ts', sourcefile: 'src/index.ts', resolveDir: __dirname, }, target: 'node10', treeShaking: true, write: false, }); if (bundleResult.outputFiles.length !== 1) { throw new Error( `Invariant violation: Produced ${bundleResult.outputFiles.length}, expecting exactly 1` ); } const javaScript = bundleResult.outputFiles[0].text; const typeDefinitions = ` ${staticFiles['src/types.ts']} export namespace Types { ${schemaTypeDefs.split('\n').join('\n ')} } export declare const Codecs: { ${codecDefinitions.join(',\n ')} }; `; return { javaScript, typeDefinitions, schamaPathsToCodecNames: uriToExportedName, }; } function validatorNameForCodec(codecName: string) { return `__validate_${codecName}`; }
ggoodman/json-schema-codec-generator
src/cli.ts
<gh_stars>1-10 import Yargs from 'yargs'; import * as Path from 'path'; import { promises as Fs } from 'fs'; import type { SchemaEntry } from './index'; import fastGlob from 'fast-glob'; Yargs.help() .strict() .showHelpOnFail(true) .command( '$0 [path]', false, (args) => { return args.options({ input: { alias: 'i', string: true, description: 'Path to a directory containing your json-schema files.', demandOption: true, }, output: { alias: 'o', string: true, description: 'Path to a directory where the generated codecs will be written. If not specified, the generated ', }, }); }, async ({ input, output }) => { const inputPath = Path.resolve(process.cwd(), input); const matches = await fastGlob('**/*.json', { cwd: inputPath, stats: false, ignore: input.includes('node_modules') ? [] : ['node_modules/**/*.json'], absolute: false, }); if (!matches.length) { console.error(`❌ No .json files found in ./${Path.relative(process.cwd(), inputPath)}.`); process.exit(1); } const schemas: SchemaEntry[] = []; for (const schemaPathRel of matches) { const schemaPath = Path.join(inputPath, schemaPathRel); const schemaUrl = `file:///${schemaPathRel}`; const schemaData = await Fs.readFile(schemaPath, 'utf8'); const preferredName = Path.basename(schemaPath, Path.extname(schemaPath)); const schema = JSON.parse(schemaData); schemas.push({ schema, uri: schemaUrl, preferredName, }); } const { generateCodecCode } = await import('./index'); const generated = await generateCodecCode(schemas); if (typeof output === 'string') { const outputPath = Path.resolve(process.cwd(), output); await Promise.all([ Fs.writeFile(Path.join(outputPath, 'index.js'), generated.javaScript), Fs.writeFile(Path.join(outputPath, 'index.d.ts'), generated.typeDefinitions), ]); } else { console.log(JSON.stringify(generated, null, 2)); } } ).argv;
ggoodman/json-schema-codec-generator
src/stub/types.ts
<reponame>ggoodman/json-schema-codec-generator<gh_stars>1-10 export interface Codec<T> { /** * Identify function returning the given argument as a value matching the schema. * * This can be useful to use in non-TypeScript code to construct a valid object while * benefitting from suggestions from a TypeScript language service. */ identity(obj: T): T; /** * Check if a value matches the schema. */ is(obj: unknown): obj is T; /** * Validate that a value matches the schema and throws if not. */ validate(obj: unknown): T; } export interface ErrorObject { keyword: string; instancePath: string; schemaPath: string; params: { [key: string]: unknown }; propertyName?: string; message?: string; schema?: unknown; data: unknown; } export declare class ValidationError extends Error { static isValidationError(err: unknown): err is ValidationError; readonly validatorErrors: ErrorObject[]; readonly value: unknown; constructor(schemaName: string, value: unknown, validatorErrors: ErrorObject[]); } export interface ValidateFunction<T = unknown> { (data: unknown): data is T; errors?: ErrorObject[]; }
zhoulvming/mycrabs
client/src/app/app-routing.module.ts
<filename>client/src/app/app-routing.module.ts import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home'; import { TopicListComponent } from './topic-list'; import { TopicDetailComponent } from './topic-detail'; const routes: Routes = [ { path: '', component: HomeComponent }, { path: 'topics/v2ex/:tab', component: TopicListComponent }, { path: 'topics/cnode/:tab', component: TopicListComponent }, { path: 'topic_cnode/:id', component: TopicDetailComponent }, { path: 'topic_v2ex/:id', component: TopicDetailComponent } ]; /** * { useHash: true } 设置的作用是避免与node服务的url冲突,导致刷新时候不走angular的路由 * * @export * @class AppRoutingModule */ @NgModule({ imports: [RouterModule.forRoot(routes, { useHash: true })], exports: [RouterModule], providers: [], }) export class AppRoutingModule { }
zhoulvming/mycrabs
client/src/app/topic-reply/index.ts
<reponame>zhoulvming/mycrabs export * from './topic-reply.component';
zhoulvming/mycrabs
client/src/app/shared/models/reply.ts
<gh_stars>0 export class Reply { id: string; content: string; member: { id: string, username: string, avatar_mini: string, avatar_normal: string, avatar_large: string }; created: string; last_modified: string; }
zhoulvming/mycrabs
client/src/app/topic-list/topic-list.component.ts
<filename>client/src/app/topic-list/topic-list.component.ts // import { Component, OnInit } from '@angular/core'; import { Component, Input, OnInit, trigger, state, style, transition, animate } from '@angular/core'; import {MdSidenav, MdDialog, MdDialogConfig} from "@angular/material"; import { ActivatedRoute, Router, Params } from '@angular/router'; import { TopicService } from '../shared/services/topic.service'; import { Topic } from '../shared/models/topic'; import { AppState, AppUtil } from '../shared/services/app.service'; @Component({ selector: 'app-topic-list', templateUrl: './topic-list.component.html', styleUrls: ['./topic-list.component.css'], providers: [ TopicService ], }) export class TopicListComponent implements OnInit { channel = ''; tab = ''; loadError = false; topics: Topic[]; constructor( public appState: AppState, public appUtil: AppUtil, public topicService: TopicService, private route: ActivatedRoute, private router: Router) { } ngOnInit() { // 当前channel设定 this.setCurrentChannel(); // 列表数据获取 this.getListData(); } private setCurrentChannel() { let channelInMemory = this.appState.state['CURRENT_CHANNEL']; if (channelInMemory) { this.channel = channelInMemory; } else { let currentPath = this.appUtil.getCurrentPath(this.route); this.channel = currentPath.split('/')[2]; this.tab = currentPath.split('/')[3]; this.appState.set('CURRENT_CHANNEL', this.channel); } } private getListData() { let list_data_key = 'topics_' + this.channel; let topicsInMemory = this.appState.state[list_data_key]; if (topicsInMemory) { console.log('get list data('+ this.channel +') from cache'); this.topics = topicsInMemory; } else { this.topicService.getTopics(this.channel, this.tab) .then(topics => { console.log('get list data from remote server('+ this.channel +')'); this.topics = topics; this.appState.set(list_data_key, topics); }) .catch(err => this.loadError = true); } } onSelect(topic) { this.appState.set('CURRENT_TOPIC', topic); let link = ['/topic_' + this.channel, topic.id]; this.router.navigate(link); } }
zhoulvming/mycrabs
client/src/app/topic-reply/topic-reply.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { TopicService } from '../shared/services/topic.service'; import { Reply } from '../shared/models/reply'; @Component({ selector: 'topic-reply', templateUrl: './topic-reply.component.html', styleUrls: ['./topic-reply.component.css'] }) export class TopicReplyComponent implements OnInit { @Input() replies: Reply[]; constructor( public topicService: TopicService) { } ngOnInit() { } private getV2exReplies() { } }
zhoulvming/mycrabs
client/src/app/app.component.ts
<reponame>zhoulvming/mycrabs<gh_stars>0 import { Component } from '@angular/core'; import { ActivatedRoute, Router, Params } from '@angular/router'; import { AppUtil } from './shared/services/app.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { constructor( public appUtil: AppUtil, private route: ActivatedRoute, private router: Router ) {} gotoCommunity(channel) { let link = ['/topics/' + channel, 'all']; this.router.navigate(link); } }
zhoulvming/mycrabs
client/src/app/topic-detail/topic-detail.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Topic } from '../shared/models/topic'; import { Reply } from '../shared/models/reply'; import { AppState } from '../shared/services/app.service'; import { TopicReplyComponent } from '../topic-reply'; import { TopicService } from '../shared/services/topic.service'; import { AppUtil } from '../shared/services/app.service'; @Component({ selector: 'topic-detail', templateUrl: './topic-detail.component.html', styleUrls: ['./topic-detail.component.css'], providers: [ TopicService, AppUtil ], }) export class TopicDetailComponent implements OnInit { channel = ''; loadError = false; currentTopic: Topic; public replies: Reply[]; constructor( public appState: AppState, private topicService: TopicService, private appUtil: AppUtil, private route: ActivatedRoute) { } ngOnInit() { // 当前channel设定 this.setCurrentChannel(); // 获取详细数据 this.getDetailData(); } private getDetailData() { let topic_id; this.currentTopic = this.appState.state['CURRENT_TOPIC']; if (this.currentTopic) { // 说明是从一栏页面点击过来的 topic_id = this.currentTopic.id; } else { // 说明是url地址过来的 this.route.params.forEach((params: Params) => { topic_id = params['id']; }); } this.topicService.getDetailData(this.channel, topic_id) .then(topic => { if (!this.currentTopic) { // 该场合表示刷新url的场合 this.currentTopic = new Topic(); this.currentTopic.id = topic_id; this.currentTopic.title = topic.title; } this.currentTopic.content = topic.content; this.replies = topic.replies; }).catch(err => this.loadError = true); } private setCurrentChannel() { let channelInMemory = this.appState.state['CURRENT_CHANNEL']; if (channelInMemory) { this.channel = channelInMemory; } else { let currentPath = this.appUtil.getCurrentPath(this.route); this.channel = currentPath.split('/')[1]; this.channel = this.channel.split('_')[1]; this.appState.set('CURRENT_CHANNEL', this.channel); } } gotoBack() { window.history.back(); } }
zhoulvming/mycrabs
client/src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; // 在app.module.ts中引入MaterialModule import { MaterialModule } from '@angular/material'; // 页面组件 import { AppComponent } from './app.component'; import { SidebarComponent } from './sidebar/sidebar.component'; import { HomeComponent } from './home/home.component'; import { AppRoutingModule } from './app-routing.module'; import { TopicListComponent } from './topic-list/topic-list.component'; import { TopicDetailComponent } from './topic-detail/topic-detail.component'; import { AppState, InteralStateType, AppUtil } from './shared/services/app.service'; import { TopicReplyComponent } from './topic-reply/topic-reply.component'; // Application wide providers const APP_PROVIDERS = [ AppState, AppUtil ]; @NgModule({ declarations: [ AppComponent, SidebarComponent, HomeComponent, TopicListComponent, TopicDetailComponent, TopicReplyComponent ], imports: [ BrowserModule, FormsModule, HttpModule, MaterialModule.forRoot(), AppRoutingModule ], providers: [APP_PROVIDERS], bootstrap: [AppComponent] }) export class AppModule { }
zhoulvming/mycrabs
client/src/app/shared/services/topic.service.ts
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Topic } from '../models/topic'; import { Reply } from '../models/reply'; import 'rxjs/add/operator/toPromise'; @Injectable() export class TopicService { constructor(public http: Http) { } private handleError(error: any): Promise<any> { console.error('An service error occurred', error); // for demo purposes only return Promise.reject(error.message || error); } getTopics(channel, tab): Promise<Topic[]> { let url = ''; if (channel == 'cnode') { url = 'http://localhost:3000/cnode-api/topics'; } else if (channel == 'v2ex') { url = 'http://localhost:3000/v2exList'; } return this.http.get(url) .toPromise() .then(response => { let topics: Topic[] = []; response.json().forEach(item => { topics.push({ id: item.id, title: item.title, created: item.created, author_id: item.author_id, author_name: item.author_name, author_avatar_mini: item.author_avatar_mini, replies_count: item.replies_count, content_url: item.content_url, content: '' }); }); return topics; }) .catch(this.handleError); } getDetailData(channel, id): Promise<any> { if (channel == 'cnode') { return this.getCnodeDetailData(id); } else { return this.getCnodeDetailData(id); } } private getCnodeDetailData(id): Promise<any> { return this.http.get('http://localhost:3000/cnode-api/topic/'+id).toPromise() .then(response => { let topic = response.json(); return topic; }) .catch(this.handleError); } private getV2exDetailData(id): Promise<any> { return null; } getV2exReplyData(id): Promise<Reply[]> { return this.http.get('v2ex_reply?topic_id=' + id).toPromise() .then(response => { let replies: Reply[] = []; response.json().forEach(item => { replies.push({ id: item.id, content: item.content_rendered, member: { id: item.member.id, username: item.member.username, avatar_mini: item.member.avatar_mini, avatar_normal: item.member.avatar_normal, avatar_large: item.member.avatar_large }, created: item.created, last_modified: item.last_modified }); }); return replies; }) .catch(this.handleError); } }
zhoulvming/mycrabs
client/src/app/topic-list/index.ts
export * from './topic-list.component';
zhoulvming/mycrabs
client/src/app/shared/models/topic.ts
<filename>client/src/app/shared/models/topic.ts export class Topic { id: string; title: string; created: string; author_id: string; author_name: string; author_avatar_mini: string; content: string = ''; replies_count: string; content_url: string; }
DerSchmale/spirv4web
src/utils/set_compare.ts
<gh_stars>0 export function set_compare<T>(a: Set<T>, b: Set<T>): boolean { if (a.size !== b.size) return false; for (let it = a.values(), val:T = null; (val = it.next().value); ) { if (!b.has(val)) return false; } return true; }
DerSchmale/spirv4web
src/compiler/glsl/PlsRemap.ts
<reponame>DerSchmale/spirv4web import { PlsFormat } from "./glsl"; export class PlsRemap { id: number; format: PlsFormat; constructor(id: number, format: PlsFormat) { this.id = id; this.format = format; } }
DerSchmale/spirv4web
build/types/spirv/SamplerFilterMode.d.ts
export declare enum SamplerFilterMode { Nearest = 0, Linear = 1, Max = 2147483647 }
DerSchmale/spirv4web
src/common/SPIRFunction.ts
<reponame>DerSchmale/spirv4web<filename>src/common/SPIRFunction.ts import { IVariant } from "./IVariant"; import { Types } from "./Types"; import { defaultClone, defaultCopy } from "../utils/defaultCopy"; export class SPIRFunctionParameter { type: TypeID; id: ID; read_count: number; write_count: number; // Set to true if this parameter aliases a global variable, // used mostly in Metal where global variables // have to be passed down to functions as regular arguments. // However, for this kind of variable, we should not care about // read and write counts as access to the function arguments // is not local to the function in question. alias_global_variable: boolean; constructor(type: TypeID = 0, id: ID = 0, read_count: number = 0, write_count: number = 0, alias_global_variable: boolean = false) { this.type = type; this.id = id; this.read_count = read_count; this.write_count = write_count; this.alias_global_variable = alias_global_variable; } clone() { return defaultClone(SPIRFunctionParameter, this); } } // When calling a function, and we're remapping separate image samplers, // resolve these arguments into combined image samplers and pass them // as additional arguments in this order. // It gets more complicated as functions can pull in their own globals // and combine them with parameters, // so we need to distinguish if something is local parameter index // or a global ID. export class SPIRFunctionCombinedImageSamplerParameter { id: VariableID; image_id: VariableID; sampler_id: VariableID; global_image: boolean; global_sampler: boolean; depth: boolean; clone() { return defaultClone(SPIRFunctionCombinedImageSamplerParameter, this); } constructor(); constructor(id: VariableID, image_id: VariableID, sampler_id: VariableID, global_image: boolean, global_sampler: boolean, depth: boolean); constructor(id: VariableID = 0, image_id: VariableID = 0, sampler_id: VariableID = 0, global_image: boolean = false, global_sampler: boolean = false, depth: boolean = false) { this.id = id; this.image_id = image_id; this.sampler_id = sampler_id; this.global_image = global_image; this.global_sampler = global_sampler; this.depth = depth; } } export class SPIRVFunctionEntryLine { file_id: number = 0; line_literal: number = 0; clone() { return defaultClone(SPIRVFunctionEntryLine, this); } } export class SPIRFunction extends IVariant { static type = Types.Function; return_type: TypeID; function_type: TypeID; arguments: SPIRFunctionParameter[] = []; // Can be used by backends to add magic arguments. // Currently used by combined image/sampler implementation. shadow_arguments: SPIRFunctionParameter[] = []; local_variables: VariableID[] = []; entry_block: BlockID = 0; blocks: BlockID[] = []; combined_parameters: SPIRFunctionCombinedImageSamplerParameter[] = []; entry_line: SPIRVFunctionEntryLine = new SPIRVFunctionEntryLine(); // Hooks to be run when the function returns. // Mostly used for lowering internal data structures onto flattened structures. // Need to defer this, because they might rely on things which change during compilation. // Intentionally not a small vector, this one is rare, and std::function can be large. fixup_hooks_out: (() => void)[] = []; // Hooks to be run when the function begins. // Mostly used for populating internal data structures from flattened structures. // Need to defer this, because they might rely on things which change during compilation. // Intentionally not a small vector, this one is rare, and std::function can be large. fixup_hooks_in: (() => void)[] = []; // On function entry, make sure to copy a constant array into thread addr space to work around // the case where we are passing a constant array by value to a function on backends which do not // consider arrays value types. constant_arrays_needed_on_stack: ID[] = []; active: boolean = false; flush_undeclared: boolean = true; do_combined_parameters: boolean = true; constructor(other: SPIRFunction); constructor(return_type: TypeID, function_type: TypeID); constructor(param0: TypeID | SPIRFunction, function_type?: TypeID) { super(); if (param0 instanceof SPIRFunction) defaultCopy(param0, this); else { this.return_type = param0; this.function_type = function_type; } } add_local_variable(id: VariableID) { this.local_variables.push(id); } add_parameter(parameter_type: TypeID, id: ID, alias_global_variable: boolean = false) { // Arguments are read-only until proven otherwise. this.arguments.push(new SPIRFunctionParameter(parameter_type, id, 0, 0, alias_global_variable)); } }
DerSchmale/spirv4web
src/compiler/OpcodeHandler.ts
import { SPIRBlock } from "../common/SPIRBlock"; import { SPIRFunction } from "../common/SPIRFunction"; import { Op } from "../spirv/Op"; export abstract class OpcodeHandler { abstract handle(opcode: Op, args: Uint32Array, length: number): boolean; handle_terminator(_: SPIRBlock): boolean { return true; } follow_function_call(_: SPIRFunction): boolean { return true; } set_current_block(_: SPIRBlock) { } // Called after returning from a function or when entering a block, // can be called multiple times per block, // while set_current_block is only called on block entry. rearm_current_block(_: SPIRBlock) { } begin_function_scope(_: Uint32Array, __: number): boolean { return true; } end_function_scope(_: Uint32Array, __: number): boolean { return true; } }
DerSchmale/spirv4web
src/spirv/SelectionControlShift.ts
export enum SelectionControlShift { Flatten = 0, DontFlatten = 1, Max = 0x7fffffff, }
DerSchmale/spirv4web
build/types/compiler/EntryPoint.d.ts
import { ExecutionModel } from "../spirv/ExecutionModel"; export declare class EntryPoint { name: string; execution_model: ExecutionModel; constructor(name: string, model: ExecutionModel); }
DerSchmale/spirv4web
build/types/utils/ensure_types.d.ts
<reponame>DerSchmale/spirv4web export declare function uint32(value: number): number;
DerSchmale/spirv4web
src/compiler/CFGBuilder.ts
<reponame>DerSchmale/spirv4web<filename>src/compiler/CFGBuilder.ts import { OpcodeHandler } from "./OpcodeHandler"; import { Compiler } from "./Compiler"; import { SPIRFunction } from "../common/SPIRFunction"; import { CFG } from "../cfg/CFG"; import { Op } from "../spirv/Op"; export class CFGBuilder extends OpcodeHandler { compiler: Compiler; // original is map function_cfgs: CFG[] = []; constructor(compiler: Compiler) { super(); this.compiler = compiler; } handle(opcode: Op, args: Uint32Array, length: number): boolean { return true; } follow_function_call(func: SPIRFunction): boolean { if (!this.function_cfgs.hasOwnProperty(func.self)) { this.function_cfgs[func.self] = new CFG(this.compiler, func); return true; } else return false; } }
DerSchmale/spirv4web
build/types/compiler/glsl/glsl.d.ts
export declare const GLSLstd450Version = 100; export declare const GLSLstd450Revision = 3; export declare enum GLSLstd450 { Bad = 0, Round = 1, RoundEven = 2, Trunc = 3, FAbs = 4, SAbs = 5, FSign = 6, SSign = 7, Floor = 8, Ceil = 9, Fract = 10, Radians = 11, Degrees = 12, Sin = 13, Cos = 14, Tan = 15, Asin = 16, Acos = 17, Atan = 18, Sinh = 19, Cosh = 20, Tanh = 21, Asinh = 22, Acosh = 23, Atanh = 24, Atan2 = 25, Pow = 26, Exp = 27, Log = 28, Exp2 = 29, Log2 = 30, Sqrt = 31, InverseSqrt = 32, Determinant = 33, MatrixInverse = 34, Modf = 35, ModfStruct = 36, FMin = 37, UMin = 38, SMin = 39, FMax = 40, UMax = 41, SMax = 42, FClamp = 43, UClamp = 44, SClamp = 45, FMix = 46, IMix = 47, Step = 48, SmoothStep = 49, Fma = 50, Frexp = 51, FrexpStruct = 52, Ldexp = 53, PackSnorm4x8 = 54, PackUnorm4x8 = 55, PackSnorm2x16 = 56, PackUnorm2x16 = 57, PackHalf2x16 = 58, PackDouble2x32 = 59, UnpackSnorm2x16 = 60, UnpackUnorm2x16 = 61, UnpackHalf2x16 = 62, UnpackSnorm4x8 = 63, UnpackUnorm4x8 = 64, UnpackDouble2x32 = 65, Length = 66, Distance = 67, Cross = 68, Normalize = 69, FaceForward = 70, Reflect = 71, Refract = 72, FindILsb = 73, FindSMsb = 74, FindUMsb = 75, InterpolateAtCentroid = 76, InterpolateAtSample = 77, InterpolateAtOffset = 78, NMin = 79, NMax = 80, NClamp = 81, Count = 82 } export declare enum PlsFormat { None = 0, R11FG11FB10F = 1, R32F = 2, RG16F = 3, RGB10A2 = 4, RGBA8 = 5, RG16 = 6, RGBA8I = 7, RG16I = 8, RGB10A2UI = 9, RGBA8UI = 10, RG16UI = 11, R32UI = 12 } export declare class BackendVariations { discard_literal: string; demote_literal: string; null_pointer_literal: string; float_literal_suffix: boolean; double_literal_suffix: boolean; uint32_t_literal_suffix: boolean; long_long_literal_suffix: boolean; basic_int_type: string; basic_uint_type: string; basic_int8_type: string; basic_uint8_type: string; basic_int16_type: string; basic_uint16_type: string; int16_t_literal_suffix: string; uint16_t_literal_suffix: string; nonuniform_qualifier: string; swizzle_is_function: boolean; shared_is_implied: boolean; unsized_array_supported: boolean; explicit_struct_type: boolean; use_initializer_list: boolean; use_typed_initializer_list: boolean; can_declare_struct_inline: boolean; can_declare_arrays_inline: boolean; native_row_major_matrix: boolean; use_constructor_splatting: boolean; allow_precision_qualifiers: boolean; can_swizzle_scalar: boolean; force_gl_in_out_block: boolean; can_return_array: boolean; allow_truncated_access_chain: boolean; supports_extensions: boolean; supports_empty_struct: boolean; array_is_value_type: boolean; buffer_offset_array_is_value_type: boolean; comparison_image_samples_scalar: boolean; native_pointers: boolean; support_small_type_sampling_result: boolean; support_case_fallthrough: boolean; use_array_constructor: boolean; needs_row_major_load_workaround: boolean; support_pointer_to_pointer: boolean; support_precise_qualifier: boolean; support_64bit_switch: boolean; workgroup_size_is_hidden: boolean; }
DerSchmale/spirv4web
build/types/spirv.d.ts
export declare const MagicNumber = 119734787; export declare const Version = 66816; export declare const Revision = 4; export declare const OpCodeMask = 65535; export declare const WordCountShift = 16; export declare enum SourceLanguage { SourceLanguageUnknown = 0, SourceLanguageESSL = 1, SourceLanguageGLSL = 2, SourceLanguageOpenCL_C = 3, SourceLanguageOpenCL_CPP = 4, SourceLanguageHLSL = 5, SourceLanguageMax = 2147483647 } export declare enum ExecutionModel { ExecutionModelVertex = 0, ExecutionModelTessellationControl = 1, ExecutionModelTessellationEvaluation = 2, ExecutionModelGeometry = 3, ExecutionModelFragment = 4, ExecutionModelGLCompute = 5, ExecutionModelKernel = 6, ExecutionModelTaskNV = 5267, ExecutionModelMeshNV = 5268, ExecutionModelRayGenerationKHR = 5313, ExecutionModelRayGenerationNV = 5313, ExecutionModelIntersectionKHR = 5314, ExecutionModelIntersectionNV = 5314, ExecutionModelAnyHitKHR = 5315, ExecutionModelAnyHitNV = 5315, ExecutionModelClosestHitKHR = 5316, ExecutionModelClosestHitNV = 5316, ExecutionModelMissKHR = 5317, ExecutionModelMissNV = 5317, ExecutionModelCallableKHR = 5318, ExecutionModelCallableNV = 5318, ExecutionModelMax = 2147483647 } export declare enum AddressingModel { AddressingModelLogical = 0, AddressingModelPhysical32 = 1, AddressingModelPhysical64 = 2, AddressingModelPhysicalStorageBuffer64 = 5348, AddressingModelPhysicalStorageBuffer64EXT = 5348, AddressingModelMax = 2147483647 } export declare enum MemoryModel { MemoryModelSimple = 0, MemoryModelGLSL450 = 1, MemoryModelOpenCL = 2, MemoryModelVulkan = 3, MemoryModelVulkanKHR = 3, MemoryModelMax = 2147483647 } export declare enum ExecutionMode { ExecutionModeInvocations = 0, ExecutionModeSpacingEqual = 1, ExecutionModeSpacingFractionalEven = 2, ExecutionModeSpacingFractionalOdd = 3, ExecutionModeVertexOrderCw = 4, ExecutionModeVertexOrderCcw = 5, ExecutionModePixelCenterInteger = 6, ExecutionModeOriginUpperLeft = 7, ExecutionModeOriginLowerLeft = 8, ExecutionModeEarlyFragmentTests = 9, ExecutionModePointMode = 10, ExecutionModeXfb = 11, ExecutionModeDepthReplacing = 12, ExecutionModeDepthGreater = 14, ExecutionModeDepthLess = 15, ExecutionModeDepthUnchanged = 16, ExecutionModeLocalSize = 17, ExecutionModeLocalSizeHint = 18, ExecutionModeInputPoints = 19, ExecutionModeInputLines = 20, ExecutionModeInputLinesAdjacency = 21, ExecutionModeTriangles = 22, ExecutionModeInputTrianglesAdjacency = 23, ExecutionModeQuads = 24, ExecutionModeIsolines = 25, ExecutionModeOutputVertices = 26, ExecutionModeOutputPoints = 27, ExecutionModeOutputLineStrip = 28, ExecutionModeOutputTriangleStrip = 29, ExecutionModeVecTypeHint = 30, ExecutionModeContractionOff = 31, ExecutionModeInitializer = 33, ExecutionModeFinalizer = 34, ExecutionModeSubgroupSize = 35, ExecutionModeSubgroupsPerWorkgroup = 36, ExecutionModeSubgroupsPerWorkgroupId = 37, ExecutionModeLocalSizeId = 38, ExecutionModeLocalSizeHintId = 39, ExecutionModePostDepthCoverage = 4446, ExecutionModeDenormPreserve = 4459, ExecutionModeDenormFlushToZero = 4460, ExecutionModeSignedZeroInfNanPreserve = 4461, ExecutionModeRoundingModeRTE = 4462, ExecutionModeRoundingModeRTZ = 4463, ExecutionModeStencilRefReplacingEXT = 5027, ExecutionModeOutputLinesNV = 5269, ExecutionModeOutputPrimitivesNV = 5270, ExecutionModeDerivativeGroupQuadsNV = 5289, ExecutionModeDerivativeGroupLinearNV = 5290, ExecutionModeOutputTrianglesNV = 5298, ExecutionModePixelInterlockOrderedEXT = 5366, ExecutionModePixelInterlockUnorderedEXT = 5367, ExecutionModeSampleInterlockOrderedEXT = 5368, ExecutionModeSampleInterlockUnorderedEXT = 5369, ExecutionModeShadingRateInterlockOrderedEXT = 5370, ExecutionModeShadingRateInterlockUnorderedEXT = 5371, ExecutionModeMaxWorkgroupSizeINTEL = 5893, ExecutionModeMaxWorkDimINTEL = 5894, ExecutionModeNoGlobalOffsetINTEL = 5895, ExecutionModeNumSIMDWorkitemsINTEL = 5896, ExecutionModeMax = 2147483647 } export declare enum StorageClass { StorageClassUniformConstant = 0, StorageClassInput = 1, StorageClassUniform = 2, StorageClassOutput = 3, StorageClassWorkgroup = 4, StorageClassCrossWorkgroup = 5, StorageClassPrivate = 6, StorageClassFunction = 7, StorageClassGeneric = 8, StorageClassPushConstant = 9, StorageClassAtomicCounter = 10, StorageClassImage = 11, StorageClassStorageBuffer = 12, StorageClassCallableDataKHR = 5328, StorageClassCallableDataNV = 5328, StorageClassIncomingCallableDataKHR = 5329, StorageClassIncomingCallableDataNV = 5329, StorageClassRayPayloadKHR = 5338, StorageClassRayPayloadNV = 5338, StorageClassHitAttributeKHR = 5339, StorageClassHitAttributeNV = 5339, StorageClassIncomingRayPayloadKHR = 5342, StorageClassIncomingRayPayloadNV = 5342, StorageClassShaderRecordBufferKHR = 5343, StorageClassShaderRecordBufferNV = 5343, StorageClassPhysicalStorageBuffer = 5349, StorageClassPhysicalStorageBufferEXT = 5349, StorageClassCodeSectionINTEL = 5605, StorageClassMax = 2147483647 } export declare enum Dim { Dim1D = 0, Dim2D = 1, Dim3D = 2, DimCube = 3, DimRect = 4, DimBuffer = 5, DimSubpassData = 6, DimMax = 2147483647 } export declare enum SamplerAddressingMode { SamplerAddressingModeNone = 0, SamplerAddressingModeClampToEdge = 1, SamplerAddressingModeClamp = 2, SamplerAddressingModeRepeat = 3, SamplerAddressingModeRepeatMirrored = 4, SamplerAddressingModeMax = 2147483647 } export declare enum SamplerFilterMode { SamplerFilterModeNearest = 0, SamplerFilterModeLinear = 1, SamplerFilterModeMax = 2147483647 } export declare enum ImageFormat { ImageFormatUnknown = 0, ImageFormatRgba32f = 1, ImageFormatRgba16f = 2, ImageFormatR32f = 3, ImageFormatRgba8 = 4, ImageFormatRgba8Snorm = 5, ImageFormatRg32f = 6, ImageFormatRg16f = 7, ImageFormatR11fG11fB10f = 8, ImageFormatR16f = 9, ImageFormatRgba16 = 10, ImageFormatRgb10A2 = 11, ImageFormatRg16 = 12, ImageFormatRg8 = 13, ImageFormatR16 = 14, ImageFormatR8 = 15, ImageFormatRgba16Snorm = 16, ImageFormatRg16Snorm = 17, ImageFormatRg8Snorm = 18, ImageFormatR16Snorm = 19, ImageFormatR8Snorm = 20, ImageFormatRgba32i = 21, ImageFormatRgba16i = 22, ImageFormatRgba8i = 23, ImageFormatR32i = 24, ImageFormatRg32i = 25, ImageFormatRg16i = 26, ImageFormatRg8i = 27, ImageFormatR16i = 28, ImageFormatR8i = 29, ImageFormatRgba32ui = 30, ImageFormatRgba16ui = 31, ImageFormatRgba8ui = 32, ImageFormatR32ui = 33, ImageFormatRgb10a2ui = 34, ImageFormatRg32ui = 35, ImageFormatRg16ui = 36, ImageFormatRg8ui = 37, ImageFormatR16ui = 38, ImageFormatR8ui = 39, ImageFormatR64ui = 40, ImageFormatR64i = 41, ImageFormatMax = 2147483647 } export declare enum ImageChannelOrder { ImageChannelOrderR = 0, ImageChannelOrderA = 1, ImageChannelOrderRG = 2, ImageChannelOrderRA = 3, ImageChannelOrderRGB = 4, ImageChannelOrderRGBA = 5, ImageChannelOrderBGRA = 6, ImageChannelOrderARGB = 7, ImageChannelOrderIntensity = 8, ImageChannelOrderLuminance = 9, ImageChannelOrderRx = 10, ImageChannelOrderRGx = 11, ImageChannelOrderRGBx = 12, ImageChannelOrderDepth = 13, ImageChannelOrderDepthStencil = 14, ImageChannelOrdersRGB = 15, ImageChannelOrdersRGBx = 16, ImageChannelOrdersRGBA = 17, ImageChannelOrdersBGRA = 18, ImageChannelOrderABGR = 19, ImageChannelOrderMax = 2147483647 } export declare enum ImageChannelDataType { ImageChannelDataTypeSnormInt8 = 0, ImageChannelDataTypeSnormInt16 = 1, ImageChannelDataTypeUnormInt8 = 2, ImageChannelDataTypeUnormInt16 = 3, ImageChannelDataTypeUnormShort565 = 4, ImageChannelDataTypeUnormShort555 = 5, ImageChannelDataTypeUnormInt101010 = 6, ImageChannelDataTypeSignedInt8 = 7, ImageChannelDataTypeSignedInt16 = 8, ImageChannelDataTypeSignedInt32 = 9, ImageChannelDataTypeUnsignedInt8 = 10, ImageChannelDataTypeUnsignedInt16 = 11, ImageChannelDataTypeUnsignedInt32 = 12, ImageChannelDataTypeHalfFloat = 13, ImageChannelDataTypeFloat = 14, ImageChannelDataTypeUnormInt24 = 15, ImageChannelDataTypeUnormInt101010_2 = 16, ImageChannelDataTypeMax = 2147483647 } export declare enum ImageOperandsShift { ImageOperandsBiasShift = 0, ImageOperandsLodShift = 1, ImageOperandsGradShift = 2, ImageOperandsConstOffsetShift = 3, ImageOperandsOffsetShift = 4, ImageOperandsConstOffsetsShift = 5, ImageOperandsSampleShift = 6, ImageOperandsMinLodShift = 7, ImageOperandsMakeTexelAvailableShift = 8, ImageOperandsMakeTexelAvailableKHRShift = 8, ImageOperandsMakeTexelVisibleShift = 9, ImageOperandsMakeTexelVisibleKHRShift = 9, ImageOperandsNonPrivateTexelShift = 10, ImageOperandsNonPrivateTexelKHRShift = 10, ImageOperandsVolatileTexelShift = 11, ImageOperandsVolatileTexelKHRShift = 11, ImageOperandsSignExtendShift = 12, ImageOperandsZeroExtendShift = 13, ImageOperandsMax = 2147483647 } export declare enum ImageOperandsMask { ImageOperandsMaskNone = 0, ImageOperandsBiasMask = 1, ImageOperandsLodMask = 2, ImageOperandsGradMask = 4, ImageOperandsConstOffsetMask = 8, ImageOperandsOffsetMask = 16, ImageOperandsConstOffsetsMask = 32, ImageOperandsSampleMask = 64, ImageOperandsMinLodMask = 128, ImageOperandsMakeTexelAvailableMask = 256, ImageOperandsMakeTexelAvailableKHRMask = 256, ImageOperandsMakeTexelVisibleMask = 512, ImageOperandsMakeTexelVisibleKHRMask = 512, ImageOperandsNonPrivateTexelMask = 1024, ImageOperandsNonPrivateTexelKHRMask = 1024, ImageOperandsVolatileTexelMask = 2048, ImageOperandsVolatileTexelKHRMask = 2048, ImageOperandsSignExtendMask = 4096, ImageOperandsZeroExtendMask = 8192 } export declare enum FPFastMathModeShift { FPFastMathModeNotNaNShift = 0, FPFastMathModeNotInfShift = 1, FPFastMathModeNSZShift = 2, FPFastMathModeAllowRecipShift = 3, FPFastMathModeFastShift = 4, FPFastMathModeMax = 2147483647 } export declare enum FPFastMathModeMask { FPFastMathModeMaskNone = 0, FPFastMathModeNotNaNMask = 1, FPFastMathModeNotInfMask = 2, FPFastMathModeNSZMask = 4, FPFastMathModeAllowRecipMask = 8, FPFastMathModeFastMask = 16 } export declare enum FPRoundingMode { FPRoundingModeRTE = 0, FPRoundingModeRTZ = 1, FPRoundingModeRTP = 2, FPRoundingModeRTN = 3, FPRoundingModeMax = 2147483647 } export declare enum LinkageType { LinkageTypeExport = 0, LinkageTypeImport = 1, LinkageTypeMax = 2147483647 } export declare enum AccessQualifier { AccessQualifierReadOnly = 0, AccessQualifierWriteOnly = 1, AccessQualifierReadWrite = 2, AccessQualifierMax = 2147483647 } export declare enum FunctionParameterAttribute { FunctionParameterAttributeZext = 0, FunctionParameterAttributeSext = 1, FunctionParameterAttributeByVal = 2, FunctionParameterAttributeSret = 3, FunctionParameterAttributeNoAlias = 4, FunctionParameterAttributeNoCapture = 5, FunctionParameterAttributeNoWrite = 6, FunctionParameterAttributeNoReadWrite = 7, FunctionParameterAttributeMax = 2147483647 } export declare enum Decoration { DecorationRelaxedPrecision = 0, DecorationSpecId = 1, DecorationBlock = 2, DecorationBufferBlock = 3, DecorationRowMajor = 4, DecorationColMajor = 5, DecorationArrayStride = 6, DecorationMatrixStride = 7, DecorationGLSLShared = 8, DecorationGLSLPacked = 9, DecorationCPacked = 10, DecorationBuiltIn = 11, DecorationNoPerspective = 13, DecorationFlat = 14, DecorationPatch = 15, DecorationCentroid = 16, DecorationSample = 17, DecorationInvariant = 18, DecorationRestrict = 19, DecorationAliased = 20, DecorationVolatile = 21, DecorationConstant = 22, DecorationCoherent = 23, DecorationNonWritable = 24, DecorationNonReadable = 25, DecorationUniform = 26, DecorationUniformId = 27, DecorationSaturatedConversion = 28, DecorationStream = 29, DecorationLocation = 30, DecorationComponent = 31, DecorationIndex = 32, DecorationBinding = 33, DecorationDescriptorSet = 34, DecorationOffset = 35, DecorationXfbBuffer = 36, DecorationXfbStride = 37, DecorationFuncParamAttr = 38, DecorationFPRoundingMode = 39, DecorationFPFastMathMode = 40, DecorationLinkageAttributes = 41, DecorationNoContraction = 42, DecorationInputAttachmentIndex = 43, DecorationAlignment = 44, DecorationMaxByteOffset = 45, DecorationAlignmentId = 46, DecorationMaxByteOffsetId = 47, DecorationNoSignedWrap = 4469, DecorationNoUnsignedWrap = 4470, DecorationExplicitInterpAMD = 4999, DecorationOverrideCoverageNV = 5248, DecorationPassthroughNV = 5250, DecorationViewportRelativeNV = 5252, DecorationSecondaryViewportRelativeNV = 5256, DecorationPerPrimitiveNV = 5271, DecorationPerViewNV = 5272, DecorationPerTaskNV = 5273, DecorationPerVertexNV = 5285, DecorationNonUniform = 5300, DecorationNonUniformEXT = 5300, DecorationRestrictPointer = 5355, DecorationRestrictPointerEXT = 5355, DecorationAliasedPointer = 5356, DecorationAliasedPointerEXT = 5356, DecorationReferencedIndirectlyINTEL = 5602, DecorationCounterBuffer = 5634, DecorationHlslCounterBufferGOOGLE = 5634, DecorationHlslSemanticGOOGLE = 5635, DecorationUserSemantic = 5635, DecorationUserTypeGOOGLE = 5636, DecorationRegisterINTEL = 5825, DecorationMemoryINTEL = 5826, DecorationNumbanksINTEL = 5827, DecorationBankwidthINTEL = 5828, DecorationMaxPrivateCopiesINTEL = 5829, DecorationSinglepumpINTEL = 5830, DecorationDoublepumpINTEL = 5831, DecorationMaxReplicatesINTEL = 5832, DecorationSimpleDualPortINTEL = 5833, DecorationMergeINTEL = 5834, DecorationBankBitsINTEL = 5835, DecorationForcePow2DepthINTEL = 5836, DecorationMax = 2147483647 } export declare enum BuiltIn { BuiltInPosition = 0, BuiltInPointSize = 1, BuiltInClipDistance = 3, BuiltInCullDistance = 4, BuiltInVertexId = 5, BuiltInInstanceId = 6, BuiltInPrimitiveId = 7, BuiltInInvocationId = 8, BuiltInLayer = 9, BuiltInViewportIndex = 10, BuiltInTessLevelOuter = 11, BuiltInTessLevelInner = 12, BuiltInTessCoord = 13, BuiltInPatchVertices = 14, BuiltInFragCoord = 15, BuiltInPointCoord = 16, BuiltInFrontFacing = 17, BuiltInSampleId = 18, BuiltInSamplePosition = 19, BuiltInSampleMask = 20, BuiltInFragDepth = 22, BuiltInHelperInvocation = 23, BuiltInNumWorkgroups = 24, BuiltInWorkgroupSize = 25, BuiltInWorkgroupId = 26, BuiltInLocalInvocationId = 27, BuiltInGlobalInvocationId = 28, BuiltInLocalInvocationIndex = 29, BuiltInWorkDim = 30, BuiltInGlobalSize = 31, BuiltInEnqueuedWorkgroupSize = 32, BuiltInGlobalOffset = 33, BuiltInGlobalLinearId = 34, BuiltInSubgroupSize = 36, BuiltInSubgroupMaxSize = 37, BuiltInNumSubgroups = 38, BuiltInNumEnqueuedSubgroups = 39, BuiltInSubgroupId = 40, BuiltInSubgroupLocalInvocationId = 41, BuiltInVertexIndex = 42, BuiltInInstanceIndex = 43, BuiltInSubgroupEqMask = 4416, BuiltInSubgroupEqMaskKHR = 4416, BuiltInSubgroupGeMask = 4417, BuiltInSubgroupGeMaskKHR = 4417, BuiltInSubgroupGtMask = 4418, BuiltInSubgroupGtMaskKHR = 4418, BuiltInSubgroupLeMask = 4419, BuiltInSubgroupLeMaskKHR = 4419, BuiltInSubgroupLtMask = 4420, BuiltInSubgroupLtMaskKHR = 4420, BuiltInBaseVertex = 4424, BuiltInBaseInstance = 4425, BuiltInDrawIndex = 4426, BuiltInPrimitiveShadingRateKHR = 4432, BuiltInDeviceIndex = 4438, BuiltInViewIndex = 4440, BuiltInShadingRateKHR = 4444, BuiltInBaryCoordNoPerspAMD = 4992, BuiltInBaryCoordNoPerspCentroidAMD = 4993, BuiltInBaryCoordNoPerspSampleAMD = 4994, BuiltInBaryCoordSmoothAMD = 4995, BuiltInBaryCoordSmoothCentroidAMD = 4996, BuiltInBaryCoordSmoothSampleAMD = 4997, BuiltInBaryCoordPullModelAMD = 4998, BuiltInFragStencilRefEXT = 5014, BuiltInViewportMaskNV = 5253, BuiltInSecondaryPositionNV = 5257, BuiltInSecondaryViewportMaskNV = 5258, BuiltInPositionPerViewNV = 5261, BuiltInViewportMaskPerViewNV = 5262, BuiltInFullyCoveredEXT = 5264, BuiltInTaskCountNV = 5274, BuiltInPrimitiveCountNV = 5275, BuiltInPrimitiveIndicesNV = 5276, BuiltInClipDistancePerViewNV = 5277, BuiltInCullDistancePerViewNV = 5278, BuiltInLayerPerViewNV = 5279, BuiltInMeshViewCountNV = 5280, BuiltInMeshViewIndicesNV = 5281, BuiltInBaryCoordNV = 5286, BuiltInBaryCoordNoPerspNV = 5287, BuiltInFragSizeEXT = 5292, BuiltInFragmentSizeNV = 5292, BuiltInFragInvocationCountEXT = 5293, BuiltInInvocationsPerPixelNV = 5293, BuiltInLaunchIdKHR = 5319, BuiltInLaunchIdNV = 5319, BuiltInLaunchSizeKHR = 5320, BuiltInLaunchSizeNV = 5320, BuiltInWorldRayOriginKHR = 5321, BuiltInWorldRayOriginNV = 5321, BuiltInWorldRayDirectionKHR = 5322, BuiltInWorldRayDirectionNV = 5322, BuiltInObjectRayOriginKHR = 5323, BuiltInObjectRayOriginNV = 5323, BuiltInObjectRayDirectionKHR = 5324, BuiltInObjectRayDirectionNV = 5324, BuiltInRayTminKHR = 5325, BuiltInRayTminNV = 5325, BuiltInRayTmaxKHR = 5326, BuiltInRayTmaxNV = 5326, BuiltInInstanceCustomIndexKHR = 5327, BuiltInInstanceCustomIndexNV = 5327, BuiltInObjectToWorldKHR = 5330, BuiltInObjectToWorldNV = 5330, BuiltInWorldToObjectKHR = 5331, BuiltInWorldToObjectNV = 5331, BuiltInHitTNV = 5332, BuiltInHitKindKHR = 5333, BuiltInHitKindNV = 5333, BuiltInIncomingRayFlagsKHR = 5351, BuiltInIncomingRayFlagsNV = 5351, BuiltInRayGeometryIndexKHR = 5352, BuiltInWarpsPerSMNV = 5374, BuiltInSMCountNV = 5375, BuiltInWarpIDNV = 5376, BuiltInSMIDNV = 5377, BuiltInMax = 2147483647 } export declare enum SelectionControlShift { SelectionControlFlattenShift = 0, SelectionControlDontFlattenShift = 1, SelectionControlMax = 2147483647 } export declare enum SelectionControlMask { SelectionControlMaskNone = 0, SelectionControlFlattenMask = 1, SelectionControlDontFlattenMask = 2 } export declare enum LoopControlShift { LoopControlUnrollShift = 0, LoopControlDontUnrollShift = 1, LoopControlDependencyInfiniteShift = 2, LoopControlDependencyLengthShift = 3, LoopControlMinIterationsShift = 4, LoopControlMaxIterationsShift = 5, LoopControlIterationMultipleShift = 6, LoopControlPeelCountShift = 7, LoopControlPartialCountShift = 8, LoopControlInitiationIntervalINTELShift = 16, LoopControlMaxConcurrencyINTELShift = 17, LoopControlDependencyArrayINTELShift = 18, LoopControlPipelineEnableINTELShift = 19, LoopControlLoopCoalesceINTELShift = 20, LoopControlMaxInterleavingINTELShift = 21, LoopControlSpeculatedIterationsINTELShift = 22, LoopControlMax = 2147483647 } export declare enum LoopControlMask { LoopControlMaskNone = 0, LoopControlUnrollMask = 1, LoopControlDontUnrollMask = 2, LoopControlDependencyInfiniteMask = 4, LoopControlDependencyLengthMask = 8, LoopControlMinIterationsMask = 16, LoopControlMaxIterationsMask = 32, LoopControlIterationMultipleMask = 64, LoopControlPeelCountMask = 128, LoopControlPartialCountMask = 256, LoopControlInitiationIntervalINTELMask = 65536, LoopControlMaxConcurrencyINTELMask = 131072, LoopControlDependencyArrayINTELMask = 262144, LoopControlPipelineEnableINTELMask = 524288, LoopControlLoopCoalesceINTELMask = 1048576, LoopControlMaxInterleavingINTELMask = 2097152, LoopControlSpeculatedIterationsINTELMask = 4194304 } export declare enum FunctionControlShift { FunctionControlInlineShift = 0, FunctionControlDontInlineShift = 1, FunctionControlPureShift = 2, FunctionControlConstShift = 3, FunctionControlMax = 2147483647 } export declare enum FunctionControlMask { FunctionControlMaskNone = 0, FunctionControlInlineMask = 1, FunctionControlDontInlineMask = 2, FunctionControlPureMask = 4, FunctionControlConstMask = 8 } export declare enum MemorySemanticsShift { MemorySemanticsAcquireShift = 1, MemorySemanticsReleaseShift = 2, MemorySemanticsAcquireReleaseShift = 3, MemorySemanticsSequentiallyConsistentShift = 4, MemorySemanticsUniformMemoryShift = 6, MemorySemanticsSubgroupMemoryShift = 7, MemorySemanticsWorkgroupMemoryShift = 8, MemorySemanticsCrossWorkgroupMemoryShift = 9, MemorySemanticsAtomicCounterMemoryShift = 10, MemorySemanticsImageMemoryShift = 11, MemorySemanticsOutputMemoryShift = 12, MemorySemanticsOutputMemoryKHRShift = 12, MemorySemanticsMakeAvailableShift = 13, MemorySemanticsMakeAvailableKHRShift = 13, MemorySemanticsMakeVisibleShift = 14, MemorySemanticsMakeVisibleKHRShift = 14, MemorySemanticsVolatileShift = 15, MemorySemanticsMax = 2147483647 } export declare enum MemorySemanticsMask { MemorySemanticsMaskNone = 0, MemorySemanticsAcquireMask = 2, MemorySemanticsReleaseMask = 4, MemorySemanticsAcquireReleaseMask = 8, MemorySemanticsSequentiallyConsistentMask = 16, MemorySemanticsUniformMemoryMask = 64, MemorySemanticsSubgroupMemoryMask = 128, MemorySemanticsWorkgroupMemoryMask = 256, MemorySemanticsCrossWorkgroupMemoryMask = 512, MemorySemanticsAtomicCounterMemoryMask = 1024, MemorySemanticsImageMemoryMask = 2048, MemorySemanticsOutputMemoryMask = 4096, MemorySemanticsOutputMemoryKHRMask = 4096, MemorySemanticsMakeAvailableMask = 8192, MemorySemanticsMakeAvailableKHRMask = 8192, MemorySemanticsMakeVisibleMask = 16384, MemorySemanticsMakeVisibleKHRMask = 16384, MemorySemanticsVolatileMask = 32768 } export declare enum MemoryAccessShift { MemoryAccessVolatileShift = 0, MemoryAccessAlignedShift = 1, MemoryAccessNontemporalShift = 2, MemoryAccessMakePointerAvailableShift = 3, MemoryAccessMakePointerAvailableKHRShift = 3, MemoryAccessMakePointerVisibleShift = 4, MemoryAccessMakePointerVisibleKHRShift = 4, MemoryAccessNonPrivatePointerShift = 5, MemoryAccessNonPrivatePointerKHRShift = 5, MemoryAccessMax = 2147483647 } export declare enum MemoryAccessMask { MemoryAccessMaskNone = 0, MemoryAccessVolatileMask = 1, MemoryAccessAlignedMask = 2, MemoryAccessNontemporalMask = 4, MemoryAccessMakePointerAvailableMask = 8, MemoryAccessMakePointerAvailableKHRMask = 8, MemoryAccessMakePointerVisibleMask = 16, MemoryAccessMakePointerVisibleKHRMask = 16, MemoryAccessNonPrivatePointerMask = 32, MemoryAccessNonPrivatePointerKHRMask = 32 } export declare enum Scope { ScopeCrossDevice = 0, ScopeDevice = 1, ScopeWorkgroup = 2, ScopeSubgroup = 3, ScopeInvocation = 4, ScopeQueueFamily = 5, ScopeQueueFamilyKHR = 5, ScopeShaderCallKHR = 6, ScopeMax = 2147483647 } export declare enum GroupOperation { GroupOperationReduce = 0, GroupOperationInclusiveScan = 1, GroupOperationExclusiveScan = 2, GroupOperationClusteredReduce = 3, GroupOperationPartitionedReduceNV = 6, GroupOperationPartitionedInclusiveScanNV = 7, GroupOperationPartitionedExclusiveScanNV = 8, GroupOperationMax = 2147483647 } export declare enum KernelEnqueueFlags { KernelEnqueueFlagsNoWait = 0, KernelEnqueueFlagsWaitKernel = 1, KernelEnqueueFlagsWaitWorkGroup = 2, KernelEnqueueFlagsMax = 2147483647 } export declare enum KernelProfilingInfoShift { KernelProfilingInfoCmdExecTimeShift = 0, KernelProfilingInfoMax = 2147483647 } export declare enum KernelProfilingInfoMask { KernelProfilingInfoMaskNone = 0, KernelProfilingInfoCmdExecTimeMask = 1 } export declare enum Capability { CapabilityMatrix = 0, CapabilityShader = 1, CapabilityGeometry = 2, CapabilityTessellation = 3, CapabilityAddresses = 4, CapabilityLinkage = 5, CapabilityKernel = 6, CapabilityVector16 = 7, CapabilityFloat16Buffer = 8, CapabilityFloat16 = 9, CapabilityFloat64 = 10, CapabilityInt64 = 11, CapabilityInt64Atomics = 12, CapabilityImageBasic = 13, CapabilityImageReadWrite = 14, CapabilityImageMipmap = 15, CapabilityPipes = 17, CapabilityGroups = 18, CapabilityDeviceEnqueue = 19, CapabilityLiteralSampler = 20, CapabilityAtomicStorage = 21, CapabilityInt16 = 22, CapabilityTessellationPointSize = 23, CapabilityGeometryPointSize = 24, CapabilityImageGatherExtended = 25, CapabilityStorageImageMultisample = 27, CapabilityUniformBufferArrayDynamicIndexing = 28, CapabilitySampledImageArrayDynamicIndexing = 29, CapabilityStorageBufferArrayDynamicIndexing = 30, CapabilityStorageImageArrayDynamicIndexing = 31, CapabilityClipDistance = 32, CapabilityCullDistance = 33, CapabilityImageCubeArray = 34, CapabilitySampleRateShading = 35, CapabilityImageRect = 36, CapabilitySampledRect = 37, CapabilityGenericPointer = 38, CapabilityInt8 = 39, CapabilityInputAttachment = 40, CapabilitySparseResidency = 41, CapabilityMinLod = 42, CapabilitySampled1D = 43, CapabilityImage1D = 44, CapabilitySampledCubeArray = 45, CapabilitySampledBuffer = 46, CapabilityImageBuffer = 47, CapabilityImageMSArray = 48, CapabilityStorageImageExtendedFormats = 49, CapabilityImageQuery = 50, CapabilityDerivativeControl = 51, CapabilityInterpolationFunction = 52, CapabilityTransformFeedback = 53, CapabilityGeometryStreams = 54, CapabilityStorageImageReadWithoutFormat = 55, CapabilityStorageImageWriteWithoutFormat = 56, CapabilityMultiViewport = 57, CapabilitySubgroupDispatch = 58, CapabilityNamedBarrier = 59, CapabilityPipeStorage = 60, CapabilityGroupNonUniform = 61, CapabilityGroupNonUniformVote = 62, CapabilityGroupNonUniformArithmetic = 63, CapabilityGroupNonUniformBallot = 64, CapabilityGroupNonUniformShuffle = 65, CapabilityGroupNonUniformShuffleRelative = 66, CapabilityGroupNonUniformClustered = 67, CapabilityGroupNonUniformQuad = 68, CapabilityShaderLayer = 69, CapabilityShaderViewportIndex = 70, CapabilityFragmentShadingRateKHR = 4422, CapabilitySubgroupBallotKHR = 4423, CapabilityDrawParameters = 4427, CapabilitySubgroupVoteKHR = 4431, CapabilityStorageBuffer16BitAccess = 4433, CapabilityStorageUniformBufferBlock16 = 4433, CapabilityStorageUniform16 = 4434, CapabilityUniformAndStorageBuffer16BitAccess = 4434, CapabilityStoragePushConstant16 = 4435, CapabilityStorageInputOutput16 = 4436, CapabilityDeviceGroup = 4437, CapabilityMultiView = 4439, CapabilityVariablePointersStorageBuffer = 4441, CapabilityVariablePointers = 4442, CapabilityAtomicStorageOps = 4445, CapabilitySampleMaskPostDepthCoverage = 4447, CapabilityStorageBuffer8BitAccess = 4448, CapabilityUniformAndStorageBuffer8BitAccess = 4449, CapabilityStoragePushConstant8 = 4450, CapabilityDenormPreserve = 4464, CapabilityDenormFlushToZero = 4465, CapabilitySignedZeroInfNanPreserve = 4466, CapabilityRoundingModeRTE = 4467, CapabilityRoundingModeRTZ = 4468, CapabilityRayQueryProvisionalKHR = 4471, CapabilityRayQueryKHR = 4472, CapabilityRayTraversalPrimitiveCullingKHR = 4478, CapabilityRayTracingKHR = 4479, CapabilityFloat16ImageAMD = 5008, CapabilityImageGatherBiasLodAMD = 5009, CapabilityFragmentMaskAMD = 5010, CapabilityStencilExportEXT = 5013, CapabilityImageReadWriteLodAMD = 5015, CapabilityInt64ImageEXT = 5016, CapabilityShaderClockKHR = 5055, CapabilitySampleMaskOverrideCoverageNV = 5249, CapabilityGeometryShaderPassthroughNV = 5251, CapabilityShaderViewportIndexLayerEXT = 5254, CapabilityShaderViewportIndexLayerNV = 5254, CapabilityShaderViewportMaskNV = 5255, CapabilityShaderStereoViewNV = 5259, CapabilityPerViewAttributesNV = 5260, CapabilityFragmentFullyCoveredEXT = 5265, CapabilityMeshShadingNV = 5266, CapabilityImageFootprintNV = 5282, CapabilityFragmentBarycentricNV = 5284, CapabilityComputeDerivativeGroupQuadsNV = 5288, CapabilityFragmentDensityEXT = 5291, CapabilityShadingRateNV = 5291, CapabilityGroupNonUniformPartitionedNV = 5297, CapabilityShaderNonUniform = 5301, CapabilityShaderNonUniformEXT = 5301, CapabilityRuntimeDescriptorArray = 5302, CapabilityRuntimeDescriptorArrayEXT = 5302, CapabilityInputAttachmentArrayDynamicIndexing = 5303, CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, CapabilityUniformTexelBufferArrayDynamicIndexing = 5304, CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, CapabilityStorageTexelBufferArrayDynamicIndexing = 5305, CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, CapabilityUniformBufferArrayNonUniformIndexing = 5306, CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, CapabilitySampledImageArrayNonUniformIndexing = 5307, CapabilitySampledImageArrayNonUniformIndexingEXT = 5307, CapabilityStorageBufferArrayNonUniformIndexing = 5308, CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, CapabilityStorageImageArrayNonUniformIndexing = 5309, CapabilityStorageImageArrayNonUniformIndexingEXT = 5309, CapabilityInputAttachmentArrayNonUniformIndexing = 5310, CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, CapabilityUniformTexelBufferArrayNonUniformIndexing = 5311, CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312, CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, CapabilityRayTracingNV = 5340, CapabilityVulkanMemoryModel = 5345, CapabilityVulkanMemoryModelKHR = 5345, CapabilityVulkanMemoryModelDeviceScope = 5346, CapabilityVulkanMemoryModelDeviceScopeKHR = 5346, CapabilityPhysicalStorageBufferAddresses = 5347, CapabilityPhysicalStorageBufferAddressesEXT = 5347, CapabilityComputeDerivativeGroupLinearNV = 5350, CapabilityRayTracingProvisionalKHR = 5353, CapabilityCooperativeMatrixNV = 5357, CapabilityFragmentShaderSampleInterlockEXT = 5363, CapabilityFragmentShaderShadingRateInterlockEXT = 5372, CapabilityShaderSMBuiltinsNV = 5373, CapabilityFragmentShaderPixelInterlockEXT = 5378, CapabilityDemoteToHelperInvocationEXT = 5379, CapabilitySubgroupShuffleINTEL = 5568, CapabilitySubgroupBufferBlockIOINTEL = 5569, CapabilitySubgroupImageBlockIOINTEL = 5570, CapabilitySubgroupImageMediaBlockIOINTEL = 5579, CapabilityIntegerFunctions2INTEL = 5584, CapabilityFunctionPointersINTEL = 5603, CapabilityIndirectReferencesINTEL = 5604, CapabilitySubgroupAvcMotionEstimationINTEL = 5696, CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697, CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698, CapabilityFPGAMemoryAttributesINTEL = 5824, CapabilityUnstructuredLoopControlsINTEL = 5886, CapabilityFPGALoopControlsINTEL = 5888, CapabilityKernelAttributesINTEL = 5892, CapabilityFPGAKernelAttributesINTEL = 5897, CapabilityBlockingPipesINTEL = 5945, CapabilityFPGARegINTEL = 5948, CapabilityAtomicFloat32AddEXT = 6033, CapabilityAtomicFloat64AddEXT = 6034, CapabilityMax = 2147483647 } export declare enum RayFlagsShift { RayFlagsOpaqueKHRShift = 0, RayFlagsNoOpaqueKHRShift = 1, RayFlagsTerminateOnFirstHitKHRShift = 2, RayFlagsSkipClosestHitShaderKHRShift = 3, RayFlagsCullBackFacingTrianglesKHRShift = 4, RayFlagsCullFrontFacingTrianglesKHRShift = 5, RayFlagsCullOpaqueKHRShift = 6, RayFlagsCullNoOpaqueKHRShift = 7, RayFlagsSkipTrianglesKHRShift = 8, RayFlagsSkipAABBsKHRShift = 9, RayFlagsMax = 2147483647 } export declare enum RayFlagsMask { RayFlagsMaskNone = 0, RayFlagsOpaqueKHRMask = 1, RayFlagsNoOpaqueKHRMask = 2, RayFlagsTerminateOnFirstHitKHRMask = 4, RayFlagsSkipClosestHitShaderKHRMask = 8, RayFlagsCullBackFacingTrianglesKHRMask = 16, RayFlagsCullFrontFacingTrianglesKHRMask = 32, RayFlagsCullOpaqueKHRMask = 64, RayFlagsCullNoOpaqueKHRMask = 128, RayFlagsSkipTrianglesKHRMask = 256, RayFlagsSkipAABBsKHRMask = 512 } export declare enum RayQueryIntersection { RayQueryIntersectionRayQueryCandidateIntersectionKHR = 0, RayQueryIntersectionRayQueryCommittedIntersectionKHR = 1, RayQueryIntersectionMax = 2147483647 } export declare enum RayQueryCommittedIntersectionType { RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR = 0, RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR = 1, RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR = 2, RayQueryCommittedIntersectionTypeMax = 2147483647 } export declare enum RayQueryCandidateIntersectionType { RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR = 0, RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR = 1, RayQueryCandidateIntersectionTypeMax = 2147483647 } export declare enum FragmentShadingRateShift { FragmentShadingRateVertical2PixelsShift = 0, FragmentShadingRateVertical4PixelsShift = 1, FragmentShadingRateHorizontal2PixelsShift = 2, FragmentShadingRateHorizontal4PixelsShift = 3, FragmentShadingRateMax = 2147483647 } export declare enum FragmentShadingRateMask { FragmentShadingRateMaskNone = 0, FragmentShadingRateVertical2PixelsMask = 1, FragmentShadingRateVertical4PixelsMask = 2, FragmentShadingRateHorizontal2PixelsMask = 4, FragmentShadingRateHorizontal4PixelsMask = 8 } export declare enum Op { OpNop = 0, OpUndef = 1, OpSourceContinued = 2, OpSource = 3, OpSourceExtension = 4, OpName = 5, OpMemberName = 6, OpString = 7, OpLine = 8, OpExtension = 10, OpExtInstImport = 11, OpExtInst = 12, OpMemoryModel = 14, OpEntryPoint = 15, OpExecutionMode = 16, OpCapability = 17, OpTypeVoid = 19, OpTypeBool = 20, OpTypeInt = 21, OpTypeFloat = 22, OpTypeVector = 23, OpTypeMatrix = 24, OpTypeImage = 25, OpTypeSampler = 26, OpTypeSampledImage = 27, OpTypeArray = 28, OpTypeRuntimeArray = 29, OpTypeStruct = 30, OpTypeOpaque = 31, OpTypePointer = 32, OpTypeFunction = 33, OpTypeEvent = 34, OpTypeDeviceEvent = 35, OpTypeReserveId = 36, OpTypeQueue = 37, OpTypePipe = 38, OpTypeForwardPointer = 39, OpConstantTrue = 41, OpConstantFalse = 42, OpConstant = 43, OpConstantComposite = 44, OpConstantSampler = 45, OpConstantNull = 46, OpSpecConstantTrue = 48, OpSpecConstantFalse = 49, OpSpecConstant = 50, OpSpecConstantComposite = 51, OpSpecConstantOp = 52, OpFunction = 54, OpFunctionParameter = 55, OpFunctionEnd = 56, OpFunctionCall = 57, OpVariable = 59, OpImageTexelPointer = 60, OpLoad = 61, OpStore = 62, OpCopyMemory = 63, OpCopyMemorySized = 64, OpAccessChain = 65, OpInBoundsAccessChain = 66, OpPtrAccessChain = 67, OpArrayLength = 68, OpGenericPtrMemSemantics = 69, OpInBoundsPtrAccessChain = 70, OpDecorate = 71, OpMemberDecorate = 72, OpDecorationGroup = 73, OpGroupDecorate = 74, OpGroupMemberDecorate = 75, OpVectorExtractDynamic = 77, OpVectorInsertDynamic = 78, OpVectorShuffle = 79, OpCompositeConstruct = 80, OpCompositeExtract = 81, OpCompositeInsert = 82, OpCopyObject = 83, OpTranspose = 84, OpSampledImage = 86, OpImageSampleImplicitLod = 87, OpImageSampleExplicitLod = 88, OpImageSampleDrefImplicitLod = 89, OpImageSampleDrefExplicitLod = 90, OpImageSampleProjImplicitLod = 91, OpImageSampleProjExplicitLod = 92, OpImageSampleProjDrefImplicitLod = 93, OpImageSampleProjDrefExplicitLod = 94, OpImageFetch = 95, OpImageGather = 96, OpImageDrefGather = 97, OpImageRead = 98, OpImageWrite = 99, OpImage = 100, OpImageQueryFormat = 101, OpImageQueryOrder = 102, OpImageQuerySizeLod = 103, OpImageQuerySize = 104, OpImageQueryLod = 105, OpImageQueryLevels = 106, OpImageQuerySamples = 107, OpConvertFToU = 109, OpConvertFToS = 110, OpConvertSToF = 111, OpConvertUToF = 112, OpUConvert = 113, OpSConvert = 114, OpFConvert = 115, OpQuantizeToF16 = 116, OpConvertPtrToU = 117, OpSatConvertSToU = 118, OpSatConvertUToS = 119, OpConvertUToPtr = 120, OpPtrCastToGeneric = 121, OpGenericCastToPtr = 122, OpGenericCastToPtrExplicit = 123, OpBitcast = 124, OpSNegate = 126, OpFNegate = 127, OpIAdd = 128, OpFAdd = 129, OpISub = 130, OpFSub = 131, OpIMul = 132, OpFMul = 133, OpUDiv = 134, OpSDiv = 135, OpFDiv = 136, OpUMod = 137, OpSRem = 138, OpSMod = 139, OpFRem = 140, OpFMod = 141, OpVectorTimesScalar = 142, OpMatrixTimesScalar = 143, OpVectorTimesMatrix = 144, OpMatrixTimesVector = 145, OpMatrixTimesMatrix = 146, OpOuterProduct = 147, OpDot = 148, OpIAddCarry = 149, OpISubBorrow = 150, OpUMulExtended = 151, OpSMulExtended = 152, OpAny = 154, OpAll = 155, OpIsNan = 156, OpIsInf = 157, OpIsFinite = 158, OpIsNormal = 159, OpSignBitSet = 160, OpLessOrGreater = 161, OpOrdered = 162, OpUnordered = 163, OpLogicalEqual = 164, OpLogicalNotEqual = 165, OpLogicalOr = 166, OpLogicalAnd = 167, OpLogicalNot = 168, OpSelect = 169, OpIEqual = 170, OpINotEqual = 171, OpUGreaterThan = 172, OpSGreaterThan = 173, OpUGreaterThanEqual = 174, OpSGreaterThanEqual = 175, OpULessThan = 176, OpSLessThan = 177, OpULessThanEqual = 178, OpSLessThanEqual = 179, OpFOrdEqual = 180, OpFUnordEqual = 181, OpFOrdNotEqual = 182, OpFUnordNotEqual = 183, OpFOrdLessThan = 184, OpFUnordLessThan = 185, OpFOrdGreaterThan = 186, OpFUnordGreaterThan = 187, OpFOrdLessThanEqual = 188, OpFUnordLessThanEqual = 189, OpFOrdGreaterThanEqual = 190, OpFUnordGreaterThanEqual = 191, OpShiftRightLogical = 194, OpShiftRightArithmetic = 195, OpShiftLeftLogical = 196, OpBitwiseOr = 197, OpBitwiseXor = 198, OpBitwiseAnd = 199, OpNot = 200, OpBitFieldInsert = 201, OpBitFieldSExtract = 202, OpBitFieldUExtract = 203, OpBitReverse = 204, OpBitCount = 205, OpDPdx = 207, OpDPdy = 208, OpFwidth = 209, OpDPdxFine = 210, OpDPdyFine = 211, OpFwidthFine = 212, OpDPdxCoarse = 213, OpDPdyCoarse = 214, OpFwidthCoarse = 215, OpEmitVertex = 218, OpEndPrimitive = 219, OpEmitStreamVertex = 220, OpEndStreamPrimitive = 221, OpControlBarrier = 224, OpMemoryBarrier = 225, OpAtomicLoad = 227, OpAtomicStore = 228, OpAtomicExchange = 229, OpAtomicCompareExchange = 230, OpAtomicCompareExchangeWeak = 231, OpAtomicIIncrement = 232, OpAtomicIDecrement = 233, OpAtomicIAdd = 234, OpAtomicISub = 235, OpAtomicSMin = 236, OpAtomicUMin = 237, OpAtomicSMax = 238, OpAtomicUMax = 239, OpAtomicAnd = 240, OpAtomicOr = 241, OpAtomicXor = 242, OpPhi = 245, OpLoopMerge = 246, OpSelectionMerge = 247, OpLabel = 248, OpBranch = 249, OpBranchConditional = 250, OpSwitch = 251, OpKill = 252, OpReturn = 253, OpReturnValue = 254, OpUnreachable = 255, OpLifetimeStart = 256, OpLifetimeStop = 257, OpGroupAsyncCopy = 259, OpGroupWaitEvents = 260, OpGroupAll = 261, OpGroupAny = 262, OpGroupBroadcast = 263, OpGroupIAdd = 264, OpGroupFAdd = 265, OpGroupFMin = 266, OpGroupUMin = 267, OpGroupSMin = 268, OpGroupFMax = 269, OpGroupUMax = 270, OpGroupSMax = 271, OpReadPipe = 274, OpWritePipe = 275, OpReservedReadPipe = 276, OpReservedWritePipe = 277, OpReserveReadPipePackets = 278, OpReserveWritePipePackets = 279, OpCommitReadPipe = 280, OpCommitWritePipe = 281, OpIsValidReserveId = 282, OpGetNumPipePackets = 283, OpGetMaxPipePackets = 284, OpGroupReserveReadPipePackets = 285, OpGroupReserveWritePipePackets = 286, OpGroupCommitReadPipe = 287, OpGroupCommitWritePipe = 288, OpEnqueueMarker = 291, OpEnqueueKernel = 292, OpGetKernelNDrangeSubGroupCount = 293, OpGetKernelNDrangeMaxSubGroupSize = 294, OpGetKernelWorkGroupSize = 295, OpGetKernelPreferredWorkGroupSizeMultiple = 296, OpRetainEvent = 297, OpReleaseEvent = 298, OpCreateUserEvent = 299, OpIsValidEvent = 300, OpSetUserEventStatus = 301, OpCaptureEventProfilingInfo = 302, OpGetDefaultQueue = 303, OpBuildNDRange = 304, OpImageSparseSampleImplicitLod = 305, OpImageSparseSampleExplicitLod = 306, OpImageSparseSampleDrefImplicitLod = 307, OpImageSparseSampleDrefExplicitLod = 308, OpImageSparseSampleProjImplicitLod = 309, OpImageSparseSampleProjExplicitLod = 310, OpImageSparseSampleProjDrefImplicitLod = 311, OpImageSparseSampleProjDrefExplicitLod = 312, OpImageSparseFetch = 313, OpImageSparseGather = 314, OpImageSparseDrefGather = 315, OpImageSparseTexelsResident = 316, OpNoLine = 317, OpAtomicFlagTestAndSet = 318, OpAtomicFlagClear = 319, OpImageSparseRead = 320, OpSizeOf = 321, OpTypePipeStorage = 322, OpConstantPipeStorage = 323, OpCreatePipeFromPipeStorage = 324, OpGetKernelLocalSizeForSubgroupCount = 325, OpGetKernelMaxNumSubgroups = 326, OpTypeNamedBarrier = 327, OpNamedBarrierInitialize = 328, OpMemoryNamedBarrier = 329, OpModuleProcessed = 330, OpExecutionModeId = 331, OpDecorateId = 332, OpGroupNonUniformElect = 333, OpGroupNonUniformAll = 334, OpGroupNonUniformAny = 335, OpGroupNonUniformAllEqual = 336, OpGroupNonUniformBroadcast = 337, OpGroupNonUniformBroadcastFirst = 338, OpGroupNonUniformBallot = 339, OpGroupNonUniformInverseBallot = 340, OpGroupNonUniformBallotBitExtract = 341, OpGroupNonUniformBallotBitCount = 342, OpGroupNonUniformBallotFindLSB = 343, OpGroupNonUniformBallotFindMSB = 344, OpGroupNonUniformShuffle = 345, OpGroupNonUniformShuffleXor = 346, OpGroupNonUniformShuffleUp = 347, OpGroupNonUniformShuffleDown = 348, OpGroupNonUniformIAdd = 349, OpGroupNonUniformFAdd = 350, OpGroupNonUniformIMul = 351, OpGroupNonUniformFMul = 352, OpGroupNonUniformSMin = 353, OpGroupNonUniformUMin = 354, OpGroupNonUniformFMin = 355, OpGroupNonUniformSMax = 356, OpGroupNonUniformUMax = 357, OpGroupNonUniformFMax = 358, OpGroupNonUniformBitwiseAnd = 359, OpGroupNonUniformBitwiseOr = 360, OpGroupNonUniformBitwiseXor = 361, OpGroupNonUniformLogicalAnd = 362, OpGroupNonUniformLogicalOr = 363, OpGroupNonUniformLogicalXor = 364, OpGroupNonUniformQuadBroadcast = 365, OpGroupNonUniformQuadSwap = 366, OpCopyLogical = 400, OpPtrEqual = 401, OpPtrNotEqual = 402, OpPtrDiff = 403, OpTerminateInvocation = 4416, OpSubgroupBallotKHR = 4421, OpSubgroupFirstInvocationKHR = 4422, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, OpSubgroupReadInvocationKHR = 4432, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, OpConvertUToAccelerationStructureKHR = 4447, OpIgnoreIntersectionKHR = 4448, OpTerminateRayKHR = 4449, OpTypeRayQueryKHR = 4472, OpRayQueryInitializeKHR = 4473, OpRayQueryTerminateKHR = 4474, OpRayQueryGenerateIntersectionKHR = 4475, OpRayQueryConfirmIntersectionKHR = 4476, OpRayQueryProceedKHR = 4477, OpRayQueryGetIntersectionTypeKHR = 4479, OpGroupIAddNonUniformAMD = 5000, OpGroupFAddNonUniformAMD = 5001, OpGroupFMinNonUniformAMD = 5002, OpGroupUMinNonUniformAMD = 5003, OpGroupSMinNonUniformAMD = 5004, OpGroupFMaxNonUniformAMD = 5005, OpGroupUMaxNonUniformAMD = 5006, OpGroupSMaxNonUniformAMD = 5007, OpFragmentMaskFetchAMD = 5011, OpFragmentFetchAMD = 5012, OpReadClockKHR = 5056, OpImageSampleFootprintNV = 5283, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, OpTerminateRayNV = 5336, OpTraceNV = 5337, OpTypeAccelerationStructureKHR = 5341, OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixStoreNV = 5360, OpCooperativeMatrixMulAddNV = 5361, OpCooperativeMatrixLengthNV = 5362, OpBeginInvocationInterlockEXT = 5364, OpEndInvocationInterlockEXT = 5365, OpDemoteToHelperInvocationEXT = 5380, OpIsHelperInvocationEXT = 5381, OpSubgroupShuffleINTEL = 5571, OpSubgroupShuffleDownINTEL = 5572, OpSubgroupShuffleUpINTEL = 5573, OpSubgroupShuffleXorINTEL = 5574, OpSubgroupBlockReadINTEL = 5575, OpSubgroupBlockWriteINTEL = 5576, OpSubgroupImageBlockReadINTEL = 5577, OpSubgroupImageBlockWriteINTEL = 5578, OpSubgroupImageMediaBlockReadINTEL = 5580, OpSubgroupImageMediaBlockWriteINTEL = 5581, OpUCountLeadingZerosINTEL = 5585, OpUCountTrailingZerosINTEL = 5586, OpAbsISubINTEL = 5587, OpAbsUSubINTEL = 5588, OpIAddSatINTEL = 5589, OpUAddSatINTEL = 5590, OpIAverageINTEL = 5591, OpUAverageINTEL = 5592, OpIAverageRoundedINTEL = 5593, OpUAverageRoundedINTEL = 5594, OpISubSatINTEL = 5595, OpUSubSatINTEL = 5596, OpIMul32x16INTEL = 5597, OpUMul32x16INTEL = 5598, OpFunctionPointerINTEL = 5600, OpFunctionPointerCallINTEL = 5601, OpDecorateString = 5632, OpDecorateStringGOOGLE = 5632, OpMemberDecorateString = 5633, OpMemberDecorateStringGOOGLE = 5633, OpVmeImageINTEL = 5699, OpTypeVmeImageINTEL = 5700, OpTypeAvcImePayloadINTEL = 5701, OpTypeAvcRefPayloadINTEL = 5702, OpTypeAvcSicPayloadINTEL = 5703, OpTypeAvcMcePayloadINTEL = 5704, OpTypeAvcMceResultINTEL = 5705, OpTypeAvcImeResultINTEL = 5706, OpTypeAvcImeResultSingleReferenceStreamoutINTEL = 5707, OpTypeAvcImeResultDualReferenceStreamoutINTEL = 5708, OpTypeAvcImeSingleReferenceStreaminINTEL = 5709, OpTypeAvcImeDualReferenceStreaminINTEL = 5710, OpTypeAvcRefResultINTEL = 5711, OpTypeAvcSicResultINTEL = 5712, OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL = 5713, OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL = 5714, OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL = 5715, OpSubgroupAvcMceSetInterShapePenaltyINTEL = 5716, OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL = 5717, OpSubgroupAvcMceSetInterDirectionPenaltyINTEL = 5718, OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL = 5719, OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL = 5720, OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL = 5721, OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL = 5722, OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL = 5723, OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL = 5724, OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL = 5725, OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL = 5726, OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL = 5727, OpSubgroupAvcMceSetAcOnlyHaarINTEL = 5728, OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL = 5729, OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL = 5730, OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL = 5731, OpSubgroupAvcMceConvertToImePayloadINTEL = 5732, OpSubgroupAvcMceConvertToImeResultINTEL = 5733, OpSubgroupAvcMceConvertToRefPayloadINTEL = 5734, OpSubgroupAvcMceConvertToRefResultINTEL = 5735, OpSubgroupAvcMceConvertToSicPayloadINTEL = 5736, OpSubgroupAvcMceConvertToSicResultINTEL = 5737, OpSubgroupAvcMceGetMotionVectorsINTEL = 5738, OpSubgroupAvcMceGetInterDistortionsINTEL = 5739, OpSubgroupAvcMceGetBestInterDistortionsINTEL = 5740, OpSubgroupAvcMceGetInterMajorShapeINTEL = 5741, OpSubgroupAvcMceGetInterMinorShapeINTEL = 5742, OpSubgroupAvcMceGetInterDirectionsINTEL = 5743, OpSubgroupAvcMceGetInterMotionVectorCountINTEL = 5744, OpSubgroupAvcMceGetInterReferenceIdsINTEL = 5745, OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL = 5746, OpSubgroupAvcImeInitializeINTEL = 5747, OpSubgroupAvcImeSetSingleReferenceINTEL = 5748, OpSubgroupAvcImeSetDualReferenceINTEL = 5749, OpSubgroupAvcImeRefWindowSizeINTEL = 5750, OpSubgroupAvcImeAdjustRefOffsetINTEL = 5751, OpSubgroupAvcImeConvertToMcePayloadINTEL = 5752, OpSubgroupAvcImeSetMaxMotionVectorCountINTEL = 5753, OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL = 5754, OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL = 5755, OpSubgroupAvcImeSetWeightedSadINTEL = 5756, OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL = 5757, OpSubgroupAvcImeEvaluateWithDualReferenceINTEL = 5758, OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL = 5759, OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL = 5760, OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL = 5761, OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL = 5762, OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL = 5763, OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL = 5764, OpSubgroupAvcImeConvertToMceResultINTEL = 5765, OpSubgroupAvcImeGetSingleReferenceStreaminINTEL = 5766, OpSubgroupAvcImeGetDualReferenceStreaminINTEL = 5767, OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL = 5768, OpSubgroupAvcImeStripDualReferenceStreamoutINTEL = 5769, OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL = 5770, OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL = 5771, OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL = 5772, OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL = 5773, OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL = 5774, OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL = 5775, OpSubgroupAvcImeGetBorderReachedINTEL = 5776, OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL = 5777, OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL = 5778, OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL = 5779, OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL = 5780, OpSubgroupAvcFmeInitializeINTEL = 5781, OpSubgroupAvcBmeInitializeINTEL = 5782, OpSubgroupAvcRefConvertToMcePayloadINTEL = 5783, OpSubgroupAvcRefSetBidirectionalMixDisableINTEL = 5784, OpSubgroupAvcRefSetBilinearFilterEnableINTEL = 5785, OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL = 5786, OpSubgroupAvcRefEvaluateWithDualReferenceINTEL = 5787, OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL = 5788, OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL = 5789, OpSubgroupAvcRefConvertToMceResultINTEL = 5790, OpSubgroupAvcSicInitializeINTEL = 5791, OpSubgroupAvcSicConfigureSkcINTEL = 5792, OpSubgroupAvcSicConfigureIpeLumaINTEL = 5793, OpSubgroupAvcSicConfigureIpeLumaChromaINTEL = 5794, OpSubgroupAvcSicGetMotionVectorMaskINTEL = 5795, OpSubgroupAvcSicConvertToMcePayloadINTEL = 5796, OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL = 5797, OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL = 5798, OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL = 5799, OpSubgroupAvcSicSetBilinearFilterEnableINTEL = 5800, OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL = 5801, OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL = 5802, OpSubgroupAvcSicEvaluateIpeINTEL = 5803, OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL = 5804, OpSubgroupAvcSicEvaluateWithDualReferenceINTEL = 5805, OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL = 5806, OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL = 5807, OpSubgroupAvcSicConvertToMceResultINTEL = 5808, OpSubgroupAvcSicGetIpeLumaShapeINTEL = 5809, OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL = 5810, OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL = 5811, OpSubgroupAvcSicGetPackedIpeLumaModesINTEL = 5812, OpSubgroupAvcSicGetIpeChromaModeINTEL = 5813, OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814, OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815, OpSubgroupAvcSicGetInterRawSadsINTEL = 5816, OpLoopControlINTEL = 5887, OpReadPipeBlockingINTEL = 5946, OpWritePipeBlockingINTEL = 5947, OpFPGARegINTEL = 5949, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, OpRayQueryGetIntersectionTKHR = 6018, OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019, OpRayQueryGetIntersectionInstanceIdKHR = 6020, OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021, OpRayQueryGetIntersectionGeometryIndexKHR = 6022, OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023, OpRayQueryGetIntersectionBarycentricsKHR = 6024, OpRayQueryGetIntersectionFrontFaceKHR = 6025, OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026, OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027, OpRayQueryGetIntersectionObjectRayOriginKHR = 6028, OpRayQueryGetWorldRayDirectionKHR = 6029, OpRayQueryGetWorldRayOriginKHR = 6030, OpRayQueryGetIntersectionObjectToWorldKHR = 6031, OpRayQueryGetIntersectionWorldToObjectKHR = 6032, OpAtomicFAddEXT = 6035, OpMax = 2147483647 }
DerSchmale/spirv4web
src/utils/Pair.ts
<gh_stars>0 import { defaultClone, defaultCopy } from "./defaultCopy"; export class Pair<A, B> { first: A; second: B; constructor(first?: A, second?: B) { this.first = first; this.second = second; } equals(b: Pair<A, B>): boolean { return this.first === b.first && this.second === b.second; } clone(): Pair<A, B> { const c = new Pair<A, B>(); defaultCopy(this, c); return c; } }
DerSchmale/spirv4web
build/types/compiler/CFGBuilder.d.ts
import { OpcodeHandler } from "./OpcodeHandler"; import { Compiler } from "./Compiler"; import { SPIRFunction } from "../common/SPIRFunction"; import { CFG } from "../cfg/CFG"; import { Op } from "../spirv/Op"; export declare class CFGBuilder extends OpcodeHandler { compiler: Compiler; function_cfgs: CFG[]; constructor(compiler: Compiler); handle(opcode: Op, args: Uint32Array, length: number): boolean; follow_function_call(func: SPIRFunction): boolean; }
DerSchmale/spirv4web
build/types/parser/BlockMetaFlagBits.d.ts
<filename>build/types/parser/BlockMetaFlagBits.d.ts export declare enum BlockMetaFlagBits { LOOP_HEADER_BIT = 1, CONTINUE_BIT = 2, LOOP_MERGE_BIT = 4, SELECTION_MERGE_BIT = 8, MULTISELECT_MERGE_BIT = 16 }
DerSchmale/spirv4web
src/compiler/SpecializationConstant.ts
<reponame>DerSchmale/spirv4web export class SpecializationConstant { // The ID of the specialization constant. id: ConstantID; // The constant ID of the constant, used in Vulkan during pipeline creation. constant_id: number; };
DerSchmale/spirv4web
src/spirv/ImageOperandsShift.ts
<reponame>DerSchmale/spirv4web export enum ImageOperandsShift { Bias = 0, Lod = 1, Grad = 2, ConstOffset = 3, Offset = 4, ConstOffsets = 5, Sample = 6, MinLod = 7, MakeTexelAvailable = 8, MakeTexelAvailableKHR = 8, MakeTexelVisible = 9, MakeTexelVisibleKHR = 9, NonPrivateTexel = 10, NonPrivateTexelKHR = 10, VolatileTexel = 11, VolatileTexelKHR = 11, SignExtend = 12, ZeroExtend = 13, Max = 0x7fffffff, }
DerSchmale/spirv4web
src/compileIteration.ts
<gh_stars>0 import { Args, PLSArg, Remap } from "./Args"; import { Parser } from "./parser/Parser"; import { CompilerGLSL } from "./compiler/glsl/CompilerGLSL"; import { Resource, ShaderResources } from "./compiler/ShaderResources"; import { Compiler } from "./compiler/Compiler"; import { inherit_combined_sampler_bindings, rename_interface_variable } from "./utils/util"; import { PlsRemap } from "./compiler/glsl/PlsRemap"; import { ExecutionModel } from "./spirv/ExecutionModel"; import { Decoration } from "./spirv/Decoration"; import { StorageClass } from "./spirv/StorageClass"; import { Dict } from "./utils/Dict"; function stage_to_execution_model(stage: string): ExecutionModel { if (stage === "vert") return ExecutionModel.Vertex; else if (stage === "frag") return ExecutionModel.Fragment; /*else if (stage === "comp") return ExecutionModel.GLCompute; else if (stage === "tesc") return ExecutionModel.TessellationControl; else if (stage === "tese") return ExecutionModel.TessellationEvaluation; else if (stage === "geom") return ExecutionModel.Geometry;*/ else throw new Error("Invalid stage!"); } export function compile_iteration(args: Args, spirv_file: Uint32Array, unnamedUBOInfo: Dict<string[]>): string { const spirv_parser = new Parser(spirv_file); spirv_parser.parse(); const combined_image_samplers: boolean = true; const build_dummy_sampler = false; const compiler = new CompilerGLSL(spirv_parser.get_parsed_ir()); compiler.unnamed_ubo_info = unnamedUBOInfo; if (args.variable_type_remaps.length !== 0) { const remap_cb = (type, name) => { for (let remap of args.variable_type_remaps) if (name === remap.variable_name) return remap.new_variable_type; return name; }; compiler.set_variable_type_remap_callback(remap_cb); } for (let masked of args.masked_stage_outputs) compiler.mask_stage_output_by_location(masked.first, masked.second); for (let masked of args.masked_stage_builtins) compiler.mask_stage_output_by_builtin(masked); for (let rename of args.entry_point_rename) compiler.rename_entry_point(rename.old_name, rename.new_name, rename.execution_model); const entry_points = compiler.get_entry_points_and_stages(); let entry_point = args.entry; let model = ExecutionModel.Max; if (args.entry_stage && args.entry_stage.length > 0) { model = stage_to_execution_model(args.entry_stage); if (!entry_point || entry_point === "") { // Just use the first entry point with this stage. for (let e of entry_points) { if (e.execution_model === model) { entry_point = e.name; break; } } if (!entry_point) { throw new Error(`Could not find an entry point with stage: ${args.entry_stage}`); } } else { // Make sure both stage and name exists. let exists = false; for (let e of entry_points) { if (e.execution_model === model && e.name === entry_point) { exists = true; break; } } if (!exists) { throw new Error(`Could not find an entry point %s with stage: ${args.entry_stage}`); } } } else if (entry_point && entry_point !== "") { // Make sure there is just one entry point with this name, or the stage // is ambiguous. let stage_count = 0; for (let e of entry_points) { if (e.name === entry_point) { stage_count++; model = e.execution_model; } } if (stage_count === 0) { throw new Error(`There is no entry point with name: ${entry_point}`); } else if (stage_count > 1) { throw new Error(`There is more than one entry point with name: ${entry_point}. Use --stage.`); } } if (entry_point && entry_point !== "") compiler.set_entry_point(entry_point, model); if (!args.set_version && !compiler.get_common_options().version) { throw new Error("Didn't specify GLSL version and SPIR-V did not specify language."); } const opts = compiler.get_common_options(); if (args.set_version) opts.version = args.version; // if (args.set_es) // opts.es = args.es; opts.force_temporary = args.force_temporary; opts.separate_shader_objects = args.sso; opts.flatten_multidimensional_arrays = args.flatten_multidimensional_arrays; opts.enable_420pack_extension = args.use_420pack_extension; opts.vertex.fixup_clipspace = args.fixup; opts.vertex.flip_vert_y = args.yflip; opts.vertex.support_nonzero_base_instance = args.support_nonzero_baseinstance; opts.emit_push_constant_as_uniform_buffer = args.glsl_emit_push_constant_as_ubo; opts.emit_uniform_buffer_as_plain_uniforms = args.glsl_emit_ubo_as_plain_uniforms; opts.force_flattened_io_blocks = args.glsl_force_flattened_io_blocks; opts.keep_unnamed_ubos = args.glsl_keep_unnamed_ubos; opts.remove_attribute_layouts = args.glsl_remove_attribute_layouts; opts.preprocess_spec_const = args.preprocess_spec_const; opts.specialization_constant_prefix = args.specialization_constant_prefix; opts.ovr_multiview_view_count = args.glsl_ovr_multiview_view_count; opts.emit_line_directives = args.emit_line_directives; opts.enable_storage_image_qualifier_deduction = args.enable_storage_image_qualifier_deduction; opts.force_zero_initialized_variables = args.force_zero_initialized_variables; for (let fetch of args.glsl_ext_framebuffer_fetch) compiler.remap_ext_framebuffer_fetch(fetch.first, fetch.second, !args.glsl_ext_framebuffer_fetch_noncoherent); if (build_dummy_sampler) { const sampler = compiler.build_dummy_sampler_for_combined_images(); if (sampler !== 0) { // Set some defaults to make validation happy. compiler.set_decoration(sampler, Decoration.DescriptorSet, 0); compiler.set_decoration(sampler, Decoration.Binding, 0); } } let res: ShaderResources; if (args.remove_unused) { const active = compiler.get_active_interface_variables(); res = compiler.get_shader_resources(active); compiler.set_enabled_interface_variables(active); } else res = compiler.get_shader_resources(); if (args.flatten_ubo) { for (let ubo of res.uniform_buffers) compiler.flatten_buffer_block(ubo.id); for (let ubo of res.push_constant_buffers) compiler.flatten_buffer_block(ubo.id); } const pls_inputs = remap_pls(args.pls_in, res.stage_inputs, res.subpass_inputs); const pls_outputs = remap_pls(args.pls_out, res.stage_outputs, null); compiler.remap_pixel_local_storage(pls_inputs, pls_outputs); for (let ext of args.extensions) compiler.require_extension(ext); for (let remap of args.remaps) { if (remap_generic(compiler, res.stage_inputs, remap)) continue; if (remap_generic(compiler, res.stage_outputs, remap)) continue; if (remap_generic(compiler, res.subpass_inputs, remap)) continue; } for (let rename of args.interface_variable_renames) { if (rename.storageClass === StorageClass.Input) rename_interface_variable(compiler, res.stage_inputs, rename.location, rename.variable_name); else if (rename.storageClass === StorageClass.Output) rename_interface_variable(compiler, res.stage_outputs, rename.location, rename.variable_name); else { throw new Error("error at --rename-interface-variable <in|out> ..."); } } if (combined_image_samplers) { compiler.build_combined_image_samplers(); if (args.combined_samplers_inherit_bindings) inherit_combined_sampler_bindings(compiler); // Give the remapped combined samplers new names. for (let remap of compiler.get_combined_image_samplers()) { compiler.set_name(remap.combined_id, "SPIRV_Cross_Combined" + compiler.get_name(remap.image_id) + compiler.get_name(remap.sampler_id)); } } const ret = compiler.compile(); /*if (args.dump_resources) { compiler->update_active_builtins(); print_resources(*compiler, res); print_push_constant_resources(*compiler, res.push_constant_buffers); print_spec_constants(*compiler); print_capabilities_and_extensions(*compiler); }*/ return ret; } function remap_generic(compiler: Compiler, resources: Resource[], remap: Remap): boolean { const elm = resources.find(res => { return res.name === remap.src_name; }); if (elm) { compiler.set_remapped_variable_state(elm.id, true); compiler.set_name(elm.id, remap.dst_name); compiler.set_subpass_input_remapped_components(elm.id, remap.components); return true; } else return false; } function remap_pls(pls_variables: PLSArg[], resources: Resource[], secondary_resources: Resource[]): PlsRemap[] { const ret: PlsRemap[] = []; for (let pls of pls_variables) { let found = false; for (let res of resources) { if (res.name === pls.name) { ret.push(new PlsRemap(res.id, pls.format)); found = true; break; } } if (!found && secondary_resources) { for (let res of secondary_resources) { if (res.name === pls.name) { ret.push(new PlsRemap(res.id, pls.format)); found = true; break; } } } if (!found) throw new Error(`Did not find stage input/output/target with name ${pls.name}`); } return ret; }
DerSchmale/spirv4web
src/containers/ObjectPool.ts
<filename>src/containers/ObjectPool.ts import { ObjectPoolBase } from "./ObjectPoolBase"; import { AnyConstructor, DefaultConstructor, FromConstructor } from "../common/ConstructorTypes"; // TODO: Actually use an object pool instead of relying on garbage collection // doing it like this for now because we don't have destructors export class ObjectPool<T> extends ObjectPoolBase { private classRef: AnyConstructor<T>; constructor(classRef: AnyConstructor<T>) { super(); this.classRef = classRef; } allocate(...args): T { // TODO: Keep a pool, but the problem is that disposing an out-of-scope is impossible return new this.classRef(...args); } deallocate(ptr: T) { // dispose: // ptr->~T(); // vacants.push_back(ptr); } deallocate_opaque(ptr: any) { this.deallocate(ptr as T); } clear() { } }
DerSchmale/spirv4web
src/spirv/LinkageType.ts
export enum LinkageType { Export = 0, Import = 1, Max = 0x7fffffff, }
DerSchmale/spirv4web
build/types/utils/Pair.d.ts
<gh_stars>0 export declare class Pair<A, B> { first: A; second: B; constructor(first?: A, second?: B); equals(b: Pair<A, B>): boolean; clone(): Pair<A, B>; }
DerSchmale/spirv4web
src/compiler/PhysicalBlockMeta.ts
export class PhysicalBlockMeta { alignment: number = 0; }
DerSchmale/spirv4web
src/spirv/spirv.ts
type Id = number; export const MagicNumber = 0x07230203; export const Version = 0x00010500; export const Revision = 4; export const OpCodeMask = 0xffff; export const WordCountShift = 16;
DerSchmale/spirv4web
build/types/spirv/LoopControlShift.d.ts
<reponame>DerSchmale/spirv4web<filename>build/types/spirv/LoopControlShift.d.ts<gh_stars>0 export declare enum LoopControlShift { Unroll = 0, DontUnroll = 1, DependencyInfinite = 2, DependencyLength = 3, MinIterations = 4, MaxIterations = 5, IterationMultiple = 6, PeelCount = 7, PartialCount = 8, InitiationIntervalINTEL = 16, MaxConcurrencyINTEL = 17, DependencyArrayINTEL = 18, PipelineEnableINTEL = 19, LoopCoalesceINTEL = 20, MaxInterleavingINTEL = 21, SpeculatedIterationsINTEL = 22, Max = 2147483647 }
DerSchmale/spirv4web
build/types/spirv/spirv.d.ts
<reponame>DerSchmale/spirv4web export declare const MagicNumber = 119734787; export declare const Version = 66816; export declare const Revision = 4; export declare const OpCodeMask = 65535; export declare const WordCountShift = 16;
DerSchmale/spirv4web
src/common/ExtendedDecorations.ts
<reponame>DerSchmale/spirv4web export enum ExtendedDecorations { // Marks if a buffer block is re-packed, i.e. member declaration might be subject to PhysicalTypeID remapping and padding. BufferBlockRepacked = 0, // A type in a buffer block might be declared with a different physical type than the logical type. // If this is not set, PhysicalTypeID === the SPIR-V type as declared. PhysicalTypeID, // Marks if the physical type is to be declared with tight packing rules, i.e. packed_floatN on MSL and friends. // If this is set, PhysicalTypeID might also be set. It can be set to same as logical type if all we're doing // is converting float3 to packed_float3 for example. // If this is marked on a struct, it means the struct itself must use only Packed types for all its members. PhysicalTypePacked, // The padding in bytes before declaring this struct member. // If used on a struct type, marks the target size of a struct. PaddingTarget, SPIRVCrossDecorationInterfaceMemberIndex, SPIRVCrossDecorationInterfaceOrigID, SPIRVCrossDecorationResourceIndexPrimary, // Used for decorations like resource indices for samplers when part of combined image samplers. // A variable might need to hold two resource indices in this case. SPIRVCrossDecorationResourceIndexSecondary, // Used for resource indices for multiplanar images when part of combined image samplers. SPIRVCrossDecorationResourceIndexTertiary, SPIRVCrossDecorationResourceIndexQuaternary, // Marks a buffer block for using explicit offsets (GLSL/HLSL). ExplicitOffset, // Apply to a variable in the Input storage class; marks it as holding the base group passed to vkCmdDispatchBase(), // or the base vertex and instance indices passed to vkCmdDrawIndexed(). // In MSL, this is used to adjust the WorkgroupId and GlobalInvocationId variables in compute shaders, // and to hold the BaseVertex and BaseInstance variables in vertex shaders. BuiltInDispatchBase, // Apply to a variable that is a function parameter; marks it as being a "dynamic" // combined image-sampler. In MSL, this is used when a function parameter might hold // either a regular combined image-sampler or one that has an attached sampler // Y'CbCr conversion. DynamicImageSampler, // Apply to a variable in the Input storage class; marks it as holding the size of the stage // input grid. // In MSL, this is used to hold the vertex and instance counts in a tessellation pipeline // vertex shader. BuiltInStageInputSize, // Apply to any access chain of a tessellation I/O variable; stores the type of the sub-object // that was chained to, as recorded in the input variable itself. This is used in case the pointer // is itself used as the base of an access chain, to calculate the original type of the sub-object // chained to, in case a swizzle needs to be applied. This should not happen normally with valid // SPIR-V, but the MSL backend can change the type of input variables, necessitating the // addition of swizzles to keep the generated code compiling. TessIOOriginalInputTypeID, // Apply to any access chain of an interface variable used with pull-model interpolation, where the variable is a // vector but the resulting pointer is a scalar; stores the component index that is to be accessed by the chain. // This is used when emitting calls to interpolation functions on the chain in MSL: in this case, the component // must be applied to the result, since pull-model interpolants in MSL cannot be swizzled directly, but the // results of interpolation can. InterpolantComponentExpr, Count }
DerSchmale/spirv4web
src/spirv/Scope.ts
<filename>src/spirv/Scope.ts export enum Scope { CrossDevice = 0, Device = 1, Workgroup = 2, Subgroup = 3, Invocation = 4, QueueFamily = 5, QueueFamilyKHR = 5, ShaderCallKHR = 6, Max = 0x7fffffff, }
DerSchmale/spirv4web
src/compiler/glsl/AccessChainFlagBits.ts
<reponame>DerSchmale/spirv4web<filename>src/compiler/glsl/AccessChainFlagBits.ts export enum AccessChainFlagBits { INDEX_IS_LITERAL_BIT = 1 << 0, CHAIN_ONLY_BIT = 1 << 1, PTR_CHAIN_BIT = 1 << 2, SKIP_REGISTER_EXPRESSION_READ_BIT = 1 << 3, LITERAL_MSB_FORCE_ID = 1 << 4, FLATTEN_ALL_MEMBERS_BIT = 1 << 5, FORCE_COMPOSITE_BIT = 1 << 6 }
DerSchmale/spirv4web
build/types/Args.d.ts
import { Pair } from "./utils/Pair"; import { PlsFormat } from "./compiler/glsl/glsl"; import { ExecutionModel } from "./spirv/ExecutionModel"; import { StorageClass } from "./spirv/StorageClass"; import { BuiltIn } from "./spirv/BuiltIn"; export declare class Rename { old_name: string; new_name: string; execution_model: ExecutionModel; } export declare class VariableTypeRemap { variable_name: string; new_variable_type: string; } export declare class InterfaceVariableRename { storageClass: StorageClass; location: number; variable_name: string; } export declare class PLSArg { format: PlsFormat; name: string; } export declare class Remap { src_name: string; dst_name: string; components: number; } export declare class Args { version: number; shader_model: number; set_version: boolean; set_shader_model: boolean; dump_resources: boolean; force_temporary: boolean; flatten_ubo: boolean; fixup: boolean; yflip: boolean; sso: boolean; support_nonzero_baseinstance: boolean; glsl_emit_push_constant_as_ubo: boolean; glsl_emit_ubo_as_plain_uniforms: boolean; glsl_force_flattened_io_blocks: boolean; glsl_keep_unnamed_ubos: boolean; glsl_ovr_multiview_view_count: number; glsl_ext_framebuffer_fetch: Pair<number, number>[]; glsl_ext_framebuffer_fetch_noncoherent: boolean; emit_line_directives: boolean; enable_storage_image_qualifier_deduction: boolean; force_zero_initialized_variables: boolean; pls_in: PLSArg[]; pls_out: PLSArg[]; remaps: Remap[]; extensions: string[]; variable_type_remaps: VariableTypeRemap[]; interface_variable_renames: InterfaceVariableRename[]; masked_stage_outputs: Pair<number, number>[]; masked_stage_builtins: BuiltIn[]; entry: string; entry_stage: string; entry_point_rename: Rename[]; cpp: boolean; reflect: string; flatten_multidimensional_arrays: boolean; use_420pack_extension: boolean; remove_unused: boolean; combined_samplers_inherit_bindings: boolean; glsl_remove_attribute_layouts: boolean; specialization_constant_prefix: string; preprocess_spec_const: boolean; }
DerSchmale/spirv4web
build/types/common/SPIREntryPoint.d.ts
import { Bitset } from "./Bitset"; import { ExecutionModel } from "../spirv/ExecutionModel"; declare class SPIREntryPointWorkgroupSize { x: number; y: number; z: number; id_x: number; id_y: number; id_z: number; constant: number; clone(): SPIREntryPointWorkgroupSize; } export declare class SPIREntryPoint { self: FunctionID; name: string; orig_name: string; interface_variables: VariableID[]; flags: Bitset; workgroup_size: SPIREntryPointWorkgroupSize; invocations: number; output_vertices: number; model: ExecutionModel; geometry_passthrough: boolean; constructor(param0: FunctionID | SPIREntryPoint, execution_model: ExecutionModel, entry_name: string); } export {};
DerSchmale/spirv4web
src/common/Meta.ts
import { Bitset } from "./Bitset"; import { BuiltIn } from "../spirv/BuiltIn"; import { FPRoundingMode } from "../spirv/FPRoundingMode"; import { defaultClone } from "../utils/defaultCopy"; import { ExtendedDecorations } from "./ExtendedDecorations"; export class MetaDecorationExtended { flags: Bitset = new Bitset(); values: Uint32Array = new Uint32Array(ExtendedDecorations.Count); clone(): MetaDecorationExtended { return defaultClone(MetaDecorationExtended, this); } } export class MetaDecoration { alias: string = ""; qualified_alias: string = ""; hlsl_semantic: string = ""; decoration_flags: Bitset = new Bitset(); builtin_type = BuiltIn.Max; location: number = 0; component: number = 0; set: number = 0; binding: number = 0; offset: number = 0; xfb_buffer: number = 0; xfb_stride: number = 0; stream: number = 0; array_stride: number = 0; matrix_stride: number = 0; input_attachment: number = 0; spec_id: number = 0; index: number = 0; fp_rounding_mode: FPRoundingMode = FPRoundingMode.Max; builtin: boolean = false; extended: MetaDecorationExtended = new MetaDecorationExtended(); clone(): MetaDecoration { return defaultClone(MetaDecoration, this); } } export class Meta { decoration = new MetaDecoration(); // Intentionally not a SmallVector. Decoration is large and somewhat rare. members: MetaDecoration[] = []; decoration_word_offset: number[] = []; // For SPV_GOOGLE_hlsl_functionality1. hlsl_is_magic_counter_buffer: boolean = false; // ID for the sibling counter buffer. hlsl_magic_counter_buffer: number = 0; }
DerSchmale/spirv4web
src/common/AccessChainMeta.ts
export class AccessChainMeta { storage_physical_type: number = 0; need_transpose: boolean = false; storage_is_packed: boolean = false; storage_is_invariant: boolean = false; flattened_struct: boolean = false; }
DerSchmale/spirv4web
src/common/SPIRString.ts
<filename>src/common/SPIRString.ts import { IVariant } from "./IVariant"; import { Types } from "./Types"; import { defaultCopy } from "../utils/defaultCopy"; export class SPIRString extends IVariant { static type = Types.String; str: string; constructor(other: SPIRString); constructor(str: string); constructor(param0: string | SPIRString) { super(); if (param0 instanceof SPIRString) defaultCopy(param0, this); else this.str = param0; } }
DerSchmale/spirv4web
src/spirv/MemorySemanticsMask.ts
<filename>src/spirv/MemorySemanticsMask.ts export enum MemorySemanticsMask { None = 0, Acquire = 0x00000002, Release = 0x00000004, AcquireRelease = 0x00000008, SequentiallyConsistent = 0x00000010, UniformMemory = 0x00000040, SubgroupMemory = 0x00000080, WorkgroupMemory = 0x00000100, CrossWorkgroupMemory = 0x00000200, AtomicCounterMemory = 0x00000400, ImageMemory = 0x00000800, OutputMemory = 0x00001000, OutputMemoryKHR = 0x00001000, MakeAvailable = 0x00002000, MakeAvailableKHR = 0x00002000, MakeVisible = 0x00004000, MakeVisibleKHR = 0x00004000, Volatile = 0x00008000, }
DerSchmale/spirv4web
build/types/common/ExtendedDecorations.d.ts
export declare enum ExtendedDecorations { BufferBlockRepacked = 0, PhysicalTypeID = 1, PhysicalTypePacked = 2, PaddingTarget = 3, SPIRVCrossDecorationInterfaceMemberIndex = 4, SPIRVCrossDecorationInterfaceOrigID = 5, SPIRVCrossDecorationResourceIndexPrimary = 6, SPIRVCrossDecorationResourceIndexSecondary = 7, SPIRVCrossDecorationResourceIndexTertiary = 8, SPIRVCrossDecorationResourceIndexQuaternary = 9, ExplicitOffset = 10, BuiltInDispatchBase = 11, DynamicImageSampler = 12, BuiltInStageInputSize = 13, TessIOOriginalInputTypeID = 14, InterpolantComponentExpr = 15, Count = 16 }