├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── cg.configuration.json ├── glsl.configuration.json ├── icon.png ├── images ├── code-completion.png ├── document-symbols.png ├── find-ref.png ├── hlsl-doc.png ├── show-hover.png ├── signature-help.png ├── syntax-highlight.png └── workspace-symbols.png ├── package-lock.json ├── package.json ├── src ├── common.ts ├── extension.ts └── hlsl │ ├── completionProvider.ts │ ├── definitionProvider.ts │ ├── hlslGlobals.ts │ ├── hoverProvider.ts │ ├── html.ts │ ├── referenceProvider.ts │ ├── signatureProvider.ts │ └── symbolProvider.ts ├── syntaxes ├── cg-cpp.tmLanguage.json ├── cg.tmLanguage ├── glsl-cpp.tmLanguage.json ├── glsl-html.tmLanguage.json ├── glsl.tmLanguage └── hlsl-cpp.tmLanguage.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .vscode-test/ 4 | .vsix 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch Extension", 6 | "type": "extensionHost", 7 | "request": "launch", 8 | "runtimeExecutable": "${execPath}", 9 | "args": [ 10 | "--extensionDevelopmentPath=${workspaceRoot}" 11 | ], 12 | "stopOnEntry": false, 13 | "sourceMaps": true, 14 | "outFiles": [ "${workspaceRoot}/out/**/*.js" ], 15 | "preLaunchTask": "npm: watch" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .temp/** 2 | .vscode/** 3 | typings/** 4 | out/test/** 5 | test/** 6 | src/** 7 | **/*.map 8 | .gitignore 9 | tsconfig.json 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.5] 2021-02-08 4 | * Remove deprecated `workspace.rootPath` 5 | * Fix HLSL Documentation (#24) 6 | * Fix error in provideDocumentFormattingEdits (#29, thanks @Systemcluster) 7 | * Update GLSL grammar (#30) 8 | * Improved icon (#37, thanks @Andari85, @Tyriar) 9 | 10 | ## [1.1.4] 2018-10-09 11 | * Fix HLSL Documentation 12 | 13 | ## [1.1.3] 2018-04-28 14 | 15 | * Use vscode-bundled rg binary instead of npm dependency 16 | * Restrict language services to local files (#15, thanks @lostintangent) 17 | 18 | ## [1.1.0] 2017-10-23 19 | 20 | * Add symbol support, for document and workspace 21 | * Add reference and definition support 22 | * Add format support, if MS CppTools is installed 23 | * Open HLSL documentation in editor, on the side 24 | 25 | ## [1.0.0] 2017-10-14 26 | 27 | * Hover, code completion and signature helper for HLSL 28 | * New config setting to disable suggestions 29 | * Add screenshots to README.md 30 | * Add a CHANGELOG.md file 31 | 32 | ## [0.2.4] 2017-09-17 33 | 34 | * Fix typo for gl_FragData & gl_FragDepth (#9, thanks @minalear) 35 | 36 | ## [0.2.3] 2017-02-11 37 | 38 | * More detailed GLSL syntax 39 | * New file extensions for OpenGL 40 | 41 | ## [0.2.2] 2016-07-11 42 | 43 | * Support for .glslg (#4) 44 | * Fix install shield 45 | 46 | ## [0.2.1] 2016-04-04 47 | 48 | * Shields on README.md 49 | * Fix comment blocks for Cg & HLSL 50 | 51 | ## [0.2.0] 2015-12-30 52 | 53 | * Launch and config files 54 | * New icon 55 | * New GLSL syntax 56 | 57 | ## [0.1.0] 2015-11-17 58 | 59 | * Initial commit 60 | 61 | [1.1.5]: https://github.com/stef-levesque/vscode-shader/compare/98b6044edbfa3d316bf2e5ef4b50f82068fb74d5...06c8a4d291980708f90363f0f2fd02fe7c4f528f 62 | [1.1.4]: https://github.com/stef-levesque/vscode-shader/compare/81be436a4f765ebec5418e7c7b309d228cd7697d...98b6044edbfa3d316bf2e5ef4b50f82068fb74d5 63 | [1.1.3]: https://github.com/stef-levesque/vscode-shader/compare/a873126ce016e077a0af4fff46c324454738ae87...81be436a4f765ebec5418e7c7b309d228cd7697d 64 | [1.1.0]: https://github.com/stef-levesque/vscode-shader/compare/f267849465eb65db750662fd9a363f42f7fb3146...58c81e53136d6549b5df943fe5650ae5c78b7564 65 | [1.0.0]: https://github.com/stef-levesque/vscode-shader/compare/e00c227839e15ddf1361edc982cb5612ecf3c5ed...9d67fe5daa928c8608ee3d82c90335b1058bb4c7 66 | [0.2.4]: https://github.com/stef-levesque/vscode-shader/compare/20c737c39f5529968c4f0813ab124b39f215899c...5c09b38d319c57fb08bdf220c792dd3c8cc4f472 67 | [0.2.3]: https://github.com/stef-levesque/vscode-shader/compare/5190ee80f366babaa660bd64e0e1c0fe1fbffb53...c646bfae579fac36716c6299904e8a4f728c4972 68 | [0.2.2]: https://github.com/stef-levesque/vscode-shader/compare/785b316a66a53146b6ec77a9ab95e59da80369ad...a1d3b263ac9be20f7575167e346a6eec64d6efba 69 | [0.2.1]: https://github.com/stef-levesque/vscode-shader/compare/620868b7f2bd3fa01429951ed6eb3cd92bcbcb93...705eb2c5056e82dd490ce63abab3ed067f17b467 70 | [0.2.0]: https://github.com/stef-levesque/vscode-shader/compare/596818fffc4270c565ecb47f229f894e7b00a048...8f7353f08249883916e7d9aad376d942aafd4f0a 71 | [0.1.0]: https://github.com/stef-levesque/vscode-shader/commit/596818fffc4270c565ecb47f229f894e7b00a048 -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | **Copyright © 2015 Stef Levesque** 3 | 4 | * * * 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the “Software”), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vscode-shader 2 | 3 | [![GitHub issues](https://img.shields.io/github/issues/stef-levesque/vscode-shader.svg)](https://github.com/stef-levesque/vscode-shader/issues) 4 | [![GitHub license button](https://img.shields.io/github/license/stef-levesque/vscode-shader.svg)](https://github.com/stef-levesque/vscode-shader/blob/master/LICENSE.md) 5 | [![VS Code marketplace button](https://vsmarketplacebadge.apphb.com/installs/slevesque.shader.svg)](https://marketplace.visualstudio.com/items/slevesque.shader) 6 | [![Gitter chat button](https://img.shields.io/gitter/room/stef-levesque/vscode-shader.svg)](https://gitter.im/stef-levesque/vscode-shader) 7 | 8 | ## Description 9 | 10 | Shader languages support for VS Code 11 | 12 | * `HLSL` - High-Level Shading Language 13 | * `GLSL` - OpenGL Shading Language 14 | * `Cg` - C for Graphics 15 | 16 | ## Main Features 17 | 18 | ### All languages 19 | 20 | #### Syntax highlighting for shader languages 21 | ![Syntax Highlighting](images/syntax-highlight.png) 22 | 23 | ### HLSL 24 | 25 | #### Show Code Completion Proposals 26 | ![Code Completion](images/code-completion.png) 27 | 28 | #### Help With Function and Method Signatures 29 | ![Signature Help](images/signature-help.png) 30 | 31 | #### Show Hover 32 | ![Show Hover](images/show-hover.png) 33 | 34 | #### HLSL Documentation 35 | ![HLSL Documentation](images/hlsl-doc.png) 36 | Clicking on the link in the Hover box will open HLSL documentation (when available) 37 | 38 | #### Find References and Definition 39 | ![Find References](images/find-ref.png) 40 | 41 | #### Document and Workspace Symbols 42 | ![document-symbols](images/document-symbols.png) ![workspace-symbols](images/workspace-symbols.png) 43 | 44 | #### Formatting Code 45 | *(Experimental)* Require [MS CppTools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) to be installed 46 | 47 | ## Configuration 48 | 49 | * `hlsl.suggest.basic` Configures if the HLSL language suggestions are enabled 50 | * `hlsl.openDocOnSide` Open HLSL Documentation link in editor and on the side, instead of in external browser 51 | 52 | ## Installation 53 | 54 | 1. Install *Visual Studio Code* (1.17.0 or higher) 55 | 2. Launch *Code* 56 | 3. From the command palette `Ctrl-Shift-P` (Windows, Linux) or `Cmd-Shift-P` (OSX) 57 | 4. Select `Install Extensions` 58 | 5. Choose the extension `Shader languages support for VS Code` 59 | 6. Reload *Visual Studio Code* 60 | 61 | ## Contributing 62 | 63 | 1. Fork it! 64 | 2. Create your feature branch: `git checkout -b my-new-feature` 65 | 3. Commit your changes: `git commit -am 'Add some feature'` 66 | 4. Push to the branch: `git push origin my-new-feature` 67 | 5. Submit a pull request :D 68 | 69 | ## Requirements 70 | 71 | Visual Studio Code v1.17.0 72 | 73 | ## Credits 74 | 75 | * [Visual Studio Code](https://code.visualstudio.com/) 76 | * [vscode-docs on GitHub](https://github.com/Microsoft/vscode-docs) 77 | * [Follow Redirects on GitHub](https://github.com/olalonde/follow-redirects) 78 | * [HLSL Tools for Visual Studio](https://github.com/tgjones/HlslTools) 79 | * [Sublime Text - GLSL Package](https://github.com/euler0/sublime-glsl) 80 | 81 | ## License 82 | 83 | [MIT](LICENSE.md) 84 | -------------------------------------------------------------------------------- /cg.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ] 14 | } -------------------------------------------------------------------------------- /glsl.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ] 14 | } -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/icon.png -------------------------------------------------------------------------------- /images/code-completion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/code-completion.png -------------------------------------------------------------------------------- /images/document-symbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/document-symbols.png -------------------------------------------------------------------------------- /images/find-ref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/find-ref.png -------------------------------------------------------------------------------- /images/hlsl-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/hlsl-doc.png -------------------------------------------------------------------------------- /images/show-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/show-hover.png -------------------------------------------------------------------------------- /images/signature-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/signature-help.png -------------------------------------------------------------------------------- /images/syntax-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/syntax-highlight.png -------------------------------------------------------------------------------- /images/workspace-symbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stef-levesque/vscode-shader/f1c804839f9f58a6749c9a840187c5527b76b053/images/workspace-symbols.png -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shader", 3 | "version": "1.1.5", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/node": { 8 | "version": "12.19.16", 9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.16.tgz", 10 | "integrity": "sha512-7xHmXm/QJ7cbK2laF+YYD7gb5MggHIIQwqyjin3bpEGiSuvScMQ5JZZXPvRipi1MwckTQbJZROMns/JxdnIL1Q==", 11 | "dev": true 12 | }, 13 | "@types/tmp": { 14 | "version": "0.2.0", 15 | "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.0.tgz", 16 | "integrity": "sha512-flgpHJjntpBAdJD43ShRosQvNC0ME97DCfGvZEDlAThQmnerRXrLbX6YgzRBQCZTthET9eAWFAMaYP0m0Y4HzQ==", 17 | "dev": true 18 | }, 19 | "@types/vscode": { 20 | "version": "1.53.0", 21 | "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.53.0.tgz", 22 | "integrity": "sha512-XjFWbSPOM0EKIT2XhhYm3D3cx3nn3lshMUcWNy1eqefk+oqRuBq8unVb6BYIZqXy9lQZyeUl7eaBCOZWv+LcXQ==", 23 | "dev": true 24 | }, 25 | "abab": { 26 | "version": "2.0.5", 27 | "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", 28 | "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==" 29 | }, 30 | "acorn": { 31 | "version": "5.7.4", 32 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", 33 | "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==" 34 | }, 35 | "acorn-globals": { 36 | "version": "4.3.4", 37 | "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", 38 | "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", 39 | "requires": { 40 | "acorn": "^6.0.1", 41 | "acorn-walk": "^6.0.1" 42 | }, 43 | "dependencies": { 44 | "acorn": { 45 | "version": "6.4.2", 46 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", 47 | "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==" 48 | } 49 | } 50 | }, 51 | "acorn-walk": { 52 | "version": "6.2.0", 53 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", 54 | "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" 55 | }, 56 | "ajv": { 57 | "version": "6.12.6", 58 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", 59 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", 60 | "requires": { 61 | "fast-deep-equal": "^3.1.1", 62 | "fast-json-stable-stringify": "^2.0.0", 63 | "json-schema-traverse": "^0.4.1", 64 | "uri-js": "^4.2.2" 65 | } 66 | }, 67 | "array-equal": { 68 | "version": "1.0.0", 69 | "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", 70 | "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" 71 | }, 72 | "asn1": { 73 | "version": "0.2.4", 74 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 75 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 76 | "requires": { 77 | "safer-buffer": "~2.1.0" 78 | } 79 | }, 80 | "assert-plus": { 81 | "version": "1.0.0", 82 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 83 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 84 | }, 85 | "async-limiter": { 86 | "version": "1.0.1", 87 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", 88 | "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" 89 | }, 90 | "asynckit": { 91 | "version": "0.4.0", 92 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 93 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 94 | }, 95 | "aws-sign2": { 96 | "version": "0.7.0", 97 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 98 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 99 | }, 100 | "aws4": { 101 | "version": "1.11.0", 102 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", 103 | "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" 104 | }, 105 | "bcrypt-pbkdf": { 106 | "version": "1.0.2", 107 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 108 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 109 | "requires": { 110 | "tweetnacl": "^0.14.3" 111 | } 112 | }, 113 | "browser-process-hrtime": { 114 | "version": "1.0.0", 115 | "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", 116 | "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" 117 | }, 118 | "caseless": { 119 | "version": "0.12.0", 120 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 121 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 122 | }, 123 | "combined-stream": { 124 | "version": "1.0.8", 125 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 126 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 127 | "requires": { 128 | "delayed-stream": "~1.0.0" 129 | } 130 | }, 131 | "core-util-is": { 132 | "version": "1.0.2", 133 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 134 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 135 | }, 136 | "cssom": { 137 | "version": "0.3.8", 138 | "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", 139 | "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" 140 | }, 141 | "cssstyle": { 142 | "version": "1.4.0", 143 | "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", 144 | "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", 145 | "requires": { 146 | "cssom": "0.3.x" 147 | } 148 | }, 149 | "dashdash": { 150 | "version": "1.14.1", 151 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 152 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 153 | "requires": { 154 | "assert-plus": "^1.0.0" 155 | } 156 | }, 157 | "data-urls": { 158 | "version": "1.1.0", 159 | "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", 160 | "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", 161 | "requires": { 162 | "abab": "^2.0.0", 163 | "whatwg-mimetype": "^2.2.0", 164 | "whatwg-url": "^7.0.0" 165 | }, 166 | "dependencies": { 167 | "whatwg-url": { 168 | "version": "7.1.0", 169 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", 170 | "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", 171 | "requires": { 172 | "lodash.sortby": "^4.7.0", 173 | "tr46": "^1.0.1", 174 | "webidl-conversions": "^4.0.2" 175 | } 176 | } 177 | } 178 | }, 179 | "deep-is": { 180 | "version": "0.1.3", 181 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", 182 | "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" 183 | }, 184 | "delayed-stream": { 185 | "version": "1.0.0", 186 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 187 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 188 | }, 189 | "domexception": { 190 | "version": "1.0.1", 191 | "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", 192 | "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", 193 | "requires": { 194 | "webidl-conversions": "^4.0.2" 195 | } 196 | }, 197 | "ecc-jsbn": { 198 | "version": "0.1.2", 199 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 200 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 201 | "requires": { 202 | "jsbn": "~0.1.0", 203 | "safer-buffer": "^2.1.0" 204 | } 205 | }, 206 | "escodegen": { 207 | "version": "1.14.3", 208 | "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", 209 | "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", 210 | "requires": { 211 | "esprima": "^4.0.1", 212 | "estraverse": "^4.2.0", 213 | "esutils": "^2.0.2", 214 | "optionator": "^0.8.1", 215 | "source-map": "~0.6.1" 216 | } 217 | }, 218 | "esprima": { 219 | "version": "4.0.1", 220 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 221 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" 222 | }, 223 | "estraverse": { 224 | "version": "4.3.0", 225 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", 226 | "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" 227 | }, 228 | "esutils": { 229 | "version": "2.0.3", 230 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", 231 | "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" 232 | }, 233 | "extend": { 234 | "version": "3.0.2", 235 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 236 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 237 | }, 238 | "extsprintf": { 239 | "version": "1.3.0", 240 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 241 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 242 | }, 243 | "fast-deep-equal": { 244 | "version": "3.1.3", 245 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 246 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" 247 | }, 248 | "fast-json-stable-stringify": { 249 | "version": "2.1.0", 250 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 251 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" 252 | }, 253 | "fast-levenshtein": { 254 | "version": "2.0.6", 255 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 256 | "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" 257 | }, 258 | "follow-redirects": { 259 | "version": "1.13.2", 260 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.2.tgz", 261 | "integrity": "sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==" 262 | }, 263 | "forever-agent": { 264 | "version": "0.6.1", 265 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 266 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 267 | }, 268 | "form-data": { 269 | "version": "2.3.3", 270 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 271 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 272 | "requires": { 273 | "asynckit": "^0.4.0", 274 | "combined-stream": "^1.0.6", 275 | "mime-types": "^2.1.12" 276 | } 277 | }, 278 | "getpass": { 279 | "version": "0.1.7", 280 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 281 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 282 | "requires": { 283 | "assert-plus": "^1.0.0" 284 | } 285 | }, 286 | "har-schema": { 287 | "version": "2.0.0", 288 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 289 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 290 | }, 291 | "har-validator": { 292 | "version": "5.1.5", 293 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", 294 | "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", 295 | "requires": { 296 | "ajv": "^6.12.3", 297 | "har-schema": "^2.0.0" 298 | } 299 | }, 300 | "html-encoding-sniffer": { 301 | "version": "1.0.2", 302 | "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", 303 | "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", 304 | "requires": { 305 | "whatwg-encoding": "^1.0.1" 306 | } 307 | }, 308 | "http-signature": { 309 | "version": "1.2.0", 310 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 311 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 312 | "requires": { 313 | "assert-plus": "^1.0.0", 314 | "jsprim": "^1.2.2", 315 | "sshpk": "^1.7.0" 316 | } 317 | }, 318 | "iconv-lite": { 319 | "version": "0.4.24", 320 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 321 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 322 | "requires": { 323 | "safer-buffer": ">= 2.1.2 < 3" 324 | } 325 | }, 326 | "is-typedarray": { 327 | "version": "1.0.0", 328 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 329 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 330 | }, 331 | "isstream": { 332 | "version": "0.1.2", 333 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 334 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 335 | }, 336 | "jsbn": { 337 | "version": "0.1.1", 338 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 339 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 340 | }, 341 | "jsdom": { 342 | "version": "11.12.0", 343 | "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", 344 | "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", 345 | "requires": { 346 | "abab": "^2.0.0", 347 | "acorn": "^5.5.3", 348 | "acorn-globals": "^4.1.0", 349 | "array-equal": "^1.0.0", 350 | "cssom": ">= 0.3.2 < 0.4.0", 351 | "cssstyle": "^1.0.0", 352 | "data-urls": "^1.0.0", 353 | "domexception": "^1.0.1", 354 | "escodegen": "^1.9.1", 355 | "html-encoding-sniffer": "^1.0.2", 356 | "left-pad": "^1.3.0", 357 | "nwsapi": "^2.0.7", 358 | "parse5": "4.0.0", 359 | "pn": "^1.1.0", 360 | "request": "^2.87.0", 361 | "request-promise-native": "^1.0.5", 362 | "sax": "^1.2.4", 363 | "symbol-tree": "^3.2.2", 364 | "tough-cookie": "^2.3.4", 365 | "w3c-hr-time": "^1.0.1", 366 | "webidl-conversions": "^4.0.2", 367 | "whatwg-encoding": "^1.0.3", 368 | "whatwg-mimetype": "^2.1.0", 369 | "whatwg-url": "^6.4.1", 370 | "ws": "^5.2.0", 371 | "xml-name-validator": "^3.0.0" 372 | } 373 | }, 374 | "json-schema": { 375 | "version": "0.2.3", 376 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 377 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" 378 | }, 379 | "json-schema-traverse": { 380 | "version": "0.4.1", 381 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 382 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" 383 | }, 384 | "json-stringify-safe": { 385 | "version": "5.0.1", 386 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 387 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 388 | }, 389 | "jsprim": { 390 | "version": "1.4.1", 391 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", 392 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", 393 | "requires": { 394 | "assert-plus": "1.0.0", 395 | "extsprintf": "1.3.0", 396 | "json-schema": "0.2.3", 397 | "verror": "1.10.0" 398 | } 399 | }, 400 | "left-pad": { 401 | "version": "1.3.0", 402 | "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", 403 | "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==" 404 | }, 405 | "levn": { 406 | "version": "0.3.0", 407 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", 408 | "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", 409 | "requires": { 410 | "prelude-ls": "~1.1.2", 411 | "type-check": "~0.3.2" 412 | } 413 | }, 414 | "lodash": { 415 | "version": "4.17.20", 416 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", 417 | "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" 418 | }, 419 | "lodash.sortby": { 420 | "version": "4.7.0", 421 | "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", 422 | "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" 423 | }, 424 | "mime-db": { 425 | "version": "1.45.0", 426 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", 427 | "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==" 428 | }, 429 | "mime-types": { 430 | "version": "2.1.28", 431 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", 432 | "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", 433 | "requires": { 434 | "mime-db": "1.45.0" 435 | } 436 | }, 437 | "nwsapi": { 438 | "version": "2.2.0", 439 | "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", 440 | "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==" 441 | }, 442 | "oauth-sign": { 443 | "version": "0.9.0", 444 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 445 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 446 | }, 447 | "optionator": { 448 | "version": "0.8.3", 449 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", 450 | "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", 451 | "requires": { 452 | "deep-is": "~0.1.3", 453 | "fast-levenshtein": "~2.0.6", 454 | "levn": "~0.3.0", 455 | "prelude-ls": "~1.1.2", 456 | "type-check": "~0.3.2", 457 | "word-wrap": "~1.2.3" 458 | } 459 | }, 460 | "os-tmpdir": { 461 | "version": "1.0.2", 462 | "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 463 | "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" 464 | }, 465 | "parse5": { 466 | "version": "4.0.0", 467 | "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", 468 | "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" 469 | }, 470 | "performance-now": { 471 | "version": "2.1.0", 472 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 473 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 474 | }, 475 | "pn": { 476 | "version": "1.1.0", 477 | "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", 478 | "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" 479 | }, 480 | "prelude-ls": { 481 | "version": "1.1.2", 482 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 483 | "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" 484 | }, 485 | "psl": { 486 | "version": "1.8.0", 487 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", 488 | "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" 489 | }, 490 | "punycode": { 491 | "version": "2.1.1", 492 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 493 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 494 | }, 495 | "qs": { 496 | "version": "6.5.2", 497 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 498 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 499 | }, 500 | "request": { 501 | "version": "2.88.2", 502 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", 503 | "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", 504 | "requires": { 505 | "aws-sign2": "~0.7.0", 506 | "aws4": "^1.8.0", 507 | "caseless": "~0.12.0", 508 | "combined-stream": "~1.0.6", 509 | "extend": "~3.0.2", 510 | "forever-agent": "~0.6.1", 511 | "form-data": "~2.3.2", 512 | "har-validator": "~5.1.3", 513 | "http-signature": "~1.2.0", 514 | "is-typedarray": "~1.0.0", 515 | "isstream": "~0.1.2", 516 | "json-stringify-safe": "~5.0.1", 517 | "mime-types": "~2.1.19", 518 | "oauth-sign": "~0.9.0", 519 | "performance-now": "^2.1.0", 520 | "qs": "~6.5.2", 521 | "safe-buffer": "^5.1.2", 522 | "tough-cookie": "~2.5.0", 523 | "tunnel-agent": "^0.6.0", 524 | "uuid": "^3.3.2" 525 | } 526 | }, 527 | "request-promise-core": { 528 | "version": "1.1.4", 529 | "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", 530 | "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", 531 | "requires": { 532 | "lodash": "^4.17.19" 533 | } 534 | }, 535 | "request-promise-native": { 536 | "version": "1.0.9", 537 | "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", 538 | "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", 539 | "requires": { 540 | "request-promise-core": "1.1.4", 541 | "stealthy-require": "^1.1.1", 542 | "tough-cookie": "^2.3.3" 543 | } 544 | }, 545 | "safe-buffer": { 546 | "version": "5.2.1", 547 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 548 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 549 | }, 550 | "safer-buffer": { 551 | "version": "2.1.2", 552 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 553 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 554 | }, 555 | "sax": { 556 | "version": "1.2.4", 557 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 558 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 559 | }, 560 | "source-map": { 561 | "version": "0.6.1", 562 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 563 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 564 | "optional": true 565 | }, 566 | "sshpk": { 567 | "version": "1.16.1", 568 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 569 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", 570 | "requires": { 571 | "asn1": "~0.2.3", 572 | "assert-plus": "^1.0.0", 573 | "bcrypt-pbkdf": "^1.0.0", 574 | "dashdash": "^1.12.0", 575 | "ecc-jsbn": "~0.1.1", 576 | "getpass": "^0.1.1", 577 | "jsbn": "~0.1.0", 578 | "safer-buffer": "^2.0.2", 579 | "tweetnacl": "~0.14.0" 580 | } 581 | }, 582 | "stealthy-require": { 583 | "version": "1.1.1", 584 | "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", 585 | "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" 586 | }, 587 | "symbol-tree": { 588 | "version": "3.2.4", 589 | "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", 590 | "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" 591 | }, 592 | "tmp": { 593 | "version": "0.0.33", 594 | "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", 595 | "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", 596 | "requires": { 597 | "os-tmpdir": "~1.0.2" 598 | } 599 | }, 600 | "tough-cookie": { 601 | "version": "2.5.0", 602 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", 603 | "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", 604 | "requires": { 605 | "psl": "^1.1.28", 606 | "punycode": "^2.1.1" 607 | } 608 | }, 609 | "tr46": { 610 | "version": "1.0.1", 611 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", 612 | "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", 613 | "requires": { 614 | "punycode": "^2.1.0" 615 | } 616 | }, 617 | "tunnel-agent": { 618 | "version": "0.6.0", 619 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 620 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 621 | "requires": { 622 | "safe-buffer": "^5.0.1" 623 | } 624 | }, 625 | "tweetnacl": { 626 | "version": "0.14.5", 627 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 628 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" 629 | }, 630 | "type-check": { 631 | "version": "0.3.2", 632 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", 633 | "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", 634 | "requires": { 635 | "prelude-ls": "~1.1.2" 636 | } 637 | }, 638 | "typescript": { 639 | "version": "4.1.3", 640 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", 641 | "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", 642 | "dev": true 643 | }, 644 | "uri-js": { 645 | "version": "4.4.1", 646 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", 647 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", 648 | "requires": { 649 | "punycode": "^2.1.0" 650 | } 651 | }, 652 | "uuid": { 653 | "version": "3.4.0", 654 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 655 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" 656 | }, 657 | "verror": { 658 | "version": "1.10.0", 659 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 660 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 661 | "requires": { 662 | "assert-plus": "^1.0.0", 663 | "core-util-is": "1.0.2", 664 | "extsprintf": "^1.2.0" 665 | } 666 | }, 667 | "w3c-hr-time": { 668 | "version": "1.0.2", 669 | "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", 670 | "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", 671 | "requires": { 672 | "browser-process-hrtime": "^1.0.0" 673 | } 674 | }, 675 | "webidl-conversions": { 676 | "version": "4.0.2", 677 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", 678 | "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" 679 | }, 680 | "whatwg-encoding": { 681 | "version": "1.0.5", 682 | "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", 683 | "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", 684 | "requires": { 685 | "iconv-lite": "0.4.24" 686 | } 687 | }, 688 | "whatwg-mimetype": { 689 | "version": "2.3.0", 690 | "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", 691 | "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" 692 | }, 693 | "whatwg-url": { 694 | "version": "6.5.0", 695 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", 696 | "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", 697 | "requires": { 698 | "lodash.sortby": "^4.7.0", 699 | "tr46": "^1.0.1", 700 | "webidl-conversions": "^4.0.2" 701 | } 702 | }, 703 | "word-wrap": { 704 | "version": "1.2.3", 705 | "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", 706 | "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" 707 | }, 708 | "ws": { 709 | "version": "5.2.2", 710 | "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", 711 | "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", 712 | "requires": { 713 | "async-limiter": "~1.0.0" 714 | } 715 | }, 716 | "xml-name-validator": { 717 | "version": "3.0.0", 718 | "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", 719 | "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" 720 | } 721 | } 722 | } 723 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shader", 3 | "displayName": "Shader languages support for VS Code", 4 | "description": "Syntax highlighter for shader language (hlsl, glsl, cg) ", 5 | "version": "1.1.5", 6 | "publisher": "slevesque", 7 | "categories": [ 8 | "Programming Languages" 9 | ], 10 | "activationEvents": [ 11 | "onLanguage:hlsl", 12 | "onLanguage:glsl", 13 | "onLanguage:cg" 14 | ], 15 | "main": "./out/extension", 16 | "license": "LICENSE.md", 17 | "icon": "icon.png", 18 | "bugs": { 19 | "url": "https://github.com/stef-levesque/vscode-shader/issues" 20 | }, 21 | "homepage": "https://github.com/stef-levesque/vscode-shader/blob/master/README.md", 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/stef-levesque/vscode-shader.git" 25 | }, 26 | "galleryBanner": { 27 | "color": "#5c2d91", 28 | "theme": "dark" 29 | }, 30 | "engines": { 31 | "vscode": "^1.53.0" 32 | }, 33 | "keywords": [ 34 | "shader", 35 | "hlsl", 36 | "glsl", 37 | "Cg" 38 | ], 39 | "contributes": { 40 | "languages": [ 41 | { 42 | "id": "hlsl", 43 | "extensions": [ 44 | ".sf" 45 | ] 46 | }, 47 | { 48 | "id": "glsl", 49 | "aliases": [ 50 | "GLSL", 51 | "OpenGL Shading Language", 52 | "glsl" 53 | ], 54 | "extensions": [ 55 | ".vs", 56 | ".fs", 57 | ".gs", 58 | ".vsf", 59 | ".fsh", 60 | ".gsh", 61 | ".vshader", 62 | ".fshader", 63 | ".gshader", 64 | ".comp", 65 | ".vert", 66 | ".tesc", 67 | ".tese", 68 | ".frag", 69 | ".geom", 70 | ".glsl", 71 | ".glslv", 72 | ".glslf", 73 | ".glslg" 74 | ], 75 | "configuration": "./glsl.configuration.json" 76 | }, 77 | { 78 | "id": "cg", 79 | "aliases": [ 80 | "Cg", 81 | "C for Graphics", 82 | "cg" 83 | ], 84 | "extensions": [ 85 | ".cg" 86 | ], 87 | "configuration": "./cg.configuration.json" 88 | } 89 | ], 90 | "grammars": [ 91 | { 92 | "language": "glsl", 93 | "scopeName": "source.glsl", 94 | "path": "./syntaxes/glsl.tmLanguage" 95 | }, 96 | { 97 | "language": "cg", 98 | "scopeName": "source.cg", 99 | "path": "./syntaxes/cg.tmLanguage" 100 | }, 101 | { 102 | "scopeName": "text.html.glsl", 103 | "path": "./syntaxes/glsl-html.tmLanguage.json", 104 | "injectTo": [ 105 | "text.html" 106 | ], 107 | "embeddedLanguages": { 108 | "source.glsl": "glsl" 109 | } 110 | }, 111 | { 112 | "scopeName": "source.cpp.glsl", 113 | "path": "./syntaxes/glsl-cpp.tmLanguage.json", 114 | "injectTo": [ 115 | "source.cpp" 116 | ], 117 | "embeddedLanguages": { 118 | "source.glsl": "glsl" 119 | } 120 | }, 121 | { 122 | "scopeName": "source.cpp.hlsl", 123 | "path": "./syntaxes/hlsl-cpp.tmLanguage.json", 124 | "injectTo": [ 125 | "source.cpp" 126 | ], 127 | "embeddedLanguages": { 128 | "source.hlsl": "hlsl" 129 | } 130 | }, 131 | { 132 | "scopeName": "source.cpp.cg", 133 | "path": "./syntaxes/cg-cpp.tmLanguage.json", 134 | "injectTo": [ 135 | "source.cpp" 136 | ], 137 | "embeddedLanguages": { 138 | "source.cg": "cg" 139 | } 140 | } 141 | ], 142 | "configuration": { 143 | "title": "VS Code Shader Configuration", 144 | "type": "object", 145 | "properties": { 146 | "hlsl.suggest.basic": { 147 | "type": "boolean", 148 | "default": true, 149 | "description": "Configures if the extension HLSL language suggestions are enabled." 150 | }, 151 | "hlsl.openDocOnSide": { 152 | "type": "boolean", 153 | "default": true, 154 | "description": "Open the HLSL Documentation links on the side" 155 | } 156 | } 157 | } 158 | }, 159 | "scripts": { 160 | "vscode:prepublish": "npm run compile", 161 | "compile": "tsc -p ./", 162 | "watch": "tsc -watch -p ./" 163 | }, 164 | "devDependencies": { 165 | "@types/node": "^12.18.3", 166 | "@types/tmp": "^0.2.0", 167 | "@types/vscode": "^1.53", 168 | "typescript": "^4.1.3" 169 | }, 170 | "dependencies": { 171 | "follow-redirects": "^1.5.8", 172 | "jsdom": "^11.3.0", 173 | "tmp": "0.0.33" 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /src/common.ts: -------------------------------------------------------------------------------- 1 | 2 | export var rgPath: string = ''; 3 | export var hlslExtensions: string[] = []; 4 | 5 | export function setRgPath(path: string) { 6 | rgPath = path; 7 | } 8 | 9 | export function getRgPath() { 10 | return rgPath; 11 | } 12 | 13 | export function setHlslExtensions(ext: string){ 14 | hlslExtensions.push(ext); 15 | } 16 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import * as vscode from 'vscode'; 4 | import * as fs from 'fs'; 5 | import * as Path from 'path'; 6 | import * as tmp from 'tmp'; 7 | 8 | import { setRgPath, setHlslExtensions } from './common' 9 | 10 | import HLSLHoverProvider from './hlsl/hoverProvider'; 11 | import HLSLCompletionItemProvider from './hlsl/completionProvider'; 12 | import HLSLSignatureHelpProvider from './hlsl/signatureProvider'; 13 | import HLSLSymbolProvider from './hlsl/symbolProvider'; 14 | import HLSLDefinitionProvider from './hlsl/definitionProvider'; 15 | import HLSLReferenceProvider from './hlsl/referenceProvider'; 16 | 17 | class HLSLFormatingProvider implements vscode.DocumentFormattingEditProvider, vscode.DocumentRangeFormattingEditProvider { 18 | 19 | public async provideDocumentFormattingEdits(document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken): Promise { 20 | var tmpFile = tmp.fileSync({prefix: 'hlsl-', postfix: '.cpp'}); 21 | fs.writeFileSync(tmpFile.name, document.getText()); 22 | 23 | let doc = await vscode.workspace.openTextDocument(tmpFile.name); 24 | return vscode.commands.executeCommand('vscode.executeFormatDocumentProvider', doc.uri, options) 25 | .then(r => (tmpFile.removeCallback(), r)); 26 | } 27 | 28 | public async provideDocumentRangeFormattingEdits(document: vscode.TextDocument, range: vscode.Range, options: vscode.FormattingOptions, token: vscode.CancellationToken): Promise { 29 | 30 | var tmpFile = tmp.fileSync({prefix: 'hlsl-', postfix: '.cpp'}); 31 | fs.writeFileSync(tmpFile.name, document.getText()); 32 | 33 | let doc = await vscode.workspace.openTextDocument(tmpFile.name); 34 | return vscode.commands.executeCommand('vscode.executeFormatRangeProvider', doc.uri, range, options) 35 | .then(r => (tmpFile.removeCallback(), r)); 36 | } 37 | 38 | } 39 | 40 | const documentSelector = [ 41 | { language: 'hlsl', scheme: 'file' }, 42 | { language: 'hlsl', scheme: 'untitled' }, 43 | ]; 44 | 45 | function searchRgPath() 46 | { 47 | function exeName() { 48 | const isWin = /^win/.test( process.platform ); 49 | return isWin ? "rg.exe" : "rg"; 50 | } 51 | 52 | function exePathIsDefined( rgExePath ) { 53 | return fs.existsSync( rgExePath ) ? rgExePath : undefined; 54 | } 55 | 56 | let rgPath = ""; 57 | 58 | rgPath = exePathIsDefined( Path.join( vscode.env.appRoot, "node_modules/vscode-ripgrep/bin/", exeName() ) ); 59 | if( rgPath ) { 60 | return rgPath; 61 | } 62 | 63 | // If vscode-ripgrep is in an .asar file, then the binary is unpacked. 64 | rgPath = exePathIsDefined( Path.join( vscode.env.appRoot, "node_modules.asar.unpacked/vscode-ripgrep/bin/", exeName() ) ); 65 | if( rgPath ) { 66 | return rgPath; 67 | } 68 | 69 | return rgPath; 70 | } 71 | 72 | export async function activate(context: vscode.ExtensionContext) { 73 | 74 | console.log('vscode-shader extension started'); 75 | 76 | const rgDiskPath = searchRgPath(); 77 | if (!rgDiskPath) { 78 | console.log("vscode-shader couldn't find vscode-ripgrep binary path"); 79 | } 80 | setRgPath(rgDiskPath); 81 | 82 | 83 | const associations = vscode.workspace.getConfiguration('files.associations'); 84 | for (const fileType of Object.keys(associations)){ 85 | if(associations[fileType] === 'hlsl') 86 | { 87 | setHlslExtensions(fileType.substring(1)); 88 | } 89 | } 90 | 91 | // add providers 92 | context.subscriptions.push(vscode.languages.registerHoverProvider(documentSelector, new HLSLHoverProvider())); 93 | context.subscriptions.push(vscode.languages.registerCompletionItemProvider(documentSelector, new HLSLCompletionItemProvider(), '.')); 94 | context.subscriptions.push(vscode.languages.registerSignatureHelpProvider(documentSelector, new HLSLSignatureHelpProvider(), '(', ',')); 95 | context.subscriptions.push(vscode.languages.registerReferenceProvider(documentSelector, new HLSLReferenceProvider())); 96 | 97 | let symbolProvider = new HLSLSymbolProvider(); 98 | context.subscriptions.push(vscode.languages.registerDocumentSymbolProvider(documentSelector, symbolProvider)); 99 | context.subscriptions.push(vscode.languages.registerWorkspaceSymbolProvider(symbolProvider)); 100 | 101 | let definitionProvider = new HLSLDefinitionProvider(); 102 | context.subscriptions.push(vscode.languages.registerDefinitionProvider(documentSelector, definitionProvider)); 103 | context.subscriptions.push(vscode.languages.registerImplementationProvider(documentSelector, definitionProvider)); 104 | context.subscriptions.push(vscode.languages.registerTypeDefinitionProvider(documentSelector, definitionProvider)); 105 | 106 | if (vscode.extensions.getExtension('ms-vscode.cpptools') !== undefined) { 107 | let formatingProvider = new HLSLFormatingProvider(); 108 | context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(documentSelector, formatingProvider)); 109 | context.subscriptions.push(vscode.languages.registerDocumentRangeFormattingEditProvider(documentSelector, formatingProvider)); 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/hlsl/completionProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import { CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Position, Range, TextEdit, workspace } from 'vscode'; 4 | import hlslGlobals = require('./hlslGlobals'); 5 | 6 | 7 | export default class HLSLCompletionItemProvider implements CompletionItemProvider { 8 | 9 | public triggerCharacters = ['.']; 10 | 11 | public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise { 12 | let result: CompletionItem[] = []; 13 | 14 | let enable = workspace.getConfiguration('hlsl').get('suggest.basic', true); 15 | if (!enable) { 16 | return Promise.resolve(result); 17 | } 18 | 19 | var range = document.getWordRangeAtPosition(position); 20 | var prefix = range ? document.getText(range) : ''; 21 | if (!range) { 22 | range = new Range(position, position); 23 | } 24 | 25 | var added: any = {}; 26 | var createNewProposal = function (kind: CompletionItemKind, name: string, entry: hlslGlobals.IEntry, type?: string): CompletionItem { 27 | var proposal: CompletionItem = new CompletionItem(name); 28 | proposal.kind = kind; 29 | if (entry) { 30 | if (entry.description) { 31 | proposal.documentation = entry.description; 32 | } 33 | if (entry.parameters) { 34 | let signature = type ? '(' + type + ') ' : ''; 35 | signature += name; 36 | signature += '('; 37 | if (entry.parameters && entry.parameters.length != 0) { 38 | let params = ''; 39 | entry.parameters.forEach(p => params += p.label + ','); 40 | signature += params.slice(0, -1); 41 | } 42 | signature += ')'; 43 | proposal.detail = signature; 44 | } 45 | } 46 | return proposal; 47 | }; 48 | 49 | var matches = (name: string) => { 50 | return prefix.length === 0 || name.length >= prefix.length && name.substr(0, prefix.length) === prefix; 51 | }; 52 | 53 | for (var name in hlslGlobals.datatypes) { 54 | if (hlslGlobals.datatypes.hasOwnProperty(name) && matches(name)) { 55 | added[name] = true; 56 | result.push(createNewProposal(CompletionItemKind.TypeParameter, name, hlslGlobals.datatypes[name], 'datatype')); 57 | } 58 | } 59 | 60 | for (var name in hlslGlobals.intrinsicfunctions) { 61 | if (hlslGlobals.intrinsicfunctions.hasOwnProperty(name) && matches(name)) { 62 | added[name] = true; 63 | result.push(createNewProposal(CompletionItemKind.Function, name, hlslGlobals.intrinsicfunctions[name], 'function')); 64 | } 65 | } 66 | 67 | for (var name in hlslGlobals.semantics) { 68 | if (hlslGlobals.semantics.hasOwnProperty(name) && matches(name)) { 69 | added[name] = true; 70 | result.push(createNewProposal(CompletionItemKind.Reference, name, hlslGlobals.semantics[name], 'semantic')); 71 | } 72 | } 73 | 74 | for (var name in hlslGlobals.semanticsNum) { 75 | if (hlslGlobals.semanticsNum.hasOwnProperty(name) && matches(name)) { 76 | added[name] = true; 77 | result.push(createNewProposal(CompletionItemKind.Reference, name, hlslGlobals.semanticsNum[name], 'semantic')); 78 | } 79 | } 80 | 81 | for (var name in hlslGlobals.keywords) { 82 | if (hlslGlobals.keywords.hasOwnProperty(name) && matches(name)) { 83 | added[name] = true; 84 | result.push(createNewProposal(CompletionItemKind.Keyword, name, hlslGlobals.keywords[name], 'keyword')); 85 | } 86 | } 87 | 88 | var text = document.getText(); 89 | var functionMatch = /^\w+\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\(/mg; 90 | var match: RegExpExecArray = null; 91 | while (match = functionMatch.exec(text)) { 92 | var word = match[1]; 93 | if (!added[word]) { 94 | added[word] = true; 95 | result.push(createNewProposal(CompletionItemKind.Function, word, null)); 96 | } 97 | } 98 | 99 | return Promise.resolve(result); 100 | } 101 | } -------------------------------------------------------------------------------- /src/hlsl/definitionProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import { DefinitionProvider, ImplementationProvider, TypeDefinitionProvider, SymbolInformation, TextDocument, Position, Location, CancellationToken, Definition, workspace, commands } from 'vscode'; 4 | 5 | 6 | export default class HLSLDefinitionProvider implements DefinitionProvider, ImplementationProvider, TypeDefinitionProvider { 7 | 8 | private getDefinitionLocations(document: TextDocument, position: Position): Thenable { 9 | return new Promise((resolve, reject) => { 10 | 11 | let enable = workspace.getConfiguration('hlsl').get('suggest.basic', true); 12 | if (!enable) { 13 | reject(); 14 | } 15 | 16 | let wordRange = document.getWordRangeAtPosition(position); 17 | if (!wordRange) { 18 | reject(); 19 | } 20 | 21 | let name = document.getText(wordRange); 22 | 23 | commands.executeCommand('vscode.executeDocumentSymbolProvider', document.uri).then(symbols => { 24 | let result: Location[] = []; 25 | for (let symbol of symbols) { 26 | if (symbol.name === name) { 27 | result.push(symbol.location); 28 | } 29 | } 30 | resolve(result); 31 | }, reason => reject(reason)); 32 | 33 | }); 34 | } 35 | 36 | public provideDefinition(document: TextDocument, position: Position, token: CancellationToken | boolean): Thenable { 37 | return this.getDefinitionLocations(document, position); 38 | } 39 | 40 | public provideImplementation(document: TextDocument, position: Position, token: CancellationToken): Thenable { 41 | return this.getDefinitionLocations(document, position); 42 | } 43 | 44 | public provideTypeDefinition(document: TextDocument, position: Position, token: CancellationToken): Thenable { 45 | return this.getDefinitionLocations(document, position); 46 | } 47 | } -------------------------------------------------------------------------------- /src/hlsl/hlslGlobals.ts: -------------------------------------------------------------------------------- 1 | import { ParameterInformation } from 'vscode'; 2 | 3 | export class IEntry { 4 | description?: string; 5 | parameters?: ParameterInformation[]; 6 | link?: string; 7 | } 8 | 9 | //TODO: support multiple entry per name 10 | export interface IEntries { [name: string]: IEntry; } 11 | 12 | // From https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-intrinsic-functions 13 | 14 | export var intrinsicfunctions: IEntries = { 15 | abort: { 16 | description: 'Submits an error message to the information queue and terminates the current draw or dispatch call being executed.', 17 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/abort' 18 | }, 19 | abs: { 20 | description: 'Returns the absolute value of the specified value.', 21 | parameters: [{ label: 'value', documentation: 'The specified value' }], 22 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-abs' 23 | }, 24 | acos: { 25 | description: 'Returns the arccosine of the specified value.', 26 | parameters: [ 27 | { 28 | label: 'value', 29 | documentation: 'The specified value. Each component should be a floating-point value within the range of -1 to 1.' 30 | } 31 | ], 32 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-acos' 33 | }, 34 | all: { 35 | description: 'Determines if all components of the specified value are non-zero.', 36 | parameters: [{ label: 'value', documentation: 'The specified value' }], 37 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-all' 38 | }, 39 | AllMemoryBarrier: { 40 | description: 'Blocks execution of all threads in a group until all memory accesses have been completed.', 41 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/allmemorybarrier' 42 | }, 43 | AllMemoryBarrierWithGroupSync: { 44 | description: 'Blocks execution of all threads in a group until all memory accesses have been completed and all threads in the group have reached this call.', 45 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/allmemorybarrierwithgroupsync' 46 | }, 47 | any: { 48 | description: 'Determines if any components of the specified value are non-zero.', 49 | parameters: [{ label: 'value', documentation: 'The specified value' }], 50 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-any' 51 | }, 52 | asdouble: { 53 | description: 'Reinterprets a cast value (two 32-bit values) into a double.', 54 | parameters: [ 55 | { 56 | label: 'lowbits', 57 | documentation: 'The low 32-bit pattern of the input value.' 58 | }, 59 | { 60 | label: 'highbits', 61 | documentation: 'The high 32-bit pattern of the input value.' 62 | } 63 | ], 64 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/asdouble' 65 | }, 66 | asfloat: { 67 | description: 'Interprets the bit pattern of the input value as a floating-point number.', 68 | parameters: [{ label: 'value', documentation: 'The input value.' }], 69 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-asfloat' 70 | }, 71 | asin: { 72 | description: 'Returns the arcsine of the specified value.', 73 | parameters: [{ label: 'value', documentation: 'The specified value' }], 74 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-asin' 75 | }, 76 | asint: { 77 | description: 'Interprets the bit pattern of the input value as an integer.', 78 | parameters: [{ label: 'value', documentation: 'The input value.' }], 79 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/asint' 80 | }, 81 | asuint: { 82 | description: 'Reinterprets the bit pattern of a 64-bit value as two unsigned 32-bit integers.', 83 | parameters: [ 84 | { label: 'value', documentation: 'The input value.' }, 85 | { 86 | label: 'lowbits', 87 | documentation: 'The low 32-bit pattern of the input value.' 88 | }, 89 | { 90 | label: 'highbits', 91 | documentation: 'The high 32-bit pattern of the input value.' 92 | } 93 | ], 94 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/asuint' 95 | }, 96 | atan: { 97 | description: 'Returns the arctangent of the specified value.', 98 | parameters: [{ label: 'value', documentation: 'The specified value' }], 99 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-atan' 100 | }, 101 | atan2: { 102 | description: 'Returns the arctangent of two values (x,y).', 103 | parameters: [ 104 | { label: 'y', documentation: 'The y value.' }, 105 | { label: 'x', documentation: 'The x value.' } 106 | ], 107 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-atan2' 108 | }, 109 | ceil: { 110 | description: 'Returns the smallest integer value that is greater than or equal to the specified value.', 111 | parameters: [{ label: 'value', documentation: 'The specified value' }], 112 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ceil' 113 | }, 114 | CheckAccessFullyMapped: { 115 | description: 'Determines whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource.', 116 | parameters: [ 117 | { 118 | label: 'status', 119 | documentation: "The status value that is returned from a Sample, Gather, or Load operation. Because you can't access this status value directly, you need to pass it to CheckAccessFullyMapped." 120 | } 121 | ], 122 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/checkaccessfullymapped' 123 | }, 124 | clamp: { 125 | description: 'Clamps the specified value to the specified minimum and maximum range.', 126 | parameters: [ 127 | { label: 'value', documentation: 'A value to clamp.' }, 128 | { label: 'min', documentation: 'The specified minimum range.' }, 129 | { label: 'max', documentation: 'The specified maximum range.' } 130 | ], 131 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-clamp' 132 | }, 133 | clip: { 134 | description: 'Discards the current pixel if the specified value is less than zero.', 135 | parameters: [{ label: 'value', documentation: 'The specified value' }], 136 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-clip' 137 | }, 138 | cos: { 139 | description: 'Returns the cosine of the specified value.', 140 | parameters: [ 141 | { 142 | label: 'value', 143 | documentation: 'The specified value, in radians.' 144 | } 145 | ], 146 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-cos' 147 | }, 148 | cosh: { 149 | description: 'Returns the hyperbolic cosine of the specified value.', 150 | parameters: [ 151 | { 152 | label: 'value', 153 | documentation: 'The specified value, in radians.' 154 | } 155 | ], 156 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-cosh' 157 | }, 158 | countbits: { 159 | description: 'Counts the number of bits (per component) in the input integer.', 160 | parameters: [{ label: 'value', documentation: 'The input value.' }], 161 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/countbits' 162 | }, 163 | cross: { 164 | description: 'Returns the cross product of two floating-point, 3D vectors.', 165 | parameters: [ 166 | { 167 | label: 'x', 168 | documentation: 'The first floating-point, 3D vector.' 169 | }, 170 | { 171 | label: 'y', 172 | documentation: 'The second floating-point, 3D vector.' 173 | } 174 | ], 175 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-cross' 176 | }, 177 | D3DCOLORtoUBYTE4: { 178 | description: 'Converts a floating-point, 4D vector set by a D3DCOLOR to a UBYTE4.', 179 | parameters: [ 180 | { 181 | label: 'value', 182 | documentation: 'The floating-point vector4 to convert.' 183 | } 184 | ], 185 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-d3dcolortoubyte4' 186 | }, 187 | ddx: { 188 | description: 'Returns the partial derivative of the specified value with respect to the screen-space x-coordinate.', 189 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 190 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ddx' 191 | }, 192 | ddx_coarse: { 193 | description: 'Computes a low precision partial derivative with respect to the screen-space x-coordinate.', 194 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 195 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/ddx-coarse' 196 | }, 197 | ddx_fine: { 198 | description: 'Computes a high precision partial derivative with respect to the screen-space x-coordinate.', 199 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 200 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/ddx-fine' 201 | }, 202 | ddy: { 203 | description: 'Returns the partial derivative of the specified value with respect to the screen-space y-coordinate.', 204 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 205 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ddy' 206 | }, 207 | ddy_coarse: { 208 | description: 'Computes a low precision partial derivative with respect to the screen-space y-coordinate.', 209 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 210 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/ddy-coarse' 211 | }, 212 | ddy_fine: { 213 | description: 'Computes a high precision partial derivative with respect to the screen-space y-coordinate.', 214 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 215 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/ddy-fine' 216 | }, 217 | degrees: { 218 | description: 'Converts the specified value from radians to degrees.', 219 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 220 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-degrees' 221 | }, 222 | determinant: { 223 | description: 'Returns the determinant of the specified floating-point, square matrix.', 224 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 225 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-determinant' 226 | }, 227 | DeviceMemoryBarrier: { 228 | description: 'Blocks execution of all threads in a group until all device memory accesses have been completed.', 229 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/devicememorybarrier' 230 | }, 231 | DeviceMemoryBarrierWithGroupSync: { 232 | description: 'Blocks execution of all threads in a group until all device memory accesses have been completed and all threads in the group have reached this call.', 233 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/devicememorybarrierwithgroupsync' 234 | }, 235 | distance: { 236 | description: 'Returns a distance scalar between two vectors.', 237 | parameters: [ 238 | { 239 | label: 'x', 240 | documentation: 'The first floating-point vector to compare.' 241 | }, 242 | { 243 | label: 'y', 244 | documentation: 'The second floating-point vector to compare.' 245 | } 246 | ], 247 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-distance' 248 | }, 249 | dot: { 250 | description: 'Returns the dot product of two vectors.', 251 | parameters: [ 252 | { label: 'x', documentation: 'The first vector.' }, 253 | { label: 'y', documentation: 'The second vector.' } 254 | ], 255 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-dot' 256 | }, 257 | dst: { 258 | description: 'Calculates a distance vector.', 259 | parameters: [ 260 | { label: 'x', documentation: 'The first vector.' }, 261 | { label: 'y', documentation: 'The second vector.' } 262 | ], 263 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dst' 264 | }, 265 | errorf: { 266 | description: 'Submits an error message to the information queue.', 267 | parameters: [ 268 | { label: 'format', documentation: 'The format string.' }, 269 | { label: 'argument ...', documentation: 'Optional arguments.' } 270 | ], 271 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/errorf' 272 | }, 273 | EvaluateAttributeAtCentroid: { 274 | description: 'Evaluates at the pixel centroid.', 275 | parameters: [{ label: 'value', documentation: 'The input value.' }], 276 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/evaluateattributeatcentroid' 277 | }, 278 | EvaluateAttributeAtSample: { 279 | description: 'Evaluates at the indexed sample location.', 280 | parameters: [ 281 | { label: 'value', documentation: 'The input value.' }, 282 | { label: 'sampleIndex', documentation: 'The sample location.' } 283 | ], 284 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/evaluateattributeatsample' 285 | }, 286 | EvaluateAttributeSnapped: { 287 | description: 'Evaluates at the pixel centroid with an offset.', 288 | parameters: [ 289 | { label: 'value', documentation: 'The input value.' }, 290 | { 291 | label: 'offset', 292 | documentation: 'A 2D offset from the pixel center using a 16x16 grid.' 293 | } 294 | ], 295 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/evaluateattributesnapped' 296 | }, 297 | exp: { 298 | description: 'Returns the base-e exponential, or e^x, of the specified value.', 299 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 300 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-exp' 301 | }, 302 | exp2: { 303 | description: 'Returns the base 2 exponential, or 2^x, of the specified value.', 304 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 305 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-exp2' 306 | }, 307 | f16tof32: { 308 | description: 'Converts the float16 stored in the low-half of the uint to a float.', 309 | parameters: [{ label: 'value', documentation: 'The input value.' }], 310 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/f16tof32' 311 | }, 312 | f32tof16: { 313 | description: 'Converts an input into a float16 type.', 314 | parameters: [{ label: 'value', documentation: 'The input value.' }], 315 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/f32tof16' 316 | }, 317 | faceforward: { 318 | description: 'Flips the surface-normal (if needed) to face in a direction opposite to i; returns the result in n.', 319 | parameters: [ 320 | { 321 | label: 'n', 322 | documentation: 'The resulting floating-point surface-normal vector.' 323 | }, 324 | { 325 | label: 'i', 326 | documentation: 'A floating-point, incident vector that points from the view position to the shading position.' 327 | }, 328 | { 329 | label: 'ng', 330 | documentation: 'A floating-point surface-normal vector.' 331 | } 332 | ], 333 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-faceforward' 334 | }, 335 | firstbithigh: { 336 | description: 'Gets the location of the first set bit starting from the highest order bit and working downward, per component.', 337 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 338 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/firstbithigh' 339 | }, 340 | firstbitlow: { 341 | description: 'Returns the location of the first set bit starting from the lowest order bit and working upward, per component.', 342 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 343 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/firstbitlow' 344 | }, 345 | floor: { 346 | description: 'Returns the largest integer that is less than or equal to the specified value.', 347 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 348 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-floor' 349 | }, 350 | fma: { 351 | description: 'Returns the double-precision fused multiply-addition of a * b + c.', 352 | parameters: [ 353 | { 354 | label: 'a', 355 | documentation: 'The first value in the fused multiply-addition.' 356 | }, 357 | { 358 | label: 'b', 359 | documentation: 'The second value in the fused multiply-addition.' 360 | }, 361 | { 362 | label: 'c', 363 | documentation: 'The third value in the fused multiply-addition.' 364 | } 365 | ], 366 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-fma' 367 | }, 368 | fmod: { 369 | description: 'Returns the floating-point remainder of x/y.', 370 | parameters: [ 371 | { label: 'x', documentation: 'The floating-point dividend.' }, 372 | { label: 'y', documentation: 'The floating-point divisor.' } 373 | ], 374 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-fmod' 375 | }, 376 | frac: { 377 | description: 'Returns the fractional (or decimal) part of x; which is greater than or equal to 0 and less than 1.', 378 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 379 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-frac' 380 | }, 381 | frexp: { 382 | description: 'Returns the mantissa and exponent of the specified floating-point value.', 383 | parameters: [ 384 | { 385 | label: 'x', 386 | documentation: 'The specified floating-point value. If the x parameter is 0, this function returns 0 for both the mantissa and the exponent.' 387 | }, 388 | { 389 | label: 'exp', 390 | documentation: 'The returned exponent of the x parameter.' 391 | } 392 | ], 393 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-frexp' 394 | }, 395 | fwidth: { 396 | description: 'Returns the absolute value of the partial derivatives of the specified value.', 397 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 398 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-fwidth' 399 | }, 400 | GetRenderTargetSampleCount: { 401 | description: 'Gets the number of samples for a render target.', 402 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-getrendertargetsamplecount' 403 | }, 404 | GetRenderTargetSamplePosition: { 405 | description: 'Gets the sampling position (x,y) for a given sample index.', 406 | parameters: [ 407 | { label: 'index', documentation: 'A zero-based sample index.' } 408 | ], 409 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-getrendertargetsampleposition' 410 | }, 411 | GroupMemoryBarrier: { 412 | description: 'Blocks execution of all threads in a group until all group shared accesses have been completed.', 413 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/groupmemorybarrier' 414 | }, 415 | GroupMemoryBarrierWithGroupSync: { 416 | description: 'Blocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call.', 417 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/groupmemorybarrierwithgroupsync' 418 | }, 419 | InterlockedAdd: { 420 | description: 'Performs a guaranteed atomic add of value to the dest resource variable.', 421 | parameters: [ 422 | { label: 'dest', documentation: 'The destination address.' }, 423 | { label: 'value', documentation: 'The input value.' }, 424 | { 425 | label: 'originalValue', 426 | documentation: 'Optional. The original input value.' 427 | } 428 | ], 429 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedadd' 430 | }, 431 | InterlockedAnd: { 432 | description: 'Performs a guaranteed atomic and.', 433 | parameters: [ 434 | { label: 'dest', documentation: 'The destination address.' }, 435 | { label: 'value', documentation: 'The input value.' }, 436 | { 437 | label: 'originalValue', 438 | documentation: 'Optional. The original input value.' 439 | } 440 | ], 441 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedand' 442 | }, 443 | InterlockedCompareExchange: { 444 | description: "Atomically compares the destination with the comparison value. If they are identical, the destination is overwritten with the input value. The original value is set to the destination's original value.", 445 | parameters: [ 446 | { label: 'dest', documentation: 'The destination address.' }, 447 | { 448 | label: 'compareValue', 449 | documentation: 'The comparison value.' 450 | }, 451 | { label: 'value', documentation: 'The input value.' }, 452 | { 453 | label: 'originalValue', 454 | documentation: 'The original value.' 455 | } 456 | ], 457 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedcompareexchange' 458 | }, 459 | InterlockedCompareStore: { 460 | description: 'Atomically compares the destination to the comparison value. If they are identical, the destination is overwritten with the input value.', 461 | parameters: [ 462 | { label: 'dest', documentation: 'The destination address.' }, 463 | { 464 | label: 'compareValue', 465 | documentation: 'The comparison value.' 466 | }, 467 | { label: 'value', documentation: 'The input value.' } 468 | ], 469 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedcomparestore' 470 | }, 471 | InterlockedExchange: { 472 | description: 'Assigns value to dest and returns the original value.', 473 | parameters: [ 474 | { label: 'dest', documentation: 'The destination address.' }, 475 | { label: 'value', documentation: 'The input value.' }, 476 | { 477 | label: 'originalValue', 478 | documentation: 'The original input value.' 479 | } 480 | ], 481 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedexchange' 482 | }, 483 | InterlockedMax: { 484 | description: 'Performs a guaranteed atomic max.', 485 | parameters: [ 486 | { label: 'dest', documentation: 'The destination address.' }, 487 | { label: 'value', documentation: 'The input value.' }, 488 | { 489 | label: 'originalValue', 490 | documentation: 'Optional. The original input value.' 491 | } 492 | ], 493 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedmax' 494 | }, 495 | InterlockedMin: { 496 | description: 'Performs a guaranteed atomic min.', 497 | parameters: [ 498 | { label: 'dest', documentation: 'The destination address.' }, 499 | { label: 'value', documentation: 'The input value.' }, 500 | { 501 | label: 'originalValue', 502 | documentation: 'Optional. The original input value.' 503 | } 504 | ], 505 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedmin' 506 | }, 507 | InterlockedOr: { 508 | description: 'Performs a guaranteed atomic or.', 509 | parameters: [ 510 | { label: 'dest', documentation: 'The destination address.' }, 511 | { label: 'value', documentation: 'The input value.' }, 512 | { 513 | label: 'originalValue', 514 | documentation: 'Optional. The original input value.' 515 | } 516 | ], 517 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedor' 518 | }, 519 | InterlockedXor: { 520 | description: 'Performs a guaranteed atomic xor.', 521 | parameters: [ 522 | { label: 'dest', documentation: 'The destination address.' }, 523 | { label: 'value', documentation: 'The input value.' }, 524 | { 525 | label: 'originalValue', 526 | documentation: 'Optional. The original input value.' 527 | } 528 | ], 529 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/interlockedxor' 530 | }, 531 | isfinite: { 532 | description: 'Determines if the specified floating-point value is finite.', 533 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 534 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-isfinite' 535 | }, 536 | isinf: { 537 | description: 'Determines if the specified value is infinite.', 538 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 539 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-isinf' 540 | }, 541 | isnan: { 542 | description: 'Determines if the specified value is NAN or QNAN.', 543 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 544 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-isnan' 545 | }, 546 | ldexp: { 547 | description: 'Determines if the specified value is NAN or QNAN.', 548 | parameters: [ 549 | { label: 'value', documentation: 'The specified value.' }, 550 | { label: 'exp', documentation: 'The specified exponent.' } 551 | ], 552 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ldexp' 553 | }, 554 | length: { 555 | description: 'Returns the length of the specified floating-point vector.', 556 | parameters: [ 557 | { 558 | label: 'value', 559 | documentation: 'The specified floating-point vector.' 560 | } 561 | ], 562 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-length' 563 | }, 564 | lerp: { 565 | description: 'Performs a linear interpolation.', 566 | parameters: [ 567 | { 568 | label: 'x', 569 | documentation: 'The first floating-point value.' 570 | }, 571 | { 572 | label: 'y', 573 | documentation: 'The second floating-point value.' 574 | }, 575 | { 576 | label: 's', 577 | documentation: 'A value that linearly interpolates between the x parameter and the y parameter.' 578 | } 579 | ], 580 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-lerp' 581 | }, 582 | lit: { 583 | description: 'Returns a lighting coefficient vector.', 584 | parameters: [ 585 | { 586 | label: 'nDotL', 587 | documentation: 'The dot product of the normalized surface normal and the light vector.' 588 | }, 589 | { 590 | label: 'nDotH', 591 | documentation: 'The dot product of the half-angle vector and the surface normal.' 592 | }, 593 | { label: 'm', documentation: 'A specular exponent.' } 594 | ], 595 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-lit' 596 | }, 597 | log: { 598 | description: 'Returns the base-e logarithm of the specified value.', 599 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 600 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log' 601 | }, 602 | log10: { 603 | description: 'Returns the base-10 logarithm of the specified value.', 604 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 605 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log10' 606 | }, 607 | log2: { 608 | description: 'Returns the base-2 logarithm of the specified value.', 609 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 610 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log2' 611 | }, 612 | mad: { 613 | description: 'Performs an arithmetic multiply/add operation on three values. Returns the result of x * y + a.', 614 | parameters: [ 615 | { 616 | label: 'x', 617 | documentation: 'The first multiplication value.' 618 | }, 619 | { 620 | label: 'y', 621 | documentation: 'The second multiplication value.' 622 | }, 623 | { label: 'a', documentation: 'The addition value.' } 624 | ], 625 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/mad' 626 | }, 627 | max: { 628 | description: 'Selects the greater of x and y.', 629 | parameters: [ 630 | { label: 'x', documentation: 'The x input value.' }, 631 | { label: 'y', documentation: 'The y input value.' } 632 | ], 633 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-max' 634 | }, 635 | min: { 636 | description: 'Selects the lesser of x and y.', 637 | parameters: [ 638 | { label: 'x', documentation: 'The x input value.' }, 639 | { label: 'y', documentation: 'The y input value.' } 640 | ], 641 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-min' 642 | }, 643 | modf: { 644 | description: 'Splits the value x into fractional and integer parts, each of which has the same sign as x.', 645 | parameters: [ 646 | { label: 'x', documentation: 'The x input value.' }, 647 | { label: 'ip', documentation: 'The integer portion of x.' } 648 | ], 649 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-modf' 650 | }, 651 | msad4: { 652 | description: 'Compares a 4-byte reference value and an 8-byte source value and accumulates a vector of 4 sums. Each sum corresponds to the masked sum of absolute differences of a different byte alignment between the reference value and the source value.', 653 | parameters: [ 654 | { 655 | label: 'reference', 656 | documentation: 'The reference array of 4 bytes in one uint value.' 657 | }, 658 | { 659 | label: 'source', 660 | documentation: 'The source array of 8 bytes in two uint2 values.' 661 | }, 662 | { 663 | label: 'accum', 664 | documentation: 'A vector of 4 values. msad4 adds this vector to the masked sum of absolute differences of the different byte alignments between the reference value and the source value.' 665 | } 666 | ], 667 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-msad4' 668 | }, 669 | mul: { 670 | description: 'Multiplies x and y using matrix math. The inner dimension x-columns and y-rows must be equal.', 671 | parameters: [ 672 | { 673 | label: 'x', 674 | documentation: 'The x input value. If x is a vector, it treated as a row vector.' 675 | }, 676 | { 677 | label: 'y', 678 | documentation: 'The y input value. If y is a vector, it treated as a column vector.' 679 | } 680 | ], 681 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-mul' 682 | }, 683 | noise: { 684 | description: 'Generates a random value using the Perlin-noise algorithm.', 685 | parameters: [ 686 | { 687 | label: 'value', 688 | documentation: 'A floating-point vector from which to generate Perlin noise.' 689 | } 690 | ], 691 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-noise' 692 | }, 693 | normalize: { 694 | description: 'Normalizes the specified floating-point vector according to x / length(x).', 695 | parameters: [ 696 | { 697 | label: 'value', 698 | documentation: 'The specified floating-point vector.' 699 | } 700 | ], 701 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-normalize' 702 | }, 703 | pow: { 704 | description: 'Returns the specified value raised to the specified power.', 705 | parameters: [ 706 | { label: 'x', documentation: 'The specified value.' }, 707 | { label: 'y', documentation: 'The specified power.' } 708 | ], 709 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-pow' 710 | }, 711 | printf: { 712 | description: 'Submits a custom shader message to the information queue.', 713 | parameters: [ 714 | { label: 'format', documentation: 'The format string.' }, 715 | { label: 'argument ...', documentation: 'Optional arguments.' } 716 | ], 717 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/printf' 718 | }, 719 | Process2DQuadTessFactorsAvg: { 720 | description: 'Generates the corrected tessellation factors for a quad patch.', 721 | parameters: [ 722 | { 723 | label: 'RawEdgeFactors', 724 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 725 | }, 726 | { 727 | label: 'InsideScale', 728 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 729 | }, 730 | { 731 | label: 'RoundedEdgeTessFactors', 732 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 733 | }, 734 | { 735 | label: 'RoundedInsideTessFactors', 736 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 737 | }, 738 | { 739 | label: 'UnroundedInsideTessFactors', 740 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 741 | } 742 | ], 743 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/process2dquadtessfactorsavg' 744 | }, 745 | Process2DQuadTessFactorsMax: { 746 | description: 'Generates the corrected tessellation factors for a quad patch.', 747 | parameters: [ 748 | { 749 | label: 'RawEdgeFactors', 750 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 751 | }, 752 | { 753 | label: 'InsideScale', 754 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 755 | }, 756 | { 757 | label: 'RoundedEdgeTessFactors', 758 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 759 | }, 760 | { 761 | label: 'RoundedInsideTessFactors', 762 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 763 | }, 764 | { 765 | label: 'UnroundedInsideTessFactors', 766 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 767 | } 768 | ], 769 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/process2dquadtessfactorsmax' 770 | }, 771 | Process2DQuadTessFactorsMin: { 772 | description: 'Generates the corrected tessellation factors for a quad patch.', 773 | parameters: [ 774 | { 775 | label: 'RawEdgeFactors', 776 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 777 | }, 778 | { 779 | label: 'InsideScale', 780 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 781 | }, 782 | { 783 | label: 'RoundedEdgeTessFactors', 784 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 785 | }, 786 | { 787 | label: 'RoundedInsideTessFactors', 788 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 789 | }, 790 | { 791 | label: 'UnroundedInsideTessFactors', 792 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 793 | } 794 | ], 795 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/process2dquadtessfactorsmin' 796 | }, 797 | ProcessIsolineTessFactors: { 798 | description: 'Generates the rounded tessellation factors for an isoline.', 799 | parameters: [ 800 | { 801 | label: 'RawDetailFactor', 802 | documentation: 'The desired detail factor.' 803 | }, 804 | { 805 | label: 'RawDensityFactor', 806 | documentation: 'The desired density factor.' 807 | }, 808 | { 809 | label: 'RoundedDetailFactor', 810 | documentation: 'The rounded detail factor clamped to a range that can be used by the tessellator.' 811 | }, 812 | { 813 | label: 'RoundedDensityFactor', 814 | documentation: 'The rounded density factor clamped to a rangethat can be used by the tessellator.' 815 | } 816 | ], 817 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/process2dquadtessfactorsmin' 818 | }, 819 | ProcessQuadTessFactorsAvg: { 820 | description: 'Generates the corrected tessellation factors for a quad patch.', 821 | parameters: [ 822 | { 823 | label: 'RawEdgeFactors', 824 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 825 | }, 826 | { 827 | label: 'InsideScale', 828 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 829 | }, 830 | { 831 | label: 'RoundedEdgeTessFactors', 832 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 833 | }, 834 | { 835 | label: 'RoundedInsideTessFactors', 836 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 837 | }, 838 | { 839 | label: 'UnroundedInsideTessFactors', 840 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 841 | } 842 | ], 843 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/processquadtessfactorsavg' 844 | }, 845 | ProcessQuadTessFactorsMax: { 846 | description: 'Generates the corrected tessellation factors for a quad patch.', 847 | parameters: [ 848 | { 849 | label: 'RawEdgeFactors', 850 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 851 | }, 852 | { 853 | label: 'InsideScale', 854 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 855 | }, 856 | { 857 | label: 'RoundedEdgeTessFactors', 858 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 859 | }, 860 | { 861 | label: 'RoundedInsideTessFactors', 862 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 863 | }, 864 | { 865 | label: 'UnroundedInsideTessFactors', 866 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 867 | } 868 | ], 869 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/processquadtessfactorsmax' 870 | }, 871 | ProcessQuadTessFactorsMin: { 872 | description: 'Generates the corrected tessellation factors for a quad patch.', 873 | parameters: [ 874 | { 875 | label: 'RawEdgeFactors', 876 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 877 | }, 878 | { 879 | label: 'InsideScale', 880 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 881 | }, 882 | { 883 | label: 'RoundedEdgeTessFactors', 884 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 885 | }, 886 | { 887 | label: 'RoundedInsideTessFactors', 888 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 889 | }, 890 | { 891 | label: 'UnroundedInsideTessFactors', 892 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 893 | } 894 | ], 895 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/processquadtessfactorsmin' 896 | }, 897 | ProcessTriTessFactorsAvg: { 898 | description: 'Generates the corrected tessellation factors for a tri patch.', 899 | parameters: [ 900 | { 901 | label: 'RawEdgeFactors', 902 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 903 | }, 904 | { 905 | label: 'InsideScale', 906 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 907 | }, 908 | { 909 | label: 'RoundedEdgeTessFactors', 910 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 911 | }, 912 | { 913 | label: 'RoundedInsideTessFactors', 914 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 915 | }, 916 | { 917 | label: 'UnroundedInsideTessFactors', 918 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 919 | } 920 | ], 921 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/processtritessfactorsavg' 922 | }, 923 | ProcessTriTessFactorsMax: { 924 | description: 'Generates the corrected tessellation factors for a tri patch.', 925 | parameters: [ 926 | { 927 | label: 'RawEdgeFactors', 928 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 929 | }, 930 | { 931 | label: 'InsideScale', 932 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 933 | }, 934 | { 935 | label: 'RoundedEdgeTessFactors', 936 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 937 | }, 938 | { 939 | label: 'RoundedInsideTessFactors', 940 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 941 | }, 942 | { 943 | label: 'UnroundedInsideTessFactors', 944 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 945 | } 946 | ], 947 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/processtritessfactorsmax' 948 | }, 949 | ProcessTriTessFactorsMin: { 950 | description: 'Generates the corrected tessellation factors for a tri patch.', 951 | parameters: [ 952 | { 953 | label: 'RawEdgeFactors', 954 | documentation: 'The edge tessellation factors, passed into the tessellator stage.' 955 | }, 956 | { 957 | label: 'InsideScale', 958 | documentation: 'The scale factor applied to the UV tessellation factors computed by the tessellation stage. The allowable range for InsideScale is 0.0 to 1.0.' 959 | }, 960 | { 961 | label: 'RoundedEdgeTessFactors', 962 | documentation: 'The rounded edge-tessellation factors calculated by the tessellator stage.' 963 | }, 964 | { 965 | label: 'RoundedInsideTessFactors', 966 | documentation: 'The rounded tessellation factors calculated by the tessellator stage for inside edges.' 967 | }, 968 | { 969 | label: 'UnroundedInsideTessFactors', 970 | documentation: 'The tessellation factors calculated by the tessellator stage for inside edges.' 971 | } 972 | ], 973 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/processtritessfactorsmin' 974 | }, 975 | radians: { 976 | description: 'Converts the specified value from degrees to radians.', 977 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 978 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-radians' 979 | }, 980 | rcp: { 981 | description: 'Calculates a fast, approximate, per-component reciprocal.', 982 | parameters: [{ label: 'value', documentation: 'The input value.' }], 983 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/rcp' 984 | }, 985 | reflect: { 986 | description: 'Returns a reflection vector using an incident ray and a surface normal.', 987 | parameters: [ 988 | { 989 | label: 'i', 990 | documentation: 'A floating-point, incident vector.' 991 | }, 992 | { 993 | label: 'n', 994 | documentation: 'A floating-point, normal vector.' 995 | } 996 | ], 997 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-reflect' 998 | }, 999 | refract: { 1000 | description: 'Returns a refraction vector using an entering ray, a surface normal, and a refraction index.', 1001 | parameters: [ 1002 | { 1003 | label: 'i', 1004 | documentation: 'A floating-point, ray direction vector.' 1005 | }, 1006 | { 1007 | label: 'n', 1008 | documentation: 'A floating-point, surface normal vector.' 1009 | }, 1010 | { 1011 | label: 'η', 1012 | documentation: 'A floating-point, refraction index scalar.' 1013 | } 1014 | ], 1015 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-refract' 1016 | }, 1017 | reversebits: { 1018 | description: 'Reverses the order of the bits, per component.', 1019 | parameters: [{ label: 'value', documentation: 'The input value.' }], 1020 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/reversebits' 1021 | }, 1022 | round: { 1023 | description: 'Rounds the specified value to the nearest integer.', 1024 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 1025 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-round' 1026 | }, 1027 | rsqrt: { 1028 | description: 'Returns the reciprocal of the square root of the specified value.', 1029 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 1030 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-rsqrt' 1031 | }, 1032 | saturate: { 1033 | description: 'Clamps the specified value within the range of 0 to 1.', 1034 | parameters: [{ label: 'value', documentation: 'The specified value.' }], 1035 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-saturate' 1036 | }, 1037 | sign: { 1038 | description: 'Returns the sign of x.', 1039 | parameters: [{ label: 'value', documentation: 'The input value.' }], 1040 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sign' 1041 | }, 1042 | sin: { 1043 | description: 'Returns the sine of the specified value.', 1044 | parameters: [ 1045 | { 1046 | label: 'value', 1047 | documentation: 'The specified value, in radians.' 1048 | } 1049 | ], 1050 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sin' 1051 | }, 1052 | sincos: { 1053 | description: 'Returns the sine and cosine of x.', 1054 | parameters: [ 1055 | { 1056 | label: 'value', 1057 | documentation: 'The specified value, in radians.' 1058 | }, 1059 | { label: 's', documentation: 'Returns the sine of x.' }, 1060 | { label: 'c', documentation: 'Returns the cosine of x.' } 1061 | ], 1062 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sincos' 1063 | }, 1064 | sinh: { 1065 | description: 'Returns the hyperbolic sine of the specified value.', 1066 | parameters: [ 1067 | { 1068 | label: 'value', 1069 | documentation: 'The specified value, in radians.' 1070 | } 1071 | ], 1072 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sinh' 1073 | }, 1074 | smoothstep: { 1075 | description: 'Returns a smooth Hermite interpolation between 0 and 1, if x is in the range [min, max].', 1076 | parameters: [ 1077 | { 1078 | label: 'min', 1079 | documentation: 'The minimum range of the x parameter.' 1080 | }, 1081 | { 1082 | label: 'max', 1083 | documentation: 'The maximum range of the x parameter.' 1084 | }, 1085 | { 1086 | label: 'x', 1087 | documentation: 'The specified value to be interpolated.' 1088 | } 1089 | ], 1090 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-smoothstep' 1091 | }, 1092 | sqrt: { 1093 | description: 'Returns the square root of the specified floating-point value, per component.', 1094 | parameters: [ 1095 | { 1096 | label: 'value', 1097 | documentation: 'The specified floating-point value.' 1098 | } 1099 | ], 1100 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sqrt' 1101 | }, 1102 | step: { 1103 | description: 'Compares two values, returning 0 or 1 based on which value is greater.', 1104 | parameters: [ 1105 | { 1106 | label: 'y', 1107 | documentation: 'The first floating-point value to compare.' 1108 | }, 1109 | { 1110 | label: 'x', 1111 | documentation: 'The second floating-point value to compare.' 1112 | } 1113 | ], 1114 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-step' 1115 | }, 1116 | tan: { 1117 | description: 'Returns the tangent of the specified value.', 1118 | parameters: [ 1119 | { 1120 | label: 'value', 1121 | documentation: 'The specified value, in radians.' 1122 | } 1123 | ], 1124 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tan' 1125 | }, 1126 | tanh: { 1127 | description: 'Returns the hyperbolic tangent of the specified value.', 1128 | parameters: [ 1129 | { 1130 | label: 'value', 1131 | documentation: 'The specified value, in radians.' 1132 | } 1133 | ], 1134 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tanh' 1135 | }, 1136 | tex1D: { 1137 | description: 'Samples a 1D texture.', 1138 | parameters: [ 1139 | { label: 's', documentation: 'The sampler state.' }, 1140 | { label: 't', documentation: 'The texture coordinate.' } 1141 | ], 1142 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex1d' 1143 | }, 1144 | tex1Dbias: { 1145 | description: 'Samples a 1D texture after biasing the mip level by t.w.', 1146 | parameters: [ 1147 | { label: 's', documentation: 'The sampler state.' }, 1148 | { label: 't', documentation: 'The texture coordinate.' } 1149 | ], 1150 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex1dbias' 1151 | }, 1152 | tex1Dgrad: { 1153 | description: 'Samples a 1D texture using a gradient to select the mip level.', 1154 | parameters: [ 1155 | { label: 's', documentation: 'The sampler state.' }, 1156 | { label: 't', documentation: 'The texture coordinate.' }, 1157 | { 1158 | label: 'ddx', 1159 | documentation: 'Rate of change of the surface geometry in the x direction.' 1160 | }, 1161 | { 1162 | label: 'ddy', 1163 | documentation: 'Rate of change of the surface geometry in the y direction.' 1164 | } 1165 | ], 1166 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex1dgrad' 1167 | }, 1168 | tex1Dlod: { 1169 | description: 'Samples a 1D texture with mipmaps. The mipmap LOD is specified in t.w.', 1170 | parameters: [ 1171 | { label: 's', documentation: 'The sampler state.' }, 1172 | { label: 't', documentation: 'The texture coordinate.' } 1173 | ], 1174 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex1dlod' 1175 | }, 1176 | tex1Dproj: { 1177 | description: 'Samples a 1D texture using a projective divide; the texture coordinate is divided by t.w before the lookup takes place.', 1178 | parameters: [ 1179 | { label: 's', documentation: 'The sampler state.' }, 1180 | { label: 't', documentation: 'The texture coordinate.' } 1181 | ], 1182 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex1dproj' 1183 | }, 1184 | tex2D: { 1185 | description: 'Samples a 2D texture.', 1186 | parameters: [ 1187 | { label: 's', documentation: 'The sampler state.' }, 1188 | { label: 't', documentation: 'The texture coordinate.' } 1189 | ], 1190 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex2d' 1191 | }, 1192 | tex2Dbias: { 1193 | description: 'Samples a 2D texture after biasing the mip level by t.w.', 1194 | parameters: [ 1195 | { label: 's', documentation: 'The sampler state.' }, 1196 | { label: 't', documentation: 'The texture coordinate.' } 1197 | ], 1198 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex2dbias' 1199 | }, 1200 | tex2Dgrad: { 1201 | description: 'Samples a 2D texture using a gradient to select the mip level.', 1202 | parameters: [ 1203 | { label: 's', documentation: 'The sampler state.' }, 1204 | { label: 't', documentation: 'The texture coordinate.' }, 1205 | { 1206 | label: 'ddx', 1207 | documentation: 'Rate of change of the surface geometry in the x direction.' 1208 | }, 1209 | { 1210 | label: 'ddy', 1211 | documentation: 'Rate of change of the surface geometry in the y direction.' 1212 | } 1213 | ], 1214 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex2dgrad' 1215 | }, 1216 | tex2Dlod: { 1217 | description: 'Samples a 2D texture with mipmaps. The mipmap LOD is specified in t.w.', 1218 | parameters: [ 1219 | { label: 's', documentation: 'The sampler state.' }, 1220 | { label: 't', documentation: 'The texture coordinate.' } 1221 | ], 1222 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex2dlod' 1223 | }, 1224 | tex2Dproj: { 1225 | description: 'Samples a 2D texture using a projective divide; the texture coordinate is divided by t.w before the lookup takes place.', 1226 | parameters: [ 1227 | { label: 's', documentation: 'The sampler state.' }, 1228 | { label: 't', documentation: 'The texture coordinate.' } 1229 | ], 1230 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex2dproj' 1231 | }, 1232 | tex3D: { 1233 | description: 'Samples a 3D texture.', 1234 | parameters: [ 1235 | { label: 's', documentation: 'The sampler state.' }, 1236 | { label: 't', documentation: 'The texture coordinate.' } 1237 | ], 1238 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex3d' 1239 | }, 1240 | tex3Dbias: { 1241 | description: 'Samples a 3D texture after biasing the mip level by t.w.', 1242 | parameters: [ 1243 | { label: 's', documentation: 'The sampler state.' }, 1244 | { label: 't', documentation: 'The texture coordinate.' } 1245 | ], 1246 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex3dbias' 1247 | }, 1248 | tex3Dgrad: { 1249 | description: 'Samples a 3D texture using a gradient to select the mip level.', 1250 | parameters: [ 1251 | { label: 's', documentation: 'The sampler state.' }, 1252 | { label: 't', documentation: 'The texture coordinate.' }, 1253 | { 1254 | label: 'ddx', 1255 | documentation: 'Rate of change of the surface geometry in the x direction.' 1256 | }, 1257 | { 1258 | label: 'ddy', 1259 | documentation: 'Rate of change of the surface geometry in the y direction.' 1260 | } 1261 | ], 1262 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex3dgrad' 1263 | }, 1264 | tex3Dlod: { 1265 | description: 'Samples a 3D texture with mipmaps. The mipmap LOD is specified in t.w.', 1266 | parameters: [ 1267 | { label: 's', documentation: 'The sampler state.' }, 1268 | { label: 't', documentation: 'The texture coordinate.' } 1269 | ], 1270 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex3dlod' 1271 | }, 1272 | tex3Dproj: { 1273 | description: 'Samples a 3D texture using a projective divide; the texture coordinate is divided by t.w before the lookup takes place.', 1274 | parameters: [ 1275 | { label: 's', documentation: 'The sampler state.' }, 1276 | { label: 't', documentation: 'The texture coordinate.' } 1277 | ], 1278 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-tex3dproj' 1279 | }, 1280 | texCUBE: { 1281 | description: 'Samples a cube texture.', 1282 | parameters: [ 1283 | { label: 's', documentation: 'The sampler state.' }, 1284 | { label: 't', documentation: 'The texture coordinate.' } 1285 | ], 1286 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texcube' 1287 | }, 1288 | texCUBEbias: { 1289 | description: 'Samples a cube texture after biasing the mip level by t.w.', 1290 | parameters: [ 1291 | { label: 's', documentation: 'The sampler state.' }, 1292 | { label: 't', documentation: 'The texture coordinate.' } 1293 | ], 1294 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texcubebias' 1295 | }, 1296 | texCUBEgrad: { 1297 | description: 'Samples a cube texture using a gradient to select the mip level.', 1298 | parameters: [ 1299 | { label: 's', documentation: 'The sampler state.' }, 1300 | { label: 't', documentation: 'The texture coordinate.' }, 1301 | { 1302 | label: 'ddx', 1303 | documentation: 'Rate of change of the surface geometry in the x direction.' 1304 | }, 1305 | { 1306 | label: 'ddy', 1307 | documentation: 'Rate of change of the surface geometry in the y direction.' 1308 | } 1309 | ], 1310 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texcubegrad' 1311 | }, 1312 | texCUBElod: { 1313 | description: 'Samples a cube texture with mipmaps. The mipmap LOD is specified in t.w.', 1314 | parameters: [ 1315 | { label: 's', documentation: 'The sampler state.' }, 1316 | { label: 't', documentation: 'The texture coordinate.' } 1317 | ], 1318 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texcubelod' 1319 | }, 1320 | texCUBEproj: { 1321 | description: 'Samples a cube texture using a projective divide; the texture coordinate is divided by t.w before the lookup takes place.', 1322 | parameters: [ 1323 | { label: 's', documentation: 'The sampler state.' }, 1324 | { label: 't', documentation: 'The texture coordinate.' } 1325 | ], 1326 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texcubeproj' 1327 | }, 1328 | transpose: { 1329 | description: 'Transposes the specified input matrix.', 1330 | parameters: [{ label: 'value', documentation: 'The specified matrix.' }], 1331 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-transpose' 1332 | }, 1333 | trunc: { 1334 | description: 'Truncates a floating-point value to the integer component.', 1335 | parameters: [{ label: 'value', documentation: 'The specified input.' }], 1336 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-trunc' 1337 | } 1338 | } 1339 | 1340 | export var preprocessors: IEntries = { 1341 | DEFINE: { 1342 | description: 'Preprocessor directive that defines a constant or a macro.', 1343 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-define' 1344 | }, 1345 | ERROR: { 1346 | description: 'Preprocessor directive that produces compiler-time error messages.', 1347 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-error' 1348 | }, 1349 | IF: { 1350 | description: 'Preprocessor directives that control compilation of portions of a source file.', 1351 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-if' 1352 | }, 1353 | ELIF: { 1354 | description: 'Preprocessor directives that control compilation of portions of a source file.', 1355 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-if' 1356 | }, 1357 | ELSE: { 1358 | description: 'Preprocessor directives that control compilation of portions of a source file.', 1359 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-if' 1360 | }, 1361 | ENDIF: { 1362 | description: 'Preprocessor directives that control compilation of portions of a source file.', 1363 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-if' 1364 | }, 1365 | IFDEF: { 1366 | description: 'Preprocessor directives that determine whether a specific preprocessor constant or macro is defined.', 1367 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-ifdef' 1368 | }, 1369 | IFNDEF: { 1370 | description: 'Preprocessor directives that determine whether a specific preprocessor constant or macro is defined.', 1371 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-ifdef' 1372 | }, 1373 | INCLUDE: { 1374 | description: 'Preprocessor directive that inserts the contents of the specified file into the source program at the point where the directive appears.', 1375 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-include' 1376 | }, 1377 | LINE: { 1378 | description: "Preprocessor directive that sets the compiler's internally-stored line number and filename to the specified values.", 1379 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-line' 1380 | }, 1381 | PRAGMA: { 1382 | description: 'Preprocessor directive that provides machine-specific or operating system-specific features while retaining overall compatibility with the C and C++ languages.', 1383 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-pragma' 1384 | }, 1385 | UNDEF: { 1386 | description: 'Preprocessor directive that removes the current definition of a constant or macro that was previously defined using the #define directive.', 1387 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-undef' 1388 | } 1389 | } 1390 | 1391 | export var semanticsNum: IEntries = { 1392 | BINORMAL: { 1393 | description: 'Binormal', 1394 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1395 | }, 1396 | BLENDINDICES: { 1397 | description: 'Blend indices', 1398 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1399 | }, 1400 | BLENDWEIGHT: { 1401 | description: 'Blend weights', 1402 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1403 | }, 1404 | COLOR: { 1405 | description: 'Diffuse and/or specular color', 1406 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1407 | }, 1408 | NORMAL: { 1409 | description: 'Normal vector', 1410 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1411 | }, 1412 | POSITION: { 1413 | description: 'Vertex position in object space.', 1414 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1415 | }, 1416 | PSIZE: { 1417 | description: 'Point size', 1418 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1419 | }, 1420 | TANGENT: { 1421 | description: 'Tangent', 1422 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1423 | }, 1424 | TEXCOORD: { 1425 | description: 'Texture coordinates', 1426 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1427 | }, 1428 | TESSFACTOR: { 1429 | description: 'Tessellation factor', 1430 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1431 | }, 1432 | DEPTH: { 1433 | description: 'Output depth', 1434 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1435 | }, 1436 | SV_CLIPDISTANCE: { 1437 | description: 'Clip distance data.', 1438 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1439 | }, 1440 | SV_CULLDISTANCE: { 1441 | description: 'Cull distance data.', 1442 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1443 | }, 1444 | SV_DEPTHGREATEREQUAL: { 1445 | description: 'Valid in any shader, tests whether the value is greater than or equal to the depth data value.', 1446 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1447 | }, 1448 | SV_DEPTHLESSEQUAL: { 1449 | description: 'Valid in any shader, tests whether the value is less than or equal to the depth data value.', 1450 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1451 | }, 1452 | SV_TARGET: { 1453 | description: 'The output value that will be stored in a render target. The index indicates which of the 8 possibly bound render targets to write to. The value is available to all shaders.', 1454 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1455 | } 1456 | } 1457 | 1458 | export var semantics: IEntries = { 1459 | POSITIONT: { 1460 | description: 'Transformed vertex position.', 1461 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1462 | }, 1463 | FOG: { 1464 | description: 'Vertex fog', 1465 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1466 | }, 1467 | PSIZE: { 1468 | description: 'Point size', 1469 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1470 | }, 1471 | VFACE: { 1472 | description: 'Floating-point scalar that indicates a back-facing primitive. A negative value faces backwards, while a positive value faces the camera.', 1473 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1474 | }, 1475 | VPOS: { 1476 | description: 'The pixel location (x,y) in screen space.', 1477 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1478 | }, 1479 | SV_COVERAGE: { 1480 | description: 'A mask that can be specified on input, output, or both of a pixel shader.', 1481 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1482 | }, 1483 | SV_DEPTH: { 1484 | description: 'Depth buffer data. Can be written or read by any shader.', 1485 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1486 | }, 1487 | SV_DISPATCHTHREADID: { 1488 | description: 'Defines the global thread offset within the Dispatch call, per dimension of the group. Available as input to compute shader. (read only)', 1489 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-dispatchthreadid' 1490 | }, 1491 | SV_DOMAINLOCATION: { 1492 | description: 'Defines the location on the hull of the current domain point being evaluated. Available as input to the domain shader. (read only)', 1493 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-domainlocation' 1494 | }, 1495 | SV_GROUPID: { 1496 | description: 'Defines the group offset within a Dispatch call, per dimension of the dispatch call. Available as input to the compute shader. (read only)', 1497 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-groupid' 1498 | }, 1499 | SV_GROUPINDEX: { 1500 | description: 'Provides a flattened index for a given thread within a given group. Available as input to the compute shader. (read only)', 1501 | link: 'https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ff471569(v=vs.85)' 1502 | }, 1503 | SV_GROUPTHREADID: { 1504 | description: 'Defines the thread offset within the group, per dimension of the group. Available as input to the compute shader. (read only)', 1505 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-groupthreadid' 1506 | }, 1507 | SV_GSINSTANCEID: { 1508 | description: 'Defines the instance of the geometry shader. Available as input to the geometry shader. The instance is needed as a geometry shader can be invoked up to 32 times on the same geometry primitive.', 1509 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-gsinstanceid' 1510 | }, 1511 | SV_INNERCOVERAGE: { 1512 | description: 'Represents underestimated conservative rasterization information (i.e. whether a pixel is guaranteed-to-be-fully covered). Can be read or written by the pixel shader.', 1513 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1514 | }, 1515 | SV_INSIDETESSFACTOR: { 1516 | description: 'Defines the tessellation amount within a patch surface. Available in the hull shader for writing, and available in the domain shader for reading.', 1517 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-insidetessfactor' 1518 | }, 1519 | SV_INSTANCEID: { 1520 | description: 'Per-instance identifier automatically generated by the runtime (see Using System-Generated Values (Direct3D 10)). Available to all shaders.', 1521 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1522 | }, 1523 | SV_ISFRONTFACE: { 1524 | description: 'Specifies whether a triangle is front facing. For lines and points, IsFrontFace has the value true. The exception is lines drawn out of triangles (wireframe mode), which sets IsFrontFace the same way as rasterizing the triangle in solid mode. Can be written to by the geometry shader, and read by the pixel shader.', 1525 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1526 | }, 1527 | SV_OUTPUTCONTROLPOINTID: { 1528 | description: 'Defines the index of the control point ID being operated on by an invocation of the main entry point of the hull shader. Can be read by the hull shader only.', 1529 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-outputcontrolpointid' 1530 | }, 1531 | SV_POSITION: { 1532 | description: 'When SV_Position is declared for input to a shader, it can have one of two interpolation modes specified: linearNoPerspective or linearNoPerspectiveCentroid, where the latter causes centroid-snapped xyzw values to be provided when multisample antialiasing. When used in a shader, SV_Position describes the pixel location. Available in all shaders to get the pixel center with a 0.5 offset.', 1533 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1534 | }, 1535 | SV_PRIMITIVEID: { 1536 | description: 'Per-primitive identifier automatically generated by the runtime (see Using System-Generated Values (Direct3D 10)). Can be written to by the geometry or pixel shaders, and read by the geometry, pixel, hull or domain shaders.', 1537 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1538 | }, 1539 | SV_RENDERTARGETARRAYINDEX: { 1540 | description: 'Render-target array index. Applied to geometry shader output and indicates the render target array slice that the primitive will be drawn to by the pixel shader. SV_RenderTargetArrayIndex is only valid if the render target is an array resource. This semantic applies only to primitives, if a primitive has more than one vertex the value from the leading vertex will be used. This value also indicates which array slice of a depthstencilview is used for read/write purposes. Can be written from the geometry shader and read or written by the pixel shader.', 1541 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1542 | }, 1543 | SV_SAMPLEINDEX: { 1544 | description: 'Sample frequency index data. Available to be read or written to by the pixel shader only.', 1545 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1546 | }, 1547 | SV_STENCILREF: { 1548 | description: 'Represents the current pixel shader stencil reference value. Can be written by the pixel shader only.', 1549 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1550 | }, 1551 | SV_TESSFACTOR: { 1552 | description: 'Defines the tessellation amount on each edge of a patch. Available for writing in the hull shader and reading in the domain shader.', 1553 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/sv-tessfactor' 1554 | }, 1555 | SV_VERTEXID: { 1556 | description: 'Per-vertex identifier automatically generated by the runtime (see Using System-Generated Values (Direct3D 10)). Available as the input to the vertex shader only.', 1557 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1558 | }, 1559 | SV_VIEWPORTARRAYINDEX: { 1560 | description: 'Viewport array index. Applied to geometry shader output and indicates which viewport to use for the primitive currently being written out. Can be read or written by the pixel shader. The primitive will be transformed and clipped against the viewport specified by the index before it is passed to the rasterizer. This semantic applies only to primitives, if a primitive has more than one vertex the value from the leading vertex will be used.', 1561 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics' 1562 | } 1563 | } 1564 | 1565 | export var datatypes: IEntries = { 1566 | bool: { 1567 | description: 'true or false.', 1568 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1569 | }, 1570 | int: { 1571 | description: '32-bit signed integer.', 1572 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1573 | }, 1574 | int1: { 1575 | description: '32-bit signed integer vector.', 1576 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1577 | }, 1578 | int2: { 1579 | description: '32-bit signed integer vector.', 1580 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1581 | }, 1582 | int3: { 1583 | description: '32-bit signed integer vector.', 1584 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1585 | }, 1586 | int4: { 1587 | description: '32-bit signed integer vector.', 1588 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1589 | }, 1590 | int1x1: { 1591 | description: '32-bit signed integer matrix.', 1592 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1593 | }, 1594 | int1x2: { 1595 | description: '32-bit signed integer matrix.', 1596 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1597 | }, 1598 | int1x3: { 1599 | description: '32-bit signed integer matrix.', 1600 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1601 | }, 1602 | int1x4: { 1603 | description: '32-bit signed integer matrix.', 1604 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1605 | }, 1606 | int2x1: { 1607 | description: '32-bit signed integer matrix.', 1608 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1609 | }, 1610 | int2x2: { 1611 | description: '32-bit signed integer matrix.', 1612 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1613 | }, 1614 | int2x3: { 1615 | description: '32-bit signed integer matrix.', 1616 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1617 | }, 1618 | int2x4: { 1619 | description: '32-bit signed integer matrix.', 1620 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1621 | }, 1622 | int3x1: { 1623 | description: '32-bit signed integer matrix.', 1624 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1625 | }, 1626 | int3x2: { 1627 | description: '32-bit signed integer matrix.', 1628 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1629 | }, 1630 | int3x3: { 1631 | description: '32-bit signed integer matrix.', 1632 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1633 | }, 1634 | int3x4: { 1635 | description: '32-bit signed integer matrix.', 1636 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1637 | }, 1638 | int4x1: { 1639 | description: '32-bit signed integer matrix.', 1640 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1641 | }, 1642 | int4x2: { 1643 | description: '32-bit signed integer matrix.', 1644 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1645 | }, 1646 | int4x3: { 1647 | description: '32-bit signed integer matrix.', 1648 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1649 | }, 1650 | int4x4: { 1651 | description: '32-bit signed integer matrix.', 1652 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1653 | }, 1654 | uint: { 1655 | description: '32-bit unsigned integer.', 1656 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1657 | }, 1658 | dword: { 1659 | description: '32-bit unsigned integer.', 1660 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1661 | }, 1662 | half: { 1663 | description: '16-bit floating point value. This data type is provided only for language compatibility. Direct3D 10 shader targets map all half data types to float data types. A half data type cannot be used on a uniform global variable (use the /Gec flag if this functionality is desired).', 1664 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1665 | }, 1666 | half1: { 1667 | description: '16-bit floating point vector.', 1668 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1669 | }, 1670 | half2: { 1671 | description: '16-bit floating point vector.', 1672 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1673 | }, 1674 | half3: { 1675 | description: '16-bit floating point vector.', 1676 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1677 | }, 1678 | half4: { 1679 | description: '16-bit floating point vector.', 1680 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1681 | }, 1682 | float: { 1683 | description: '32-bit floating point value.', 1684 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1685 | }, 1686 | float1: { 1687 | description: '32-bit floating point vector.', 1688 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1689 | }, 1690 | float2: { 1691 | description: '32-bit floating point vector.', 1692 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1693 | }, 1694 | float3: { 1695 | description: '32-bit floating point vector.', 1696 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1697 | }, 1698 | float4: { 1699 | description: '32-bit floating point vector.', 1700 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1701 | }, 1702 | float1x1: { 1703 | description: '32-bit floating point matrix.', 1704 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1705 | }, 1706 | float1x2: { 1707 | description: '32-bit floating point matrix.', 1708 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1709 | }, 1710 | float1x3: { 1711 | description: '32-bit floating point matrix.', 1712 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1713 | }, 1714 | float1x4: { 1715 | description: '32-bit floating point matrix.', 1716 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1717 | }, 1718 | float2x1: { 1719 | description: '32-bit floating point matrix.', 1720 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1721 | }, 1722 | float2x2: { 1723 | description: '32-bit floating point matrix.', 1724 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1725 | }, 1726 | float2x3: { 1727 | description: '32-bit floating point matrix.', 1728 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1729 | }, 1730 | float2x4: { 1731 | description: '32-bit floating point matrix.', 1732 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1733 | }, 1734 | float3x1: { 1735 | description: '32-bit floating point matrix.', 1736 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1737 | }, 1738 | float3x2: { 1739 | description: '32-bit floating point matrix.', 1740 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1741 | }, 1742 | float3x3: { 1743 | description: '32-bit floating point matrix.', 1744 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1745 | }, 1746 | float3x4: { 1747 | description: '32-bit floating point matrix.', 1748 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1749 | }, 1750 | float4x1: { 1751 | description: '32-bit floating point matrix.', 1752 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1753 | }, 1754 | float4x2: { 1755 | description: '32-bit floating point matrix.', 1756 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1757 | }, 1758 | float4x3: { 1759 | description: '32-bit floating point matrix.', 1760 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1761 | }, 1762 | float4x4: { 1763 | description: '32-bit floating point matrix.', 1764 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1765 | }, 1766 | double: { 1767 | description: '64-bit floating point value. You cannot use double precision values as inputs and outputs for a stream. To pass double precision values between shaders, declare each double as a pair of uint data types. Then, use the asdouble function to pack each double into the pair of uints and the asuint function to unpack the pair of uints back into the double.', 1768 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1769 | }, 1770 | min16float: { 1771 | description: 'minimum 16-bit floating point value.', 1772 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1773 | }, 1774 | min10float: { 1775 | description: 'minimum 10-bit floating point value.', 1776 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1777 | }, 1778 | min16int: { 1779 | description: 'minimum 16-bit signed integer.', 1780 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1781 | }, 1782 | min12int: { 1783 | description: 'minimum 12-bit signed integer.', 1784 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1785 | }, 1786 | min16uint: { 1787 | description: 'minimum 16-bit unsigned integer.', 1788 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-scalar' 1789 | }, 1790 | Buffer: { 1791 | description: 'Use to declare a buffer variable.', 1792 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-buffer' 1793 | }, 1794 | vector: { 1795 | description: 'A vector contains between one and four scalar components; every component of a vector must be of the same type.', 1796 | link: 'https://docs.microsoft.com/en-ca/windows/win32/direct3dhlsl/dx-graphics-hlsl-vector' 1797 | }, 1798 | matrix: { 1799 | description: 'A matrix is a special data type that contains between one and sixteen components. Every component of a matrix must be of the same type.', 1800 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-matrix' 1801 | }, 1802 | sampler: { 1803 | description: 'Use to declare sampler state as well as sampler-comparison state.', 1804 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sampler' 1805 | }, 1806 | SamplerState: { 1807 | description: 'Use to declare sampler state as well as sampler-comparison state.', 1808 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-sampler' 1809 | }, 1810 | PixelShader: { 1811 | description: 'Declare a shader variable within an effect pass.', 1812 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-shader' 1813 | }, 1814 | VertexShader: { 1815 | description: 'Declare a shader variable within an effect pass.', 1816 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-shader' 1817 | }, 1818 | texture: { 1819 | description: 'Use to declare a texture variable.', 1820 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1821 | }, 1822 | Texture1D: { 1823 | description: 'Use to declare a texture variable.', 1824 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1825 | }, 1826 | Texture1DArray: { 1827 | description: 'Use to declare a texture variable.', 1828 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1829 | }, 1830 | Texture2D: { 1831 | description: 'Use to declare a texture variable.', 1832 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1833 | }, 1834 | Texture2DArray: { 1835 | description: 'Use to declare a texture variable.', 1836 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1837 | }, 1838 | Texture2DMS: { 1839 | description: 'Use to declare a texture variable.', 1840 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1841 | }, 1842 | Texture2DMSArray: { 1843 | description: 'Use to declare a texture variable.', 1844 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1845 | }, 1846 | Texture3D: { 1847 | description: 'Use to declare a texture variable.', 1848 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1849 | }, 1850 | TextureCube: { 1851 | description: 'Use to declare a texture variable.', 1852 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1853 | }, 1854 | TextureCubeArray: { 1855 | description: 'Use to declare a texture variable.', 1856 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-texture' 1857 | }, 1858 | struct: { 1859 | description: 'Use to declare a structure using HLSL.', 1860 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-struct' 1861 | }, 1862 | typedef: { 1863 | description: 'Use to declare a user-defined type.', 1864 | link: 'https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-user-defined' 1865 | } 1866 | } 1867 | 1868 | //TODO: descriptions and links 1869 | export var keywords: IEntries = { 1870 | AppendStructuredBuffer: { description: "" }, 1871 | asm: { description: "" }, 1872 | asm_fragment: { description: "" }, 1873 | BlendState: { description: "" }, 1874 | bool: { description: "" }, 1875 | break: { description: "" }, 1876 | Buffer: { description: "" }, 1877 | ByteAddressBuffer: { description: "" }, 1878 | case: { description: "" }, 1879 | cbuffer: { description: "" }, 1880 | centroid: { description: "" }, 1881 | class: { description: "" }, 1882 | column_major: { description: "" }, 1883 | compile: { description: "" }, 1884 | compile_fragment: { description: "" }, 1885 | CompileShader: { description: "" }, 1886 | const: { description: "" }, 1887 | continue: { description: "" }, 1888 | ComputeShader: { description: "" }, 1889 | ConsumeStructuredBuffer: { description: "" }, 1890 | default: { description: "" }, 1891 | DepthStencilState: { description: "" }, 1892 | DepthStencilView: { description: "" }, 1893 | discard: { description: "" }, 1894 | do: { description: "" }, 1895 | double: { description: "" }, 1896 | DomainShader: { description: "" }, 1897 | dword: { description: "" }, 1898 | else: { description: "" }, 1899 | export: { description: "" }, 1900 | extern: { description: "" }, 1901 | false: { description: "" }, 1902 | float: { description: "" }, 1903 | for: { description: "" }, 1904 | fxgroup: { description: "" }, 1905 | GeometryShader: { description: "" }, 1906 | groupshared: { description: "" }, 1907 | half: { description: "" }, 1908 | Hullshader: { description: "" }, 1909 | if: { description: "" }, 1910 | in: { description: "" }, 1911 | inline: { description: "" }, 1912 | inout: { description: "" }, 1913 | InputPatch: { description: "" }, 1914 | int: { description: "" }, 1915 | interface: { description: "" }, 1916 | line: { description: "" }, 1917 | lineadj: { description: "" }, 1918 | linear: { description: "" }, 1919 | LineStream: { description: "" }, 1920 | matrix: { description: "" }, 1921 | min16float: { description: "" }, 1922 | min10float: { description: "" }, 1923 | min16int: { description: "" }, 1924 | min12int: { description: "" }, 1925 | min16uint: { description: "" }, 1926 | namespace: { description: "" }, 1927 | nointerpolation: { description: "" }, 1928 | noperspective: { description: "" }, 1929 | NULL: { description: "" }, 1930 | out: { description: "" }, 1931 | OutputPatch: { description: "" }, 1932 | packoffset: { description: "" }, 1933 | pass: { description: "" }, 1934 | pixelfragment: { description: "" }, 1935 | PixelShader: { description: "" }, 1936 | point: { description: "" }, 1937 | PointStream: { description: "" }, 1938 | precise: { description: "" }, 1939 | RasterizerState: { description: "" }, 1940 | RenderTargetView: { description: "" }, 1941 | return: { description: "" }, 1942 | register: { description: "" }, 1943 | row_major: { description: "" }, 1944 | RWBuffer: { description: "" }, 1945 | RWByteAddressBuffer: { description: "" }, 1946 | RWStructuredBuffer: { description: "" }, 1947 | RWTexture1D: { description: "" }, 1948 | RWTexture1DArray: { description: "" }, 1949 | RWTexture2D: { description: "" }, 1950 | RWTexture2DArray: { description: "" }, 1951 | RWTexture3D: { description: "" }, 1952 | sample: { description: "" }, 1953 | sampler: { description: "" }, 1954 | SamplerState: { description: "" }, 1955 | SamplerComparisonState: { description: "" }, 1956 | shared: { description: "" }, 1957 | snorm: { description: "" }, 1958 | stateblock: { description: "" }, 1959 | stateblock_state: { description: "" }, 1960 | static: { description: "" }, 1961 | string: { description: "" }, 1962 | struct: { description: "" }, 1963 | switch: { description: "" }, 1964 | StructuredBuffer: { description: "" }, 1965 | tbuffer: { description: "" }, 1966 | technique: { description: "" }, 1967 | technique10: { description: "" }, 1968 | technique11: { description: "" }, 1969 | texture: { description: "" }, 1970 | Texture1D: { description: "" }, 1971 | Texture1DArray: { description: "" }, 1972 | Texture2D: { description: "" }, 1973 | Texture2DArray: { description: "" }, 1974 | Texture2DMS: { description: "" }, 1975 | Texture2DMSArray: { description: "" }, 1976 | Texture3D: { description: "" }, 1977 | TextureCube: { description: "" }, 1978 | TextureCubeArray: { description: "" }, 1979 | true: { description: "" }, 1980 | typedef: { description: "" }, 1981 | triangle: { description: "" }, 1982 | triangleadj: { description: "" }, 1983 | TriangleStream: { description: "" }, 1984 | uint: { description: "" }, 1985 | uniform: { description: "" }, 1986 | unorm: { description: "" }, 1987 | unsigned: { description: "" }, 1988 | vector: { description: "" }, 1989 | vertexfragment: { description: "" }, 1990 | VertexShader: { description: "" }, 1991 | void: { description: "" }, 1992 | volatile: { description: "" }, 1993 | while: { description: "" } 1994 | } 1995 | 1996 | -------------------------------------------------------------------------------- /src/hlsl/hoverProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import { HoverProvider, Hover, SymbolInformation, SymbolKind, MarkdownString, MarkedString, TextDocument, CancellationToken, Range, Position, Uri, ViewColumn, Disposable, commands, window, workspace, WebviewPanel } from 'vscode'; 4 | import { HTML_TEMPLATE } from './html'; 5 | import hlslGlobals = require('./hlslGlobals'); 6 | import { https } from 'follow-redirects'; 7 | import { JSDOM } from 'jsdom'; 8 | 9 | export function textToMarkedString(text: string): MarkedString { 10 | return text.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash 11 | } 12 | 13 | export function linkToMarkdownString(linkUrl: string): MarkdownString { 14 | if (linkUrl === undefined || linkUrl === '') { 15 | return; 16 | } 17 | 18 | let link = new MarkdownString('[HLSL documentation][1]\n\n[1]: '); 19 | let openDocOnSide = workspace.getConfiguration('hlsl').get('openDocOnSide', false); 20 | if (openDocOnSide) { 21 | link.appendText(encodeURI( 'command:shader.openLink?' + JSON.stringify([linkUrl, true]))); 22 | } else { 23 | link.appendText(linkUrl); 24 | } 25 | link.isTrusted = true; 26 | return link; 27 | } 28 | 29 | export default class HLSLHoverProvider implements HoverProvider { 30 | 31 | private _subscriptions: Disposable[] = []; 32 | private _panel: WebviewPanel = null; 33 | 34 | private getSymbols(document: TextDocument): Thenable { 35 | return commands.executeCommand('vscode.executeDocumentSymbolProvider', document.uri); 36 | } 37 | 38 | constructor() { 39 | this._subscriptions.push( commands.registerCommand('shader.openLink', (link: string, newWindow: boolean) => { 40 | if (!this._panel) { 41 | this._panel = window.createWebviewPanel( 42 | 'hlsldoc', 43 | 'HLSL Documentation', 44 | newWindow ? ViewColumn.Two : ViewColumn.Active, 45 | { 46 | // Enable scripts in the webview 47 | enableScripts: true 48 | } 49 | ); 50 | 51 | this._panel.onDidDispose( () => { 52 | this._panel = null; 53 | }); 54 | 55 | this._panel.webview.onDidReceiveMessage( 56 | message => { 57 | switch (message.command) { 58 | case 'clickLink': 59 | commands.executeCommand('shader.openLink', message.text); 60 | return; 61 | } 62 | } 63 | ); 64 | } 65 | this._panel.reveal(); 66 | // And set its HTML content 67 | getWebviewContent(link).then(html => this._panel.webview.html = html); 68 | })); 69 | 70 | } 71 | 72 | dispose() { 73 | this._subscriptions.forEach(s => {s.dispose()}); 74 | } 75 | 76 | 77 | public async provideHover(document: TextDocument, position: Position, token: CancellationToken): Promise { 78 | 79 | let enable = workspace.getConfiguration('hlsl').get('suggest.basic', true); 80 | if (!enable) { 81 | return null; 82 | } 83 | 84 | let wordRange = document.getWordRangeAtPosition(position); 85 | if (!wordRange) { 86 | return null; 87 | } 88 | 89 | let name = document.getText(wordRange); 90 | let backchar = ''; 91 | if(wordRange.start.character > 0) { 92 | let backidx = wordRange.start.translate({characterDelta: -1}); 93 | backchar = backidx.character < 0 ? '' : document.getText(new Range(backidx, wordRange.start)); 94 | } 95 | 96 | if (backchar === '#') { 97 | const key = name.substr(1); 98 | var entry = hlslGlobals.preprocessors[name.toUpperCase()]; 99 | if (entry && entry.description) { 100 | let signature = '(*preprocessor*) '; 101 | signature += '**#' + name + '**'; 102 | let contents: MarkedString[] = []; 103 | contents.push(new MarkdownString(signature)); 104 | contents.push(textToMarkedString(entry.description)); 105 | contents.push(linkToMarkdownString(entry.link)); 106 | return new Hover(contents, wordRange); 107 | } 108 | } 109 | 110 | var entry = hlslGlobals.intrinsicfunctions[name] 111 | if (entry && entry.description) { 112 | let signature = '(*function*) '; 113 | signature += '**' + name + '**'; 114 | signature += '('; 115 | if (entry.parameters && entry.parameters.length != 0) { 116 | let params = ''; 117 | entry.parameters.forEach(p => params += p.label + ','); 118 | signature += params.slice(0, -1); 119 | } 120 | signature += ')'; 121 | let contents: MarkedString[] = []; 122 | contents.push(new MarkdownString(signature)); 123 | contents.push(textToMarkedString(entry.description)); 124 | contents.push(linkToMarkdownString(entry.link)); 125 | return new Hover(contents, wordRange); 126 | } 127 | 128 | entry = hlslGlobals.datatypes[name]; 129 | if (entry && entry.description) { 130 | let signature = '(*datatype*) '; 131 | signature += '**' + name + '**'; 132 | let contents: MarkedString[] = []; 133 | contents.push(new MarkdownString(signature)); 134 | contents.push(textToMarkedString(entry.description)); 135 | contents.push(linkToMarkdownString(entry.link)); 136 | return new Hover(contents, wordRange); 137 | } 138 | 139 | entry = hlslGlobals.semantics[name.toUpperCase()]; 140 | if (entry && entry.description) { 141 | let signature = '(*semantic*) '; 142 | signature += '**' + name + '**'; 143 | let contents: MarkedString[] = []; 144 | contents.push(new MarkdownString(signature)); 145 | contents.push(textToMarkedString(entry.description)); 146 | contents.push(linkToMarkdownString(entry.link)); 147 | return new Hover(contents, wordRange); 148 | } 149 | 150 | let key = name.replace(/\d+$/, '') //strip tailing number 151 | entry = hlslGlobals.semanticsNum[key.toUpperCase()]; 152 | if (entry && entry.description) { 153 | let signature = '(*semantic*) '; 154 | signature += '**' + name + '**'; 155 | let contents: MarkedString[] = []; 156 | contents.push(new MarkdownString(signature)); 157 | contents.push(textToMarkedString(entry.description)); 158 | contents.push(linkToMarkdownString(entry.link)); 159 | return new Hover(contents, wordRange); 160 | } 161 | 162 | entry = hlslGlobals.keywords[name]; 163 | if (entry) { 164 | let signature = '(*keyword*) '; 165 | signature += '**' + name + '**'; 166 | let contents: MarkedString[] = []; 167 | contents.push(new MarkdownString(signature)); 168 | contents.push(textToMarkedString(entry.description)); 169 | contents.push(linkToMarkdownString(entry.link)); 170 | return new Hover(contents, wordRange); 171 | } 172 | 173 | let symbols = await this.getSymbols(document); 174 | 175 | for (let s of symbols) { 176 | if (s.name === name) { 177 | let contents: MarkedString[] = []; 178 | let signature = '(*' + SymbolKind[s.kind].toLowerCase() + '*) '; 179 | signature += s.containerName ? s.containerName + '.' : ''; 180 | signature += '**' + name + '**'; 181 | 182 | contents.push(new MarkdownString(signature)); 183 | 184 | if (s.location.uri.toString() === document.uri.toString()) { 185 | //contents = []; 186 | contents.push( {language: 'hlsl', value: document.getText(s.location.range)} ); 187 | } 188 | 189 | return new Hover(contents, wordRange); 190 | } 191 | } 192 | } 193 | } 194 | 195 | function getWebviewContent(link: string): Promise { 196 | const uri = Uri.parse(link); 197 | return new Promise((resolve, reject) => { 198 | let request = https.request({ 199 | host: uri.authority, 200 | path: uri.path, 201 | rejectUnauthorized: workspace.getConfiguration().get("http.proxyStrictSSL", true) 202 | }, (response) => { 203 | if (response.statusCode == 301 || response.statusCode == 302) 204 | return resolve(response.headers.location); 205 | if (response.statusCode != 200) 206 | return resolve(response.statusCode.toString()); 207 | let html = ''; 208 | response.on('data', (data) => { html += data.toString(); }); 209 | response.on('end', () => { 210 | const dom = new JSDOM(html); 211 | let topic = ''; 212 | let node = dom.window.document.querySelector('.content'); 213 | if (node) { 214 | let num = node.getElementsByTagName('a').length; 215 | for (let i = 0; i < num; ++i) { 216 | const href = node.getElementsByTagName('a')[i].href; 217 | const fulllink = new dom.window.URL(href, uri.toString()).href 218 | node.getElementsByTagName('a')[i].href = '#'; 219 | node.getElementsByTagName('a')[i].setAttribute('onclick', `clickLink('${fulllink}')`) 220 | } 221 | node.querySelector('.metadata.page-metadata')?.remove(); 222 | node.querySelector('#center-doc-outline')?.remove(); 223 | topic = node.outerHTML; 224 | 225 | } else { 226 | let link = uri.with({ scheme: 'https' }).toString(); 227 | topic = `No topic found, click to follow link`; 228 | } 229 | resolve(HTML_TEMPLATE.replace('{0}', topic)); 230 | }); 231 | response.on('error', (error) => { console.log(error); }); 232 | }); 233 | request.on('error', (error) => { console.log(error) }); 234 | request.end(); 235 | }); 236 | } 237 | -------------------------------------------------------------------------------- /src/hlsl/html.ts: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | export const HTML_TEMPLATE = ` 4 | 5 | 6 | 7 | 8 | 209 | 218 | 219 | 220 | {0} 221 | 222 | 223 | ` -------------------------------------------------------------------------------- /src/hlsl/referenceProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import { ReferenceProvider, CancellationToken, TextDocument, Position, Location, SymbolInformation, commands, workspace } from 'vscode'; 4 | 5 | export default class HLSLReferenceProvider implements ReferenceProvider { 6 | 7 | public provideReferences(document: TextDocument, position: Position, options: { includeDeclaration: boolean }, token: CancellationToken): Thenable { 8 | let enable = workspace.getConfiguration('hlsl').get('suggest.basic', true); 9 | if (!enable) { 10 | return null; 11 | } 12 | 13 | let wordRange = document.getWordRangeAtPosition(position); 14 | if (!wordRange) { 15 | return null; 16 | } 17 | 18 | let name = document.getText(wordRange); 19 | 20 | return new Promise( async (resolve, reject) => { 21 | let results: Location[] = []; 22 | 23 | const text = document.getText(); 24 | 25 | const regex = new RegExp(`\\b${name}\\b`, 'gm'); 26 | let match: RegExpExecArray = null; 27 | while (match = regex.exec(text)) { 28 | let refPosition = document.positionAt(match.index); 29 | results.push(new Location(document.uri, document.getWordRangeAtPosition(refPosition))); 30 | } 31 | 32 | let symbols = await commands.executeCommand('vscode.executeWorkspaceSymbolProvider', name); 33 | symbols.filter(s => (s.name === name && s.location.uri.toString() != document.uri.toString()) ).forEach(symbol => { 34 | results.push(symbol.location); 35 | }); 36 | resolve(results); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/hlsl/signatureProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import { SignatureHelpProvider, SignatureHelp, SignatureInformation, ParameterInformation, CancellationToken, TextDocument, Position, workspace } from 'vscode'; 4 | import hlslGlobals = require('./hlslGlobals'); 5 | 6 | const _NL = '\n'.charCodeAt(0); 7 | const _TAB = '\t'.charCodeAt(0); 8 | const _WSB = ' '.charCodeAt(0); 9 | const _LBracket = '['.charCodeAt(0); 10 | const _RBracket = ']'.charCodeAt(0); 11 | const _LCurly = '{'.charCodeAt(0); 12 | const _RCurly = '}'.charCodeAt(0); 13 | const _LParent = '('.charCodeAt(0); 14 | const _RParent = ')'.charCodeAt(0); 15 | const _Comma = ','.charCodeAt(0); 16 | const _Quote = '\''.charCodeAt(0); 17 | const _DQuote = '"'.charCodeAt(0); 18 | const _USC = '_'.charCodeAt(0); 19 | const _a = 'a'.charCodeAt(0); 20 | const _z = 'z'.charCodeAt(0); 21 | const _A = 'A'.charCodeAt(0); 22 | const _Z = 'Z'.charCodeAt(0); 23 | const _0 = '0'.charCodeAt(0); 24 | const _9 = '9'.charCodeAt(0); 25 | 26 | const BOF = 0; 27 | 28 | class BackwardIterator { 29 | private lineNumber: number; 30 | private offset: number; 31 | private line: string; 32 | private model: TextDocument; 33 | 34 | constructor(model: TextDocument, offset: number, lineNumber: number) { 35 | this.lineNumber = lineNumber; 36 | this.offset = offset; 37 | this.line = model.lineAt(this.lineNumber).text; 38 | this.model = model; 39 | } 40 | 41 | public hasNext(): boolean { 42 | return this.lineNumber >= 0; 43 | } 44 | 45 | public next(): number { 46 | if (this.offset < 0) { 47 | if (this.lineNumber > 0) { 48 | this.lineNumber--; 49 | this.line = this.model.lineAt(this.lineNumber).text; 50 | this.offset = this.line.length - 1; 51 | return _NL; 52 | } 53 | this.lineNumber = -1; 54 | return BOF; 55 | } 56 | let ch = this.line.charCodeAt(this.offset); 57 | this.offset--; 58 | return ch; 59 | } 60 | 61 | } 62 | 63 | export default class HLSLSignatureHelperProvider implements SignatureHelpProvider { 64 | 65 | public provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken): Promise { 66 | 67 | let enable = workspace.getConfiguration('hlsl').get('suggest.basic', true); 68 | if (!enable) { 69 | return null; 70 | } 71 | 72 | let iterator = new BackwardIterator(document, position.character - 1, position.line); 73 | 74 | let paramCount = this.readArguments(iterator); 75 | if (paramCount < 0) { 76 | return null; 77 | } 78 | 79 | let ident = this.readIdent(iterator); 80 | if (!ident) { 81 | return null; 82 | } 83 | 84 | let entry = hlslGlobals.intrinsicfunctions[ident]; 85 | if (!entry) { 86 | return null; 87 | } 88 | 89 | let infos: ParameterInformation[] = []; 90 | let signature = ident; 91 | signature += '('; 92 | if (entry.parameters && entry.parameters.length != 0) { 93 | let params = ''; 94 | entry.parameters.forEach(p => { 95 | params += p.label + ','; 96 | infos.push({ label: p.label, documentation: p.documentation}); 97 | }); 98 | signature += params.slice(0, -1); 99 | } else { 100 | signature += 'void'; 101 | } 102 | signature += ')'; 103 | 104 | let signatureInfo = new SignatureInformation(signature, entry.description); 105 | signatureInfo.parameters = infos; 106 | 107 | let ret = new SignatureHelp(); 108 | ret.signatures.push(signatureInfo); 109 | ret.activeSignature = 0; 110 | ret.activeParameter = Math.min(paramCount, signatureInfo.parameters.length - 1); 111 | return Promise.resolve(ret); 112 | } 113 | 114 | private readArguments(iterator: BackwardIterator): number { 115 | let parentNesting = 0; 116 | let bracketNesting = 0; 117 | let curlyNesting = 0; 118 | let paramCount = 0; 119 | while (iterator.hasNext()) { 120 | let ch = iterator.next(); 121 | switch (ch) { 122 | case _LParent: 123 | parentNesting--; 124 | if (parentNesting < 0) { 125 | return paramCount; 126 | } 127 | break; 128 | case _RParent: parentNesting++; break; 129 | case _LCurly: curlyNesting--; break; 130 | case _RCurly: curlyNesting++; break; 131 | case _LBracket: bracketNesting--; break; 132 | case _RBracket: bracketNesting++; break; 133 | case _DQuote: 134 | case _Quote: 135 | while (iterator.hasNext() && ch !== iterator.next()) { 136 | // find the closing quote or double quote 137 | } 138 | break; 139 | case _Comma: 140 | if (!parentNesting && !bracketNesting && !curlyNesting) { 141 | paramCount++; 142 | } 143 | break; 144 | } 145 | } 146 | return -1; 147 | } 148 | 149 | private isIdentPart(ch: number): boolean { 150 | if (ch === _USC || // _ 151 | ch >= _a && ch <= _z || // a-z 152 | ch >= _A && ch <= _Z || // A-Z 153 | ch >= _0 && ch <= _9 || // 0/9 154 | ch >= 0x80 && ch <= 0xFFFF) { // nonascii 155 | 156 | return true; 157 | } 158 | return false; 159 | } 160 | 161 | private readIdent(iterator: BackwardIterator): string { 162 | let identStarted = false; 163 | let ident = ''; 164 | while (iterator.hasNext()) { 165 | let ch = iterator.next(); 166 | if (!identStarted && (ch === _WSB || ch === _TAB || ch === _NL)) { 167 | continue; 168 | } 169 | if (this.isIdentPart(ch)) { 170 | identStarted = true; 171 | ident = String.fromCharCode(ch) + ident; 172 | } else if (identStarted) { 173 | return ident; 174 | } 175 | } 176 | return ident; 177 | } 178 | 179 | 180 | } -------------------------------------------------------------------------------- /src/hlsl/symbolProvider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import { DocumentSymbolProvider, WorkspaceSymbolProvider, SymbolKind, SymbolInformation, CancellationToken, TextDocument, Position, Range, RelativePattern, Location, Uri, Disposable, window, workspace, extensions } from 'vscode'; 4 | import { rgPath, hlslExtensions } from '../common'; 5 | import { execSync } from 'child_process'; 6 | import { join } from 'path'; 7 | 8 | interface ISymbolPattern { kind: SymbolKind, pattern: string } 9 | 10 | const searchPatterns: ISymbolPattern[] = [ 11 | { kind: SymbolKind.Function, pattern: /^\w+\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9:_\x7f-\xff]*)\s*\(/.source }, 12 | { kind: SymbolKind.Struct, pattern: /^(?:struct|cbuffer|tbuffer)\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9:_\x7f-\xff]*)/.source }, 13 | { kind: SymbolKind.Variable, pattern: /^(?:sampler|sampler1D|sampler2D|sampler3D|samplerCUBE|samplerRECT|sampler_state|SamplerState)\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9:_\x7f-\xff]*)/.source }, 14 | { kind: SymbolKind.Field, pattern: /^(?:texture|texture2D|textureCUBE|Texture1D|Texture1DArray|Texture2D|Texture2DArray|Texture2DMS|Texture2DMSArray|Texture3D|TextureCube|TextureCubeArray|RWTexture1D|RWTexture1DArray|RWTexture2D|RWTexture2DArray|RWTexture3D)(?:\s*<(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9,_\x7f-\xff]*)>)?\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9\[\]_\x7f-\xff]*)/.source }, 15 | { kind: SymbolKind.Field, pattern: /^(?:AppendStructuredBuffer|Buffer|ByteAddressBuffer|ConsumeStructuredBuffer|RWBuffer|RWByteAddressBuffer|RWStructuredBuffer|StructuredBuffer)(?:\s*<(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9,_\x7f-\xff]*)>)?\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9\[\]_\x7f-\xff]*)/.source }, 16 | ]; 17 | 18 | export interface ISymbolCache { [path: string]: SymbolInformation[]; } 19 | 20 | export default class HLSLDocumentSymbolProvider implements DocumentSymbolProvider, WorkspaceSymbolProvider { 21 | 22 | private _disposables: Disposable[] = []; 23 | 24 | private _hlslPattern = ['.hlsl','.hlsli','.fx','.fxh','.vsh','.psh','.cginc','.compute', '.ush', '.usf']; 25 | 26 | constructor() { 27 | const extention = extensions.getExtension('vscode.hlsl'); 28 | if (extention && extention.packageJSON 29 | && extention.packageJSON.contributes 30 | && extention.packageJSON.contributes.languages) { 31 | let hlsllang: any[] = extention.packageJSON.contributes.languages.filter(l => l.id === 'hlsl'); 32 | if (hlsllang.length && hlsllang[0].extensions) { 33 | this._hlslPattern = this._hlslPattern.concat(hlsllang[0].extensions.slice()); 34 | } 35 | } 36 | 37 | this._hlslPattern = this._hlslPattern.concat(hlslExtensions) 38 | 39 | // Keep only unique entries 40 | this._hlslPattern = [...new Set(this._hlslPattern)]; 41 | } 42 | 43 | public dispose(){ 44 | if (this._disposables.length > 0) { 45 | this._disposables.forEach(d => d.dispose()); 46 | this._disposables = []; 47 | } 48 | } 49 | 50 | private getDocumentSymbols(uri: Uri): Promise { 51 | return new Promise((resolve, reject) => { 52 | let result: SymbolInformation[] = []; 53 | 54 | let document: TextDocument = null; 55 | for (let d of workspace.textDocuments) { 56 | if (d.uri.toString() === uri.toString()) { 57 | document = d; 58 | break; 59 | } 60 | } 61 | 62 | if (document === null) { 63 | resolve([]); 64 | return; 65 | } 66 | 67 | let text = document.getText(); 68 | 69 | function fetchSymbol(entry: ISymbolPattern) { 70 | const kind = entry.kind; 71 | const pattern = entry.pattern; 72 | 73 | let regex = new RegExp(pattern, "gm"); 74 | let match: RegExpExecArray = null; 75 | while (match = regex.exec(text)) { 76 | let line = document.positionAt(match.index).line; 77 | let range = document.lineAt(line).range; 78 | let word = match[1]; 79 | 80 | let lastChar = kind === SymbolKind.Function ? ')' : 81 | kind === SymbolKind.Struct ? '}' : 82 | kind === SymbolKind.Variable ? ';' : 83 | kind === SymbolKind.Field ? ';' : 84 | ''; 85 | 86 | if (lastChar) { 87 | let end = text.indexOf(lastChar, match.index) + 1; 88 | range = new Range(range.start, document.positionAt(end)); 89 | } 90 | result.push(new SymbolInformation(word, kind, '', new Location(document.uri, range))); 91 | } 92 | } 93 | 94 | for (let entry of searchPatterns) { 95 | fetchSymbol(entry); 96 | } 97 | 98 | resolve(result); 99 | 100 | }); 101 | } 102 | 103 | public provideDocumentSymbols(document: TextDocument, token: CancellationToken): Thenable { 104 | return this.getDocumentSymbols(document.uri); 105 | } 106 | 107 | private getDocument(): TextDocument | undefined { 108 | // we wants to have a resource even when asking 109 | // general questions so we check the active editor. If this 110 | // doesn't match we take the first TS document. 111 | 112 | const activeDocument = window.activeTextEditor?.document; 113 | if (activeDocument) { 114 | if (activeDocument.languageId == 'hlsl') { 115 | return activeDocument; 116 | } 117 | } 118 | 119 | const documents = workspace.textDocuments; 120 | for (const document of documents) { 121 | if (document.languageId == 'hlsl') { 122 | return document; 123 | } 124 | } 125 | return undefined; 126 | } 127 | 128 | public provideWorkspaceSymbols(query: string, token: CancellationToken): Thenable { 129 | if (!rgPath) { 130 | return null; 131 | } 132 | 133 | return new Promise((resolve, reject) => { 134 | let results: SymbolInformation[] = []; 135 | 136 | const document = this.getDocument(); 137 | if (!document){ 138 | resolve( results ); 139 | } 140 | 141 | const ws = workspace.getWorkspaceFolder(document.uri); 142 | if (!ws) { 143 | resolve(results); 144 | } 145 | 146 | const rootPath = ws.uri.fsPath; 147 | const execOpts = { 148 | cwd: rootPath, 149 | maxBuffer: 1024 * 1024 150 | } 151 | 152 | let includePattern = '-g *' + this._hlslPattern.join(' -g *'); 153 | 154 | for (let entry of searchPatterns) { 155 | const kind = entry.kind; 156 | const searchPattern = entry.pattern; 157 | let output = execSync(`"${rgPath}" ${includePattern} -o --case-sensitive -H --line-number --column --hidden -e "${searchPattern}" .`, execOpts); 158 | 159 | let lines = output.toString().split('\n'); 160 | for (let line of lines) { 161 | let lineMatch = /^(?:((?:[a-zA-Z]:)?[^:]*):)?(\d+):(\d):(.+)/.exec(line); 162 | if (lineMatch) { 163 | let position: Position = new Position(parseInt(lineMatch[2]) - 1, parseInt(lineMatch[3]) - 1); 164 | let range = new Range(position, position); 165 | let filepath = join(rootPath, lineMatch[1]); 166 | let regex = new RegExp(searchPattern); 167 | let word = '?????'; 168 | let symbolMatch = regex.exec(lineMatch[4].toString()); 169 | if (symbolMatch) { 170 | word = symbolMatch[1]; 171 | position = position.with({ character: symbolMatch[0].indexOf(word) }); 172 | range = new Range(position, position.translate(0, word.length)); 173 | } 174 | 175 | results.push(new SymbolInformation(word, kind, '', new Location(Uri.file(filepath), range))); 176 | } 177 | } 178 | } 179 | 180 | resolve( results ); 181 | }); 182 | 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /syntaxes/cg-cpp.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.cpp.cg", 3 | "injectionSelector": "L:source.cpp", 4 | "patterns": [ 5 | { 6 | "include": "#cg-raw-string" 7 | } 8 | ], 9 | "repository": { 10 | "cg-raw-string": { 11 | "begin": "R\"(?i:cg)(\\()", 12 | "beginCaptures": { 13 | "0": { 14 | "name": "punctuation.definition.string.begin.cpp" 15 | }, 16 | "1": { 17 | "name": "cg.delimeter.raw.string.cpp" 18 | } 19 | }, 20 | "end": "\\)(?i:cg)\"", 21 | "endCaptures": { 22 | "0": { 23 | "name": "punctuation.definition.string.end.cpp" 24 | }, 25 | "1": { 26 | "name": "cg.delimeter.raw.string.cpp" 27 | } 28 | }, 29 | "name": "cg.raw.string.cpp", 30 | "patterns": [ 31 | { 32 | "contentName": "source.cg", 33 | "begin": "(?!\\G)", 34 | "end": "(?i)(?=\\)cg\")", 35 | "patterns": [ 36 | { 37 | "include": "source.cg" 38 | } 39 | ] 40 | } 41 | ] 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /syntaxes/cg.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | cg 8 | 9 | foldingStartMarker 10 | (?x) 11 | /\*\*(?!\*) 12 | |^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S)) 13 | 14 | foldingStopMarker 15 | (?<!\*)\*\*/|^\s*\} 16 | name 17 | Cg 18 | patterns 19 | 20 | 21 | begin 22 | // 23 | end 24 | $ 25 | name 26 | comment.line.double-slash.cg 27 | 28 | 29 | begin 30 | /\* 31 | end 32 | \*/ 33 | name 34 | comment.block.cg 35 | 36 | 37 | comment 38 | Numeric constants 39 | match 40 | \b([0-9]+\.?[0-9]*)|(\.[0-9]+)\b 41 | name 42 | constant.numeric.cg 43 | 44 | 45 | comment 46 | Language constants 47 | match 48 | \b(false|FALSE|NULL|true|TRUE)\b 49 | name 50 | constant.language.cg 51 | 52 | 53 | comment 54 | Basic control keywords 55 | match 56 | \b(break|continue|discard|do|for|if|return|switch|while)\b 57 | name 58 | keyword.control.cg 59 | 60 | 61 | comment 62 | Declaration specifiers 63 | match 64 | \b(const|extern|in|inline|inout|static|out|uniform|varying)\b 65 | name 66 | storage.declaration.specifier.cg 67 | 68 | 69 | comment 70 | Basic types 71 | match 72 | \b(void|bool|struct|float|half|fixed|char|short|long|int|unsigned)\b 73 | name 74 | storage.type.scalar.cg 75 | 76 | 77 | comment 78 | Vector forms of scalar types 79 | match 80 | \b(float1|float2|float3|float4|half1|half2|half3|half4|fixed1|fixed2|fixed3|fixed4|int1|int2|int3|int4)\b 81 | name 82 | storage.type.vector.cg 83 | 84 | 85 | comment 86 | Matrix forms of scalar types 87 | match 88 | \b(float1x1|float1x2|float1x3|float1x4|float2x1|float2x2|float2x3|float2x4|float3x1|float3x2|float3x3|float3x4|float4x1|float4x2|float4x3|float4x4|half1x1|half1x2|half1x3|half1x4|half2x1|half2x2|half2x3|half2x4|half3x1|half3x2|half3x3|half3x4|half4x1|half4x2|half4x3|half4x4|fixed1x1|fixed1x2|fixed1x3|fixed1x4|fixed2x1|fixed2x2|fixed2x3|fixed2x4|fixed3x1|fixed3x2|fixed3x3|fixed3x4|fixed4x1|fixed4x2|fixed4x3|fixed4x4|int1x1|int1x2|int1x3|int1x4|int2x1|int2x2|int2x3|int2x4|int3x1|int3x2|int3x3|int3x4|int4x1|int4x2|int4x3|int4x4)\b 89 | name 90 | storage.type.matrix.cg 91 | 92 | 93 | comment 94 | Sampler types 95 | match 96 | \b(sampler|sampler1D|sampler2D|sampler3D|samplerCUBE|samplerRECT)\b 97 | name 98 | storage.type.sampler.cg 99 | 100 | 101 | comment 102 | Intrinsic functions 103 | match 104 | \b(abs|acos|all|any|asin|atan|atan2|bitCount|bitfieldExtract|bitfieldInsert|bitfieldReverse|ceil|clamp|clip|cos|cosh|cross|ddx|ddy|degrees|determinant|distance|dot|exp|exp2|faceforward|findLSB|findMSB|floatToIntBits|floatToRawIntBits|floor|fmod|frac|frexp|fwidth|intBitsToFloat|inverse|isfinite|isinf|isnan|ldexp|length|lerp|lit|log|log10|log2|max|min|modf|mul|normalize|pow|radians|reflect|refract|round|rsqrt|saturate|sign|sin|sincos|sinh|smoothstep|sqrt|step|tan|tanh|tex1D|tex1Dbias|tex1Dcmpbias|tex1Dcmplod|tex1Dfetch|tex1Dlod|tex1Dproj|tex1Dsize|tex1DARRAY|tex1DARRAYbias|tex1DARRAYcmpbias|tex1DARRAYcmplod|tex1DARRAYfetch|tex1DARRAYlod|tex1DARRAYproj|tex1DARRAYsize|tex1DARRAYbias|tex2D|tex2Dbias|tex2Dcmpbias|tex2Dcmplod|tex2Dfetch|tex2Dlod|tex2Dproj|tex2Dsize|tex2DARRAY|tex2DARRAYbias|tex2DARRAYcmpbias|tex2DARRAYcmplod|tex2DARRAYfetch|tex2DARRAYlod|tex2DARRAYproj|tex2DARRAYsize|tex2DARRAYbias|tex2DMSfetch|tex2DMSARRAYfetch|tex2DMSARRAYsize|tex3D|tex3Dbias|tex3Dcmpbias|tex3Dcmplod|tex3Dfetch|tex3Dlod|tex3Dproj|tex3Dsize|texBUF|texBUFsize|texCUBE|texCUBEARRAY|texCUBEARRAYbias|texCUBEARRAYlod|texCUBEARRAYsize|texCUBEbias|texCUBElod|texCUBEproj|texCUBEsize|texRBUF|texRBUFsize|texRECT|texRECTbias|texRECTfetch|texRECTlod|texRECTproj|texRECTsize|transpose|trunc)\b 105 | name 106 | keyword.function.intrinsic.cg 107 | 108 | 109 | scopeName 110 | source.cg 111 | uuid 112 | 1cd9b3de-8096-11e1-ad2e-5fe8cad0a628 113 | 114 | -------------------------------------------------------------------------------- /syntaxes/glsl-cpp.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.cpp.glsl", 3 | "injectionSelector": "L:source.cpp", 4 | "patterns": [ 5 | { 6 | "include": "#glsl-raw-string" 7 | } 8 | ], 9 | "repository": { 10 | "glsl-raw-string": { 11 | "begin": "R\"(?i:glsl)(\\()", 12 | "beginCaptures": { 13 | "0": { 14 | "name": "punctuation.definition.string.begin.cpp" 15 | }, 16 | "1": { 17 | "name": "glsl.delimeter.raw.string.cpp" 18 | } 19 | }, 20 | "end": "\\)(?i:glsl)\"", 21 | "endCaptures": { 22 | "0": { 23 | "name": "punctuation.definition.string.end.cpp" 24 | }, 25 | "1": { 26 | "name": "glsl.delimeter.raw.string.cpp" 27 | } 28 | }, 29 | "name": "glsl.raw.string.cpp", 30 | "patterns": [ 31 | { 32 | "contentName": "source.glsl", 33 | "begin": "(?!\\G)", 34 | "end": "(?i)(?=\\)glsl\")", 35 | "patterns": [ 36 | { 37 | "include": "source.glsl" 38 | } 39 | ] 40 | } 41 | ] 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /syntaxes/glsl-html.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "text.html.glsl", 3 | "injectionSelector": "L:text.html", 4 | "patterns": [ 5 | { 6 | "include": "#glsl-tag" 7 | }, 8 | { 9 | "include": "#script-type-glsl-tag" 10 | } 11 | ], 12 | "repository": { 13 | "string-double-quoted": { 14 | "begin": "\"", 15 | "beginCaptures": { 16 | "0": { 17 | "name": "punctuation.definition.string.begin.html" 18 | } 19 | }, 20 | "end": "\"", 21 | "endCaptures": { 22 | "0": { 23 | "name": "punctuation.definition.string.end.html" 24 | } 25 | }, 26 | "name": "string.quoted.double.html" 27 | }, 28 | "string-single-quoted": { 29 | "begin": "'", 30 | "beginCaptures": { 31 | "0": { 32 | "name": "punctuation.definition.string.begin.html" 33 | } 34 | }, 35 | "end": "'", 36 | "endCaptures": { 37 | "0": { 38 | "name": "punctuation.definition.string.end.html" 39 | } 40 | }, 41 | "name": "string.quoted.single.html" 42 | }, 43 | "unquoted-attribute": { 44 | "patterns": [ 45 | { 46 | "match": "([^\\s&>\"'<=`]|&(?=>))+", 47 | "name": "string.unquoted.html" 48 | } 49 | ] 50 | }, 51 | "tag-stuff": { 52 | "patterns": [ 53 | { 54 | "begin": "([^\\s/=>\"'<]+)\\s*(=)\\s*", 55 | "beginCaptures": { 56 | "1": { 57 | "name": "entity.other.attribute-name.html" 58 | }, 59 | "2": { 60 | "name": "punctuation.separator.key-value.html" 61 | } 62 | }, 63 | "end": "(?!\\G)|(?=\\s|/?>)", 64 | "name": "meta.attribute-with-value.html", 65 | "patterns": [ 66 | { 67 | "include": "#string-double-quoted" 68 | }, 69 | { 70 | "include": "#string-single-quoted" 71 | }, 72 | { 73 | "include": "#unquoted-attribute" 74 | } 75 | ] 76 | }, 77 | { 78 | "match": "[^\\s/=>\"'<]+", 79 | "captures": { 80 | "0": { 81 | "name": "entity.other.attribute-name.html" 82 | } 83 | }, 84 | "name": "meta.attribute-without-value.html" 85 | } 86 | ] 87 | }, 88 | "glsl-tag": { 89 | "begin": "(?i)(?=))(<)(glsl)", 90 | "beginCaptures": { 91 | "1": { 92 | "name": "punctuation.definition.tag.begin.html" 93 | }, 94 | "2": { 95 | "name": "entity.name.tag.html" 96 | }, 97 | "3": { 98 | "name": "punctuation.definition.tag.end.html" 99 | } 100 | }, 101 | "end": "()", 102 | "endCaptures": { 103 | "1": { 104 | "name": "punctuation.definition.tag.begin.html" 105 | }, 106 | "2": { 107 | "name": "entity.name.tag.html" 108 | }, 109 | "3": { 110 | "name": "punctuation.definition.tag.end.html" 111 | } 112 | }, 113 | "name": "meta.tag.glsl.html", 114 | "patterns": [ 115 | { 116 | "begin": "\\G", 117 | "end": "(>)", 118 | "endCaptures": { 119 | "1": { 120 | "name": "punctuation.definition.tag.end.html" 121 | } 122 | }, 123 | "patterns": [ 124 | { 125 | "include": "#tag-stuff" 126 | } 127 | ] 128 | }, 129 | { 130 | "contentName": "source.glsl", 131 | "begin": "(?!\\G)", 132 | "end": "(?i)(?=)", 133 | "patterns": [ 134 | { 135 | "include": "source.glsl" 136 | } 137 | ] 138 | } 139 | ] 140 | }, 141 | "script-type-glsl-tag": { 142 | "begin": "(?i)(?=))(<)(script)", 143 | "beginCaptures": { 144 | "1": { 145 | "name": "punctuation.definition.tag.begin.html" 146 | }, 147 | "2": { 148 | "name": "entity.name.tag.html" 149 | }, 150 | "3": { 151 | "name": "punctuation.definition.tag.end.html" 152 | } 153 | }, 154 | "end": "(?i)()", 155 | "endCaptures": { 156 | "1": { 157 | "name": "punctuation.definition.tag.begin.html" 158 | }, 159 | "2": { 160 | "name": "entity.name.tag.html" 161 | }, 162 | "3": { 163 | "name": "punctuation.definition.tag.end.html" 164 | } 165 | }, 166 | "name": "meta.tag.script-glsl.html", 167 | "patterns": [ 168 | { 169 | "begin": "\\G", 170 | "end": "(>)", 171 | "endCaptures": { 172 | "1": { 173 | "name": "punctuation.definition.tag.end.html" 174 | } 175 | }, 176 | "patterns": [ 177 | { 178 | "include": "#tag-stuff" 179 | } 180 | ] 181 | }, 182 | { 183 | "contentName": "source.glsl", 184 | "begin": "(?!\\G)", 185 | "end": "(?i)(?=)", 186 | "patterns": [ 187 | { 188 | "include": "source.glsl" 189 | } 190 | ] 191 | } 192 | ] 193 | } 194 | } 195 | } -------------------------------------------------------------------------------- /syntaxes/glsl.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | vs 8 | fs 9 | gs 10 | vsh 11 | fsh 12 | gsh 13 | vshader 14 | fshader 15 | gshader 16 | vert 17 | frag 18 | geom 19 | tesc 20 | tese 21 | comp 22 | glsl 23 | f.glsl 24 | v.glsl 25 | g.glsl 26 | 27 | foldingStartMarker 28 | /\*\*|\{\s*$ 29 | foldingStopMarker 30 | \*\*/|^\s*\} 31 | keyEquivalent 32 | ^~G 33 | name 34 | GLSL 35 | patterns 36 | 37 | 38 | include 39 | #literal 40 | 41 | 42 | include 43 | #operator 44 | 45 | 46 | begin 47 | /\* 48 | beginCaptures 49 | 50 | 0 51 | 52 | name 53 | punctuation.definition.comment.block.begin.glsl 54 | 55 | 56 | end 57 | \*/ 58 | endCaptures 59 | 60 | 0 61 | 62 | name 63 | punctuation.definition.comment.block.end.glsl 64 | 65 | 66 | name 67 | comment.block.glsl 68 | 69 | 70 | begin 71 | // 72 | beginCaptures 73 | 74 | 0 75 | 76 | name 77 | punctuation.definition.comment.glsl 78 | 79 | 80 | end 81 | \n 82 | name 83 | comment.line.double-slash.glsl 84 | 85 | 86 | match 87 | ^\s*#\s*(define|defined|undef|if|ifdef|ifndef|else|elif|endif|error|pragma|extension|version|line)\b 88 | name 89 | keyword.directive.preprocessor.glsl 90 | 91 | 92 | match 93 | \b(__LINE__|__FILE__|__VERSION__|GL_core_profile|GL_es_profile|GL_compatibility_profile)\b 94 | name 95 | constant.macro.predefined.glsl 96 | 97 | 98 | match 99 | \b(precision|highp|mediump|lowp) 100 | name 101 | storage.modifier.precision.glsl 102 | 103 | 104 | match 105 | \b(break|case|continue|default|discard|do|else|for|if|return|switch|while)\b 106 | name 107 | keyword.control.glsl 108 | 109 | 110 | match 111 | \b(void|bool|int|uint|float|double|vec[2|3|4]|dvec[2|3|4]|bvec[2|3|4]|ivec[2|3|4]|uvec[2|3|4]|mat[2|3|4]|mat2x2|mat2x3|mat2x4|mat3x2|mat3x3|mat3x4|mat4x2|mat4x3|mat4x4|dmat2|dmat3|dmat4|dmat2x2|dmat2x3|dmat2x4|dmat3x2|dmat3x3|dmat3x4|dmat4x2|dmat4x3|dmat4x4|sampler[1|2|3]D|image[1|2|3]D|samplerCube|imageCube|sampler2DRect|image2DRect|sampler[1|2]DArray|image[1|2]DArray|samplerBuffer|imageBuffer|sampler2DMS|image2DMS|sampler2DMSArray|image2DMSArray|samplerCubeArray|imageCubeArray|sampler[1|2]DShadow|sampler2DRectShadow|sampler[1|2]DArrayShadow|samplerCubeShadow|samplerCubeArrayShadow|isampler[1|2|3]D|iimage[1|2|3]D|isamplerCube|iimageCube|isampler2DRect|iimage2DRect|isampler[1|2]DArray|iimage[1|2]DArray|isamplerBuffer|iimageBuffer|isampler2DMS|iimage2DMS|isampler2DMSArray|iimage2DMSArray|isamplerCubeArray|iimageCubeArray|atomic_uint|usampler[1|2|3]D|uimage[1|2|3]D|usamplerCube|uimageCube|usampler2DRect|uimage2DRect|usampler[1|2]DArray|uimage[1|2]DArray|usamplerBuffer|uimageBuffer|usampler2DMS|uimage2DMS|usampler2DMSArray|uimage2DMSArray|usamplerCubeArray|uimageCubeArray|struct)\b 112 | name 113 | storage.type.glsl 114 | 115 | 116 | match 117 | \b(layout|attribute|centroid|sampler|patch|const|flat|in|inout|invariant|noperspective|out|smooth|uniform|varying|buffer|shared|coherent|readonly|writeonly|volatile|restrict)\b 118 | name 119 | storage.modifier.glsl 120 | 121 | 122 | match 123 | \b(gl_BackColor|gl_BackLightModelProduct|gl_BackLightProduct|gl_BackMaterial|gl_BackSecondaryColor|gl_ClipDistance|gl_ClipPlane|gl_ClipVertex|gl_Color|gl_DepthRange|gl_DepthRangeParameters|gl_EyePlaneQ|gl_EyePlaneR|gl_EyePlaneS|gl_EyePlaneT|gl_Fog|gl_FogCoord|gl_FogFragCoord|gl_FogParameters|gl_FragColor|gl_FragCoord|gl_FragData|gl_FragDepth|gl_FrontColor|gl_FrontFacing|gl_FrontLightModelProduct|gl_FrontLightProduct|gl_FrontMaterial|gl_FrontSecondaryColor|gl_InstanceID|gl_Layer|gl_LightModel|gl_LightModelParameters|gl_LightModelProducts|gl_LightProducts|gl_LightSource|gl_LightSourceParameters|gl_MaterialParameters|gl_ModelViewMatrix|gl_ModelViewMatrixInverse|gl_ModelViewMatrixInverseTranspose|gl_ModelViewMatrixTranspose|gl_ModelViewProjectionMatrix|gl_ModelViewProjectionMatrixInverse|gl_ModelViewProjectionMatrixInverseTranspose|gl_ModelViewProjectionMatrixTranspose|gl_MultiTexCoord[0-7]|gl_Normal|gl_NormalMatrix|gl_NormalScale|gl_ObjectPlaneQ|gl_ObjectPlaneR|gl_ObjectPlaneS|gl_ObjectPlaneT|gl_Point|gl_PointCoord|gl_PointParameters|gl_PointSize|gl_Position|gl_PrimitiveIDIn|gl_ProjectionMatrix|gl_ProjectionMatrixInverse|gl_ProjectionMatrixInverseTranspose|gl_ProjectionMatrixTranspose|gl_SecondaryColor|gl_TexCoord|gl_TextureEnvColor|gl_TextureMatrix|gl_TextureMatrixInverse|gl_TextureMatrixInverseTranspose|gl_TextureMatrixTranspose|gl_Vertex|gl_VertexID)\b 124 | name 125 | support.variable.glsl 126 | 127 | 128 | match 129 | \b(gl_MaxClipPlanes|gl_MaxCombinedTextureImageUnits|gl_MaxDrawBuffers|gl_MaxFragmentUniformComponents|gl_MaxLights|gl_MaxTextureCoords|gl_MaxTextureImageUnits|gl_MaxTextureUnits|gl_MaxVaryingFloats|gl_MaxVertexAttribs|gl_MaxVertexTextureImageUnits|gl_MaxVertexUniformComponents)\b 130 | name 131 | support.constant.glsl 132 | 133 | 134 | match 135 | \b(abs|acos|all|any|asin|atan|ceil|clamp|cos|cross|degrees|dFdx|dFdy|distance|dot|equal|exp|exp2|faceforward|floor|fract|ftransform|fwidth|greaterThan|greaterThanEqual|inversesqrt|length|lessThan|lessThanEqual|log|log2|matrixCompMult|max|min|mix|mod|noise[1-4]|normalize|not|notEqual|outerProduct|pow|radians|reflect|refract|shadow1D|shadow1DLod|shadow1DProj|shadow1DProjLod|shadow2D|shadow2DLod|shadow2DProj|shadow2DProjLod|sign|sin|smoothstep|sqrt|step|tan|texture1D|texture1DLod|texture1DProj|texture1DProjLod|texture2D|texture2DLod|texture2DProj|texture2DProjLod|texture3D|texture3DLod|texture3DProj|texture3DProjLod|textureCube|textureCubeLod|transpose)\b 136 | name 137 | support.function.glsl 138 | 139 | 140 | repository 141 | 142 | literal 143 | 144 | patterns 145 | 146 | 147 | include 148 | #numeric-literal 149 | 150 | 151 | 152 | operator 153 | 154 | patterns 155 | 156 | 157 | include 158 | #arithmetic-operator 159 | 160 | 161 | include 162 | #increment-decrement-operator 163 | 164 | 165 | include 166 | #bitwise-operator 167 | 168 | 169 | include 170 | #comparative-operator 171 | 172 | 173 | include 174 | #assignment-operator 175 | 176 | 177 | include 178 | #logical-operator 179 | 180 | 181 | include 182 | #ternary-operator 183 | 184 | 185 | 186 | numeric-literal 187 | 188 | match 189 | \b([0-9][0-9_]*)(\.([0-9][0-9_]*))?([eE][+/-]?([0-9][0-9_]*))?\b 190 | name 191 | constant.numeric.glsl 192 | 193 | arithmetic-operator 194 | 195 | match 196 | (?<![/=\-+!*%<>&|\^~.])(\+|\-|\*|\/|\%)(?![/=\-+!*%<>&|^~.]) 197 | name 198 | keyword.operator.arithmetic.glsl 199 | 200 | increment-decrement-operator 201 | 202 | match 203 | (?<![/=\-+!*%<>&|\^~.])(\+\+|\-\-)(?![/=\-+!*%<>&|^~.]) 204 | name 205 | keyword.operator.increment-or-decrement.glsl 206 | 207 | bitwise-operator 208 | 209 | match 210 | (?<![/=\-+!*%<>&|\^~.])(~|&|\||\^|<<|>>)(?![/=\-+!*%<>&|^~.]) 211 | name 212 | keyword.operator.bitwise.glsl 213 | 214 | assignment-operator 215 | 216 | match 217 | (?<![/=\-+!*%<>&|\^~.])(\+|\-|\*|\%|\/|<<|>>|&|\^|\|)?=(?![/=\-+!*%<>&|^~.]) 218 | name 219 | keyword.operator.assignment.glsl 220 | 221 | comparative-operator 222 | 223 | match 224 | (?<![/=\-+!*%<>&|\^~.])((=|!)=|(<|>)=?)(?![/=\-+!*%<>&|^~.]) 225 | name 226 | keyword.operator.comparative.glsl 227 | 228 | logical-operator 229 | 230 | match 231 | (?<![/=\-+!*%<>&|\^~.])(!|&&|\|\||\^\^)(?![/=\-+!*%<>&|^~.]) 232 | name 233 | keyword.operator.arithmetic.glsl 234 | 235 | ternary-operator 236 | 237 | match 238 | (\?|:) 239 | name 240 | keyword.operator.ternary.glsl 241 | 242 | 243 | scopeName 244 | source.glsl 245 | uuid 246 | D0FD1B52-F137-4FBA-A148-B8A893CD948C 247 | 248 | -------------------------------------------------------------------------------- /syntaxes/hlsl-cpp.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.cpp.hlsl", 3 | "injectionSelector": "L:source.cpp", 4 | "patterns": [ 5 | { 6 | "include": "#hlsl-raw-string" 7 | } 8 | ], 9 | "repository": { 10 | "hlsl-raw-string": { 11 | "begin": "R\"(?i:hlsl)(\\()", 12 | "beginCaptures": { 13 | "0": { 14 | "name": "punctuation.definition.string.begin.cpp" 15 | }, 16 | "1": { 17 | "name": "hlsl.delimeter.raw.string.cpp" 18 | } 19 | }, 20 | "end": "\\)(?i:hlsl)\"", 21 | "endCaptures": { 22 | "0": { 23 | "name": "punctuation.definition.string.end.cpp" 24 | }, 25 | "1": { 26 | "name": "hlsl.delimeter.raw.string.cpp" 27 | } 28 | }, 29 | "name": "hlsl.raw.string.cpp", 30 | "patterns": [ 31 | { 32 | "contentName": "source.hlsl", 33 | "begin": "(?!\\G)", 34 | "end": "(?i)(?=\\)hlsl\")", 35 | "patterns": [ 36 | { 37 | "include": "source.hlsl" 38 | } 39 | ] 40 | } 41 | ] 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src" 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } --------------------------------------------------------------------------------