Check in initial code
This commit is contained in:
Родитель
0c468c5315
Коммит
dada492762
|
@ -0,0 +1,16 @@
|
|||
AccessModifierOffset: -4
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BreakBeforeBraces: Allman
|
||||
ColumnLimit: 140
|
||||
Cpp11BracedListStyle: false
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
NamespaceIndentation: All
|
||||
PointerAlignment: Left
|
||||
SpaceBeforeParens: ControlStatements
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
|
@ -0,0 +1,8 @@
|
|||
* text=auto
|
||||
*.hpp text
|
||||
*.cpp text
|
||||
*.hlsl text
|
||||
*.glsl text
|
||||
*.msl text
|
||||
*.dxil binary
|
||||
*.spv binary
|
|
@ -328,3 +328,7 @@ ASALocalRun/
|
|||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
#
|
||||
/External/
|
||||
/Build/
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env python
|
||||
#-*- coding: ascii -*-
|
||||
|
||||
# ShaderConductor
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import os, platform, subprocess, sys
|
||||
|
||||
def FindProgramFilesFolder():
|
||||
env = os.environ
|
||||
if "64bit" == platform.architecture()[0]:
|
||||
if "ProgramFiles(x86)" in env:
|
||||
program_files_folder = env["ProgramFiles(x86)"]
|
||||
else:
|
||||
program_files_folder = "C:\Program Files (x86)"
|
||||
else:
|
||||
if "ProgramFiles" in env:
|
||||
program_files_folder = env["ProgramFiles"]
|
||||
else:
|
||||
program_files_folder = "C:\Program Files"
|
||||
return program_files_folder
|
||||
|
||||
def FindVS2017Folder(program_files_folder):
|
||||
try_vswhere_location = program_files_folder + "\\Microsoft Visual Studio\\Installer\\vswhere.exe"
|
||||
if os.path.exists(try_vswhere_location):
|
||||
vs_location = subprocess.check_output([try_vswhere_location,
|
||||
"-latest",
|
||||
"-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"-property", "installationPath",
|
||||
"-version", "[15.0,16.0)",
|
||||
"-prerelease"]).decode().split("\r\n")[0]
|
||||
try_folder = vs_location + "\\VC\\Auxiliary\\Build\\"
|
||||
try_vcvarsall = "VCVARSALL.BAT"
|
||||
if os.path.exists(try_folder + try_vcvarsall):
|
||||
return try_folder
|
||||
else:
|
||||
names = ("Preview", "2017")
|
||||
skus = ("Community", "Professional", "Enterprise")
|
||||
for name in names:
|
||||
for sku in skus:
|
||||
try_folder = program_files_folder + "\\Microsoft Visual Studio\\%s\\%s\\VC\\Auxiliary\\Build\\" % (name, sku)
|
||||
try_vcvarsall = "VCVARSALL.BAT"
|
||||
if os.path.exists(try_folder + try_vcvarsall):
|
||||
return try_folder
|
||||
return ""
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not os.path.exists("Build"):
|
||||
os.mkdir("Build")
|
||||
if not os.path.exists("Build/Vs2017X64"):
|
||||
os.mkdir("Build/Vs2017X64")
|
||||
os.chdir("Build/Vs2017X64")
|
||||
curdir = os.path.abspath(os.curdir)
|
||||
subprocess.call("cmake -G \"Visual Studio 15\" -T v141,host=x64 -A x64 ../../")
|
||||
subprocess.call("%sVCVARSALL.BAT amd64 & cd /d \"%s\" & MSBuild ALL_BUILD.vcxproj /nologo /m:2 /v:m /p:Configuration=Debug,Platform=x64" % (FindVS2017Folder(FindProgramFilesFolder()), curdir))
|
||||
|
||||
os.chdir("../..")
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
project(ShaderConductor)
|
||||
|
||||
set(SC_MAJOR_VERSION 0)
|
||||
set(SC_MINOR_VERSION 1)
|
||||
set(SC_PATCH_VERSION 0)
|
||||
set(SC_VERSION ${SC_MAJOR_VERSION}.${SC_MINOR_VERSION}.${SC_PATCH_VERSION})
|
||||
|
||||
set(SC_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(SC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
mark_as_advanced(SC_ROOT_DIR)
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SC_BUILD_DIR}/Bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SC_BUILD_DIR}/Lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SC_BUILD_DIR}/Lib)
|
||||
|
||||
# DirectXShaderCompiler requires it
|
||||
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
|
||||
|
||||
add_subdirectory(Source)
|
||||
add_subdirectory(External)
|
||||
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "ShaderConductorCmd")
|
|
@ -0,0 +1,41 @@
|
|||
# How to contribute
|
||||
|
||||
One of the easiest ways to contribute is to participate in discussions and discuss issues. You can also contribute by submitting pull requests with code changes.
|
||||
|
||||
## General feedback and discussions?
|
||||
Please start a discussion on the repo issue tracker.
|
||||
|
||||
## Bugs and feature requests?
|
||||
For non-security related bugs please log a new issue in the GitHub repo.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
Security issues and bugs should be reported privately, via email, to the Microsoft Security
|
||||
Response Center (MSRC) at [secure@microsoft.com](mailto:secure@microsoft.com). You should
|
||||
receive a response within 24 hours. If for some reason you do not, please follow up via
|
||||
email to ensure we received your original message. Further information, including the
|
||||
[MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in
|
||||
the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).
|
||||
|
||||
## Filing issues
|
||||
When filing issues, please use our [bug filing templates](https://github.com/aspnet/Home/wiki/Functional-bug-template).
|
||||
The best way to get your bug fixed is to be as detailed as you can be about the problem.
|
||||
Providing a minimal project with steps to reproduce the problem is ideal.
|
||||
Here are questions you can answer before you file a bug to make sure you're not missing any important information.
|
||||
|
||||
1. Did you read the documentation?
|
||||
2. Did you include the snippet of broken code in the issue?
|
||||
3. What are the *EXACT* steps to reproduce this problem?
|
||||
4. What version are you using?
|
||||
|
||||
GitHub supports [markdown](https://help.github.com/articles/github-flavored-markdown/), so when filing bugs make sure you check the formatting before clicking submit.
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
||||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
@ -0,0 +1,492 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by Microsoft Visio, SVG Export Arch.svg Page-1 -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events"
|
||||
xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="14.1406in" height="8.12533in"
|
||||
viewBox="0 0 1018.13 585.023" xml:space="preserve" color-interpolation-filters="sRGB" class="st16">
|
||||
<v:documentProperties v:langID="1033" v:viewMarkup="false"/>
|
||||
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
.st1 {visibility:visible}
|
||||
.st2 {fill:#ed7d31;fill-opacity:0.25;filter:url(#filter_2);stroke:#ed7d31;stroke-opacity:0.25}
|
||||
.st3 {fill:#d06d29;stroke:#ae5a21;stroke-width:0.75}
|
||||
.st4 {fill:#feffff;font-family:Calibri;font-size:1.5em}
|
||||
.st5 {font-size:1em}
|
||||
.st6 {fill:url(#grad0-15);stroke:#ae5a21;stroke-width:0.75}
|
||||
.st7 {marker-end:url(#mrkr4-22);stroke:#70ad47;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}
|
||||
.st8 {fill:#70ad47;fill-opacity:1;stroke:#70ad47;stroke-opacity:1;stroke-width:0.52631578947368}
|
||||
.st9 {fill:#70ad47;fill-opacity:0.25;filter:url(#filter_2);stroke:#70ad47;stroke-opacity:0.25}
|
||||
.st10 {fill:#61973d;stroke:#507e31;stroke-width:0.75}
|
||||
.st11 {fill:#5b9bd5;fill-opacity:0.25;filter:url(#filter_2);stroke:#5b9bd5;stroke-opacity:0.25}
|
||||
.st12 {fill:url(#grad0-82);stroke:#40709c;stroke-width:0.75}
|
||||
.st13 {fill:#feffff;font-family:Calibri;font-size:2.50001em}
|
||||
.st14 {fill:url(#grad0-169);stroke:#4f87bb;stroke-width:0.75}
|
||||
.st15 {fill:#4f87bb;font-family:Calibri;font-size:2.50001em}
|
||||
.st16 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
|
||||
]]>
|
||||
</style>
|
||||
|
||||
<defs id="Patterns_And_Gradients">
|
||||
<linearGradient id="grad0-15" x1="0" y1="0" x2="1" y2="0" gradientTransform="rotate(250 0.5 0.5)">
|
||||
<stop offset="0" stop-color="#d06d29" stop-opacity="1"/>
|
||||
<stop offset="0.48" stop-color="#d06d29" stop-opacity="1"/>
|
||||
<stop offset="0.82" stop-color="#ed7d31" stop-opacity="1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="grad0-82" x1="0" y1="0" x2="1" y2="0" gradientTransform="rotate(250 0.5 0.5)">
|
||||
<stop offset="0" stop-color="#4f87bb" stop-opacity="1"/>
|
||||
<stop offset="0.48" stop-color="#4f87bb" stop-opacity="1"/>
|
||||
<stop offset="0.82" stop-color="#5b9bd5" stop-opacity="1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="grad0-169" x1="0" y1="0" x2="1" y2="0" gradientTransform="rotate(60 0.5 0.5)">
|
||||
<stop offset="0" stop-color="#e9eff7" stop-opacity="1"/>
|
||||
<stop offset="0.24" stop-color="#f4f7fb" stop-opacity="1"/>
|
||||
<stop offset="0.54" stop-color="#feffff" stop-opacity="1"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<defs id="Markers">
|
||||
<g id="lend4">
|
||||
<path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"/>
|
||||
</g>
|
||||
<marker id="mrkr4-22" class="st8" v:arrowType="4" v:arrowSize="1" v:setback="3.8" refX="-3.8" orient="auto"
|
||||
markerUnits="strokeWidth" overflow="visible">
|
||||
<use xlink:href="#lend4" transform="scale(-1.9,-1.9) "/>
|
||||
</marker>
|
||||
</defs>
|
||||
<defs id="Filters">
|
||||
<filter id="filter_2">
|
||||
<feGaussianBlur stdDeviation="2"/>
|
||||
</filter>
|
||||
</defs>
|
||||
<g v:mID="0" v:index="1" v:groupContext="foregroundPage">
|
||||
<title>Page-1</title>
|
||||
<v:pageProperties v:drawingScale="1" v:pageScale="1" v:drawingUnits="0" v:shadowOffsetX="9" v:shadowOffsetY="-9"/>
|
||||
<v:layer v:name="Connector" v:index="0"/>
|
||||
<g id="shape1000-1" v:mID="1000" v:groupContext="shape" transform="translate(46.6856,-5.3478)">
|
||||
<title>Rounded Rectangle.1012</title>
|
||||
<desc>D3D 12</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1000-2" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st2"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st3"/>
|
||||
<text x="27.21" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>D3D<tspan class="st5"
|
||||
v:langID="1033"> </tspan><tspan class="st5" v:langID="1033">12</tspan></text> </g>
|
||||
<g id="shape1001-9" v:mID="1001" v:groupContext="shape" transform="translate(481.936,-5.3478)">
|
||||
<title>Rectangle.4</title>
|
||||
<desc>OpenGL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1001-10" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st2"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st6"/>
|
||||
<text x="24.64" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>OpenGL</text> </g>
|
||||
<g id="shape1002-17" v:mID="1002" v:groupContext="shape" v:layerMember="0" transform="translate(526.936,-158.266)">
|
||||
<title>Dynamic connector.6</title>
|
||||
<path d="M9 585.02 L9 685.34" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1003-23" v:mID="1003" v:groupContext="shape" transform="translate(481.936,-158.266)">
|
||||
<title>Snip Same Side Corner Rectangle.1064</title>
|
||||
<desc>GLSL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1003-24" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st9"/>
|
||||
</g>
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st10"/>
|
||||
<text x="36.62" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>GLSL</text> </g>
|
||||
<g id="shape1006-29" v:mID="1006" v:groupContext="shape" transform="translate(46.6856,-158.266)">
|
||||
<title>Rectangle.19</title>
|
||||
<desc>DXIL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1006-30" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M10.8 585.02 L97.2 585.02 A10.7998 10.7998 -180 0 0 108 574.22 L108 550.82 A10.7998 10.7998 -180 0 0 97.2
|
||||
540.02 L10.8 540.02 A10.7998 10.7998 -180 0 0 0 550.82 L0 574.22 A10.7998 10.7998 -180 0 0 10.8 585.02
|
||||
Z" class="st9"/>
|
||||
</g>
|
||||
<path d="M10.8 585.02 L97.2 585.02 A10.7998 10.7998 -180 0 0 108 574.22 L108 550.82 A10.7998 10.7998 -180 0 0 97.2 540.02
|
||||
L10.8 540.02 A10.7998 10.7998 -180 0 0 0 550.82 L0 574.22 A10.7998 10.7998 -180 0 0 10.8 585.02 Z"
|
||||
class="st10"/>
|
||||
<text x="37.74" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>DXIL</text> </g>
|
||||
<g id="shape1007-35" v:mID="1007" v:groupContext="shape" v:layerMember="0" transform="translate(91.6856,-158.266)">
|
||||
<title>Dynamic connector.11</title>
|
||||
<path d="M9 585.02 L9 685.34" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1008-40" v:mID="1008" v:groupContext="shape" transform="translate(604.561,-5.3478)">
|
||||
<title>Rectangle.38</title>
|
||||
<desc>OpenGL ES</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1008-41" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st2"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st6"/>
|
||||
<text x="14.08" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>OpenGL ES</text> </g>
|
||||
<g id="shape1009-47" v:mID="1009" v:groupContext="shape" transform="translate(604.561,-158.266)">
|
||||
<title>Rectangle.39</title>
|
||||
<desc>ESSL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1009-48" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st9"/>
|
||||
</g>
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st10"/>
|
||||
<text x="37.55" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>ESSL</text> </g>
|
||||
<g id="shape1010-53" v:mID="1010" v:groupContext="shape" v:layerMember="0" transform="translate(667.561,-158.266)">
|
||||
<title>Dynamic connector.41</title>
|
||||
<path d="M-9 585.02 L-9 685.34" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1011-58" v:mID="1011" v:groupContext="shape" transform="translate(268.748,-158.266)">
|
||||
<title>Rounded Rectangle.1018</title>
|
||||
<desc>SPIR-V</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1011-59" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M10.8 585.02 L97.2 585.02 A10.7998 10.7998 -180 0 0 108 574.22 L108 550.82 A10.7998 10.7998 -180 0 0 97.2
|
||||
540.02 L10.8 540.02 A10.7998 10.7998 -180 0 0 0 550.82 L0 574.22 A10.7998 10.7998 -180 0 0 10.8 585.02
|
||||
Z" class="st9"/>
|
||||
</g>
|
||||
<path d="M10.8 585.02 L97.2 585.02 A10.7998 10.7998 -180 0 0 108 574.22 L108 550.82 A10.7998 10.7998 -180 0 0 97.2 540.02
|
||||
L10.8 540.02 A10.7998 10.7998 -180 0 0 0 550.82 L0 574.22 A10.7998 10.7998 -180 0 0 10.8 585.02 Z"
|
||||
class="st10"/>
|
||||
<text x="30.2" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>SPIR-V</text> </g>
|
||||
<g id="shape1012-64" v:mID="1012" v:groupContext="shape" transform="translate(268.748,-5.3478)">
|
||||
<title>Rectangle.1057</title>
|
||||
<desc>Vulkan</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1012-65" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st2"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st6"/>
|
||||
<text x="28.97" y="567.92" class="st4" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>Vulkan</text> </g>
|
||||
<g id="shape1013-71" v:mID="1013" v:groupContext="shape" v:layerMember="0" transform="translate(376.748,-180.766)">
|
||||
<title>Dynamic connector.30</title>
|
||||
<path d="M0 585.02 L85.5 585.02 L85.5 286.82 L425.81 286.82 L425.81 325.3" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1014-76" v:mID="1014" v:groupContext="shape" transform="translate(109.061,-498.074)">
|
||||
<title>Snip Same Side Corner Rectangle.1067</title>
|
||||
<desc>HLSL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.28515621200204):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.28515621200204):1"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="102.656" cy="542.25" width="205.32" height="85.5469"/>
|
||||
<g id="shadow1014-77" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M0 585.02 L205.31 585.02 L205.31 520.01 L184.78 499.48 L20.53 499.48 L0 520.01 L0 585.02 Z" class="st11"/>
|
||||
</g>
|
||||
<path d="M0 585.02 L205.31 585.02 L205.31 520.01 L184.78 499.48 L20.53 499.48 L0 520.01 L0 585.02 Z" class="st12"/>
|
||||
<text x="73.81" y="551.25" class="st13" v:langID="2052"><v:paragraph v:horizAlign="1"/><v:tabList/>HLSL</text> </g>
|
||||
<g id="shape1015-84" v:mID="1015" v:groupContext="shape" v:layerMember="0" transform="translate(202.717,-498.074)">
|
||||
<title>Dynamic connector</title>
|
||||
<path d="M9 585.02 L9 642.61" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1017-89" v:mID="1017" v:groupContext="shape" v:layerMember="0" transform="translate(658.561,-312.834)">
|
||||
<title>Dynamic connector.1001</title>
|
||||
<path d="M0 585.02 L0 636.01 L-122.63 636.01 L-122.63 686.99" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1019-94" v:mID="1019" v:groupContext="shape" v:layerMember="0" transform="translate(313.748,-158.266)">
|
||||
<title>Dynamic connector.1027</title>
|
||||
<path d="M9 585.02 L9 685.34" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1021-99" v:mID="1021" v:groupContext="shape" v:layerMember="0" transform="translate(91.6856,-312.834)">
|
||||
<title>Dynamic connector.1029</title>
|
||||
<path d="M9 585.02 L9 686.99" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1023-104" v:mID="1023" v:groupContext="shape" v:layerMember="0" transform="translate(313.748,-312.834)">
|
||||
<title>Dynamic connector.1023</title>
|
||||
<path d="M9 585.02 L9 686.99" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1024-109" v:mID="1024" v:groupContext="shape" v:layerMember="0" transform="translate(649.561,-312.834)">
|
||||
<title>Dynamic connector.1024</title>
|
||||
<path d="M9 585.02 L9 686.99" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1035-114" v:mID="1035" v:groupContext="shape" transform="translate(748.561,-5.3478)">
|
||||
<title>Rectangle.1060</title>
|
||||
<desc>Metal</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1035-115" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st2"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st6"/>
|
||||
<text x="32.44" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>Metal</text> </g>
|
||||
<g id="shape1050-121" v:mID="1050" v:groupContext="shape" transform="translate(748.561,-158.266)">
|
||||
<title>Snip Same Side Corner Rectangle.1050</title>
|
||||
<desc>MSL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1050-122" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st9"/>
|
||||
</g>
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st10"/>
|
||||
<text x="38.39" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>MSL</text> </g>
|
||||
<g id="shape1040-127" v:mID="1040" v:groupContext="shape" v:layerMember="0" transform="translate(811.561,-158.266)">
|
||||
<title>Dynamic connector.1040</title>
|
||||
<path d="M-9 585.02 L-9 685.34" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1044-132" v:mID="1044" v:groupContext="shape" v:layerMember="0" transform="translate(793.561,-312.834)">
|
||||
<title>Dynamic connector.1053</title>
|
||||
<path d="M9 585.02 L9 686.99" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1049-137" v:mID="1049" v:groupContext="shape" v:layerMember="0" transform="translate(376.748,-180.766)">
|
||||
<title>Dynamic connector.1069</title>
|
||||
<path d="M0 585.02 L85.5 585.02 L85.5 737.94 L97.59 737.94" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1054-142" v:mID="1054" v:groupContext="shape" transform="translate(895.717,-5.3478)">
|
||||
<title>Rectangle.1054</title>
|
||||
<desc>D3D 9/10/11</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1054-143" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st2"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="108" height="45" class="st6"/>
|
||||
<text x="6.57" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>D3D 9/10/11</text> </g>
|
||||
<g id="shape1055-149" v:mID="1055" v:groupContext="shape" transform="translate(895.717,-158.266)">
|
||||
<title>Snip Same Side Corner Rectangle.1055</title>
|
||||
<desc>HLSL</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="CTypeTopLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockHoriz" v:prompt="" v:val="VT0(1):5"/>
|
||||
<v:ud v:nameU="CornerLockVert" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="CornerLockDiag" v:prompt="" v:val="VT0(0):5"/>
|
||||
<v:ud v:nameU="TopLeftOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="TopRightOffset" v:prompt="" v:val="VT0(0.15):1"/>
|
||||
<v:ud v:nameU="BotLeftOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="BotRightOffset" v:prompt="" v:val="VT0(0):1"/>
|
||||
<v:ud v:nameU="visVersion" v:prompt="" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="54" cy="562.523" width="108" height="45"/>
|
||||
<g id="shadow1055-150" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279" v:shadowType="1"
|
||||
transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st9"/>
|
||||
</g>
|
||||
<path d="M0 585.02 L108 585.02 L108 550.82 L97.2 540.02 L10.8 540.02 L0 550.82 L0 585.02 Z" class="st10"/>
|
||||
<text x="36.69" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>HLSL</text> </g>
|
||||
<g id="shape1056-155" v:mID="1056" v:groupContext="shape" v:layerMember="0" transform="translate(940.717,-158.266)">
|
||||
<title>Dynamic connector.1056</title>
|
||||
<path d="M9 585.02 L9 685.34" class="st7"/>
|
||||
</g>
|
||||
<g id="shape1057-160" v:mID="1057" v:groupContext="shape" v:layerMember="0" transform="translate(958.717,-312.834)">
|
||||
<title>Dynamic connector.1057</title>
|
||||
<path d="M-9 585.02 L-9 686.99" class="st7"/>
|
||||
</g>
|
||||
<g id="group1060-165" transform="translate(3.0294,-312.834)" v:mID="1060" v:groupContext="group">
|
||||
<title>Sheet.1060</title>
|
||||
<g id="shape1005-166" v:mID="1005" v:groupContext="shape">
|
||||
<title>Rectangle.17</title>
|
||||
<desc>DirectXShaderCompiler</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="208.688" cy="524.996" width="417.38" height="120.054"/>
|
||||
<rect x="0" y="464.969" width="417.375" height="120.054" class="st14"/>
|
||||
<text x="66.29" y="516" class="st15" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>DirectXShaderCompiler<v:newlineChar/></text> </g>
|
||||
<g id="shape1020-171" v:mID="1020" v:groupContext="shape">
|
||||
<title>Rectangle.1020</title>
|
||||
<desc>DXIL CodeGen</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="97.6562" cy="562.523" width="195.32" height="45"/>
|
||||
<g id="shadow1020-172" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279"
|
||||
v:shadowType="1" transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="195.312" height="45" class="st11"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="195.312" height="45" class="st12"/>
|
||||
<text x="45.73" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>DXIL CodeGen</text> </g>
|
||||
<g id="shape1022-178" v:mID="1022" v:groupContext="shape" transform="translate(222.063,0)">
|
||||
<title>Rectangle.1030</title>
|
||||
<desc>SPIR-V CodeGen</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="97.6562" cy="562.523" width="195.32" height="45"/>
|
||||
<g id="shadow1022-179" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279"
|
||||
v:shadowType="1" transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="195.312" height="45" class="st11"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="195.312" height="45" class="st12"/>
|
||||
<text x="38.19" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>SPIR-V CodeGen</text> </g>
|
||||
</g>
|
||||
<g id="group1061-185" transform="translate(593.873,-312.834)" v:mID="1061" v:groupContext="group">
|
||||
<title>Sheet.1061</title>
|
||||
<g id="shape1016-186" v:mID="1016" v:groupContext="shape">
|
||||
<title>Rectangle.1000</title>
|
||||
<desc>SPIRV-Cross</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="208.688" cy="524.996" width="417.38" height="120.054"/>
|
||||
<rect x="0" y="464.969" width="417.375" height="120.054" class="st14"/>
|
||||
<text x="136.15" y="516" class="st15" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>SPIRV-Cross<v:newlineChar/></text> </g>
|
||||
<g id="shape1051-190" v:mID="1051" v:groupContext="shape" transform="translate(-1.27898E-13,-5.70774E-06)">
|
||||
<title>Rectangle.1051</title>
|
||||
<desc>GLSL Compiler</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="64.6875" cy="562.523" width="129.38" height="45"/>
|
||||
<g id="shadow1051-191" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279"
|
||||
v:shadowType="1" transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="129.375" height="45" class="st11"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="129.375" height="45" class="st12"/>
|
||||
<text x="12.06" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>GLSL Compiler</text> </g>
|
||||
<g id="shape1052-197" v:mID="1052" v:groupContext="shape" transform="translate(147.156,-5.70774E-06)">
|
||||
<title>Rectangle.1052</title>
|
||||
<desc>MSL Compiler</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="64.6875" cy="562.523" width="129.38" height="45"/>
|
||||
<g id="shadow1052-198" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279"
|
||||
v:shadowType="1" transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="129.375" height="45" class="st11"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="129.375" height="45" class="st12"/>
|
||||
<text x="13.83" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>MSL Compiler</text> </g>
|
||||
<g id="shape1053-204" v:mID="1053" v:groupContext="shape" transform="translate(291.156,-5.70774E-06)">
|
||||
<title>Rectangle.1053</title>
|
||||
<desc>HLSL Compiler</desc>
|
||||
<v:userDefs>
|
||||
<v:ud v:nameU="visVersion" v:val="VT0(15):26"/>
|
||||
</v:userDefs>
|
||||
<v:textBlock v:margins="rect(4,4,4,4)"/>
|
||||
<v:textRect cx="64.6875" cy="562.523" width="129.38" height="45"/>
|
||||
<g id="shadow1053-205" v:groupContext="shadow" v:shadowOffsetX="0.345598" v:shadowOffsetY="-1.97279"
|
||||
v:shadowType="1" transform="matrix(1,0,0,1,0.345598,1.97279)" class="st1">
|
||||
<rect x="0" y="540.023" width="129.375" height="45" class="st11"/>
|
||||
</g>
|
||||
<rect x="0" y="540.023" width="129.375" height="45" class="st12"/>
|
||||
<text x="12.13" y="567.92" class="st4" v:langID="1033"><v:paragraph v:horizAlign="1"/><v:tabList/>HLSL Compiler</text> </g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 29 KiB |
|
@ -0,0 +1,195 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
set(cxxopts_REV "3f2d70530219e09fe7e563f86126b0d3b228a60d")
|
||||
set(googletest_REV "440527a61e1c91188195f7de212c63c77e8f0a45")
|
||||
set(DirectXShaderCompiler_REV "362defac9072f9bfd81fdfeb4dc8db9226f38d5f")
|
||||
set(SPIRV_Cross_REV "cc5c0204d8bcdadbb4add03e53346df98bf27fa4")
|
||||
|
||||
function(UpdateExternalLib name url rev submodules)
|
||||
set(need_checkout FALSE)
|
||||
set(need_submodule_init FALSE)
|
||||
set(external_folder "${SC_ROOT_DIR}/External")
|
||||
set(external_lib_folder "${external_folder}/${name}")
|
||||
if(EXISTS ${external_lib_folder})
|
||||
message(STATUS "Updating ${name} to revision ${rev}...")
|
||||
execute_process(COMMAND "git" "fetch" "origin" WORKING_DIRECTORY "${external_lib_folder}")
|
||||
execute_process(COMMAND "git" "rev-parse" "HEAD" WORKING_DIRECTORY "${external_lib_folder}" OUTPUT_VARIABLE head_rev)
|
||||
string(STRIP ${head_rev} head_rev)
|
||||
if (${head_rev} STREQUAL ${rev})
|
||||
set(need_checkout FALSE)
|
||||
else()
|
||||
set(need_checkout TRUE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Cloning ${name} revision...")
|
||||
execute_process(COMMAND "git" "clone" ${url} "-n" WORKING_DIRECTORY "${external_folder}")
|
||||
set(need_checkout TRUE)
|
||||
if(submodules)
|
||||
set(need_submodule_init TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(need_checkout)
|
||||
message(STATUS "Checking out to revision ${rev}...")
|
||||
execute_process(COMMAND "git" "checkout" "-q" ${rev} WORKING_DIRECTORY "${external_lib_folder}")
|
||||
if(submodules)
|
||||
if(need_submodule_init)
|
||||
message(STATUS "Initializing submodules...")
|
||||
set(init_param "--init")
|
||||
else()
|
||||
message(STATUS "Updating submodules...")
|
||||
set(init_param "")
|
||||
endif()
|
||||
execute_process(COMMAND "git" "submodule" "update" ${init_param} WORKING_DIRECTORY "${external_lib_folder}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
UpdateExternalLib("cxxopts" "git://github.com/jarro2783/cxxopts.git" ${cxxopts_REV} FALSE)
|
||||
UpdateExternalLib("googletest" "git://github.com/google/googletest" ${googletest_REV} FALSE)
|
||||
UpdateExternalLib("DirectXShaderCompiler" "git://github.com/Microsoft/DirectXShaderCompiler.git" ${DirectXShaderCompiler_REV} TRUE)
|
||||
UpdateExternalLib("SPIRV-Cross" "git://github.com/KhronosGroup/SPIRV-Cross.git" ${SPIRV_Cross_REV} FALSE)
|
||||
|
||||
set(ENABLE_SPIRV_CODEGEN ON CACHE BOOL "" FORCE)
|
||||
set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "" FORCE)
|
||||
set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "" FORCE)
|
||||
set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(HLSL_INCLUDE_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(LLVM_TARGETS_TO_BUILD "None" CACHE STRING "" FORCE)
|
||||
set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(LIBCLANG_BUILD_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(LLVM_OPTIMIZED_TABLEGEN OFF CACHE BOOL "" FORCE)
|
||||
set(LLVM_REQUIRES_EH ON CACHE BOOL "" FORCE)
|
||||
set(LLVM_APPEND_VC_REV ON CACHE BOOL "" FORCE)
|
||||
set(LLVM_ENABLE_RTTI ON CACHE BOOL "" FORCE)
|
||||
set(LLVM_ENABLE_EH ON CACHE BOOL "" FORCE)
|
||||
set(LLVM_DEFAULT_TARGET_TRIPLE "dxil-ms-dx" CACHE STRING "" FORCE)
|
||||
set(CLANG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(LLVM_REQUIRES_RTTI ON CACHE BOOL "" FORCE)
|
||||
set(CLANG_CL OFF CACHE BOOL "" FORCE)
|
||||
set(DXC_BUILD_ARCH "x64" CACHE STRING "" FORCE) # TODO: Support more architectures
|
||||
set(SPIRV_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE)
|
||||
set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(DirectXShaderCompiler EXCLUDE_FROM_ALL)
|
||||
set(dxc_folder "External/DirectXShaderCompiler")
|
||||
set_target_properties("clang" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dndxc" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dxa" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dxc" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dxl" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dxopt" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dxr" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("dxv" PROPERTIES FOLDER "${dxc_folder}/Clang executables")
|
||||
set_target_properties("clangAnalysis" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangAST" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangASTMatchers" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangBasic" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangCodeGen" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangDriver" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangEdit" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangFormat" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangFrontend" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangFrontendTool" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangIndex" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangLex" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangParse" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangRewrite" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangRewriteFrontend" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangSema" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangSPIRV" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangTooling" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("clangToolingCore" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("d3dcompiler_dxc_bridge" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("dxcompiler" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("dxlib_sample" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("dxrfallbackcompiler" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("libclang" PROPERTIES FOLDER "${dxc_folder}/Clang libraries")
|
||||
set_target_properties("ClangAttrClasses" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrDump" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrHasAttributeImpl" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrImpl" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrList" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrParsedAttrImpl" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrParsedAttrKinds" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrParsedAttrList" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrParserStringSwitches" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrPCHRead" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrPCHWrite" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrSpellingListIndex" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrTemplateInstantiate" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangAttrVisitor" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangCommentCommandInfo" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangCommentCommandList" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangCommentHTMLNamedCharacterReferences" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangCommentHTMLTags" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangCommentHTMLTagsProperties" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangCommentNodes" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDeclNodes" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticAnalysis" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticAST" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticComment" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticCommon" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticDriver" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticFrontend" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticGroups" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticIndexName" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticLex" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticParse" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticSema" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangDiagnosticSerialization" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("ClangStmtNodes" PROPERTIES FOLDER "${dxc_folder}/Clang tablegenning")
|
||||
set_target_properties("SPIRV-Tools" PROPERTIES FOLDER "${dxc_folder}/External dependencies")
|
||||
set_target_properties("SPIRV-Tools-opt" PROPERTIES FOLDER "${dxc_folder}/External dependencies")
|
||||
set_target_properties("LLVMAnalysis" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMAsmParser" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMBitReader" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMBitWriter" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMCore" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMDxcSupport" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMDxrFallback" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMHLSL" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMInstCombine" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMipa" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMipo" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMIRReader" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMLinker" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMLTO" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMMSSupport" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMOption" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMProfileData" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMScalarOpts" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMSupport" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMTableGen" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMTarget" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMTransformUtils" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("LLVMVectorize" PROPERTIES FOLDER "${dxc_folder}/Libraries")
|
||||
set_target_properties("ClangDriverOptions" PROPERTIES FOLDER "${dxc_folder}/Tablegenning")
|
||||
set_target_properties("DxcEtw" PROPERTIES FOLDER "${dxc_folder}/Tablegenning")
|
||||
set_target_properties("intrinsics_gen" PROPERTIES FOLDER "${dxc_folder}/Tablegenning")
|
||||
set_target_properties("TablegenHLSLOptions" PROPERTIES FOLDER "${dxc_folder}/Tablegenning")
|
||||
set_target_properties("dxexp" PROPERTIES FOLDER "${dxc_folder}/Tools")
|
||||
set_target_properties("clang-tblgen" PROPERTIES FOLDER "${dxc_folder}/Utils")
|
||||
set_target_properties("GIT_COMMIT_INFO_ALWAYS_REBUILD" PROPERTIES FOLDER "${dxc_folder}/Utils")
|
||||
set_target_properties("llvm-tblgen" PROPERTIES FOLDER "${dxc_folder}/Utils")
|
||||
|
||||
add_subdirectory(SPIRV-Cross EXCLUDE_FROM_ALL)
|
||||
set(spirv_cross_folder "External/SPIRV-Cross")
|
||||
set_target_properties("spirv-cross" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-core" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-cpp" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-glsl" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-hlsl" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-msl" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-reflect" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
set_target_properties("spirv-cross-util" PROPERTIES FOLDER ${spirv_cross_folder})
|
||||
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(googletest EXCLUDE_FROM_ALL)
|
||||
set(googletest_folder "External/googletest")
|
||||
set_target_properties("gtest" PROPERTIES FOLDER ${googletest_folder})
|
||||
set_target_properties("gtest_main" PROPERTIES FOLDER ${googletest_folder})
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* ShaderConductor
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
* to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SHADER_CONDUCTOR_HPP
|
||||
#define SHADER_CONDUCTOR_HPP
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#if defined(__clang__)
|
||||
#define SC_SYMBOL_EXPORT __attribute__((__visibility__("default")))
|
||||
#define SC_SYMBOL_IMPORT
|
||||
#elif defined(__GNUC__)
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
#define SC_SYMBOL_EXPORT __attribute__((__dllexport__))
|
||||
#define SC_SYMBOL_IMPORT __attribute__((__dllimport__))
|
||||
#else
|
||||
#define SC_SYMBOL_EXPORT __attribute__((__visibility__("default")))
|
||||
#define SC_SYMBOL_IMPORT
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#define SC_SYMBOL_EXPORT __declspec(dllexport)
|
||||
#define SC_SYMBOL_IMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef SHADER_CONDUCTOR_SOURCE
|
||||
#define SC_API SC_SYMBOL_EXPORT
|
||||
#else
|
||||
#define SC_API SC_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
namespace ShaderConductor
|
||||
{
|
||||
enum class ShaderStage : uint32_t
|
||||
{
|
||||
VertexShader,
|
||||
PixelShader,
|
||||
GeometryShader,
|
||||
HullShader,
|
||||
DomainShader,
|
||||
ComputeShader,
|
||||
|
||||
NumShaderStages,
|
||||
};
|
||||
|
||||
enum class ShadingLanguage : uint32_t
|
||||
{
|
||||
Dxil = 0,
|
||||
SpirV,
|
||||
|
||||
Hlsl,
|
||||
Glsl,
|
||||
Essl,
|
||||
Msl,
|
||||
|
||||
NumShadingLanguages,
|
||||
};
|
||||
|
||||
struct MacroDefine
|
||||
{
|
||||
std::string name;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
class SC_API Compiler
|
||||
{
|
||||
public:
|
||||
struct SourceDesc
|
||||
{
|
||||
std::string source;
|
||||
std::string fileName;
|
||||
std::string entryPoint = "main";
|
||||
ShaderStage stage;
|
||||
std::vector<MacroDefine> defines;
|
||||
std::function<std::string(const std::string& includeName)> loadIncludeCallback;
|
||||
};
|
||||
|
||||
struct TargetDesc
|
||||
{
|
||||
ShadingLanguage language;
|
||||
std::string version;
|
||||
};
|
||||
|
||||
struct ResultDesc
|
||||
{
|
||||
std::vector<uint8_t> target;
|
||||
bool isText;
|
||||
|
||||
std::string errorWarningMsg;
|
||||
bool hasError;
|
||||
};
|
||||
|
||||
public:
|
||||
static ResultDesc Compile(SourceDesc source, TargetDesc target);
|
||||
};
|
||||
} // namespace ShaderConductor
|
||||
|
||||
#endif // SHADER_CONDUCTOR_HPP
|
58
README.md
58
README.md
|
@ -1,13 +1,57 @@
|
|||
# ShaderConductor
|
||||
|
||||
# Contributing
|
||||
ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages.
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||
## Features
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
||||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||
* Converts HLSL to readable, usable and efficient GLSL
|
||||
* Converts HLSL to readable, usable and efficient ESSL
|
||||
* Converts HLSL to readable, usable and efficient Metal Shading Language (MSL)
|
||||
* Converts HLSL to readable, usable and efficient old shader model HLSL
|
||||
* Supports all stages of shaders, vertex, pixel, hull, domain, geometry, and compute.
|
||||
|
||||
Note that this project is still in an early stage, and it is under active development.
|
||||
|
||||
## Architecture
|
||||
|
||||
ShaderConductor is not a real compiler. Instead, it glues existing open source components to do the cross-compiling.
|
||||
1. [DirectX Shader Compiler](https://github.com/Microsoft/DirectXShaderCompiler) to compile HLSL to [DXIL](https://github.com/Microsoft/DirectXShaderCompiler/blob/master/docs/DXIL.rst) or [SPIR-V](https://www.khronos.org/registry/spir-v/),
|
||||
1. [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross) to convert SPIR-V to target shading languages.
|
||||
|
||||
![Architecture](Doc/Arch.svg)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* [Git](http://git-scm.com/downloads).
|
||||
* [Visual Studio 2017](https://www.visualstudio.com/downloads). Select the following workloads: Universal Windows Platform Development and Desktop Development with C++.
|
||||
* [CMake](https://www.cmake.org/download/). Version 3.9 or up. It's highly recommended to choose "Add CMake to the system PATH for all users" during installation.
|
||||
* [Python](https://www.python.org/downloads/). Version 2.7 or up. You need not change your PATH variable during installation.
|
||||
* (Optional) [Windows Driver Kit](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk). DirectXShaderCompiler's tests are built using the TAEF framework. Unless you have the Windows Driver Kit installed, you should run the script at `External\DirectXShaderCompiler\utils\hct\hctgettaef.py` from your build environment before you start building to download and unzip it as an external dependency. You should only need to do this once.
|
||||
|
||||
## Building
|
||||
|
||||
ShaderConductor has been tested on Windows. Linux and macOS support are coming soon.
|
||||
|
||||
### The script way:
|
||||
|
||||
Run BuildAll.py. It automatically grabs external dependencies to External folder, generates VS2017 solution file in Build/Vs2017X64, and builds in Debug x64 configuration.
|
||||
|
||||
### The manual way:
|
||||
|
||||
```
|
||||
mkdir Build
|
||||
cd Build
|
||||
cmake -G "Visual Studio 15" -T v141,host=x64 -A x64 ../
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
After building, the output file ShaderConductor.dll can be located in \<YourCMakeTargetFolder\>/Bin/\<Configuration\>/. It depends on dxcompiler.dll in the same folder.
|
||||
|
||||
## License
|
||||
|
||||
ShaderConductor is distributed under the terms of MIT License. See [LICENSE](LICENSE) for details.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
set(CMAKE_CXX_FLAGS "/W4 /WX /EHsc /MP /bigobj /Zc:throwingNew /Zc:strictStrings /Zc:rvalueCast /Gw /std:c++14 /permissive-")
|
||||
if(MSVC_VERSION GREATER 1912)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:externConstexpr")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /fp:fast /Ob2 /GL /Qpar")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /fp:fast /Ob2 /GL /Qpar")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /fp:fast /Ob1 /GL /Qpar")
|
||||
foreach(flag_var
|
||||
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL)
|
||||
set(${flag_var} "${${flag_var}} /GS-")
|
||||
endforeach()
|
||||
|
||||
foreach(flag_var
|
||||
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS)
|
||||
set(${flag_var} "/pdbcompress")
|
||||
endforeach()
|
||||
foreach(flag_var
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG CMAKE_SHARED_LINKER_FLAGS_DEBUG)
|
||||
set(${flag_var} "/DEBUG:FASTLINK")
|
||||
endforeach()
|
||||
foreach(flag_var
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
|
||||
set(${flag_var} "/DEBUG:FASTLINK /INCREMENTAL:NO /LTCG:incremental /OPT:REF /OPT:ICF")
|
||||
endforeach()
|
||||
foreach(flag_var
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELEASE CMAKE_SHARED_LINKER_FLAGS_RELEASE)
|
||||
set(${flag_var} "/INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF")
|
||||
endforeach()
|
||||
foreach(flag_var
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL)
|
||||
set(${flag_var} "/INCREMENTAL:NO /LTCG")
|
||||
endforeach()
|
||||
foreach(flag_var
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL)
|
||||
set(${flag_var} "${${flag_var}} /LTCG")
|
||||
endforeach()
|
||||
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG:incremental")
|
||||
|
||||
add_definitions(-DWIN32 -D_WINDOWS)
|
||||
else()
|
||||
# TODO: Supports other compilers
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})
|
||||
|
||||
# Required by DirectXShaderCompiler
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
set(${flag_var} "${${flag_var}} /UNDEBUG")
|
||||
endforeach()
|
||||
add_definitions(-DDBG -DSUPPORT_QUERY_GIT_COMMIT_INFO -DENABLE_SPIRV_CODEGEN
|
||||
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
|
||||
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
|
||||
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
|
||||
-D_GNU_SOURCE)
|
||||
|
||||
add_subdirectory(Core)
|
||||
add_subdirectory(Tests)
|
||||
add_subdirectory(Tools)
|
|
@ -0,0 +1,60 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
set(LIB_NAME ShaderConductor)
|
||||
|
||||
set(SOURCE_FILES
|
||||
${SC_ROOT_DIR}/Source/Core/ShaderConductor.cpp
|
||||
)
|
||||
|
||||
set(HEADER_FILES
|
||||
${SC_ROOT_DIR}/Include/ShaderConductor/ShaderConductor.hpp
|
||||
)
|
||||
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
add_definitions(-DSHADER_CONDUCTOR_SOURCE)
|
||||
|
||||
include_directories(
|
||||
${SC_ROOT_DIR}/Include
|
||||
${SC_BUILD_DIR}/External/DirectXShaderCompiler/include
|
||||
${SC_ROOT_DIR}/External/DirectXShaderCompiler/include
|
||||
${SC_ROOT_DIR}/External/SPIRV-Cross
|
||||
)
|
||||
link_directories(
|
||||
${SC_BUILD_DIR}/External/DirectXShaderCompiler/${CMAKE_CFG_INTDIR}/lib
|
||||
${SC_BUILD_DIR}/External/DirectXShaderCompiler/lib/${CMAKE_CFG_INTDIR}
|
||||
)
|
||||
|
||||
add_library(${LIB_NAME} "SHARED"
|
||||
${SOURCE_FILES} ${HEADER_FILES}
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_NAME}
|
||||
LLVMDxcSupport LLVMHLSL LLVMOption LLVMSupport dxcompiler SPIRV-Tools LLVMDxcSupport LLVMBitReader
|
||||
LLVMipa LLVMAnalysis LLVMCore LLVMSupport
|
||||
spirv-cross-core spirv-cross-glsl spirv-cross-hlsl spirv-cross-msl
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(dxcompiler_name "dxcompiler.dll")
|
||||
else()
|
||||
set(dxcompiler_name "dxcompiler.so")
|
||||
endif()
|
||||
|
||||
set(dxcompiler_output "${SC_BUILD_DIR}/Bin/${CMAKE_CFG_INTDIR}/${dxcompiler_name}")
|
||||
add_custom_command(OUTPUT ${dxcompiler_output}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${SC_BUILD_DIR}/External/DirectXShaderCompiler/${CMAKE_CFG_INTDIR}/bin/${dxcompiler_name}
|
||||
${SC_BUILD_DIR}/Bin/${CMAKE_CFG_INTDIR}/${dxcompiler_name}
|
||||
COMMENT "Copying dxcompiler...")
|
||||
add_custom_target(CopyDxcompiler DEPENDS ${dxcompiler_output})
|
||||
add_dependencies(CopyDxcompiler dxcompiler)
|
||||
|
||||
set_target_properties(CopyDxcompiler PROPERTIES FOLDER "Core")
|
||||
|
||||
add_dependencies(${LIB_NAME} spirv-cross-core spirv-cross-glsl spirv-cross-hlsl spirv-cross-msl)
|
||||
add_dependencies(${LIB_NAME} CopyDxcompiler)
|
||||
|
||||
set_target_properties(${LIB_NAME} PROPERTIES FOLDER "Core")
|
|
@ -0,0 +1,620 @@
|
|||
/*
|
||||
* ShaderConductor
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
* to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <ShaderConductor/ShaderConductor.hpp>
|
||||
|
||||
#include <dxc/Support/Global.h>
|
||||
#include <dxc/Support/Unicode.h>
|
||||
#include <dxc/Support/WinIncludes.h>
|
||||
|
||||
#include <wrl.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
|
||||
#include <dxc/dxcapi.h>
|
||||
#include <llvm/Support/ErrorHandling.h>
|
||||
|
||||
#include <spirv.hpp>
|
||||
#include <spirv_cross.hpp>
|
||||
#include <spirv_glsl.hpp>
|
||||
#include <spirv_hlsl.hpp>
|
||||
#include <spirv_msl.hpp>
|
||||
|
||||
#define SC_UNUSED(x) (void)(x);
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace ShaderConductor;
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifndef _WIN32
|
||||
using HMODULE = void*;
|
||||
#endif
|
||||
|
||||
extern "C" const GUID DECLSPEC_SELECTANY IID_IDxcCompiler = {
|
||||
0x8c210bf3, 0x011f, 0x4422, { 0x8d, 0x70, 0x6f, 0x9a, 0xcb, 0x8d, 0xb6, 0x17 }
|
||||
};
|
||||
extern "C" const GUID DECLSPEC_SELECTANY IID_IDxcIncludeHandler = {
|
||||
0x7f61fc7d, 0x950d, 0x467f, { 0xb3, 0xe3, 0x3c, 0x02, 0xfb, 0x49, 0x18, 0x7c }
|
||||
};
|
||||
extern "C" const GUID DECLSPEC_SELECTANY IID_IDxcLibrary = {
|
||||
0xe5204dc7, 0xd18c, 0x4c3c, { 0xbd, 0xfb, 0x85, 0x16, 0x73, 0x98, 0x0f, 0xe7 }
|
||||
};
|
||||
|
||||
bool dllDetaching = false;
|
||||
|
||||
class Dxcompiler
|
||||
{
|
||||
public:
|
||||
~Dxcompiler()
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
|
||||
static Dxcompiler& Instance()
|
||||
{
|
||||
static Dxcompiler instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
IDxcLibrary* Library() const
|
||||
{
|
||||
return m_library.Get();
|
||||
}
|
||||
|
||||
IDxcCompiler* Compiler() const
|
||||
{
|
||||
return m_compiler.Get();
|
||||
}
|
||||
|
||||
void Destroy()
|
||||
{
|
||||
if (m_dxcompilerDll)
|
||||
{
|
||||
m_compiler.Reset();
|
||||
m_library.Reset();
|
||||
|
||||
m_createInstanceFunc = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
::FreeLibrary(m_dxcompilerDll);
|
||||
#else
|
||||
::dlclose(m_dxcompilerDll);
|
||||
#endif
|
||||
|
||||
m_dxcompilerDll = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Terminate()
|
||||
{
|
||||
if (m_dxcompilerDll)
|
||||
{
|
||||
m_compiler.Detach();
|
||||
m_library.Detach();
|
||||
|
||||
m_createInstanceFunc = nullptr;
|
||||
|
||||
m_dxcompilerDll = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Dxcompiler()
|
||||
{
|
||||
if (dllDetaching)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const char* dllName = "dxcompiler.dll";
|
||||
const char* functionName = "DxcCreateInstance";
|
||||
|
||||
#ifdef _WIN32
|
||||
m_dxcompilerDll = ::LoadLibraryA(dllName);
|
||||
#else
|
||||
m_dxcompilerDll = ::dlopen(dllName, RTLD_LAZY);
|
||||
#endif
|
||||
|
||||
if (m_dxcompilerDll != nullptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_createInstanceFunc = (DxcCreateInstanceProc)::GetProcAddress(m_dxcompilerDll, functionName);
|
||||
#else
|
||||
m_createInstanceFunc = (DxcCreateInstanceProc)::dlsym(m_dxcompilerDll, functionName);
|
||||
#endif
|
||||
|
||||
if (m_createInstanceFunc != nullptr)
|
||||
{
|
||||
IFT(m_createInstanceFunc(CLSID_DxcLibrary, IID_IDxcLibrary, reinterpret_cast<void**>(m_library.GetAddressOf())));
|
||||
IFT(m_createInstanceFunc(CLSID_DxcCompiler, IID_IDxcCompiler, reinterpret_cast<void**>(m_compiler.GetAddressOf())));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->Destroy();
|
||||
|
||||
throw std::runtime_error(std::string("COULDN'T get ") + functionName + " from dxcompiler.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("COULDN'T load dxcompiler.");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
HMODULE m_dxcompilerDll = nullptr;
|
||||
DxcCreateInstanceProc m_createInstanceFunc = nullptr;
|
||||
|
||||
ComPtr<IDxcLibrary> m_library;
|
||||
ComPtr<IDxcCompiler> m_compiler;
|
||||
};
|
||||
|
||||
class ScIncludeHandler : public IDxcIncludeHandler
|
||||
{
|
||||
public:
|
||||
explicit ScIncludeHandler(std::function<std::string(const std::string& includeName)> loadCallback)
|
||||
: m_loadCallback(std::move(loadCallback))
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE LoadSource(LPCWSTR fileName, IDxcBlob** includeSource) override
|
||||
{
|
||||
if ((fileName[0] == L'.') && (fileName[1] == L'/'))
|
||||
{
|
||||
fileName += 2;
|
||||
}
|
||||
|
||||
std::string utf8FileName;
|
||||
if (!Unicode::UTF16ToUTF8String(fileName, &utf8FileName))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
std::string source = m_loadCallback(utf8FileName);
|
||||
if (source.empty())
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*includeSource = nullptr;
|
||||
return Dxcompiler::Instance().Library()->CreateBlobWithEncodingOnHeapCopy(
|
||||
source.data(), static_cast<UINT32>(source.size()), CP_UTF8, reinterpret_cast<IDxcBlobEncoding**>(includeSource));
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef() override
|
||||
{
|
||||
++m_ref;
|
||||
return m_ref;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release() override
|
||||
{
|
||||
--m_ref;
|
||||
ULONG result = m_ref;
|
||||
if (result == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** object) override
|
||||
{
|
||||
if (IsEqualIID(iid, IID_IDxcIncludeHandler))
|
||||
{
|
||||
*object = dynamic_cast<IDxcIncludeHandler*>(this);
|
||||
this->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualIID(iid, IID_IUnknown))
|
||||
{
|
||||
*object = dynamic_cast<IUnknown*>(this);
|
||||
this->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::function<std::string(const std::string& includeName)> m_loadCallback;
|
||||
|
||||
std::atomic<ULONG> m_ref = 0;
|
||||
};
|
||||
|
||||
std::string DefaultLoadCallback(const std::string& includeName)
|
||||
{
|
||||
std::vector<char> ret;
|
||||
std::ifstream includeFile(includeName, std::ios_base::in);
|
||||
includeFile.seekg(0, std::ios::end);
|
||||
ret.resize(includeFile.tellg());
|
||||
includeFile.seekg(0, std::ios::beg);
|
||||
includeFile.read(ret.data(), ret.size());
|
||||
return std::string(ret.data());
|
||||
}
|
||||
|
||||
Compiler::ResultDesc CompileToBinary(const Compiler::SourceDesc& source, ShadingLanguage targetLanguage)
|
||||
{
|
||||
assert((targetLanguage == ShadingLanguage::Dxil) || (targetLanguage == ShadingLanguage::SpirV));
|
||||
|
||||
std::wstring shaderProfile;
|
||||
switch (source.stage)
|
||||
{
|
||||
case ShaderStage::VertexShader:
|
||||
shaderProfile = L"vs";
|
||||
break;
|
||||
|
||||
case ShaderStage::PixelShader:
|
||||
shaderProfile = L"ps";
|
||||
break;
|
||||
|
||||
case ShaderStage::GeometryShader:
|
||||
shaderProfile = L"gs";
|
||||
break;
|
||||
|
||||
case ShaderStage::HullShader:
|
||||
shaderProfile = L"hs";
|
||||
break;
|
||||
|
||||
case ShaderStage::DomainShader:
|
||||
shaderProfile = L"ds";
|
||||
break;
|
||||
|
||||
case ShaderStage::ComputeShader:
|
||||
shaderProfile = L"cs";
|
||||
break;
|
||||
|
||||
default:
|
||||
llvm_unreachable("Invalid shader stage.");
|
||||
}
|
||||
shaderProfile += L"_6_0";
|
||||
|
||||
std::vector<DxcDefine> dxcDefines;
|
||||
std::vector<std::wstring> dxcDefineStrings;
|
||||
for (const auto& define : source.defines)
|
||||
{
|
||||
std::wstring nameUtf16Str;
|
||||
Unicode::UTF8ToUTF16String(define.name.c_str(), &nameUtf16Str);
|
||||
dxcDefineStrings.emplace_back(std::move(nameUtf16Str));
|
||||
const wchar_t* nameUtf16 = dxcDefineStrings.back().c_str();
|
||||
|
||||
const wchar_t* valueUtf16;
|
||||
if (define.value.empty())
|
||||
{
|
||||
std::wstring valueUtf16Str;
|
||||
Unicode::UTF8ToUTF16String(define.value.c_str(), &valueUtf16Str);
|
||||
dxcDefineStrings.emplace_back(std::move(valueUtf16Str));
|
||||
valueUtf16 = dxcDefineStrings.back().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
valueUtf16 = nullptr;
|
||||
}
|
||||
|
||||
dxcDefines.push_back({ nameUtf16, valueUtf16 });
|
||||
}
|
||||
|
||||
ComPtr<IDxcBlobEncoding> sourceBlob;
|
||||
IFT(Dxcompiler::Instance().Library()->CreateBlobWithEncodingOnHeapCopy(
|
||||
source.source.data(), static_cast<UINT32>(source.source.size()), CP_UTF8, sourceBlob.GetAddressOf()));
|
||||
IFTARG(sourceBlob->GetBufferSize() >= 4);
|
||||
|
||||
std::wstring shaderNameUtf16;
|
||||
Unicode::UTF8ToUTF16String(source.fileName.c_str(), &shaderNameUtf16);
|
||||
|
||||
std::wstring entryPointUtf16;
|
||||
Unicode::UTF8ToUTF16String(source.entryPoint.c_str(), &entryPointUtf16);
|
||||
|
||||
std::vector<std::wstring> dxcArgStrings =
|
||||
{
|
||||
L"-T", shaderProfile,
|
||||
L"-E", entryPointUtf16,
|
||||
};
|
||||
|
||||
switch (targetLanguage)
|
||||
{
|
||||
case ShadingLanguage::Dxil:
|
||||
break;
|
||||
|
||||
case ShadingLanguage::SpirV:
|
||||
case ShadingLanguage::Hlsl:
|
||||
case ShadingLanguage::Glsl:
|
||||
case ShadingLanguage::Essl:
|
||||
case ShadingLanguage::Msl:
|
||||
dxcArgStrings.push_back(L"-spirv");
|
||||
break;
|
||||
|
||||
default:
|
||||
llvm_unreachable("Invalid shading language.");
|
||||
}
|
||||
|
||||
std::vector<const wchar_t*> dxcArgs;
|
||||
dxcArgs.reserve(dxcArgStrings.size());
|
||||
for (const auto& arg : dxcArgStrings)
|
||||
{
|
||||
dxcArgs.push_back(arg.c_str());
|
||||
}
|
||||
|
||||
ComPtr<IDxcIncludeHandler> includeHandler = new ScIncludeHandler(std::move(source.loadIncludeCallback));
|
||||
ComPtr<IDxcOperationResult> compileResult;
|
||||
IFT(Dxcompiler::Instance().Compiler()->Compile(sourceBlob.Get(), shaderNameUtf16.c_str(), entryPointUtf16.c_str(),
|
||||
shaderProfile.c_str(), dxcArgs.data(), static_cast<UINT32>(dxcArgs.size()),
|
||||
dxcDefines.data(), static_cast<UINT32>(dxcDefines.size()), includeHandler.Get(),
|
||||
compileResult.GetAddressOf()));
|
||||
|
||||
HRESULT status;
|
||||
IFT(compileResult->GetStatus(&status));
|
||||
|
||||
Compiler::ResultDesc ret;
|
||||
|
||||
ComPtr<IDxcBlobEncoding> errors;
|
||||
IFT(compileResult->GetErrorBuffer(errors.GetAddressOf()));
|
||||
if (errors != nullptr)
|
||||
{
|
||||
ret.errorWarningMsg.assign(reinterpret_cast<const char*>(errors->GetBufferPointer()), errors->GetBufferSize());
|
||||
errors.Reset();
|
||||
}
|
||||
|
||||
ret.hasError = true;
|
||||
if (SUCCEEDED(status))
|
||||
{
|
||||
ComPtr<IDxcBlob> program;
|
||||
IFT(compileResult->GetResult(program.GetAddressOf()));
|
||||
compileResult.Reset();
|
||||
if (program != nullptr)
|
||||
{
|
||||
const uint8_t* programPtr = reinterpret_cast<const uint8_t*>(program->GetBufferPointer());
|
||||
ret.target.assign(programPtr, programPtr + program->GetBufferSize());
|
||||
|
||||
ret.hasError = false;
|
||||
}
|
||||
}
|
||||
|
||||
ret.isText = false;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Compiler::ResultDesc ConvertBinary(const Compiler::ResultDesc& binaryResult, const Compiler::SourceDesc& source,
|
||||
const Compiler::TargetDesc& target)
|
||||
{
|
||||
assert((target.language != ShadingLanguage::Dxil) && (target.language != ShadingLanguage::SpirV));
|
||||
assert((binaryResult.target.size() & (sizeof(uint32_t) - 1)) == 0);
|
||||
|
||||
Compiler::ResultDesc ret;
|
||||
|
||||
ret.errorWarningMsg = binaryResult.errorWarningMsg;
|
||||
|
||||
std::vector<uint32_t> binary32(binaryResult.target.size() / sizeof(uint32_t));
|
||||
memcpy(binary32.data(), binaryResult.target.data(), binaryResult.target.size());
|
||||
|
||||
std::unique_ptr<spirv_cross::CompilerGLSL> compiler;
|
||||
bool combinedImageSamplers = false;
|
||||
bool buildDummySampler = false;
|
||||
|
||||
switch (target.language)
|
||||
{
|
||||
case ShadingLanguage::Hlsl:
|
||||
compiler = std::make_unique<spirv_cross::CompilerHLSL>(std::move(binary32));
|
||||
break;
|
||||
|
||||
case ShadingLanguage::Glsl:
|
||||
case ShadingLanguage::Essl:
|
||||
compiler = std::make_unique<spirv_cross::CompilerGLSL>(std::move(binary32));
|
||||
combinedImageSamplers = true;
|
||||
buildDummySampler = true;
|
||||
break;
|
||||
|
||||
case ShadingLanguage::Msl:
|
||||
compiler = std::make_unique<spirv_cross::CompilerMSL>(std::move(binary32));
|
||||
break;
|
||||
|
||||
default:
|
||||
llvm_unreachable("Invalid target language.");
|
||||
}
|
||||
|
||||
spv::ExecutionModel model;
|
||||
switch (source.stage)
|
||||
{
|
||||
case ShaderStage::VertexShader:
|
||||
model = spv::ExecutionModelVertex;
|
||||
break;
|
||||
|
||||
case ShaderStage::HullShader:
|
||||
model = spv::ExecutionModelTessellationControl;
|
||||
break;
|
||||
|
||||
case ShaderStage::DomainShader:
|
||||
model = spv::ExecutionModelTessellationEvaluation;
|
||||
break;
|
||||
|
||||
case ShaderStage::GeometryShader:
|
||||
model = spv::ExecutionModelGeometry;
|
||||
break;
|
||||
|
||||
case ShaderStage::PixelShader:
|
||||
model = spv::ExecutionModelFragment;
|
||||
break;
|
||||
|
||||
case ShaderStage::ComputeShader:
|
||||
model = spv::ExecutionModelGLCompute;
|
||||
break;
|
||||
|
||||
default:
|
||||
llvm_unreachable("Invalid shader stage.");
|
||||
}
|
||||
compiler->set_entry_point(source.entryPoint, model);
|
||||
|
||||
spirv_cross::CompilerGLSL::Options opts = compiler->get_common_options();
|
||||
if (!target.version.empty())
|
||||
{
|
||||
opts.version = std::stoi(target.version);
|
||||
}
|
||||
opts.es = (target.language == ShadingLanguage::Essl);
|
||||
opts.force_temporary = false;
|
||||
opts.separate_shader_objects = true;
|
||||
opts.flatten_multidimensional_arrays = false;
|
||||
opts.enable_420pack_extension = (target.language == ShadingLanguage::Glsl) && (target.version.empty() || (opts.version >= 420));
|
||||
opts.vulkan_semantics = false;
|
||||
opts.vertex.fixup_clipspace = false;
|
||||
opts.vertex.flip_vert_y = false;
|
||||
opts.vertex.support_nonzero_base_instance = true;
|
||||
compiler->set_common_options(opts);
|
||||
|
||||
if (target.language == ShadingLanguage::Hlsl)
|
||||
{
|
||||
auto* hlslCompiler = static_cast<spirv_cross::CompilerHLSL*>(compiler.get());
|
||||
auto hlslOpts = hlslCompiler->get_hlsl_options();
|
||||
if (!target.version.empty())
|
||||
{
|
||||
if (opts.version < 30)
|
||||
{
|
||||
ret.errorWarningMsg += "\nShader model earlier than 30 (3.0) is not supported.";
|
||||
ret.hasError = true;
|
||||
return ret;
|
||||
}
|
||||
hlslOpts.shader_model = opts.version;
|
||||
}
|
||||
|
||||
hlslCompiler->set_hlsl_options(hlslOpts);
|
||||
}
|
||||
else if (target.language == ShadingLanguage::Msl)
|
||||
{
|
||||
auto* mslCompiler = static_cast<spirv_cross::CompilerMSL*>(compiler.get());
|
||||
auto mslOpts = mslCompiler->get_msl_options();
|
||||
if (!target.version.empty())
|
||||
{
|
||||
mslOpts.msl_version = opts.version;
|
||||
}
|
||||
mslOpts.swizzle_texture_samples = false;
|
||||
mslCompiler->set_msl_options(mslOpts);
|
||||
}
|
||||
|
||||
if (buildDummySampler)
|
||||
{
|
||||
const uint32_t sampler = compiler->build_dummy_sampler_for_combined_images();
|
||||
if (sampler != 0)
|
||||
{
|
||||
compiler->set_decoration(sampler, spv::DecorationDescriptorSet, 0);
|
||||
compiler->set_decoration(sampler, spv::DecorationBinding, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (combinedImageSamplers)
|
||||
{
|
||||
compiler->build_combined_image_samplers();
|
||||
|
||||
for (auto& remap : compiler->get_combined_image_samplers())
|
||||
{
|
||||
compiler->set_name(remap.combined_id,
|
||||
"SPIRV_Cross_Combined" + compiler->get_name(remap.image_id) + compiler->get_name(remap.sampler_id));
|
||||
}
|
||||
}
|
||||
|
||||
if (target.language == ShadingLanguage::Hlsl)
|
||||
{
|
||||
auto* hlslCompiler = static_cast<spirv_cross::CompilerHLSL*>(compiler.get());
|
||||
const uint32_t newBuiltin = hlslCompiler->remap_num_workgroups_builtin();
|
||||
if (newBuiltin)
|
||||
{
|
||||
compiler->set_decoration(newBuiltin, spv::DecorationDescriptorSet, 0);
|
||||
compiler->set_decoration(newBuiltin, spv::DecorationBinding, 0);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
const std::string targetStr = compiler->compile();
|
||||
ret.target.assign(targetStr.begin(), targetStr.end());
|
||||
ret.hasError = false;
|
||||
}
|
||||
catch (spirv_cross::CompilerError& error)
|
||||
{
|
||||
ret.errorWarningMsg = error.what();
|
||||
ret.hasError = true;
|
||||
}
|
||||
|
||||
ret.isText = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace ShaderConductor
|
||||
{
|
||||
Compiler::ResultDesc Compiler::Compile(SourceDesc source, TargetDesc target)
|
||||
{
|
||||
if (source.entryPoint.empty())
|
||||
{
|
||||
source.entryPoint = "main";
|
||||
}
|
||||
if (!source.loadIncludeCallback)
|
||||
{
|
||||
source.loadIncludeCallback = DefaultLoadCallback;
|
||||
}
|
||||
|
||||
const auto binaryLanguage = target.language == ShadingLanguage::Dxil ? ShadingLanguage::Dxil : ShadingLanguage::SpirV;
|
||||
auto ret = CompileToBinary(source, binaryLanguage);
|
||||
|
||||
if (!ret.hasError && (target.language != binaryLanguage))
|
||||
{
|
||||
ret = ConvertBinary(ret, source, target);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
} // namespace ShaderConductor
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
SC_UNUSED(instance);
|
||||
|
||||
BOOL result = TRUE;
|
||||
if (reason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
dllDetaching = true;
|
||||
|
||||
if (reserved == 0)
|
||||
{
|
||||
// FreeLibrary has been called or the DLL load failed
|
||||
Dxcompiler::Instance().Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process termination. We should not call FreeLibrary()
|
||||
Dxcompiler::Instance().Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,51 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
set(EXE_NAME ShaderConductorTest)
|
||||
|
||||
set(SOURCE_FILES
|
||||
ShaderConductorTest.cpp
|
||||
)
|
||||
|
||||
set(DATA_FILES
|
||||
Data/Input/Constant_PS.hlsl
|
||||
Data/Input/Constant_VS.hlsl
|
||||
Data/Input/DetailTessellation_HS.hlsl
|
||||
Data/Input/Fluid_CS.hlsl
|
||||
Data/Input/Particle_GS.hlsl
|
||||
Data/Input/PassThrough_PS.hlsl
|
||||
Data/Input/PassThrough_VS.hlsl
|
||||
Data/Input/PNTriangles_DS.hlsl
|
||||
Data/Input/ToneMapping_PS.hlsl
|
||||
Data/Input/Transform_VS.hlsl
|
||||
)
|
||||
|
||||
set_source_files_properties(${DATA_FILES}
|
||||
PROPERTIES VS_TOOL_OVERRIDE "None"
|
||||
)
|
||||
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
source_group("Data Files\\Input" FILES ${DATA_FILES})
|
||||
|
||||
add_definitions(-DTEST_DATA_DIR="${SC_ROOT_DIR}/Source/Tests/Data/")
|
||||
|
||||
include_directories(
|
||||
${SC_ROOT_DIR}/Include
|
||||
${SC_ROOT_DIR}/External/googletest/googletest/include
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
)
|
||||
|
||||
add_executable(${EXE_NAME} ${SOURCE_FILES} ${DATA_FILES})
|
||||
|
||||
target_link_libraries(${EXE_NAME}
|
||||
ShaderConductor
|
||||
debug gtestd optimized gtest
|
||||
)
|
||||
|
||||
add_dependencies(${EXE_NAME} ShaderConductor)
|
||||
add_dependencies(${EXE_NAME} gtest)
|
||||
|
||||
set_target_properties(${EXE_NAME} PROPERTIES FOLDER "Tests")
|
|
@ -0,0 +1,19 @@
|
|||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : COLOR0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
out_var_SV_Target = float4(0.20000000298023223876953125f, 0.4000000059604644775390625f, 0.60000002384185791015625f, 1.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = float4(out_var_SV_Target);
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(location = 0) out highp vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = vec4(0.20000000298023223876953125, 0.4000000059604644775390625, 0.60000002384185791015625, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
|
||||
out vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = vec4(0.20000000298023223876953125, 0.4000000059604644775390625, 0.60000002384185791015625, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(location = 0) out highp vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = vec4(0.20000000298023223876953125, 0.4000000059604644775390625, 0.60000002384185791015625, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
out_var_SV_Target = float4(0.20000000298023223876953125f, 0.4000000059604644775390625f, 0.60000002384185791015625f, 1.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = out_var_SV_Target;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#version 410
|
||||
|
||||
layout(location = 0) out vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = vec4(0.20000000298023223876953125, 0.4000000059604644775390625, 0.60000002384185791015625, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
out_var_SV_Target = float4(0.20000000298023223876953125f, 0.4000000059604644775390625f, 0.60000002384185791015625f, 1.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = out_var_SV_Target;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct PSMain_out
|
||||
{
|
||||
float4 out_var_SV_Target [[color(0)]];
|
||||
};
|
||||
|
||||
fragment PSMain_out PSMain()
|
||||
{
|
||||
PSMain_out out = {};
|
||||
out.out_var_SV_Target = float4(0.20000000298023223876953125, 0.4000000059604644775390625, 0.60000002384185791015625, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
uniform float4 gl_HalfPixel;
|
||||
|
||||
static float4 gl_Position;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : POSITION;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = float4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w;
|
||||
gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#version 300 es
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0, 2.0, 3.0, 4.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0, 2.0, 3.0, 4.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#version 310 es
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0, 2.0, 3.0, 4.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
static float4 gl_Position;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = float4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#version 410
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0, 2.0, 3.0, 4.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
static float4 gl_Position;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = float4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct VSMain_out
|
||||
{
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
vertex VSMain_out VSMain()
|
||||
{
|
||||
VSMain_out out = {};
|
||||
out.gl_Position = float4(1.0, 2.0, 3.0, 4.0);
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#version 300 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(vertices = 3) out;
|
||||
|
||||
struct VS_OUTPUT_HS_INPUT
|
||||
{
|
||||
vec3 worldPos;
|
||||
vec3 normal;
|
||||
vec2 texCoord;
|
||||
vec3 lightTS;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbMain
|
||||
{
|
||||
vec4 tessellationFactor;
|
||||
} cbMain;
|
||||
|
||||
in vec3 in_var_WORLDPOS[];
|
||||
in vec3 in_var_NORMAL[];
|
||||
in vec2 in_var_TEXCOORD0[];
|
||||
in vec3 in_var_LIGHTVECTORTS[];
|
||||
out vec3 out_var_WORLDPOS[3];
|
||||
out vec3 out_var_NORMAL[3];
|
||||
out vec2 out_var_TEXCOORD0[3];
|
||||
out vec3 out_var_LIGHTVECTORTS[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[0], in_var_NORMAL[0], in_var_TEXCOORD0[0], in_var_LIGHTVECTORTS[0]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[1], in_var_NORMAL[1], in_var_TEXCOORD0[1], in_var_LIGHTVECTORTS[1]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[2], in_var_NORMAL[2], in_var_TEXCOORD0[2], in_var_LIGHTVECTORTS[2]));
|
||||
out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos;
|
||||
out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal;
|
||||
out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord;
|
||||
out_var_LIGHTVECTORTS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].lightTS;
|
||||
barrier();
|
||||
if (gl_InvocationID == 0u)
|
||||
{
|
||||
gl_TessLevelOuter[0u] = cbMain.tessellationFactor.x;
|
||||
gl_TessLevelOuter[1u] = cbMain.tessellationFactor.y;
|
||||
gl_TessLevelOuter[2u] = cbMain.tessellationFactor.z;
|
||||
gl_TessLevelInner[0u] = cbMain.tessellationFactor.w;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#version 300
|
||||
#extension GL_ARB_tessellation_shader : require
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
layout(vertices = 3) out;
|
||||
|
||||
struct VS_OUTPUT_HS_INPUT
|
||||
{
|
||||
vec3 worldPos;
|
||||
vec3 normal;
|
||||
vec2 texCoord;
|
||||
vec3 lightTS;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbMain
|
||||
{
|
||||
vec4 tessellationFactor;
|
||||
} cbMain;
|
||||
|
||||
layout(location = 0) in vec3 in_var_WORLDPOS[];
|
||||
layout(location = 1) in vec3 in_var_NORMAL[];
|
||||
layout(location = 2) in vec2 in_var_TEXCOORD0[];
|
||||
layout(location = 3) in vec3 in_var_LIGHTVECTORTS[];
|
||||
layout(location = 3) out vec3 out_var_WORLDPOS[3];
|
||||
layout(location = 1) out vec3 out_var_NORMAL[3];
|
||||
layout(location = 2) out vec2 out_var_TEXCOORD0[3];
|
||||
layout(location = 0) out vec3 out_var_LIGHTVECTORTS[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[0], in_var_NORMAL[0], in_var_TEXCOORD0[0], in_var_LIGHTVECTORTS[0]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[1], in_var_NORMAL[1], in_var_TEXCOORD0[1], in_var_LIGHTVECTORTS[1]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[2], in_var_NORMAL[2], in_var_TEXCOORD0[2], in_var_LIGHTVECTORTS[2]));
|
||||
out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos;
|
||||
out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal;
|
||||
out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord;
|
||||
out_var_LIGHTVECTORTS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].lightTS;
|
||||
barrier();
|
||||
if (gl_InvocationID == 0u)
|
||||
{
|
||||
gl_TessLevelOuter[0u] = cbMain.tessellationFactor.x;
|
||||
gl_TessLevelOuter[1u] = cbMain.tessellationFactor.y;
|
||||
gl_TessLevelOuter[2u] = cbMain.tessellationFactor.z;
|
||||
gl_TessLevelInner[0u] = cbMain.tessellationFactor.w;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(vertices = 3) out;
|
||||
|
||||
struct VS_OUTPUT_HS_INPUT
|
||||
{
|
||||
vec3 worldPos;
|
||||
vec3 normal;
|
||||
vec2 texCoord;
|
||||
vec3 lightTS;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform type_cbMain
|
||||
{
|
||||
vec4 tessellationFactor;
|
||||
} cbMain;
|
||||
|
||||
layout(location = 0) in vec3 in_var_WORLDPOS[];
|
||||
layout(location = 1) in vec3 in_var_NORMAL[];
|
||||
layout(location = 2) in vec2 in_var_TEXCOORD0[];
|
||||
layout(location = 3) in vec3 in_var_LIGHTVECTORTS[];
|
||||
layout(location = 3) out vec3 out_var_WORLDPOS[3];
|
||||
layout(location = 1) out vec3 out_var_NORMAL[3];
|
||||
layout(location = 2) out vec2 out_var_TEXCOORD0[3];
|
||||
layout(location = 0) out vec3 out_var_LIGHTVECTORTS[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[0], in_var_NORMAL[0], in_var_TEXCOORD0[0], in_var_LIGHTVECTORTS[0]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[1], in_var_NORMAL[1], in_var_TEXCOORD0[1], in_var_LIGHTVECTORTS[1]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[2], in_var_NORMAL[2], in_var_TEXCOORD0[2], in_var_LIGHTVECTORTS[2]));
|
||||
out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos;
|
||||
out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal;
|
||||
out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord;
|
||||
out_var_LIGHTVECTORTS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].lightTS;
|
||||
barrier();
|
||||
if (gl_InvocationID == 0u)
|
||||
{
|
||||
gl_TessLevelOuter[0u] = cbMain.tessellationFactor.x;
|
||||
gl_TessLevelOuter[1u] = cbMain.tessellationFactor.y;
|
||||
gl_TessLevelOuter[2u] = cbMain.tessellationFactor.z;
|
||||
gl_TessLevelInner[0u] = cbMain.tessellationFactor.w;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#version 410
|
||||
layout(vertices = 3) out;
|
||||
|
||||
struct VS_OUTPUT_HS_INPUT
|
||||
{
|
||||
vec3 worldPos;
|
||||
vec3 normal;
|
||||
vec2 texCoord;
|
||||
vec3 lightTS;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbMain
|
||||
{
|
||||
vec4 tessellationFactor;
|
||||
} cbMain;
|
||||
|
||||
layout(location = 0) in vec3 in_var_WORLDPOS[];
|
||||
layout(location = 1) in vec3 in_var_NORMAL[];
|
||||
layout(location = 2) in vec2 in_var_TEXCOORD0[];
|
||||
layout(location = 3) in vec3 in_var_LIGHTVECTORTS[];
|
||||
layout(location = 3) out vec3 out_var_WORLDPOS[3];
|
||||
layout(location = 1) out vec3 out_var_NORMAL[3];
|
||||
layout(location = 2) out vec2 out_var_TEXCOORD0[3];
|
||||
layout(location = 0) out vec3 out_var_LIGHTVECTORTS[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
VS_OUTPUT_HS_INPUT param_var_inputPatch[3] = VS_OUTPUT_HS_INPUT[](VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[0], in_var_NORMAL[0], in_var_TEXCOORD0[0], in_var_LIGHTVECTORTS[0]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[1], in_var_NORMAL[1], in_var_TEXCOORD0[1], in_var_LIGHTVECTORTS[1]), VS_OUTPUT_HS_INPUT(in_var_WORLDPOS[2], in_var_NORMAL[2], in_var_TEXCOORD0[2], in_var_LIGHTVECTORTS[2]));
|
||||
out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos;
|
||||
out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal;
|
||||
out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord;
|
||||
out_var_LIGHTVECTORTS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].lightTS;
|
||||
barrier();
|
||||
if (gl_InvocationID == 0u)
|
||||
{
|
||||
gl_TessLevelOuter[0u] = cbMain.tessellationFactor.x;
|
||||
gl_TessLevelOuter[1u] = cbMain.tessellationFactor.y;
|
||||
gl_TessLevelOuter[2u] = cbMain.tessellationFactor.z;
|
||||
gl_TessLevelInner[0u] = cbMain.tessellationFactor.w;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct type_cbMain
|
||||
{
|
||||
float4 tessellationFactor;
|
||||
};
|
||||
|
||||
struct VS_OUTPUT_HS_INPUT
|
||||
{
|
||||
float3 worldPos;
|
||||
float3 normal;
|
||||
float2 texCoord;
|
||||
float3 lightTS;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float3 out_var_LIGHTVECTORTS_0;
|
||||
float3 out_var_NORMAL_0;
|
||||
float3 out_var_LIGHTVECTORTS_1;
|
||||
float3 out_var_NORMAL_1;
|
||||
float2 out_var_TEXCOORD0_0;
|
||||
float3 out_var_LIGHTVECTORTS_2;
|
||||
float3 out_var_WORLDPOS_0;
|
||||
float3 out_var_NORMAL_2;
|
||||
float2 out_var_TEXCOORD0_1;
|
||||
float3 out_var_WORLDPOS_1;
|
||||
float2 out_var_TEXCOORD0_2;
|
||||
float3 out_var_WORLDPOS_2;
|
||||
float gl_TessLevelOuter[4];
|
||||
float gl_TessLevelInner[2];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float3 in_var_WORLDPOS_0;
|
||||
float3 in_var_WORLDPOS_1;
|
||||
float3 in_var_NORMAL_0;
|
||||
float3 in_var_WORLDPOS_2;
|
||||
float3 in_var_NORMAL_1;
|
||||
float2 in_var_TEXCOORD0_0;
|
||||
float3 in_var_NORMAL_2;
|
||||
float2 in_var_TEXCOORD0_1;
|
||||
float3 in_var_LIGHTVECTORTS_0;
|
||||
float2 in_var_TEXCOORD0_2;
|
||||
float3 in_var_LIGHTVECTORTS_1;
|
||||
float3 in_var_LIGHTVECTORTS_2;
|
||||
};
|
||||
|
||||
// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment.
|
||||
template<typename T, uint N>
|
||||
void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N])
|
||||
{
|
||||
for (uint i = 0; i < N; dst[i] = src[i], i++);
|
||||
}
|
||||
|
||||
template<typename T, uint N>
|
||||
void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N])
|
||||
{
|
||||
for (uint i = 0; i < N; dst[i] = src[i], i++);
|
||||
}
|
||||
|
||||
unknown main0_out main0(main0_in in [[stage_in]], constant type_cbMain& cbMain [[buffer(0)]], unsupported-built-in-type gl_InvocationID [[unsupported-built-in]], unsupported-built-in-type gl_PrimitiveID [[unsupported-built-in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float3 out_var_WORLDPOS[3] = {};
|
||||
float3 out_var_NORMAL[3] = {};
|
||||
float2 out_var_TEXCOORD0[3] = {};
|
||||
float3 out_var_LIGHTVECTORTS[3] = {};
|
||||
float3 in_var_WORLDPOS[] = {};
|
||||
float3 in_var_NORMAL[] = {};
|
||||
float2 in_var_TEXCOORD0[] = {};
|
||||
float3 in_var_LIGHTVECTORTS[] = {};
|
||||
in_var_WORLDPOS[0] = in.in_var_WORLDPOS_0;
|
||||
in_var_WORLDPOS[1] = in.in_var_WORLDPOS_1;
|
||||
in_var_WORLDPOS[2] = in.in_var_WORLDPOS_2;
|
||||
in_var_NORMAL[0] = in.in_var_NORMAL_0;
|
||||
in_var_NORMAL[1] = in.in_var_NORMAL_1;
|
||||
in_var_NORMAL[2] = in.in_var_NORMAL_2;
|
||||
in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0;
|
||||
in_var_TEXCOORD0[1] = in.in_var_TEXCOORD0_1;
|
||||
in_var_TEXCOORD0[2] = in.in_var_TEXCOORD0_2;
|
||||
in_var_LIGHTVECTORTS[0] = in.in_var_LIGHTVECTORTS_0;
|
||||
in_var_LIGHTVECTORTS[1] = in.in_var_LIGHTVECTORTS_1;
|
||||
in_var_LIGHTVECTORTS[2] = in.in_var_LIGHTVECTORTS_2;
|
||||
VS_OUTPUT_HS_INPUT _77[3] = { VS_OUTPUT_HS_INPUT{ in_var_WORLDPOS[0], in_var_NORMAL[0], in_var_TEXCOORD0[0], in_var_LIGHTVECTORTS[0] }, VS_OUTPUT_HS_INPUT{ in_var_WORLDPOS[1], in_var_NORMAL[1], in_var_TEXCOORD0[1], in_var_LIGHTVECTORTS[1] }, VS_OUTPUT_HS_INPUT{ in_var_WORLDPOS[2], in_var_NORMAL[2], in_var_TEXCOORD0[2], in_var_LIGHTVECTORTS[2] } };
|
||||
VS_OUTPUT_HS_INPUT param_var_inputPatch[3];
|
||||
spvArrayCopyFromStack1(param_var_inputPatch, _77);
|
||||
out_var_WORLDPOS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].worldPos;
|
||||
out_var_NORMAL[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].normal;
|
||||
out_var_TEXCOORD0[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].texCoord;
|
||||
out_var_LIGHTVECTORTS[gl_InvocationID] = param_var_inputPatch[gl_InvocationID].lightTS;
|
||||
if (gl_InvocationID == 0u)
|
||||
{
|
||||
gl_TessLevelOuter[0u] = cbMain.tessellationFactor.x;
|
||||
gl_TessLevelOuter[1u] = cbMain.tessellationFactor.y;
|
||||
gl_TessLevelOuter[2u] = cbMain.tessellationFactor.z;
|
||||
gl_TessLevelInner[0u] = cbMain.tessellationFactor.w;
|
||||
}
|
||||
out.out_var_WORLDPOS_0 = out_var_WORLDPOS[0];
|
||||
out.out_var_WORLDPOS_1 = out_var_WORLDPOS[1];
|
||||
out.out_var_WORLDPOS_2 = out_var_WORLDPOS[2];
|
||||
out.out_var_NORMAL_0 = out_var_NORMAL[0];
|
||||
out.out_var_NORMAL_1 = out_var_NORMAL[1];
|
||||
out.out_var_NORMAL_2 = out_var_NORMAL[2];
|
||||
out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0];
|
||||
out.out_var_TEXCOORD0_1 = out_var_TEXCOORD0[1];
|
||||
out.out_var_TEXCOORD0_2 = out_var_TEXCOORD0[2];
|
||||
out.out_var_LIGHTVECTORTS_0 = out_var_LIGHTVECTORTS[0];
|
||||
out.out_var_LIGHTVECTORTS_1 = out_var_LIGHTVECTORTS[1];
|
||||
out.out_var_LIGHTVECTORTS_2 = out_var_LIGHTVECTORTS[2];
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#version 300
|
||||
#extension GL_ARB_compute_shader : require
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
struct Particle
|
||||
{
|
||||
vec2 position;
|
||||
vec2 velocity;
|
||||
};
|
||||
|
||||
struct ParticleForces
|
||||
{
|
||||
vec2 acceleration;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbSimulationConstants
|
||||
{
|
||||
float timeStep;
|
||||
float wallStiffness;
|
||||
vec4 gravity;
|
||||
vec3 planes[4];
|
||||
} cbSimulationConstants;
|
||||
|
||||
layout(std430) buffer type_RWStructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[];
|
||||
} particlesRW;
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[];
|
||||
} particlesRO;
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_ParticleForces
|
||||
{
|
||||
ParticleForces _m0[];
|
||||
} particlesForcesRO;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 _51 = particlesRO._m0[gl_GlobalInvocationID.x].position;
|
||||
vec2 _53 = particlesRO._m0[gl_GlobalInvocationID.x].velocity;
|
||||
vec2 _57;
|
||||
_57 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration;
|
||||
for (uint _60 = 0u; _60 < 4u; )
|
||||
{
|
||||
_57 += (cbSimulationConstants.planes[_60].xy * (min(dot(vec3(_51, 1.0), cbSimulationConstants.planes[_60]), 0.0) * (-cbSimulationConstants.wallStiffness)));
|
||||
_60++;
|
||||
continue;
|
||||
}
|
||||
vec2 _84 = _53 + ((_57 + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].position = _51 + (_84 * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].velocity = _84;
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
#version 310 es
|
||||
layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
struct Particle
|
||||
{
|
||||
vec2 position;
|
||||
vec2 velocity;
|
||||
};
|
||||
|
||||
struct ParticleForces
|
||||
{
|
||||
vec2 acceleration;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform type_cbSimulationConstants
|
||||
{
|
||||
float timeStep;
|
||||
float wallStiffness;
|
||||
vec4 gravity;
|
||||
vec3 planes[4];
|
||||
} cbSimulationConstants;
|
||||
|
||||
layout(binding = 0, std430) buffer type_RWStructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[];
|
||||
} particlesRW;
|
||||
|
||||
layout(binding = 0, std430) readonly buffer type_StructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[];
|
||||
} particlesRO;
|
||||
|
||||
layout(binding = 2, std430) readonly buffer type_StructuredBuffer_ParticleForces
|
||||
{
|
||||
ParticleForces _m0[];
|
||||
} particlesForcesRO;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 _51 = particlesRO._m0[gl_GlobalInvocationID.x].position;
|
||||
vec2 _53 = particlesRO._m0[gl_GlobalInvocationID.x].velocity;
|
||||
vec2 _57;
|
||||
_57 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration;
|
||||
for (uint _60 = 0u; _60 < 4u; )
|
||||
{
|
||||
_57 += (cbSimulationConstants.planes[_60].xy * (min(dot(vec3(_51, 1.0), cbSimulationConstants.planes[_60]), 0.0) * (-cbSimulationConstants.wallStiffness)));
|
||||
_60++;
|
||||
continue;
|
||||
}
|
||||
vec2 _84 = _53 + ((_57 + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].position = _51 + (_84 * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].velocity = _84;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#version 410
|
||||
#extension GL_ARB_compute_shader : require
|
||||
layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
struct Particle
|
||||
{
|
||||
vec2 position;
|
||||
vec2 velocity;
|
||||
};
|
||||
|
||||
struct ParticleForces
|
||||
{
|
||||
vec2 acceleration;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbSimulationConstants
|
||||
{
|
||||
float timeStep;
|
||||
float wallStiffness;
|
||||
vec4 gravity;
|
||||
vec3 planes[4];
|
||||
} cbSimulationConstants;
|
||||
|
||||
layout(std430) buffer type_RWStructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[];
|
||||
} particlesRW;
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[];
|
||||
} particlesRO;
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_ParticleForces
|
||||
{
|
||||
ParticleForces _m0[];
|
||||
} particlesForcesRO;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 _51 = particlesRO._m0[gl_GlobalInvocationID.x].position;
|
||||
vec2 _53 = particlesRO._m0[gl_GlobalInvocationID.x].velocity;
|
||||
vec2 _57;
|
||||
_57 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration;
|
||||
for (uint _60 = 0u; _60 < 4u; )
|
||||
{
|
||||
_57 += (cbSimulationConstants.planes[_60].xy * (min(dot(vec3(_51, 1.0), cbSimulationConstants.planes[_60]), 0.0) * (-cbSimulationConstants.wallStiffness)));
|
||||
_60++;
|
||||
continue;
|
||||
}
|
||||
vec2 _84 = _53 + ((_57 + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].position = _51 + (_84 * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].velocity = _84;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
struct Particle
|
||||
{
|
||||
float2 position;
|
||||
float2 velocity;
|
||||
};
|
||||
|
||||
struct ParticleForces
|
||||
{
|
||||
float2 acceleration;
|
||||
};
|
||||
|
||||
cbuffer cbSimulationConstants : register(b0)
|
||||
{
|
||||
float cbSimulationConstants_timeStep : packoffset(c0);
|
||||
float cbSimulationConstants_wallStiffness : packoffset(c0.y);
|
||||
float4 cbSimulationConstants_gravity : packoffset(c1);
|
||||
float3 cbSimulationConstants_planes[4] : packoffset(c2);
|
||||
};
|
||||
RWByteAddressBuffer particlesRW : register(u0);
|
||||
ByteAddressBuffer particlesRO : register(t0);
|
||||
ByteAddressBuffer particlesForcesRO : register(t2);
|
||||
|
||||
static uint3 gl_GlobalInvocationID;
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
float2 _51 = asfloat(particlesRO.Load2(gl_GlobalInvocationID.x * 16 + 0));
|
||||
float2 _53 = asfloat(particlesRO.Load2(gl_GlobalInvocationID.x * 16 + 8));
|
||||
float2 _57;
|
||||
_57 = asfloat(particlesForcesRO.Load2(gl_GlobalInvocationID.x * 8 + 0));
|
||||
[unroll]
|
||||
for (uint _60 = 0u; _60 < 4u; )
|
||||
{
|
||||
_57 += (cbSimulationConstants_planes[_60].xy * (min(dot(float3(_51, 1.0f), cbSimulationConstants_planes[_60]), 0.0f) * (-cbSimulationConstants_wallStiffness)));
|
||||
_60++;
|
||||
continue;
|
||||
}
|
||||
float2 _84 = _53 + ((_57 + cbSimulationConstants_gravity.xy) * cbSimulationConstants_timeStep);
|
||||
particlesRW.Store2(gl_GlobalInvocationID.x * 16 + 0, asuint(_51 + (_84 * cbSimulationConstants_timeStep)));
|
||||
particlesRW.Store2(gl_GlobalInvocationID.x * 16 + 8, asuint(_84));
|
||||
}
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||
comp_main();
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct type_cbSimulationConstants
|
||||
{
|
||||
float timeStep;
|
||||
float wallStiffness;
|
||||
float4 gravity;
|
||||
float3 planes[4];
|
||||
};
|
||||
|
||||
struct Particle
|
||||
{
|
||||
float2 position;
|
||||
float2 velocity;
|
||||
};
|
||||
|
||||
struct type_RWStructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[1];
|
||||
};
|
||||
|
||||
struct type_StructuredBuffer_Particle
|
||||
{
|
||||
Particle _m0[1];
|
||||
};
|
||||
|
||||
struct ParticleForces
|
||||
{
|
||||
float2 acceleration;
|
||||
};
|
||||
|
||||
struct type_StructuredBuffer_ParticleForces
|
||||
{
|
||||
ParticleForces _m0[1];
|
||||
};
|
||||
|
||||
kernel void main0(constant type_cbSimulationConstants& cbSimulationConstants [[buffer(0)]], device type_RWStructuredBuffer_Particle& particlesRW [[buffer(0)]], const device type_StructuredBuffer_Particle& particlesRO [[buffer(0)]], const device type_StructuredBuffer_ParticleForces& particlesForcesRO [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
|
||||
{
|
||||
float2 _51 = particlesRO._m0[gl_GlobalInvocationID.x].position;
|
||||
float2 _53 = particlesRO._m0[gl_GlobalInvocationID.x].velocity;
|
||||
float2 _57;
|
||||
_57 = particlesForcesRO._m0[gl_GlobalInvocationID.x].acceleration;
|
||||
for (uint _60 = 0u; _60 < 4u; )
|
||||
{
|
||||
_57 += (cbSimulationConstants.planes[_60].xy * (fast::min(dot(float3(_51, 1.0), cbSimulationConstants.planes[_60]), 0.0) * (-cbSimulationConstants.wallStiffness)));
|
||||
_60++;
|
||||
continue;
|
||||
}
|
||||
float2 _84 = _53 + ((_57 + cbSimulationConstants.gravity.xy) * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].position = _51 + (_84 * cbSimulationConstants.timeStep);
|
||||
particlesRW._m0[gl_GlobalInvocationID.x].velocity = _84;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#version 300 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles) in;
|
||||
|
||||
layout(std140) uniform type_cbPNTriangles
|
||||
{
|
||||
layout(row_major) mat4 viewProj;
|
||||
vec4 lightDir;
|
||||
} cbPNTriangles;
|
||||
|
||||
patch in vec3 in_var_POSITION3;
|
||||
patch in vec3 in_var_POSITION4;
|
||||
patch in vec3 in_var_POSITION5;
|
||||
patch in vec3 in_var_POSITION6;
|
||||
patch in vec3 in_var_POSITION7;
|
||||
patch in vec3 in_var_POSITION8;
|
||||
patch in vec3 in_var_CENTER;
|
||||
in vec3 in_var_POSITION[3];
|
||||
in vec2 in_var_TEXCOORD[3];
|
||||
out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
float _67 = gl_TessCoord.x * gl_TessCoord.x;
|
||||
float _68 = gl_TessCoord.y * gl_TessCoord.y;
|
||||
float _69 = gl_TessCoord.z * gl_TessCoord.z;
|
||||
float _70 = _67 * 3.0;
|
||||
float _71 = _68 * 3.0;
|
||||
float _72 = _69 * 3.0;
|
||||
gl_Position = cbPNTriangles.viewProj * vec4(((((((((((in_var_POSITION[0] * _69) * gl_TessCoord.z) + ((in_var_POSITION[1] * _67) * gl_TessCoord.x)) + ((in_var_POSITION[2] * _68) * gl_TessCoord.y)) + ((in_var_POSITION3 * _72) * gl_TessCoord.x)) + ((in_var_POSITION4 * gl_TessCoord.z) * _70)) + ((in_var_POSITION8 * _72) * gl_TessCoord.y)) + ((in_var_POSITION5 * _70) * gl_TessCoord.y)) + ((in_var_POSITION7 * gl_TessCoord.z) * _71)) + ((in_var_POSITION6 * gl_TessCoord.x) * _71)) + ((((in_var_CENTER * 6.0) * gl_TessCoord.z) * gl_TessCoord.x) * gl_TessCoord.y), 1.0);
|
||||
out_var_TEXCOORD0 = ((in_var_TEXCOORD[0] * gl_TessCoord.z) + (in_var_TEXCOORD[1] * gl_TessCoord.x)) + (in_var_TEXCOORD[2] * gl_TessCoord.y);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#version 300
|
||||
#extension GL_ARB_tessellation_shader : require
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
layout(triangles) in;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbPNTriangles
|
||||
{
|
||||
layout(row_major) mat4 viewProj;
|
||||
vec4 lightDir;
|
||||
} cbPNTriangles;
|
||||
|
||||
layout(location = 2) patch in vec3 in_var_POSITION3;
|
||||
layout(location = 3) patch in vec3 in_var_POSITION4;
|
||||
layout(location = 4) patch in vec3 in_var_POSITION5;
|
||||
layout(location = 5) patch in vec3 in_var_POSITION6;
|
||||
layout(location = 6) patch in vec3 in_var_POSITION7;
|
||||
layout(location = 7) patch in vec3 in_var_POSITION8;
|
||||
layout(location = 0) patch in vec3 in_var_CENTER;
|
||||
layout(location = 1) in vec3 in_var_POSITION[3];
|
||||
layout(location = 8) in vec2 in_var_TEXCOORD[3];
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
float _67 = gl_TessCoord.x * gl_TessCoord.x;
|
||||
float _68 = gl_TessCoord.y * gl_TessCoord.y;
|
||||
float _69 = gl_TessCoord.z * gl_TessCoord.z;
|
||||
float _70 = _67 * 3.0;
|
||||
float _71 = _68 * 3.0;
|
||||
float _72 = _69 * 3.0;
|
||||
gl_Position = cbPNTriangles.viewProj * vec4(((((((((((in_var_POSITION[0] * _69) * gl_TessCoord.z) + ((in_var_POSITION[1] * _67) * gl_TessCoord.x)) + ((in_var_POSITION[2] * _68) * gl_TessCoord.y)) + ((in_var_POSITION3 * _72) * gl_TessCoord.x)) + ((in_var_POSITION4 * gl_TessCoord.z) * _70)) + ((in_var_POSITION8 * _72) * gl_TessCoord.y)) + ((in_var_POSITION5 * _70) * gl_TessCoord.y)) + ((in_var_POSITION7 * gl_TessCoord.z) * _71)) + ((in_var_POSITION6 * gl_TessCoord.x) * _71)) + ((((in_var_CENTER * 6.0) * gl_TessCoord.z) * gl_TessCoord.x) * gl_TessCoord.y), 1.0);
|
||||
out_var_TEXCOORD0 = ((in_var_TEXCOORD[0] * gl_TessCoord.z) + (in_var_TEXCOORD[1] * gl_TessCoord.x)) + (in_var_TEXCOORD[2] * gl_TessCoord.y);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_tessellation_shader : require
|
||||
layout(triangles) in;
|
||||
|
||||
layout(binding = 0, std140) uniform type_cbPNTriangles
|
||||
{
|
||||
layout(row_major) mat4 viewProj;
|
||||
vec4 lightDir;
|
||||
} cbPNTriangles;
|
||||
|
||||
layout(location = 2) patch in vec3 in_var_POSITION3;
|
||||
layout(location = 3) patch in vec3 in_var_POSITION4;
|
||||
layout(location = 4) patch in vec3 in_var_POSITION5;
|
||||
layout(location = 5) patch in vec3 in_var_POSITION6;
|
||||
layout(location = 6) patch in vec3 in_var_POSITION7;
|
||||
layout(location = 7) patch in vec3 in_var_POSITION8;
|
||||
layout(location = 0) patch in vec3 in_var_CENTER;
|
||||
layout(location = 1) in vec3 in_var_POSITION[3];
|
||||
layout(location = 8) in vec2 in_var_TEXCOORD[3];
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
float _67 = gl_TessCoord.x * gl_TessCoord.x;
|
||||
float _68 = gl_TessCoord.y * gl_TessCoord.y;
|
||||
float _69 = gl_TessCoord.z * gl_TessCoord.z;
|
||||
float _70 = _67 * 3.0;
|
||||
float _71 = _68 * 3.0;
|
||||
float _72 = _69 * 3.0;
|
||||
gl_Position = cbPNTriangles.viewProj * vec4(((((((((((in_var_POSITION[0] * _69) * gl_TessCoord.z) + ((in_var_POSITION[1] * _67) * gl_TessCoord.x)) + ((in_var_POSITION[2] * _68) * gl_TessCoord.y)) + ((in_var_POSITION3 * _72) * gl_TessCoord.x)) + ((in_var_POSITION4 * gl_TessCoord.z) * _70)) + ((in_var_POSITION8 * _72) * gl_TessCoord.y)) + ((in_var_POSITION5 * _70) * gl_TessCoord.y)) + ((in_var_POSITION7 * gl_TessCoord.z) * _71)) + ((in_var_POSITION6 * gl_TessCoord.x) * _71)) + ((((in_var_CENTER * 6.0) * gl_TessCoord.z) * gl_TessCoord.x) * gl_TessCoord.y), 1.0);
|
||||
out_var_TEXCOORD0 = ((in_var_TEXCOORD[0] * gl_TessCoord.z) + (in_var_TEXCOORD[1] * gl_TessCoord.x)) + (in_var_TEXCOORD[2] * gl_TessCoord.y);
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#version 410
|
||||
layout(triangles) in;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbPNTriangles
|
||||
{
|
||||
layout(row_major) mat4 viewProj;
|
||||
vec4 lightDir;
|
||||
} cbPNTriangles;
|
||||
|
||||
layout(location = 2) patch in vec3 in_var_POSITION3;
|
||||
layout(location = 3) patch in vec3 in_var_POSITION4;
|
||||
layout(location = 4) patch in vec3 in_var_POSITION5;
|
||||
layout(location = 5) patch in vec3 in_var_POSITION6;
|
||||
layout(location = 6) patch in vec3 in_var_POSITION7;
|
||||
layout(location = 7) patch in vec3 in_var_POSITION8;
|
||||
layout(location = 0) patch in vec3 in_var_CENTER;
|
||||
layout(location = 1) in vec3 in_var_POSITION[3];
|
||||
layout(location = 8) in vec2 in_var_TEXCOORD[3];
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
float _67 = gl_TessCoord.x * gl_TessCoord.x;
|
||||
float _68 = gl_TessCoord.y * gl_TessCoord.y;
|
||||
float _69 = gl_TessCoord.z * gl_TessCoord.z;
|
||||
float _70 = _67 * 3.0;
|
||||
float _71 = _68 * 3.0;
|
||||
float _72 = _69 * 3.0;
|
||||
gl_Position = cbPNTriangles.viewProj * vec4(((((((((((in_var_POSITION[0] * _69) * gl_TessCoord.z) + ((in_var_POSITION[1] * _67) * gl_TessCoord.x)) + ((in_var_POSITION[2] * _68) * gl_TessCoord.y)) + ((in_var_POSITION3 * _72) * gl_TessCoord.x)) + ((in_var_POSITION4 * gl_TessCoord.z) * _70)) + ((in_var_POSITION8 * _72) * gl_TessCoord.y)) + ((in_var_POSITION5 * _70) * gl_TessCoord.y)) + ((in_var_POSITION7 * gl_TessCoord.z) * _71)) + ((in_var_POSITION6 * gl_TessCoord.x) * _71)) + ((((in_var_CENTER * 6.0) * gl_TessCoord.z) * gl_TessCoord.x) * gl_TessCoord.y), 1.0);
|
||||
out_var_TEXCOORD0 = ((in_var_TEXCOORD[0] * gl_TessCoord.z) + (in_var_TEXCOORD[1] * gl_TessCoord.x)) + (in_var_TEXCOORD[2] * gl_TessCoord.y);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct type_cbPNTriangles
|
||||
{
|
||||
float4x4 viewProj;
|
||||
float4 lightDir;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float2 out_var_TEXCOORD0;
|
||||
float4 gl_Position;
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float3 in_var_CENTER;
|
||||
float3 in_var_POSITION_0;
|
||||
float3 in_var_POSITION3;
|
||||
float3 in_var_POSITION_1;
|
||||
float3 in_var_POSITION4;
|
||||
float3 in_var_POSITION_2;
|
||||
float3 in_var_POSITION5;
|
||||
float3 in_var_POSITION6;
|
||||
float3 in_var_POSITION7;
|
||||
float3 in_var_POSITION8;
|
||||
float2 in_var_TEXCOORD_0;
|
||||
float2 in_var_TEXCOORD_1;
|
||||
float2 in_var_TEXCOORD_2;
|
||||
};
|
||||
|
||||
unknown main0_out main0(main0_in in [[stage_in]], constant type_cbPNTriangles& cbPNTriangles [[buffer(0)]], unsupported-built-in-type gl_TessLevelOuter [[unsupported-built-in]], unsupported-built-in-type gl_TessLevelInner [[unsupported-built-in]], unsupported-built-in-type gl_TessCoord [[unsupported-built-in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float3 in_var_POSITION[3] = {};
|
||||
float2 in_var_TEXCOORD[3] = {};
|
||||
in_var_POSITION[0] = in.in_var_POSITION_0;
|
||||
in_var_POSITION[1] = in.in_var_POSITION_1;
|
||||
in_var_POSITION[2] = in.in_var_POSITION_2;
|
||||
in_var_TEXCOORD[0] = in.in_var_TEXCOORD_0;
|
||||
in_var_TEXCOORD[1] = in.in_var_TEXCOORD_1;
|
||||
in_var_TEXCOORD[2] = in.in_var_TEXCOORD_2;
|
||||
float _67 = gl_TessCoord.x * gl_TessCoord.x;
|
||||
float _68 = gl_TessCoord.y * gl_TessCoord.y;
|
||||
float _69 = gl_TessCoord.z * gl_TessCoord.z;
|
||||
float _70 = _67 * 3.0;
|
||||
float _71 = _68 * 3.0;
|
||||
float _72 = _69 * 3.0;
|
||||
out.gl_Position = float4(((((((((((in_var_POSITION[0] * _69) * gl_TessCoord.z) + ((in_var_POSITION[1] * _67) * gl_TessCoord.x)) + ((in_var_POSITION[2] * _68) * gl_TessCoord.y)) + ((in.in_var_POSITION3 * _72) * gl_TessCoord.x)) + ((in.in_var_POSITION4 * gl_TessCoord.z) * _70)) + ((in.in_var_POSITION8 * _72) * gl_TessCoord.y)) + ((in.in_var_POSITION5 * _70) * gl_TessCoord.y)) + ((in.in_var_POSITION7 * gl_TessCoord.z) * _71)) + ((in.in_var_POSITION6 * gl_TessCoord.x) * _71)) + ((((in.in_var_CENTER * 6.0) * gl_TessCoord.z) * gl_TessCoord.x) * gl_TessCoord.y), 1.0) * cbPNTriangles.viewProj;
|
||||
out.out_var_TEXCOORD0 = ((in_var_TEXCOORD[0] * gl_TessCoord.z) + (in_var_TEXCOORD[1] * gl_TessCoord.x)) + (in_var_TEXCOORD[2] * gl_TessCoord.y);
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#version 300 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(points) in;
|
||||
layout(max_vertices = 4, triangle_strip) out;
|
||||
|
||||
const vec3 _42[4] = vec3[](vec3(-1.0, 1.0, 0.0), vec3(1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0), vec3(1.0, -1.0, 0.0));
|
||||
const vec2 _47[4] = vec2[](vec2(0.0, 1.0), vec2(1.0), vec2(0.0), vec2(1.0, 0.0));
|
||||
|
||||
layout(std140) uniform type_cbMain
|
||||
{
|
||||
layout(row_major) mat4 invView;
|
||||
layout(row_major) mat4 viewProj;
|
||||
} cbMain;
|
||||
|
||||
in vec4 in_var_POSITION[1];
|
||||
out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
for (int _54 = 0; _54 < 4; )
|
||||
{
|
||||
gl_Position = cbMain.viewProj * vec4((mat3(cbMain.invView[0].xyz, cbMain.invView[1].xyz, cbMain.invView[2].xyz) * (_42[_54] * 1.0)) + in_var_POSITION[0].xyz, 1.0);
|
||||
out_var_TEXCOORD0 = _47[_54];
|
||||
EmitVertex();
|
||||
_54++;
|
||||
continue;
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
layout(points) in;
|
||||
layout(max_vertices = 4, triangle_strip) out;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
const vec3 _42[4] = vec3[](vec3(-1.0, 1.0, 0.0), vec3(1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0), vec3(1.0, -1.0, 0.0));
|
||||
const vec2 _47[4] = vec2[](vec2(0.0, 1.0), vec2(1.0), vec2(0.0), vec2(1.0, 0.0));
|
||||
|
||||
layout(std140) uniform type_cbMain
|
||||
{
|
||||
layout(row_major) mat4 invView;
|
||||
layout(row_major) mat4 viewProj;
|
||||
} cbMain;
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION[1];
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
for (int _54 = 0; _54 < 4; )
|
||||
{
|
||||
gl_Position = cbMain.viewProj * vec4((mat3(cbMain.invView[0].xyz, cbMain.invView[1].xyz, cbMain.invView[2].xyz) * (_42[_54] * 1.0)) + in_var_POSITION[0].xyz, 1.0);
|
||||
out_var_TEXCOORD0 = _47[_54];
|
||||
EmitVertex();
|
||||
_54++;
|
||||
continue;
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#version 310 es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout(points) in;
|
||||
layout(max_vertices = 4, triangle_strip) out;
|
||||
|
||||
const vec3 _42[4] = vec3[](vec3(-1.0, 1.0, 0.0), vec3(1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0), vec3(1.0, -1.0, 0.0));
|
||||
const vec2 _47[4] = vec2[](vec2(0.0, 1.0), vec2(1.0), vec2(0.0), vec2(1.0, 0.0));
|
||||
|
||||
layout(binding = 0, std140) uniform type_cbMain
|
||||
{
|
||||
layout(row_major) mat4 invView;
|
||||
layout(row_major) mat4 viewProj;
|
||||
} cbMain;
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION[1];
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
for (int _54 = 0; _54 < 4; )
|
||||
{
|
||||
gl_Position = cbMain.viewProj * vec4((mat3(cbMain.invView[0].xyz, cbMain.invView[1].xyz, cbMain.invView[2].xyz) * (_42[_54] * 1.0)) + in_var_POSITION[0].xyz, 1.0);
|
||||
out_var_TEXCOORD0 = _47[_54];
|
||||
EmitVertex();
|
||||
_54++;
|
||||
continue;
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#version 410
|
||||
layout(points) in;
|
||||
layout(max_vertices = 4, triangle_strip) out;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
const vec3 _42[4] = vec3[](vec3(-1.0, 1.0, 0.0), vec3(1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0), vec3(1.0, -1.0, 0.0));
|
||||
const vec2 _47[4] = vec2[](vec2(0.0, 1.0), vec2(1.0), vec2(0.0), vec2(1.0, 0.0));
|
||||
|
||||
layout(std140) uniform type_cbMain
|
||||
{
|
||||
layout(row_major) mat4 invView;
|
||||
layout(row_major) mat4 viewProj;
|
||||
} cbMain;
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION[1];
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
for (int _54 = 0; _54 < 4; )
|
||||
{
|
||||
gl_Position = cbMain.viewProj * vec4((mat3(cbMain.invView[0].xyz, cbMain.invView[1].xyz, cbMain.invView[2].xyz) * (_42[_54] * 1.0)) + in_var_POSITION[0].xyz, 1.0);
|
||||
out_var_TEXCOORD0 = _47[_54];
|
||||
EmitVertex();
|
||||
_54++;
|
||||
continue;
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
static float4 in_var_COLOR;
|
||||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_COLOR : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : COLOR0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_COLOR = stage_input.in_var_COLOR;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = float4(out_var_SV_Target);
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
in highp vec4 in_var_COLOR;
|
||||
layout(location = 0) out highp vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
|
||||
layout(location = 0) in vec4 in_var_COLOR;
|
||||
out vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(location = 0) in highp vec4 in_var_COLOR;
|
||||
layout(location = 0) out highp vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
static float4 in_var_COLOR;
|
||||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_COLOR : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_COLOR = stage_input.in_var_COLOR;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = out_var_SV_Target;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#version 410
|
||||
|
||||
layout(location = 0) in vec4 in_var_COLOR;
|
||||
layout(location = 0) out vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
static float4 in_var_COLOR;
|
||||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_COLOR : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
out_var_SV_Target = in_var_COLOR;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_COLOR = stage_input.in_var_COLOR;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = out_var_SV_Target;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct PSMain_out
|
||||
{
|
||||
float4 out_var_SV_Target [[color(0)]];
|
||||
};
|
||||
|
||||
struct PSMain_in
|
||||
{
|
||||
float4 in_var_COLOR [[user(locn0)]];
|
||||
};
|
||||
|
||||
fragment PSMain_out PSMain(PSMain_in in [[stage_in]])
|
||||
{
|
||||
PSMain_out out = {};
|
||||
out.out_var_SV_Target = in.in_var_COLOR;
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
uniform float4 gl_HalfPixel;
|
||||
|
||||
static float4 gl_Position;
|
||||
static float4 in_var_POSITION;
|
||||
static float2 in_var_TEXCOORD0;
|
||||
static float2 out_var_TEXCOORD0;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_POSITION : TEXCOORD0;
|
||||
float2 in_var_TEXCOORD0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float2 out_var_TEXCOORD0 : TEXCOORD0;
|
||||
float4 gl_Position : POSITION;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w;
|
||||
gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_POSITION = stage_input.in_var_POSITION;
|
||||
in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.out_var_TEXCOORD0 = out_var_TEXCOORD0;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#version 300 es
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION;
|
||||
layout(location = 1) in vec2 in_var_TEXCOORD0;
|
||||
out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
in vec4 in_var_POSITION;
|
||||
in vec2 in_var_TEXCOORD0;
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#version 310 es
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION;
|
||||
layout(location = 1) in vec2 in_var_TEXCOORD0;
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
static float4 gl_Position;
|
||||
static float4 in_var_POSITION;
|
||||
static float2 in_var_TEXCOORD0;
|
||||
static float2 out_var_TEXCOORD0;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_POSITION : TEXCOORD0;
|
||||
float2 in_var_TEXCOORD0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float2 out_var_TEXCOORD0 : TEXCOORD0;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_POSITION = stage_input.in_var_POSITION;
|
||||
in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.out_var_TEXCOORD0 = out_var_TEXCOORD0;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#version 410
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION;
|
||||
layout(location = 1) in vec2 in_var_TEXCOORD0;
|
||||
layout(location = 0) out vec2 out_var_TEXCOORD0;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
static float4 gl_Position;
|
||||
static float4 in_var_POSITION;
|
||||
static float2 in_var_TEXCOORD0;
|
||||
static float2 out_var_TEXCOORD0;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_POSITION : TEXCOORD0;
|
||||
float2 in_var_TEXCOORD0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float2 out_var_TEXCOORD0 : TEXCOORD0;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
out_var_TEXCOORD0 = in_var_TEXCOORD0;
|
||||
gl_Position = in_var_POSITION;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_POSITION = stage_input.in_var_POSITION;
|
||||
in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.out_var_TEXCOORD0 = out_var_TEXCOORD0;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct VSMain_out
|
||||
{
|
||||
float2 out_var_TEXCOORD0 [[user(locn0)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct VSMain_in
|
||||
{
|
||||
float4 in_var_POSITION [[attribute(0)]];
|
||||
float2 in_var_TEXCOORD0 [[attribute(1)]];
|
||||
};
|
||||
|
||||
vertex VSMain_out VSMain(VSMain_in in [[stage_in]])
|
||||
{
|
||||
VSMain_out out = {};
|
||||
out.out_var_TEXCOORD0 = in.in_var_TEXCOORD0;
|
||||
out.gl_Position = in.in_var_POSITION;
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_float
|
||||
{
|
||||
highp float _m0[];
|
||||
} lumBuff;
|
||||
|
||||
layout(std140) uniform type_cbPS
|
||||
{
|
||||
highp float lumStrength;
|
||||
} cbPS;
|
||||
|
||||
uniform highp sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
|
||||
uniform highp sampler2D SPIRV_Cross_CombinedbloomTexlinearSampler;
|
||||
|
||||
in highp vec2 in_var_TEXCOORD0;
|
||||
layout(location = 0) out highp vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
highp vec4 _48 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0);
|
||||
highp vec3 _63 = (_48.xyz * (0.7200000286102294921875 / ((lumBuff._m0[0u] * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
|
||||
highp vec3 _67 = (_63 * (vec3(1.0) + (_63 * vec3(0.666666686534881591796875)))).xyz;
|
||||
highp vec3 _72 = (_67 / (vec3(1.0) + _67)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
|
||||
highp vec4 _74 = vec4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0;
|
||||
out_var_SV_Target = _74;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_float
|
||||
{
|
||||
float _m0[];
|
||||
} lumBuff;
|
||||
|
||||
layout(std140) uniform type_cbPS
|
||||
{
|
||||
float lumStrength;
|
||||
} cbPS;
|
||||
|
||||
uniform sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedbloomTexlinearSampler;
|
||||
|
||||
layout(location = 0) in vec2 in_var_TEXCOORD0;
|
||||
out vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 _48 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0);
|
||||
vec3 _63 = (_48.xyz * (0.7200000286102294921875 / ((lumBuff._m0[0u] * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
|
||||
vec3 _67 = (_63 * (vec3(1.0) + (_63 * vec3(0.666666686534881591796875)))).xyz;
|
||||
vec3 _72 = (_67 / (vec3(1.0) + _67)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
|
||||
vec4 _74 = vec4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0;
|
||||
out_var_SV_Target = _74;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(binding = 1, std430) readonly buffer type_StructuredBuffer_float
|
||||
{
|
||||
highp float _m0[];
|
||||
} lumBuff;
|
||||
|
||||
layout(binding = 0, std140) uniform type_cbPS
|
||||
{
|
||||
highp float lumStrength;
|
||||
} cbPS;
|
||||
|
||||
uniform highp sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
|
||||
uniform highp sampler2D SPIRV_Cross_CombinedbloomTexlinearSampler;
|
||||
|
||||
layout(location = 0) in highp vec2 in_var_TEXCOORD0;
|
||||
layout(location = 0) out highp vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
highp vec4 _48 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0);
|
||||
highp vec3 _63 = (_48.xyz * (0.7200000286102294921875 / ((lumBuff._m0[0u] * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
|
||||
highp vec3 _67 = (_63 * (vec3(1.0) + (_63 * vec3(0.666666686534881591796875)))).xyz;
|
||||
highp vec3 _72 = (_67 / (vec3(1.0) + _67)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
|
||||
highp vec4 _74 = vec4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0;
|
||||
out_var_SV_Target = _74;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
ByteAddressBuffer lumBuff : register(t1);
|
||||
cbuffer cbPS : register(b0)
|
||||
{
|
||||
float cbPS_lumStrength : packoffset(c0);
|
||||
};
|
||||
SamplerState pointSampler : register(s0);
|
||||
SamplerState linearSampler : register(s1);
|
||||
Texture2D<float4> colorTex : register(t0);
|
||||
Texture2D<float4> bloomTex : register(t2);
|
||||
|
||||
static float2 in_var_TEXCOORD0;
|
||||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 in_var_TEXCOORD0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _48 = colorTex.Sample(pointSampler, in_var_TEXCOORD0);
|
||||
float3 _63 = (_48.xyz * (0.7200000286102294921875f / ((asfloat(lumBuff.Load(0)) * cbPS_lumStrength) + 0.001000000047497451305389404296875f))).xyz;
|
||||
float3 _67 = (_63 * (1.0f.xxx + (_63 * 0.666666686534881591796875f.xxx))).xyz;
|
||||
float3 _72 = (_67 / (1.0f.xxx + _67)).xyz + (bloomTex.Sample(linearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625f);
|
||||
float4 _74 = float4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0f;
|
||||
out_var_SV_Target = _74;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = out_var_SV_Target;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#version 410
|
||||
|
||||
layout(std430) readonly buffer type_StructuredBuffer_float
|
||||
{
|
||||
float _m0[];
|
||||
} lumBuff;
|
||||
|
||||
layout(std140) uniform type_cbPS
|
||||
{
|
||||
float lumStrength;
|
||||
} cbPS;
|
||||
|
||||
uniform sampler2D SPIRV_Cross_CombinedcolorTexpointSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedbloomTexlinearSampler;
|
||||
|
||||
layout(location = 0) in vec2 in_var_TEXCOORD0;
|
||||
layout(location = 0) out vec4 out_var_SV_Target;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 _48 = texture(SPIRV_Cross_CombinedcolorTexpointSampler, in_var_TEXCOORD0);
|
||||
vec3 _63 = (_48.xyz * (0.7200000286102294921875 / ((lumBuff._m0[0u] * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
|
||||
vec3 _67 = (_63 * (vec3(1.0) + (_63 * vec3(0.666666686534881591796875)))).xyz;
|
||||
vec3 _72 = (_67 / (vec3(1.0) + _67)).xyz + (texture(SPIRV_Cross_CombinedbloomTexlinearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
|
||||
vec4 _74 = vec4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0;
|
||||
out_var_SV_Target = _74;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
ByteAddressBuffer lumBuff : register(t1);
|
||||
cbuffer cbPS : register(b0)
|
||||
{
|
||||
float cbPS_lumStrength : packoffset(c0);
|
||||
};
|
||||
SamplerState pointSampler : register(s0);
|
||||
SamplerState linearSampler : register(s1);
|
||||
Texture2D<float4> colorTex : register(t0);
|
||||
Texture2D<float4> bloomTex : register(t2);
|
||||
|
||||
static float2 in_var_TEXCOORD0;
|
||||
static float4 out_var_SV_Target;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float2 in_var_TEXCOORD0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 out_var_SV_Target : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _48 = colorTex.Sample(pointSampler, in_var_TEXCOORD0);
|
||||
float3 _63 = (_48.xyz * (0.7200000286102294921875f / ((asfloat(lumBuff.Load(0)) * cbPS_lumStrength) + 0.001000000047497451305389404296875f))).xyz;
|
||||
float3 _67 = (_63 * (1.0f.xxx + (_63 * 0.666666686534881591796875f.xxx))).xyz;
|
||||
float3 _72 = (_67 / (1.0f.xxx + _67)).xyz + (bloomTex.Sample(linearSampler, in_var_TEXCOORD0).xyz * 0.60000002384185791015625f);
|
||||
float4 _74 = float4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0f;
|
||||
out_var_SV_Target = _74;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0;
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.out_var_SV_Target = out_var_SV_Target;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct type_StructuredBuffer_float
|
||||
{
|
||||
float _m0[1];
|
||||
};
|
||||
|
||||
struct type_cbPS
|
||||
{
|
||||
float lumStrength;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 out_var_SV_Target [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 in_var_TEXCOORD0 [[user(locn0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], constant type_cbPS& cbPS [[buffer(0)]], const device type_StructuredBuffer_float& lumBuff [[buffer(1)]], texture2d<float> colorTex [[texture(0)]], texture2d<float> bloomTex [[texture(2)]], sampler pointSampler [[sampler(0)]], sampler linearSampler [[sampler(1)]], float4 gl_FragCoord [[position]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 _48 = colorTex.sample(pointSampler, in.in_var_TEXCOORD0);
|
||||
float3 _63 = (_48.xyz * (0.7200000286102294921875 / ((lumBuff._m0[0u] * cbPS.lumStrength) + 0.001000000047497451305389404296875))).xyz;
|
||||
float3 _67 = (_63 * (float3(1.0) + (_63 * float3(0.666666686534881591796875)))).xyz;
|
||||
float3 _72 = (_67 / (float3(1.0) + _67)).xyz + (bloomTex.sample(linearSampler, in.in_var_TEXCOORD0).xyz * 0.60000002384185791015625);
|
||||
float4 _74 = float4(_72.x, _72.y, _72.z, _48.w);
|
||||
_74.w = 1.0;
|
||||
out.out_var_SV_Target = _74;
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
cbuffer cbVS : register(b0)
|
||||
{
|
||||
column_major float4x4 cbVS_wvp : packoffset(c0);
|
||||
};
|
||||
uniform float4 gl_HalfPixel;
|
||||
|
||||
static float4 gl_Position;
|
||||
static float4 in_var_POSITION;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_POSITION : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : POSITION;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = mul(in_var_POSITION, cbVS_wvp);
|
||||
gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w;
|
||||
gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_POSITION = stage_input.in_var_POSITION;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#version 300 es
|
||||
|
||||
layout(std140) uniform type_cbVS
|
||||
{
|
||||
layout(row_major) mat4 wvp;
|
||||
} cbVS;
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = cbVS.wvp * in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#version 300
|
||||
#extension GL_ARB_separate_shader_objects : require
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbVS
|
||||
{
|
||||
layout(row_major) mat4 wvp;
|
||||
} cbVS;
|
||||
|
||||
in vec4 in_var_POSITION;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = cbVS.wvp * in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#version 310 es
|
||||
|
||||
layout(binding = 0, std140) uniform type_cbVS
|
||||
{
|
||||
layout(row_major) mat4 wvp;
|
||||
} cbVS;
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = cbVS.wvp * in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
cbuffer cbVS : register(b0)
|
||||
{
|
||||
column_major float4x4 cbVS_wvp : packoffset(c0);
|
||||
};
|
||||
|
||||
static float4 gl_Position;
|
||||
static float4 in_var_POSITION;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_POSITION : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = mul(in_var_POSITION, cbVS_wvp);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_POSITION = stage_input.in_var_POSITION;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#version 410
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
layout(std140) uniform type_cbVS
|
||||
{
|
||||
layout(row_major) mat4 wvp;
|
||||
} cbVS;
|
||||
|
||||
layout(location = 0) in vec4 in_var_POSITION;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = cbVS.wvp * in_var_POSITION;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
cbuffer cbVS : register(b0)
|
||||
{
|
||||
column_major float4x4 cbVS_wvp : packoffset(c0);
|
||||
};
|
||||
|
||||
static float4 gl_Position;
|
||||
static float4 in_var_POSITION;
|
||||
|
||||
struct SPIRV_Cross_Input
|
||||
{
|
||||
float4 in_var_POSITION : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
{
|
||||
gl_Position = mul(in_var_POSITION, cbVS_wvp);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||
{
|
||||
in_var_POSITION = stage_input.in_var_POSITION;
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
return stage_output;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct type_cbVS
|
||||
{
|
||||
float4x4 wvp;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 in_var_POSITION [[attribute(0)]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]], constant type_cbVS& cbVS [[buffer(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.gl_Position = in.in_var_POSITION * cbVS.wvp;
|
||||
return out;
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
SamplerState pointSampler : register(s0);
|
||||
SamplerState linearSampler : register(s1);
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
float4 PSMain() : SV_Target
|
||||
{
|
||||
return float4(0.2f, 0.4f, 0.6f, 1.0f);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
float4 VSMain() : SV_Position
|
||||
{
|
||||
return float4(1, 2, 3, 4);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
cbuffer cbMain : register(b0)
|
||||
{
|
||||
float4 tessellationFactor;
|
||||
};
|
||||
|
||||
struct VS_OUTPUT_HS_INPUT
|
||||
{
|
||||
float3 worldPos : WORLDPOS;
|
||||
float3 normal : NORMAL;
|
||||
float2 texCoord : TEXCOORD0;
|
||||
float3 lightTS : LIGHTVECTORTS;
|
||||
};
|
||||
|
||||
struct HS_CONSTANT_DATA_OUTPUT
|
||||
{
|
||||
float edges[3] : SV_TessFactor;
|
||||
float inside : SV_InsideTessFactor;
|
||||
};
|
||||
|
||||
struct HS_CONTROL_POINT_OUTPUT
|
||||
{
|
||||
float3 worldPos : WORLDPOS;
|
||||
float3 normal : NORMAL;
|
||||
float2 texCoord : TEXCOORD0;
|
||||
float3 lightTS : LIGHTVECTORTS;
|
||||
};
|
||||
|
||||
HS_CONSTANT_DATA_OUTPUT ConstantsHS(InputPatch<VS_OUTPUT_HS_INPUT, 3> p, uint patchID : SV_PrimitiveID)
|
||||
{
|
||||
HS_CONSTANT_DATA_OUTPUT output;
|
||||
|
||||
output.edges[0] = tessellationFactor.x;
|
||||
output.edges[1] = tessellationFactor.y;
|
||||
output.edges[2] = tessellationFactor.z;
|
||||
output.inside = tessellationFactor.w;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
[domain("tri")]
|
||||
[partitioning("fractional_odd")]
|
||||
[outputtopology("triangle_cw")]
|
||||
[outputcontrolpoints(3)]
|
||||
[patchconstantfunc("ConstantsHS")]
|
||||
[maxtessfactor(15.0)]
|
||||
HS_CONTROL_POINT_OUTPUT main(InputPatch<VS_OUTPUT_HS_INPUT, 3> inputPatch, uint uCPID : SV_OutputControlPointID)
|
||||
{
|
||||
HS_CONTROL_POINT_OUTPUT output;
|
||||
|
||||
output.worldPos = inputPatch[uCPID].worldPos.xyz;
|
||||
output.normal = inputPatch[uCPID].normal;
|
||||
output.texCoord = inputPatch[uCPID].texCoord;
|
||||
output.lightTS = inputPatch[uCPID].lightTS;
|
||||
|
||||
return output;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
struct Particle
|
||||
{
|
||||
float2 position;
|
||||
float2 velocity;
|
||||
};
|
||||
|
||||
struct ParticleForces
|
||||
{
|
||||
float2 acceleration;
|
||||
};
|
||||
|
||||
cbuffer cbSimulationConstants : register(b0)
|
||||
{
|
||||
float timeStep;
|
||||
float wallStiffness;
|
||||
|
||||
float4 gravity;
|
||||
float3 planes[4];
|
||||
};
|
||||
|
||||
RWStructuredBuffer<Particle> particlesRW : register(u0);
|
||||
StructuredBuffer<Particle> particlesRO : register(t0);
|
||||
|
||||
StructuredBuffer<ParticleForces> particlesForcesRO : register(t2);
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void main(uint3 dtid : SV_DispatchThreadID, uint gi : SV_GroupIndex)
|
||||
{
|
||||
const uint p_id = dtid.x;
|
||||
|
||||
float2 position = particlesRO[p_id].position;
|
||||
float2 velocity = particlesRO[p_id].velocity;
|
||||
float2 acceleration = particlesForcesRO[p_id].acceleration;
|
||||
|
||||
[unroll]
|
||||
for (uint i = 0 ; i < 4 ; ++i)
|
||||
{
|
||||
float dist = dot(float3(position, 1), planes[i]);
|
||||
acceleration += min(dist, 0) * -wallStiffness * planes[i].xy;
|
||||
}
|
||||
|
||||
acceleration += gravity.xy;
|
||||
|
||||
velocity += timeStep * acceleration;
|
||||
position += timeStep * velocity;
|
||||
|
||||
particlesRW[p_id].position = position;
|
||||
particlesRW[p_id].velocity = velocity;
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
cbuffer cbPNTriangles : register(b0)
|
||||
{
|
||||
float4x4 viewProj;
|
||||
float4 lightDir;
|
||||
}
|
||||
|
||||
struct HS_ConstantOutput
|
||||
{
|
||||
float tessFactor[3] : SV_TessFactor;
|
||||
float insideTessFactor : SV_InsideTessFactor;
|
||||
|
||||
float3 b210 : POSITION3;
|
||||
float3 b120 : POSITION4;
|
||||
float3 b021 : POSITION5;
|
||||
float3 b012 : POSITION6;
|
||||
float3 b102 : POSITION7;
|
||||
float3 b201 : POSITION8;
|
||||
float3 b111 : CENTER;
|
||||
};
|
||||
|
||||
struct HS_ControlPointOutput
|
||||
{
|
||||
float3 position : POSITION;
|
||||
float2 texCoord : TEXCOORD;
|
||||
};
|
||||
|
||||
struct DS_Output
|
||||
{
|
||||
float4 position : SV_Position;
|
||||
float2 texCoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
[domain("tri")]
|
||||
DS_Output main(HS_ConstantOutput hsConstantData, const OutputPatch<HS_ControlPointOutput, 3> input,
|
||||
float3 barycentricCoords : SV_DomainLocation)
|
||||
{
|
||||
DS_Output output;
|
||||
|
||||
float u = barycentricCoords.x;
|
||||
float v = barycentricCoords.y;
|
||||
float w = barycentricCoords.z;
|
||||
|
||||
float uu = u * u;
|
||||
float vv = v * v;
|
||||
float ww = w * w;
|
||||
float uu3 = uu * 3;
|
||||
float vv3 = vv * 3;
|
||||
float ww3 = ww * 3;
|
||||
|
||||
float3 position = input[0].position * ww * w +
|
||||
input[1].position * uu * u +
|
||||
input[2].position * vv * v +
|
||||
hsConstantData.b210 * ww3 * u +
|
||||
hsConstantData.b120 * w * uu3 +
|
||||
hsConstantData.b201 * ww3 * v +
|
||||
hsConstantData.b021 * uu3 * v +
|
||||
hsConstantData.b102 * w * vv3 +
|
||||
hsConstantData.b012 * u * vv3 +
|
||||
hsConstantData.b111 * 6 * w * u * v;
|
||||
|
||||
output.position = mul(float4(position, 1), viewProj);
|
||||
|
||||
output.texCoord = input[0].texCoord * w + input[1].texCoord * u + input[2].texCoord * v;
|
||||
|
||||
return output;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
cbuffer cbMain : register(b0)
|
||||
{
|
||||
matrix invView;
|
||||
matrix viewProj;
|
||||
};
|
||||
|
||||
struct GS_PARTICLE_INPUT
|
||||
{
|
||||
float4 wsPos : POSITION;
|
||||
};
|
||||
|
||||
struct PS_PARTICLE_INPUT
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
[maxvertexcount(4)]
|
||||
void main(point GS_PARTICLE_INPUT input[1], inout TriangleStream<PS_PARTICLE_INPUT> spriteStream)
|
||||
{
|
||||
const float3 quadPositions[4] =
|
||||
{
|
||||
float3(-1, 1, 0),
|
||||
float3( 1, 1, 0),
|
||||
float3(-1, -1, 0),
|
||||
float3( 1, -1, 0),
|
||||
};
|
||||
const float2 quadTexcoords[4] =
|
||||
{
|
||||
float2(0, 1),
|
||||
float2(1, 1),
|
||||
float2(0, 0),
|
||||
float2(1, 0),
|
||||
};
|
||||
|
||||
PS_PARTICLE_INPUT output;
|
||||
|
||||
[unroll]
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
float3 position = quadPositions[i] * FIXED_VERTEX_RADIUS;
|
||||
position = mul(position, (float3x3)invView) + input[0].wsPos.xyz;
|
||||
output.pos = mul(float4(position, 1.0f), viewProj);
|
||||
|
||||
output.tex = quadTexcoords[i];
|
||||
|
||||
spriteStream.Append(output);
|
||||
}
|
||||
spriteStream.RestartStrip();
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
float4 PSMain(float4 color : COLOR) : SV_Target
|
||||
{
|
||||
return color;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
void VSMain(float4 pos : POSITION,
|
||||
float2 tex : TEXCOORD0,
|
||||
out float2 oTex : TEXCOORD0,
|
||||
out float4 oPos : SV_Position)
|
||||
{
|
||||
oTex = tex;
|
||||
oPos = pos;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "Common.hlsli"
|
||||
|
||||
struct PSInput
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
Texture2D colorTex : register(t0);
|
||||
StructuredBuffer<float> lumBuff : register(t1);
|
||||
Texture2D bloomTex : register(t2);
|
||||
|
||||
static const float MIDDLE_GRAY = 0.72f;
|
||||
static const float LUM_WHITE = 1.5f;
|
||||
|
||||
cbuffer cbPS : register(b0)
|
||||
{
|
||||
float lumStrength;
|
||||
};
|
||||
|
||||
float4 main(PSInput input) : SV_Target
|
||||
{
|
||||
float4 color = colorTex.Sample(pointSampler, input.tex);
|
||||
float3 bloom = bloomTex.Sample(linearSampler, input.tex).xyz;
|
||||
float lum = lumBuff[0] * lumStrength;
|
||||
|
||||
color.rgb *= MIDDLE_GRAY / (lum + 0.001f);
|
||||
color.rgb *= (1.0f + color.rgb / LUM_WHITE);
|
||||
color.rgb /= (1.0f + color.rgb);
|
||||
|
||||
color.rgb += 0.6f * bloom;
|
||||
color.a = 1.0f;
|
||||
|
||||
return color;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
cbuffer cbVS : register(b0)
|
||||
{
|
||||
float4x4 wvp;
|
||||
};
|
||||
|
||||
void main(float4 pos : POSITION,
|
||||
out float4 oPos : SV_Position)
|
||||
{
|
||||
oPos = mul(pos, wvp);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
# All files and folders in this folder should be ignored
|
||||
*
|
|
@ -0,0 +1,522 @@
|
|||
/*
|
||||
* ShaderConductor
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
* to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <ShaderConductor/ShaderConductor.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
using namespace ShaderConductor;
|
||||
|
||||
namespace
|
||||
{
|
||||
std::vector<uint8_t> LoadFile(const std::string& name, bool isText)
|
||||
{
|
||||
std::vector<uint8_t> ret;
|
||||
std::ifstream file(name, std::ios_base::in | (isText ? 0 : std::ios_base::binary));
|
||||
if (file)
|
||||
{
|
||||
file.seekg(0, std::ios::end);
|
||||
ret.resize(file.tellg());
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.read(reinterpret_cast<char*>(ret.data()), ret.size());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TrimZeros(std::vector<uint8_t>* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
while (!data->empty() && (data->back() == '\0'))
|
||||
{
|
||||
data->pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
void HlslToAnyTest(const std::string& name, const Compiler::SourceDesc& source, const Compiler::TargetDesc& target)
|
||||
{
|
||||
static const std::string extMap[] = { "dxil", "spv", "hlsl", "glsl", "essl", "msl" };
|
||||
static_assert(sizeof(extMap) / sizeof(extMap[0]) == static_cast<uint32_t>(ShadingLanguage::NumShadingLanguages),
|
||||
"extMap doesn't match with the number of shading languages.");
|
||||
|
||||
const auto result = Compiler::Compile(source, target);
|
||||
|
||||
EXPECT_FALSE(result.hasError);
|
||||
EXPECT_STREQ(result.errorWarningMsg.c_str(), "");
|
||||
EXPECT_TRUE(result.isText);
|
||||
|
||||
std::string compareName = name;
|
||||
if (!target.version.empty())
|
||||
{
|
||||
compareName += "." + std::string(target.version);
|
||||
}
|
||||
compareName += "." + extMap[static_cast<uint32_t>(target.language)];
|
||||
|
||||
std::vector<uint8_t> expected = LoadFile(TEST_DATA_DIR "Expected/" + std::string(compareName), result.isText);
|
||||
if (result.isText)
|
||||
{
|
||||
TrimZeros(&expected);
|
||||
}
|
||||
|
||||
const auto& actual = result.target;
|
||||
if (expected != actual)
|
||||
{
|
||||
if (!actual.empty())
|
||||
{
|
||||
std::ofstream actual_file(TEST_DATA_DIR "Result/" + std::string(compareName),
|
||||
std::ios_base::out | (result.isText ? 0 : std::ios_base::binary));
|
||||
actual_file.write(reinterpret_cast<const char*>(actual.data()), actual.size());
|
||||
}
|
||||
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
}
|
||||
|
||||
class TestBase : public testing::Test
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
for (auto& src : m_combinations)
|
||||
{
|
||||
const std::string& name = std::get<0>(src);
|
||||
Compiler::SourceDesc& source = std::get<1>(src);
|
||||
|
||||
source.fileName = TEST_DATA_DIR "Input/" + name + ".hlsl";
|
||||
source.source = std::string(reinterpret_cast<char*>(LoadFile(source.fileName, true).data()));
|
||||
}
|
||||
}
|
||||
|
||||
void RunTests(ShadingLanguage targetSl)
|
||||
{
|
||||
for (const auto& combination : m_combinations)
|
||||
{
|
||||
for (const auto& target : std::get<2>(combination))
|
||||
{
|
||||
if (std::get<0>(target) && (std::get<1>(target).language == targetSl))
|
||||
{
|
||||
HlslToAnyTest(std::get<0>(combination), std::get<1>(combination), std::get<1>(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<std::tuple<std::string, Compiler::SourceDesc, std::vector<std::tuple<bool, Compiler::TargetDesc>>>> m_combinations;
|
||||
};
|
||||
|
||||
class VertexShaderTest : public TestBase
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
m_combinations =
|
||||
{
|
||||
{
|
||||
"Constant_VS",
|
||||
{ "", "", "VSMain", ShaderStage::VertexShader },
|
||||
{
|
||||
{ true, { ShadingLanguage::Hlsl, "30" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "40" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
{
|
||||
"PassThrough_VS",
|
||||
{ "", "", "VSMain", ShaderStage::VertexShader },
|
||||
{
|
||||
{ true, { ShadingLanguage::Hlsl, "30" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "40" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
{
|
||||
"Transform_VS",
|
||||
{ "", "", "", ShaderStage::VertexShader },
|
||||
{
|
||||
{ true, { ShadingLanguage::Hlsl, "30" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "40" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
TestBase::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
class PixelShaderTest : public TestBase
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
m_combinations =
|
||||
{
|
||||
{
|
||||
"Constant_PS",
|
||||
{ "", "", "PSMain", ShaderStage::PixelShader },
|
||||
{
|
||||
{ true, { ShadingLanguage::Hlsl, "30" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "40" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
{
|
||||
"PassThrough_PS",
|
||||
{ "", "", "PSMain", ShaderStage::PixelShader },
|
||||
{
|
||||
{ true, { ShadingLanguage::Hlsl, "30" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "40" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
{
|
||||
"ToneMapping_PS",
|
||||
{ "", "", "", ShaderStage::PixelShader },
|
||||
{
|
||||
{ false, { ShadingLanguage::Hlsl, "30" } }, // TODO Github #6: Separate image and samplers not supported
|
||||
{ true, { ShadingLanguage::Hlsl, "40" } },
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
TestBase::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
class GeometryShaderTest : public TestBase
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
m_combinations =
|
||||
{
|
||||
{
|
||||
"Particle_GS",
|
||||
{ "", "", "", ShaderStage::GeometryShader, { { "FIXED_VERTEX_RADIUS", "5.0" } } },
|
||||
{
|
||||
{ false, { ShadingLanguage::Hlsl, "30" } }, // No GS in HLSL SM3
|
||||
{ false, { ShadingLanguage::Hlsl, "40" } }, // TODO Github #4: Unsupported execution model
|
||||
{ false, { ShadingLanguage::Hlsl, "50" } }, // TODO Github #4: Unsupported execution model
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ false, { ShadingLanguage::Msl } }, // No GS in MSL
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
TestBase::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
class HullShaderTest : public TestBase
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
m_combinations =
|
||||
{
|
||||
{
|
||||
"DetailTessellation_HS",
|
||||
{ "", "", "", ShaderStage::HullShader },
|
||||
{
|
||||
{ false, { ShadingLanguage::Hlsl, "30" } }, // No HS in HLSL SM3
|
||||
{ false, { ShadingLanguage::Hlsl, "40" } }, // No HS in HLSL SM4
|
||||
{ false, { ShadingLanguage::Hlsl, "50" } }, // TODO Github #5: Unsupported builtin
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
TestBase::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
class DomainShaderTest : public TestBase
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
m_combinations =
|
||||
{
|
||||
{
|
||||
"PNTriangles_DS",
|
||||
{ "", "", "", ShaderStage::DomainShader },
|
||||
{
|
||||
{ false, { ShadingLanguage::Hlsl, "30" } }, // No HS in HLSL SM3
|
||||
{ false, { ShadingLanguage::Hlsl, "40" } }, // No HS in HLSL SM4
|
||||
{ false, { ShadingLanguage::Hlsl, "50" } }, // TODO Github #5: Unsupported builtin
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ true, { ShadingLanguage::Essl, "300" } },
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
TestBase::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
class ComputeShaderTest : public TestBase
|
||||
{
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
m_combinations =
|
||||
{
|
||||
{
|
||||
"Fluid_CS",
|
||||
{ "", "", "", ShaderStage::ComputeShader },
|
||||
{
|
||||
{ false, { ShadingLanguage::Hlsl, "30" } }, // No CS in HLSL SM3
|
||||
{ false, { ShadingLanguage::Hlsl, "40" } }, // No CS in HLSL SM4
|
||||
{ true, { ShadingLanguage::Hlsl, "50" } },
|
||||
|
||||
{ true, { ShadingLanguage::Glsl, "300" } },
|
||||
{ true, { ShadingLanguage::Glsl, "410" } },
|
||||
|
||||
{ false, { ShadingLanguage::Essl, "300" } }, // No CS in OpenGL ES 3.0
|
||||
{ true, { ShadingLanguage::Essl, "310" } },
|
||||
|
||||
{ true, { ShadingLanguage::Msl } },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
TestBase::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST_F(VertexShaderTest, ToHlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Hlsl);
|
||||
}
|
||||
|
||||
TEST_F(VertexShaderTest, ToGlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Glsl);
|
||||
}
|
||||
|
||||
TEST_F(VertexShaderTest, ToEssl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Essl);
|
||||
}
|
||||
|
||||
TEST_F(VertexShaderTest, ToMsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Msl);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(PixelShaderTest, ToHlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Hlsl);
|
||||
}
|
||||
|
||||
TEST_F(PixelShaderTest, ToGlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Glsl);
|
||||
}
|
||||
|
||||
TEST_F(PixelShaderTest, ToEssl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Essl);
|
||||
}
|
||||
|
||||
TEST_F(PixelShaderTest, ToMsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Msl);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(GeometryShaderTest, ToHlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Hlsl);
|
||||
}
|
||||
|
||||
TEST_F(GeometryShaderTest, ToGlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Glsl);
|
||||
}
|
||||
|
||||
TEST_F(GeometryShaderTest, ToEssl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Essl);
|
||||
}
|
||||
|
||||
TEST_F(GeometryShaderTest, ToMsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Msl);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(HullShaderTest, ToHlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Hlsl);
|
||||
}
|
||||
|
||||
TEST_F(HullShaderTest, ToGlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Glsl);
|
||||
}
|
||||
|
||||
TEST_F(HullShaderTest, ToEssl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Essl);
|
||||
}
|
||||
|
||||
TEST_F(HullShaderTest, ToMsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Msl);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(DomainShaderTest, ToHlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Hlsl);
|
||||
}
|
||||
|
||||
TEST_F(DomainShaderTest, ToGlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Glsl);
|
||||
}
|
||||
|
||||
TEST_F(DomainShaderTest, ToEssl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Essl);
|
||||
}
|
||||
|
||||
TEST_F(DomainShaderTest, ToMsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Msl);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ComputeShaderTest, ToHlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Hlsl);
|
||||
}
|
||||
|
||||
TEST_F(ComputeShaderTest, ToGlsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Glsl);
|
||||
}
|
||||
|
||||
TEST_F(ComputeShaderTest, ToEssl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Essl);
|
||||
}
|
||||
|
||||
TEST_F(ComputeShaderTest, ToMsl)
|
||||
{
|
||||
RunTests(ShadingLanguage::Msl);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
int retVal = RUN_ALL_TESTS();
|
||||
if (retVal != 0)
|
||||
{
|
||||
getchar();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
set(EXE_NAME ShaderConductorCmd)
|
||||
|
||||
set(SOURCE_FILES
|
||||
ShaderConductorCmd.cpp
|
||||
)
|
||||
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
include_directories(
|
||||
${SC_ROOT_DIR}/Include
|
||||
${SC_ROOT_DIR}/External/cxxopts/include
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
)
|
||||
|
||||
add_executable(${EXE_NAME} ${SOURCE_FILES})
|
||||
|
||||
target_link_libraries(${EXE_NAME} ShaderConductor)
|
||||
|
||||
add_dependencies(${EXE_NAME} ShaderConductor)
|
||||
|
||||
set_target_properties(${EXE_NAME} PROPERTIES FOLDER "Tools")
|
|
@ -0,0 +1,188 @@
|
|||
/*
|
||||
* ShaderConductor
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
* to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <ShaderConductor/ShaderConductor.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4819)
|
||||
#endif
|
||||
#include <cxxopts.hpp>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
cxxopts::Options options("ShaderConductorCmd", "A tool for compiling HLSL to many shader languages.");
|
||||
options.add_options()
|
||||
("E,entry", "Entry point of the shader", cxxopts::value<std::string>()->default_value("main"))
|
||||
("I,input", "Input file name", cxxopts::value<std::string>())("O,output", "Output file name", cxxopts::value<std::string>())
|
||||
("S,stage", "Shader stage: vs, ps, gs, hs, ds, cs", cxxopts::value<std::string>())
|
||||
("T,target", "Target shading language: dxil, spirv, hlsl, glsl, essl, msl", cxxopts::value<std::string>()->default_value("dxil"))
|
||||
("V,version", "The version of target shading language", cxxopts::value<std::string>()->default_value(""));
|
||||
|
||||
auto opts = options.parse(argc, argv);
|
||||
|
||||
if ((opts.count("input") == 0) || (opts.count("stage") == 0))
|
||||
{
|
||||
std::cerr << "COULDN'T find <input> or <stage> in command line parameters." << std::endl;
|
||||
std::cerr << options.help() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
using namespace ShaderConductor;
|
||||
|
||||
Compiler::SourceDesc sourceDesc;
|
||||
Compiler::TargetDesc targetDesc;
|
||||
|
||||
sourceDesc.fileName = opts["input"].as<std::string>();
|
||||
const auto targetName = opts["target"].as<std::string>();
|
||||
targetDesc.version = opts["version"].as<std::string>();
|
||||
|
||||
const auto stageName = opts["stage"].as<std::string>();
|
||||
if (stageName == "vs")
|
||||
{
|
||||
sourceDesc.stage = ShaderStage::VertexShader;
|
||||
}
|
||||
else if (stageName == "ps")
|
||||
{
|
||||
sourceDesc.stage = ShaderStage::PixelShader;
|
||||
}
|
||||
else if (stageName == "gs")
|
||||
{
|
||||
sourceDesc.stage = ShaderStage::GeometryShader;
|
||||
}
|
||||
else if (stageName == "hs")
|
||||
{
|
||||
sourceDesc.stage = ShaderStage::HullShader;
|
||||
}
|
||||
else if (stageName == "ds")
|
||||
{
|
||||
sourceDesc.stage = ShaderStage::DomainShader;
|
||||
}
|
||||
else if (stageName == "cs")
|
||||
{
|
||||
sourceDesc.stage = ShaderStage::ComputeShader;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Invalid shader stage: " << stageName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
sourceDesc.entryPoint = opts["entry"].as<std::string>();
|
||||
|
||||
if (targetName == "dxil")
|
||||
{
|
||||
targetDesc.language = ShadingLanguage::Dxil;
|
||||
}
|
||||
else if (targetName == "spirv")
|
||||
{
|
||||
targetDesc.language = ShadingLanguage::SpirV;
|
||||
}
|
||||
else if (targetName == "hlsl")
|
||||
{
|
||||
targetDesc.language = ShadingLanguage::Hlsl;
|
||||
}
|
||||
else if (targetName == "glsl")
|
||||
{
|
||||
targetDesc.language = ShadingLanguage::Glsl;
|
||||
}
|
||||
else if (targetName == "essl")
|
||||
{
|
||||
targetDesc.language = ShadingLanguage::Essl;
|
||||
}
|
||||
else if (targetName == "msl")
|
||||
{
|
||||
targetDesc.language = ShadingLanguage::Msl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Invalid target shading language: " << targetName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string outputName;
|
||||
if (opts.count("output") == 0)
|
||||
{
|
||||
static const std::string extMap[] = { "dxil", "spv", "hlsl", "glsl", "essl", "msl" };
|
||||
static_assert(sizeof(extMap) / sizeof(extMap[0]) == static_cast<uint32_t>(ShadingLanguage::NumShadingLanguages),
|
||||
"extMap doesn't match with the number of shading languages.");
|
||||
outputName = sourceDesc.fileName + "." + extMap[static_cast<uint32_t>(targetDesc.language)];
|
||||
}
|
||||
else
|
||||
{
|
||||
outputName = opts["output"].as<std::string>();
|
||||
}
|
||||
|
||||
{
|
||||
std::ifstream inputFile(sourceDesc.fileName, std::ios_base::binary);
|
||||
if (!inputFile)
|
||||
{
|
||||
std::cerr << "COULDN'T load the input file: " << sourceDesc.fileName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
inputFile.seekg(0, std::ios::end);
|
||||
sourceDesc.source.resize(inputFile.tellg());
|
||||
inputFile.seekg(0, std::ios::beg);
|
||||
inputFile.read(&sourceDesc.source[0], sourceDesc.source.size());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
const auto result = Compiler::Compile(std::move(sourceDesc), std::move(targetDesc));
|
||||
|
||||
if (!result.errorWarningMsg.empty())
|
||||
{
|
||||
std::cerr << "Error or warning form shader compiler: " << std::endl << result.errorWarningMsg << std::endl;
|
||||
}
|
||||
if (!result.target.empty())
|
||||
{
|
||||
std::ofstream outputFile(outputName, std::ios_base::binary);
|
||||
if (!outputFile)
|
||||
{
|
||||
std::cerr << "COULDN'T open the output file: " << outputName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
outputFile.write(reinterpret_cast<const char*>(result.target.data()), result.target.size());
|
||||
|
||||
std::cout << "The compiled file is saved to " << outputName << std::endl;
|
||||
}
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
std::cerr << ex.what() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Загрузка…
Ссылка в новой задаче