summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-03-28 22:14:33 -0700
committerGitHub <noreply@github.com>2022-03-28 22:14:33 -0700
commit255fd5873f65a6b01d5385c277d55612dc3cc587 (patch)
tree54eda0ae98bc9c1b30ca75e534ca203d8e03f241
parent79b81083b75dc0abdbb8184568dbe36d082e04f3 (diff)
Allow slangc to generate exe from .slang file. (#2170)
-rw-r--r--.gitignore5
-rw-r--r--build/visual-studio/heterogeneous-hello-world/heterogeneous-first-gen.vcxproj168
-rw-r--r--build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj324
-rw-r--r--build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj.filters21
-rw-r--r--build/visual-studio/run-generators/run-generators.vcxproj17
-rw-r--r--build/visual-studio/run-generators/run-generators.vcxproj.filters3
-rw-r--r--build/visual-studio/slang-rt/slang-rt.vcxproj396
-rw-r--r--build/visual-studio/slang-rt/slang-rt.vcxproj.filters326
-rw-r--r--build/visual-studio/slang/slang.vcxproj1
-rw-r--r--build/visual-studio/slang/slang.vcxproj.filters3
-rw-r--r--examples/cpu-hello-world/main.cpp2
-rw-r--r--examples/heterogeneous-hello-world/main.cpp273
-rw-r--r--examples/heterogeneous-hello-world/main.slang10
-rw-r--r--examples/heterogeneous-hello-world/shader.slang76
-rw-r--r--prelude/slang-cpp-host-prelude.h16
-rw-r--r--premake5.lua47
-rw-r--r--slang.h9
-rw-r--r--slang.sln14
-rw-r--r--source/compiler-core/slang-downstream-compiler.h5
-rw-r--r--source/compiler-core/slang-gcc-compiler-util.cpp10
-rw-r--r--source/compiler-core/slang-visual-studio-compiler-util.cpp16
-rw-r--r--source/core/slang-common.h19
-rw-r--r--source/core/slang-smart-pointer.h5
-rw-r--r--source/core/slang-string.h14
-rw-r--r--source/core/slang-token-reader.cpp3
-rw-r--r--source/core/slang-token-reader.h2
-rw-r--r--source/core/slang-type-convert-util.cpp1
-rw-r--r--source/core/slang-type-text-util.cpp7
-rw-r--r--source/slang/core.meta.slang18
-rw-r--r--source/slang/slang-ast-modifier.h4
-rw-r--r--source/slang/slang-compiler.cpp91
-rwxr-xr-xsource/slang/slang-compiler.h13
-rw-r--r--source/slang/slang-emit-c-like.cpp37
-rw-r--r--source/slang/slang-emit-cpp.cpp183
-rw-r--r--source/slang/slang-emit.cpp11
-rw-r--r--source/slang/slang-ir-inst-defs.h6
-rw-r--r--source/slang/slang-ir-insts.h30
-rw-r--r--source/slang/slang-lower-to-ir.cpp15
-rw-r--r--source/slang/slang-mangle.cpp4
-rw-r--r--source/slang/slang-options.cpp10
-rw-r--r--source/slang/slang-parameter-binding.cpp6
-rw-r--r--source/slang/slang-type-layout.cpp12
-rw-r--r--source/slang/slang.cpp12
-rw-r--r--tools/gfx/cpu/render-cpu.cpp2
-rw-r--r--tools/render-test/render-test-main.cpp2
-rw-r--r--tools/slang-embed/slang-embed.cpp10
-rw-r--r--tools/slang-test/slang-test-main.cpp13
47 files changed, 1080 insertions, 1192 deletions
diff --git a/.gitignore b/.gitignore
index bf49ea7d7..f2c9be351 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,3 +62,8 @@ prelude/*.h.cpp
/examples/heterogeneous-hello-world/shader.cpp
/multiple-definitions.hlsl
/external/slang-llvm/
+
+build/**/*.tlog
+build/**/*.lastbuildstate
+build/**/*.recipe
+build/**/*.log
diff --git a/build/visual-studio/heterogeneous-hello-world/heterogeneous-first-gen.vcxproj b/build/visual-studio/heterogeneous-hello-world/heterogeneous-first-gen.vcxproj
deleted file mode 100644
index a2181ad08..000000000
--- a/build/visual-studio/heterogeneous-hello-world/heterogeneous-first-gen.vcxproj
+++ /dev/null
@@ -1,168 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|ARM">
- <Configuration>Debug</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug aarch64|Win32">
- <Configuration>Debug aarch64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug aarch64|x64">
- <Configuration>Debug aarch64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug aarch64|ARM">
- <Configuration>Debug aarch64</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM">
- <Configuration>Release</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release aarch64|Win32">
- <Configuration>Release aarch64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release aarch64|x64">
- <Configuration>Release aarch64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release aarch64|ARM">
- <Configuration>Release aarch64</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{3E8C6F8B-AAC3-B722-B3CD-1B461F84DE1B}</ProjectGuid>
- <IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>heterogeneous-first-gen</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>..\..\..\bin\windows-x86\debug\</OutDir>
- <IntDir>obj\x86\Debug\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <OutDir>..\..\..\bin\windows-x64\debug\</OutDir>
- <IntDir>obj\x64\Debug\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
- <OutDir>..\..\..\bin\windows-aarch64\debug\</OutDir>
- <IntDir>obj\aarch64\Debug\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>..\..\..\bin\windows-x86\release\</OutDir>
- <IntDir>obj\x86\Release\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <OutDir>..\..\..\bin\windows-x64\release\</OutDir>
- <IntDir>obj\x64\Release\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
- <OutDir>..\..\..\bin\windows-aarch64\release\</OutDir>
- <IntDir>obj\aarch64\Release\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <PreBuildEvent>
- <Command>"../../../bin/windows-x86/debug/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <PreBuildEvent>
- <Command>"../../../bin/windows-x64/debug/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
- <PreBuildEvent>
- <Command>"../../../bin/windows-aarch64/debug/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <PreBuildEvent>
- <Command>"../../../bin/windows-x86/release/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <PreBuildEvent>
- <Command>"../../../bin/windows-x64/release/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
- <PreBuildEvent>
- <Command>"../../../bin/windows-aarch64/release/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ProjectReference Include="..\slangc\slangc.vcxproj">
- <Project>{D56CBCEB-1EB5-4CA8-AEC4-48EA35ED61C7}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj b/build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj
deleted file mode 100644
index 3e3049f65..000000000
--- a/build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj
+++ /dev/null
@@ -1,324 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|ARM">
- <Configuration>Debug</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug aarch64|Win32">
- <Configuration>Debug aarch64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug aarch64|x64">
- <Configuration>Debug aarch64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug aarch64|ARM">
- <Configuration>Debug aarch64</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM">
- <Configuration>Release</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release aarch64|Win32">
- <Configuration>Release aarch64</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release aarch64|x64">
- <Configuration>Release aarch64</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release aarch64|ARM">
- <Configuration>Release aarch64</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{150CAA5A-0177-6A66-AA92-CFCB96DC2D49}</ProjectGuid>
- <IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>heterogeneous-hello-world</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
- <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
- <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>..\..\..\bin\windows-x86\debug\</OutDir>
- <IntDir>..\..\..\intermediate\windows-x86\debug\heterogeneous-hello-world\</IntDir>
- <TargetName>heterogeneous-hello-world</TargetName>
- <TargetExt>.exe</TargetExt>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>..\..\..\bin\windows-x64\debug\</OutDir>
- <IntDir>..\..\..\intermediate\windows-x64\debug\heterogeneous-hello-world\</IntDir>
- <TargetName>heterogeneous-hello-world</TargetName>
- <TargetExt>.exe</TargetExt>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>..\..\..\bin\windows-aarch64\debug\</OutDir>
- <IntDir>..\..\..\intermediate\windows-aarch64\debug\heterogeneous-hello-world\</IntDir>
- <TargetName>heterogeneous-hello-world</TargetName>
- <TargetExt>.exe</TargetExt>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>..\..\..\bin\windows-x86\release\</OutDir>
- <IntDir>..\..\..\intermediate\windows-x86\release\heterogeneous-hello-world\</IntDir>
- <TargetName>heterogeneous-hello-world</TargetName>
- <TargetExt>.exe</TargetExt>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>..\..\..\bin\windows-x64\release\</OutDir>
- <IntDir>..\..\..\intermediate\windows-x64\release\heterogeneous-hello-world\</IntDir>
- <TargetName>heterogeneous-hello-world</TargetName>
- <TargetExt>.exe</TargetExt>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>..\..\..\bin\windows-aarch64\release\</OutDir>
- <IntDir>..\..\..\intermediate\windows-aarch64\release\heterogeneous-hello-world\</IntDir>
- <TargetName>heterogeneous-hello-world</TargetName>
- <TargetExt>.exe</TargetExt>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\tools;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <Optimization>Disabled</Optimization>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <PreBuildEvent>
- <Command>"../../../bin/windows-x86/debug/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- <Message>Generating shader.cpp in ../../../examples/heterogeneous-hello-world/</Message>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\tools;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <Optimization>Disabled</Optimization>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <PreBuildEvent>
- <Command>"../../../bin/windows-x64/debug/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- <Message>Generating shader.cpp in ../../../examples/heterogeneous-hello-world/</Message>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\tools;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <Optimization>Disabled</Optimization>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- <PreBuildEvent>
- <Command>"../../../bin/windows-aarch64/debug/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- <Message>Generating shader.cpp in ../../../examples/heterogeneous-hello-world/</Message>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\tools;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <Optimization>Full</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <MinimalRebuild>false</MinimalRebuild>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- <PreBuildEvent>
- <Command>"../../../bin/windows-x86/release/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- <Message>Generating shader.cpp in ../../../examples/heterogeneous-hello-world/</Message>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\tools;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <Optimization>Full</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <MinimalRebuild>false</MinimalRebuild>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- <PreBuildEvent>
- <Command>"../../../bin/windows-x64/release/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- <Message>Generating shader.cpp in ../../../examples/heterogeneous-hello-world/</Message>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\tools;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <Optimization>Full</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <MinimalRebuild>false</MinimalRebuild>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- <PreBuildEvent>
- <Command>"../../../bin/windows-aarch64/release/slangc" "../../../examples/heterogeneous-hello-world/shader.slang" -o "../../../examples/heterogeneous-hello-world/shader.cpp" -heterogeneous -target cpp -target hlsl</Command>
- <Message>Generating shader.cpp in ../../../examples/heterogeneous-hello-world/</Message>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\..\..\examples\heterogeneous-hello-world\main.cpp" />
- <ClCompile Include="..\..\..\examples\heterogeneous-hello-world\shader.cpp" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\..\examples\heterogeneous-hello-world\shader.slang" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\example-base\example-base.vcxproj">
- <Project>{37BED5B5-23FA-D81F-8C0C-F1167867813A}</Project>
- </ProjectReference>
- <ProjectReference Include="..\slang\slang.vcxproj">
- <Project>{DB00DA62-0533-4AFD-B59F-A67D5B3A0808}</Project>
- </ProjectReference>
- <ProjectReference Include="..\gfx\gfx.vcxproj">
- <Project>{222F7498-B40C-4F3F-A704-DDEB91A4484A}</Project>
- </ProjectReference>
- <ProjectReference Include="..\gfx-util\gfx-util.vcxproj">
- <Project>{F5ADB74E-02A7-44FB-AA3B-FC02F8AC7A4B}</Project>
- </ProjectReference>
- <ProjectReference Include="..\slangc\slangc.vcxproj">
- <Project>{D56CBCEB-1EB5-4CA8-AEC4-48EA35ED61C7}</Project>
- </ProjectReference>
- <ProjectReference Include="..\platform\platform.vcxproj">
- <Project>{3565FE5E-4FA3-11EB-AE93-0242AC130002}</Project>
- </ProjectReference>
- <ProjectReference Include="..\core\core.vcxproj">
- <Project>{F9BE7957-8399-899E-0C49-E714FDDD4B65}</Project>
- </ProjectReference>
- <ProjectReference Include="heterogeneous-first-gen.vcxproj">
- <Project>{3E8C6F8B-AAC3-B722-B3CD-1B461F84DE1B}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj.filters b/build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj.filters
deleted file mode 100644
index 3b195e092..000000000
--- a/build/visual-studio/heterogeneous-hello-world/heterogeneous-hello-world.vcxproj.filters
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\..\examples\heterogeneous-hello-world\main.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\examples\heterogeneous-hello-world\shader.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\..\examples\heterogeneous-hello-world\shader.slang">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/build/visual-studio/run-generators/run-generators.vcxproj b/build/visual-studio/run-generators/run-generators.vcxproj
index 6e10e3ca1..c8a99e931 100644
--- a/build/visual-studio/run-generators/run-generators.vcxproj
+++ b/build/visual-studio/run-generators/run-generators.vcxproj
@@ -258,6 +258,23 @@
<ClCompile Include="..\..\..\source\core\slang-string.cpp" />
</ItemGroup>
<ItemGroup>
+ <CustomBuild Include="..\..\..\prelude\slang-cpp-host-prelude.h">
+ <FileType>Document</FileType>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"../../../bin/windows-x86/debug/slang-embed" %(Identity)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"../../../bin/windows-x64/debug/slang-embed" %(Identity)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">"$(SolutionDir)/bin/windows-x64/debug/slang-embed" %(Identity)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"../../../bin/windows-x86/release/slang-embed" %(Identity)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"../../../bin/windows-x64/release/slang-embed" %(Identity)</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">"$(SolutionDir)/bin/windows-x64/release/slang-embed" %(Identity)</Command>
+ <Outputs>../../../prelude/slang-cpp-host-prelude.h.cpp</Outputs>
+ <Message>slang-embed %(Identity)</Message>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../bin/windows-x86/debug/slang-embed.exe</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../../bin/windows-x64/debug/slang-embed.exe</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">../../../bin/windows-x64/debug/slang-embed.exe</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../bin/windows-x86/release/slang-embed.exe</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../../bin/windows-x64/release/slang-embed.exe</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">../../../bin/windows-x64/release/slang-embed.exe</AdditionalInputs>
+ </CustomBuild>
<CustomBuild Include="..\..\..\prelude\slang-cpp-prelude.h">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"../../../bin/windows-x86/debug/slang-embed" %(Identity)</Command>
diff --git a/build/visual-studio/run-generators/run-generators.vcxproj.filters b/build/visual-studio/run-generators/run-generators.vcxproj.filters
index 775c3672c..609af9779 100644
--- a/build/visual-studio/run-generators/run-generators.vcxproj.filters
+++ b/build/visual-studio/run-generators/run-generators.vcxproj.filters
@@ -25,6 +25,9 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <CustomBuild Include="..\..\..\prelude\slang-cpp-host-prelude.h">
+ <Filter>Header Files</Filter>
+ </CustomBuild>
<CustomBuild Include="..\..\..\prelude\slang-cpp-prelude.h">
<Filter>Header Files</Filter>
</CustomBuild>
diff --git a/build/visual-studio/slang-rt/slang-rt.vcxproj b/build/visual-studio/slang-rt/slang-rt.vcxproj
new file mode 100644
index 000000000..c0fab7f97
--- /dev/null
+++ b/build/visual-studio/slang-rt/slang-rt.vcxproj
@@ -0,0 +1,396 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|ARM">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug aarch64|Win32">
+ <Configuration>Debug aarch64</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug aarch64|x64">
+ <Configuration>Debug aarch64</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug aarch64|ARM">
+ <Configuration>Debug aarch64</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM">
+ <Configuration>Release</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release aarch64|Win32">
+ <Configuration>Release aarch64</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release aarch64|x64">
+ <Configuration>Release aarch64</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release aarch64|ARM">
+ <Configuration>Release aarch64</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{DFC79D72-91DE-434C-871B-B3943B488BEB}</ProjectGuid>
+ <IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>slang-rt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v142</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v142</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v142</PlatformToolset>
+ <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v142</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v142</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v142</PlatformToolset>
+ <WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>..\..\..\bin\windows-x86\debug\</OutDir>
+ <IntDir>..\..\..\intermediate\windows-x86\debug\slang-rt\</IntDir>
+ <TargetName>slang-rt</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>..\..\..\bin\windows-x64\debug\</OutDir>
+ <IntDir>..\..\..\intermediate\windows-x64\debug\slang-rt\</IntDir>
+ <TargetName>slang-rt</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>..\..\..\bin\windows-aarch64\debug\</OutDir>
+ <IntDir>..\..\..\intermediate\windows-aarch64\debug\slang-rt\</IntDir>
+ <TargetName>slang-rt</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>..\..\..\bin\windows-x86\release\</OutDir>
+ <IntDir>..\..\..\intermediate\windows-x86\release\slang-rt\</IntDir>
+ <TargetName>slang-rt</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>..\..\..\bin\windows-x64\release\</OutDir>
+ <IntDir>..\..\..\intermediate\windows-x64\release\slang-rt\</IntDir>
+ <TargetName>slang-rt</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>..\..\..\bin\windows-aarch64\release\</OutDir>
+ <IntDir>..\..\..\intermediate\windows-aarch64\release\slang-rt\</IntDir>
+ <TargetName>slang-rt</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <PreprocessorDefinitions>_DEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <Optimization>Disabled</Optimization>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>..\..\..\bin\windows-x86\debug\slang-rt.lib</ImportLibrary>
+ <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <PreprocessorDefinitions>_DEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <Optimization>Disabled</Optimization>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>..\..\..\bin\windows-x64\debug\slang-rt.lib</ImportLibrary>
+ <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug aarch64|ARM'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <PreprocessorDefinitions>_DEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <Optimization>Disabled</Optimization>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>..\..\..\bin\windows-aarch64\debug\slang-rt.lib</ImportLibrary>
+ <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <PreprocessorDefinitions>NDEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <ImportLibrary>..\..\..\bin\windows-x86\release\slang-rt.lib</ImportLibrary>
+ <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <PreprocessorDefinitions>NDEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <ImportLibrary>..\..\..\bin\windows-x64\release\slang-rt.lib</ImportLibrary>
+ <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release aarch64|ARM'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <PreprocessorDefinitions>NDEBUG;SLANG_RT_DYNAMIC;SLANG_RT_DYNAMIC_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <ImportLibrary>..\..\..\bin\windows-aarch64\release\slang-rt.lib</ImportLibrary>
+ <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\source\core\slang-allocator.h" />
+ <ClInclude Include="..\..\..\source\core\slang-archive-file-system.h" />
+ <ClInclude Include="..\..\..\source\core\slang-array-view.h" />
+ <ClInclude Include="..\..\..\source\core\slang-array.h" />
+ <ClInclude Include="..\..\..\source\core\slang-basic.h" />
+ <ClInclude Include="..\..\..\source\core\slang-blob.h" />
+ <ClInclude Include="..\..\..\source\core\slang-byte-encode-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-char-encode.h" />
+ <ClInclude Include="..\..\..\source\core\slang-char-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-chunked-list.h" />
+ <ClInclude Include="..\..\..\source\core\slang-com-object.h" />
+ <ClInclude Include="..\..\..\source\core\slang-command-line.h" />
+ <ClInclude Include="..\..\..\source\core\slang-common.h" />
+ <ClInclude Include="..\..\..\source\core\slang-compression-system.h" />
+ <ClInclude Include="..\..\..\source\core\slang-deflate-compression-system.h" />
+ <ClInclude Include="..\..\..\source\core\slang-dictionary.h" />
+ <ClInclude Include="..\..\..\source\core\slang-exception.h" />
+ <ClInclude Include="..\..\..\source\core\slang-file-system.h" />
+ <ClInclude Include="..\..\..\source\core\slang-free-list.h" />
+ <ClInclude Include="..\..\..\source\core\slang-func-ptr.h" />
+ <ClInclude Include="..\..\..\source\core\slang-hash.h" />
+ <ClInclude Include="..\..\..\source\core\slang-hex-dump-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-http.h" />
+ <ClInclude Include="..\..\..\source\core\slang-io.h" />
+ <ClInclude Include="..\..\..\source\core\slang-linked-list.h" />
+ <ClInclude Include="..\..\..\source\core\slang-list.h" />
+ <ClInclude Include="..\..\..\source\core\slang-lz4-compression-system.h" />
+ <ClInclude Include="..\..\..\source\core\slang-math.h" />
+ <ClInclude Include="..\..\..\source\core\slang-memory-arena.h" />
+ <ClInclude Include="..\..\..\source\core\slang-offset-container.h" />
+ <ClInclude Include="..\..\..\source\core\slang-platform.h" />
+ <ClInclude Include="..\..\..\source\core\slang-process-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-process.h" />
+ <ClInclude Include="..\..\..\source\core\slang-random-generator.h" />
+ <ClInclude Include="..\..\..\source\core\slang-render-api-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-riff-file-system.h" />
+ <ClInclude Include="..\..\..\source\core\slang-riff.h" />
+ <ClInclude Include="..\..\..\source\core\slang-rtti-info.h" />
+ <ClInclude Include="..\..\..\source\core\slang-rtti-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-secure-crt.h" />
+ <ClInclude Include="..\..\..\source\core\slang-semantic-version.h" />
+ <ClInclude Include="..\..\..\source\core\slang-shared-library.h" />
+ <ClInclude Include="..\..\..\source\core\slang-short-list.h" />
+ <ClInclude Include="..\..\..\source\core\slang-signal.h" />
+ <ClInclude Include="..\..\..\source\core\slang-smart-pointer.h" />
+ <ClInclude Include="..\..\..\source\core\slang-std-writers.h" />
+ <ClInclude Include="..\..\..\source\core\slang-stream.h" />
+ <ClInclude Include="..\..\..\source\core\slang-string-escape-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-string-slice-pool.h" />
+ <ClInclude Include="..\..\..\source\core\slang-string-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-string.h" />
+ <ClInclude Include="..\..\..\source\core\slang-test-tool-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-text-io.h" />
+ <ClInclude Include="..\..\..\source\core\slang-token-reader.h" />
+ <ClInclude Include="..\..\..\source\core\slang-type-convert-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-type-text-util.h" />
+ <ClInclude Include="..\..\..\source\core\slang-type-traits.h" />
+ <ClInclude Include="..\..\..\source\core\slang-uint-set.h" />
+ <ClInclude Include="..\..\..\source\core\slang-virtual-object-pool.h" />
+ <ClInclude Include="..\..\..\source\core\slang-writer.h" />
+ <ClInclude Include="..\..\..\source\core\slang-zip-file-system.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\source\core\slang-archive-file-system.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-blob.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-byte-encode-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-char-encode.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-char-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-command-line.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-deflate-compression-system.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-file-system.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-free-list.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-hex-dump-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-http.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-io.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-lz4-compression-system.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-memory-arena.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-offset-container.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-platform.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-process-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-random-generator.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-render-api-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-riff-file-system.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-riff.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-rtti-info.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-rtti-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-semantic-version.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-shared-library.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-signal.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-std-writers.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-stream.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-string-escape-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-string-slice-pool.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-string-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-string.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-test-tool-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-text-io.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-token-reader.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-type-convert-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-type-text-util.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-uint-set.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-writer.cpp" />
+ <ClCompile Include="..\..\..\source\core\slang-zip-file-system.cpp" />
+ <ClCompile Include="..\..\..\source\core\windows\slang-win-process.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <Natvis Include="..\..\..\source\core\core.natvis" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\miniz\miniz.vcxproj">
+ <Project>{E76ACB11-4A12-4F0A-BE1E-CE0B8836EB7F}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\lz4\lz4.vcxproj">
+ <Project>{E1EC8075-823E-46E5-BC38-C124CCCDF878}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/build/visual-studio/slang-rt/slang-rt.vcxproj.filters b/build/visual-studio/slang-rt/slang-rt.vcxproj.filters
new file mode 100644
index 000000000..51b0313f6
--- /dev/null
+++ b/build/visual-studio/slang-rt/slang-rt.vcxproj.filters
@@ -0,0 +1,326 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{21EB8090-0D4E-1035-B6D3-48EBA215DCB7}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\source\core\slang-allocator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-archive-file-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-array-view.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-array.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-basic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-blob.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-byte-encode-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-char-encode.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-char-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-chunked-list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-com-object.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-command-line.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-compression-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-deflate-compression-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-dictionary.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-exception.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-file-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-free-list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-func-ptr.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-hash.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-hex-dump-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-http.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-io.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-linked-list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-lz4-compression-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-math.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-memory-arena.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-offset-container.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-platform.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-process-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-process.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-random-generator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-render-api-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-riff-file-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-riff.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-rtti-info.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-rtti-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-secure-crt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-semantic-version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-shared-library.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-short-list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-signal.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-smart-pointer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-std-writers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-stream.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-string-escape-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-string-slice-pool.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-string-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-string.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-test-tool-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-text-io.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-token-reader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-type-convert-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-type-text-util.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-type-traits.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-uint-set.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-virtual-object-pool.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-writer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\source\core\slang-zip-file-system.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\source\core\slang-archive-file-system.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-blob.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-byte-encode-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-char-encode.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-char-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-command-line.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-deflate-compression-system.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-file-system.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-free-list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-hex-dump-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-http.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-io.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-lz4-compression-system.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-memory-arena.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-offset-container.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-platform.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-process-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-random-generator.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-render-api-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-riff-file-system.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-riff.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-rtti-info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-rtti-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-semantic-version.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-shared-library.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-signal.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-std-writers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-stream.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-string-escape-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-string-slice-pool.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-string-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-string.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-test-tool-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-text-io.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-token-reader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-type-convert-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-type-text-util.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-uint-set.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-writer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\slang-zip-file-system.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\source\core\windows\slang-win-process.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <Natvis Include="..\..\..\source\core\core.natvis">
+ <Filter>Source Files</Filter>
+ </Natvis>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/build/visual-studio/slang/slang.vcxproj b/build/visual-studio/slang/slang.vcxproj
index 61ddc40f4..a54c4da89 100644
--- a/build/visual-studio/slang/slang.vcxproj
+++ b/build/visual-studio/slang/slang.vcxproj
@@ -432,6 +432,7 @@ IF EXIST ..\..\..\external\slang-binaries\bin\windows-aarch64\slang-glslang.dll\
<ClInclude Include="..\..\..\source\slang\slang-visitor.h" />
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\..\..\prelude\slang-cpp-host-prelude.h.cpp" />
<ClCompile Include="..\..\..\prelude\slang-cpp-prelude.h.cpp" />
<ClCompile Include="..\..\..\prelude\slang-cuda-prelude.h.cpp" />
<ClCompile Include="..\..\..\prelude\slang-hlsl-prelude.h.cpp" />
diff --git a/build/visual-studio/slang/slang.vcxproj.filters b/build/visual-studio/slang/slang.vcxproj.filters
index ba0e4fe52..3b88a758a 100644
--- a/build/visual-studio/slang/slang.vcxproj.filters
+++ b/build/visual-studio/slang/slang.vcxproj.filters
@@ -389,6 +389,9 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\..\..\prelude\slang-cpp-host-prelude.h.cpp">
+ <Filter>Header Files</Filter>
+ </ClCompile>
<ClCompile Include="..\..\..\prelude\slang-cpp-prelude.h.cpp">
<Filter>Header Files</Filter>
</ClCompile>
diff --git a/examples/cpu-hello-world/main.cpp b/examples/cpu-hello-world/main.cpp
index cf8c57285..460b4698b 100644
--- a/examples/cpu-hello-world/main.cpp
+++ b/examples/cpu-hello-world/main.cpp
@@ -83,7 +83,7 @@ static SlangResult _innerMain(int argc, char** argv)
// We would like to request a CPU code that can be executed directly on the host -
// which is the 'SLANG_HOST_CALLABLE' target.
// If we wanted a just a shared library/dll, we could have used SLANG_SHARED_LIBRARY.
- int targetIndex = spAddCodeGenTarget(slangRequest, SLANG_HOST_CALLABLE);
+ int targetIndex = spAddCodeGenTarget(slangRequest, SLANG_SHADER_HOST_CALLABLE);
// Set the target flag to indicate that we want to compile all the entrypoints in the
// slang shader file into a library.
diff --git a/examples/heterogeneous-hello-world/main.cpp b/examples/heterogeneous-hello-world/main.cpp
deleted file mode 100644
index e711d4486..000000000
--- a/examples/heterogeneous-hello-world/main.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-// main.cpp
-
-// This example uses the Slang gfx layer to target different APIs and execute
-// both CPU and GPU code from a single Slang file (?)
-//
-#include <slang.h>
-#include <slang-com-ptr.h>
-using Slang::ComPtr;
-
-#include "slang-gfx.h"
-#include "gfx-util/shader-cursor.h"
-#include "source/core/slang-basic.h"
-#include "../../prelude/slang-cpp-types.h"
-
-using namespace gfx;
-using namespace Slang;
-
-// Creating global ref pointers to avoid dereferencing values
-//
-ComPtr<gfx::IDevice> gDevice;
-ComPtr<gfx::IShaderProgram> gProgram;
-ComPtr<gfx::IBufferResource> gBufferResource;
-ComPtr<gfx::IResourceView> gResourceView;
-ComPtr<gfx::ITransientResourceHeap> gTransientHeap;
-ComPtr<gfx::IPipelineState> gPipelineState;
-ComPtr<gfx::ICommandQueue> gQueue;
-
-// Boilerplate types to help the slang-generated file
-//
-bool executeComputation();
-
-// Many Slang API functions return detailed diagnostic information
-// (error messages, warnings, etc.) as a "blob" of data, or return
-// a null blob pointer instead if there were no issues.
-//
-// For convenience, we define a subroutine that will dump the information
-// in a diagnostic blob if one is produced, and skip it otherwise.
-//
-void diagnoseIfNeeded(slang::IBlob *diagnosticsBlob)
-{
- if (diagnosticsBlob != nullptr)
- {
- printf("%s", (const char *)diagnosticsBlob->getBufferPointer());
- }
-}
-
-gfx::IDevice *createDevice()
-{
- ComPtr<gfx::IDevice> device;
- IDevice::Desc deviceDesc = {};
- // Changing device type would happen here. For example:
- //deviceDesc.deviceType = DeviceType::CUDA;
- SLANG_RETURN_NULL_ON_FAIL(gfxCreateDevice(&deviceDesc, gDevice.writeRef()));
- return gDevice;
-}
-
-// Loads the shader code defined in `shader.slang` for use by the `gfx` layer.
-//
-gfx::IShaderProgram *loadShaderProgram(gfx::IDevice *device, char* entryPoint, char* moduleName)
-{
- // We need to obtain a compilation session (`slang::ISession`) that will provide
- // a scope to all the compilation and loading of code we do.
- //
- ComPtr<slang::ISession> slangSession;
- SLANG_RETURN_NULL_ON_FAIL(device->getSlangSession(slangSession.writeRef()));
-
- // We can now start loading code into the slang session.
- //
- // The simplest way to load code is by calling `loadModule` with the name of a Slang
- // module. A call to `loadModule("MyStuff")` will behave more or less as if you
- // wrote:
- //
- // import MyStuff;
- //
- // In a Slang shader file. The compiler will use its search paths to try to locate
- // `MyModule.slang`, then compile and load that file. If a matching module had
- // already been loaded previously, that would be used directly.
- //
- ComPtr<slang::IBlob> diagnosticsBlob;
- slang::IModule *module = slangSession->loadModule(moduleName, diagnosticsBlob.writeRef());
- diagnoseIfNeeded(diagnosticsBlob);
- if (!module)
- return NULL;
-
- // Look up entry point
- //
- // char const *computeEntryPointName = entryPoint.getBuffer();
- ComPtr<slang::IEntryPoint> computeEntryPoint;
- SLANG_RETURN_NULL_ON_FAIL(
- module->findEntryPointByName(entryPoint, computeEntryPoint.writeRef()));
-
- // At this point we have a few different Slang API objects that represent
- // pieces of our code: `module`, `vertexEntryPoint`, and `fragmentEntryPoint`.
- //
- // A single Slang module could contain many different entry points (e.g.,
- // four vertex entry points, three fragment entry points, and two compute
- // shaders), and before we try to generate output code for our target API
- // we need to identify which entry points we plan to use together.
- //
- // Modules and entry points are both examples of *component types* in the
- // Slang API. The API also provides a way to build a *composite* out of
- // other pieces, and that is what we are going to do with our module
- // and entry points.
- //
- Slang::List<slang::IComponentType *> componentTypes;
- componentTypes.add(module);
- componentTypes.add(computeEntryPoint);
-
- // Actually creating the composite component type is a single operation
- // on the Slang session, but the operation could potentially fail if
- // something about the composite was invalid (e.g., you are trying to
- // combine multiple copies of the same module), so we need to deal
- // with the possibility of diagnostic output.
- //
- ComPtr<slang::IComponentType> composedProgram;
- SlangResult result = slangSession->createCompositeComponentType(
- componentTypes.getBuffer(),
- componentTypes.getCount(),
- composedProgram.writeRef(),
- diagnosticsBlob.writeRef());
- diagnoseIfNeeded(diagnosticsBlob);
- SLANG_RETURN_NULL_ON_FAIL(result);
-
- // At this point, `composedProgram` represents the shader program
- // we want to run, and the compute shader there have been checked.
- // We can create a `gfx::IShaderProgram` object from `composedProgram`
- // so it may be used by the graphics layer.
- gfx::IShaderProgram::Desc programDesc = {};
- programDesc.slangProgram = composedProgram.get();
-
- gProgram = device->createProgram(programDesc);
-
- return gProgram;
-}
-
-gfx::IBufferResource* createStructuredBuffer(gfx::IDevice* device, FixedArray<float, 4> initialData)
-{
- // Create a structured buffer for storing computation data
- //
- const int numberCount = 4;
- int structuredBufferSize = numberCount * sizeof(float);
-
- IBufferResource::Desc bufferDesc = {};
- bufferDesc.sizeInBytes = numberCount * sizeof(float);
- bufferDesc.format = gfx::Format::Unknown;
- bufferDesc.elementSize = sizeof(float);
- bufferDesc.allowedStates = ResourceStateSet(ResourceState::ShaderResource,
- ResourceState::UnorderedAccess,
- ResourceState::CopyDestination,
- ResourceState::CopySource);
- bufferDesc.defaultState = ResourceState::UnorderedAccess;
- bufferDesc.memoryType = MemoryType::DeviceLocal;
-
- SlangResult result = device->createBufferResource(bufferDesc,
- (void *)&initialData,
- gBufferResource.writeRef());
- SLANG_RETURN_NULL_ON_FAIL(result);
- return gBufferResource;
-}
-
-gfx::IResourceView *createBufferView(
- gfx::IDevice *device,
- gfx::IBufferResource *buffer)
-{
- // Create a resource view for the structured buffer
- //
- gfx::IResourceView::Desc viewDesc = {};
- viewDesc.type = gfx::IResourceView::Type::UnorderedAccess;
- viewDesc.format = gfx::Format::Unknown;
- SLANG_RETURN_NULL_ON_FAIL(device->createBufferView(buffer, viewDesc, gResourceView.writeRef()));
- return gResourceView;
-}
-
-gfx::ITransientResourceHeap *buildTransientHeap(gfx::IDevice *device)
-{
- ITransientResourceHeap::Desc transientHeapDesc = {};
- transientHeapDesc.constantBufferSize = 4096;
- SLANG_RETURN_NULL_ON_FAIL(
- device->createTransientResourceHeap(transientHeapDesc, gTransientHeap.writeRef()));
- return gTransientHeap;
-}
-
-gfx::IPipelineState *buildPipelineState(
- gfx::IDevice *device,
- gfx::IShaderProgram *shaderProgram)
-{
- gfx::ComputePipelineStateDesc pipelineDesc = {};
- pipelineDesc.program = shaderProgram;
- SLANG_RETURN_NULL_ON_FAIL(
- device->createComputePipelineState(pipelineDesc, gPipelineState.writeRef()));
- return gPipelineState;
-}
-
-void printInitialValues(FixedArray<float, 4> initialArray, int length)
-{
- printf("Before:\n");
- for (int i = 0; i < length; i++)
- {
- printf("%f, ", initialArray[i]);
- }
- printf("\n");
-}
-
-void dispatchComputation(
- gfx::IDevice *device,
- gfx::ITransientResourceHeap *transientHeap,
- gfx::IPipelineState *pipelineState,
- gfx::IResourceView *bufferView,
- unsigned int gridDimsX,
- unsigned int gridDimsY,
- unsigned int gridDimsZ)
-{
- ICommandQueue::Desc queueDesc = {ICommandQueue::QueueType::Graphics};
- gQueue = device->createCommandQueue(queueDesc);
-
- auto commandBuffer = transientHeap->createCommandBuffer();
- auto encoder = commandBuffer->encodeComputeCommands();
-
- // First, obtain a root shader object from command encoder to start parameter binding.
- auto rootObject = encoder->bindPipeline(pipelineState);
-
- gfx::ShaderCursor entryPointCursor(
- rootObject->getEntryPoint(0)); // get a cursor the the first entry-point.
- // Bind buffer view to the entry point.
- entryPointCursor.getPath("ioBuffer").setResource(bufferView);
-
- encoder->dispatchCompute(gridDimsX, gridDimsY, gridDimsZ);
- encoder->endEncoding();
- commandBuffer->close();
- gQueue->executeCommandBuffer(commandBuffer);
- gQueue->waitOnHost();
-}
-
-bool printOutputValues(
- gfx::IDevice *device,
- gfx::IBufferResource *buffer,
- int length)
-{
- ComPtr<ISlangBlob> resultBlob;
- SLANG_RETURN_FALSE_ON_FAIL(device->readBufferResource(
- buffer, 0, length * sizeof(float), resultBlob.writeRef()));
- auto result = reinterpret_cast<const float *>(resultBlob->getBufferPointer());
- printf("After: \n");
- for (int i = 0; i < length; i++)
- {
- printf("%f, ", result[i]);
- }
- printf("\n");
- return true;
-}
-
-RWStructuredBuffer<float> convertBuffer(gfx::IBufferResource* _0) {
- RWStructuredBuffer<float> result;
- result.data = (float*)_0;
- return result;
-}
-
-gfx::IBufferResource *unconvertBuffer(RWStructuredBuffer<float> _0)
-{
- return (gfx::IBufferResource *)(_0.data);
-}
-
-int main()
-{
- // We construct an instance of our example application
- // `struct` type, and then walk through the lifecyle
- // of the application.
-
- if (!(executeComputation()))
- {
- return -1;
- }
-}
diff --git a/examples/heterogeneous-hello-world/main.slang b/examples/heterogeneous-hello-world/main.slang
new file mode 100644
index 000000000..08b4b7f39
--- /dev/null
+++ b/examples/heterogeneous-hello-world/main.slang
@@ -0,0 +1,10 @@
+// main.slang
+
+__target_intrinsic(cpp, "printf(\"%s\", ($0).getBuffer())")
+public void writeln(String text);
+
+public __extern_cpp int main()
+{
+ writeln("hello world");
+ return 0;
+} \ No newline at end of file
diff --git a/examples/heterogeneous-hello-world/shader.slang b/examples/heterogeneous-hello-world/shader.slang
deleted file mode 100644
index d87370be1..000000000
--- a/examples/heterogeneous-hello-world/shader.slang
+++ /dev/null
@@ -1,76 +0,0 @@
-// shader.slang
-
-//TEST_INPUT:ubuffer(random(float, 4096, -1.0, 1.0), stride=4):name=ioBuffer
-__unmangled __exportDirectly RWStructuredBuffer<float> convertBuffer(Ptr<gfx::IBufferResource> x);
-
-[shader("compute")]
-[numthreads(4, 1, 1)]
-void computeMain(uniform RWStructuredBuffer<float> ioBuffer, uint3 dispatchThreadID : SV_DispatchThreadID)
-{
- uint tid = dispatchThreadID.x;
-
- float i = ioBuffer[tid];
- float o = i < 0.5 ? (i + i) : sqrt(i);
-
- ioBuffer[tid] = o;
-}
-
-
-
-// Forward declarations of gfx types
-//
-namespace gfx {
- __externLib __exportDirectly struct IDevice{};
- __externLib __exportDirectly struct IBufferResource{};
- __exportDirectly struct ITransientResourceHeap{};
- __exportDirectly struct IPipelineState{};
- __exportDirectly struct IShaderProgram{};
- __exportDirectly struct IResourceView{};
-}
-
-// Forward declarations of cpp functions
-//
-__unmangled __exportDirectly Ptr<gfx::IDevice> createDevice();
-__unmangled __exportDirectly Ptr<gfx::IShaderProgram> loadShaderProgram(
- Ptr<gfx::IDevice> device,
- String entryPoint,
- String module);
-__unmangled __exportDirectly Ptr<gfx::IBufferResource> createStructuredBuffer(
- Ptr<gfx::IDevice> device,
- float[4] initialData);
-__unmangled __exportDirectly Ptr<gfx::IResourceView> createBufferView(
- Ptr<gfx::IDevice> device,
- Ptr<gfx::IBufferResource> buffer);
-__unmangled __exportDirectly Ptr<gfx::ITransientResourceHeap> buildTransientHeap(
- Ptr<gfx::IDevice> device);
-__unmangled __exportDirectly Ptr<gfx::IPipelineState> buildPipelineState(
- Ptr<gfx::IDevice> device,
- Ptr<gfx::IShaderProgram> shaderProgram);
-__unmangled __exportDirectly void printInitialValues(float[4] initialArray, int length);
-__unmangled __exportDirectly void dispatchComputation(
- Ptr<gfx::IDevice> device,
- Ptr<gfx::ITransientResourceHeap> transientHeap,
- Ptr<gfx::IPipelineState> pipelineState,
- Ptr<gfx::IResourceView> bufferView);
-__unmangled __exportDirectly bool printOutputValues(
- Ptr<gfx::IDevice> device,
- Ptr<gfx::IBufferResource> buffer,
- int length);
-
-public __unmangled __exportDirectly bool executeComputation() {
- // We will hard-code the size of our initial array.
- //
- float initialArray[4] = { 3.0f, -20.0f, -6.0f, 8.0f };
-
- // Declare functions
- let device = createDevice();
- let structuredBuffer = createStructuredBuffer(device, initialArray);
- // let bufferView = createBufferView(device, structuredBuffer);
- __GPU_FOREACH(device, uint3(4, 1, 1), LAMBDA(uint3 dispatchThreadID)
- { computeMain(convertBuffer(structuredBuffer), dispatchThreadID) ; });
- printInitialValues(initialArray, 4);
- printOutputValues(device, structuredBuffer, 4);
-
-
- return true;
-}
diff --git a/prelude/slang-cpp-host-prelude.h b/prelude/slang-cpp-host-prelude.h
new file mode 100644
index 000000000..90087d158
--- /dev/null
+++ b/prelude/slang-cpp-host-prelude.h
@@ -0,0 +1,16 @@
+#ifndef SLANG_CPP_HOST_PRELUDE_H
+#define SLANG_CPP_HOST_PRELUDE_H
+
+#include <cstdio>
+#include <cmath>
+#include <cstring>
+
+#include "../source/core/slang-string.h"
+#include "../source/core/slang-smart-pointer.h"
+#include "../slang-com-ptr.h"
+#include "../slang-gfx.h"
+
+using namespace Slang;
+using namespace gfx;
+
+#endif
diff --git a/premake5.lua b/premake5.lua
index d5a9d102a..d4b1715a2 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -680,30 +680,17 @@ newoption {
example "cpu-hello-world"
kind "ConsoleApp"
-
if enableExperimental then
- project "heterogeneous-first-gen"
- kind "Utility"
+ project "heterogeneous-hello-world"
+ kind "ConsoleApp"
links "slangc"
location("build/" .. slangUtil.getBuildLocationName(targetInfo) .. "/heterogeneous-hello-world")
prebuildcommands {
- "\"%{wks.location:lower()}/bin/" .. targetName .. "/%{cfg.buildcfg:lower()}/slangc\" \"%{wks.location:lower()}/examples/heterogeneous-hello-world/shader.slang\" -o \"%{wks.location:lower()}/examples/heterogeneous-hello-world/shader.cpp\" -heterogeneous -target cpp -target hlsl"
- }
-
- example "heterogeneous-hello-world"
- kind "ConsoleApp"
- -- Additionally add slangc for compiling shader.cpp
- links { "example-base", "slang", "gfx", "gfx-util", "slangc", "platform", "core", "heterogeneous-first-gen" }
- -- Generate shader.cpp from shader.slang
- prebuildmessage "Generating shader.cpp in %{wks.location:lower()}/examples/heterogeneous-hello-world/"
- prebuildcommands {
- "\"%{wks.location:lower()}/bin/" .. targetName .. "/%{cfg.buildcfg:lower()}/slangc\" \"%{wks.location:lower()}/examples/heterogeneous-hello-world/shader.slang\" -o \"%{wks.location:lower()}/examples/heterogeneous-hello-world/shader.cpp\" -heterogeneous -target cpp -target hlsl"
- }
- files {
- "examples/heterogeneous-hello-world/shader.cpp"
+ "\"%{cfg.targetdir}/slangc\" \"%{wks.location:lower()}/examples/heterogeneous-hello-world/main.slang\" -o \"%{cfg.targetdir}/heterogeneous-hello-world.exe\""
}
+ files {"examples/heterogeneous-hello-world/*.slang"}
+
end
-
-- Most of the other projects have more interesting configuration going
-- on, so let's walk through them in order of increasing complexity.
--
@@ -754,6 +741,21 @@ newoption {
addSourceDir "source/compiler-core/unix"
end
+standardProject("slang-rt", "source/slang-rt")
+ uuid "DFC79D72-91DE-434C-871B-B3943B488BEB"
+ kind "SharedLib"
+ pic "On"
+ warnings "Extra"
+ links {"miniz", "lz4"}
+ flags { "FatalWarnings" }
+ defines { "SLANG_RT_DYNAMIC", "SLANG_RT_DYNAMIC_EXPORT" }
+ addSourceDir "source/core"
+ if targetInfo.isWindows then
+ addSourceDir "source/core/windows"
+ else
+ addSourceDir "source/core/unix"
+ end
+
--
-- The cpp extractor is a tool that scans C++ header files to extract
-- reflection like information, and generate files to handle
@@ -1213,7 +1215,8 @@ newoption {
files {
"prelude/slang-cuda-prelude.h.cpp",
"prelude/slang-hlsl-prelude.h.cpp",
- "prelude/slang-cpp-prelude.h.cpp"
+ "prelude/slang-cpp-prelude.h.cpp",
+ "prelude/slang-cpp-host-prelude.h.cpp"
}
end
@@ -1318,7 +1321,8 @@ newoption {
files {
"prelude/slang-cuda-prelude.h.cpp",
"prelude/slang-hlsl-prelude.h.cpp",
- "prelude/slang-cpp-prelude.h.cpp"
+ "prelude/slang-cpp-prelude.h.cpp",
+ "prelude/slang-cpp-host-prelude.h.cpp"
}
--
@@ -1396,7 +1400,8 @@ newoption {
files {
"prelude/slang-cuda-prelude.h.cpp",
"prelude/slang-hlsl-prelude.h.cpp",
- "prelude/slang-cpp-prelude.h.cpp"
+ "prelude/slang-cpp-prelude.h.cpp",
+ "prelude/slang-cpp-host-prelude.h.cpp"
}
-- Add the slang source
diff --git a/slang.h b/slang.h
index 1d4c517b5..0de215a33 100644
--- a/slang.h
+++ b/slang.h
@@ -551,13 +551,14 @@ extern "C"
SLANG_DXIL,
SLANG_DXIL_ASM,
SLANG_C_SOURCE, ///< The C language
- SLANG_CPP_SOURCE, ///< The C++ language
- SLANG_EXECUTABLE, ///< Executable (for hosting CPU/OS)
- SLANG_SHARED_LIBRARY, ///< A shared library/Dll (for hosting CPU/OS)
- SLANG_HOST_CALLABLE, ///< A CPU target that makes the compiled code available to be run immediately
+ SLANG_CPP_SOURCE, ///< C++ code for shader kernels.
+ SLANG_HOST_EXECUTABLE, ///< Standalone binary executable (for hosting CPU/OS)
+ SLANG_SHADER_SHARED_LIBRARY, ///< A shared library/Dll for shader kernels (for hosting CPU/OS)
+ SLANG_SHADER_HOST_CALLABLE, ///< A CPU target that makes the compiled shader code available to be run immediately
SLANG_CUDA_SOURCE, ///< Cuda source
SLANG_PTX, ///< PTX
SLANG_OBJECT_CODE, ///< Object code that can be used for later linking
+ SLANG_HOST_CPP_SOURCE, ///< C++ code for host library or executable.
SLANG_TARGET_COUNT_OF,
};
diff --git a/slang.sln b/slang.sln
index b4b30eeee..f9584f25d 100644
--- a/slang.sln
+++ b/slang.sln
@@ -65,6 +65,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slang", "build\visual-studi
{E145B2B8-CD13-A6BE-B6A7-16E5A2148223} = {E145B2B8-CD13-A6BE-B6A7-16E5A2148223}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slang-rt", "build\visual-studio\slang-rt\slang-rt.vcxproj", "{DFC79D72-91DE-434C-871B-B3943B488BEB}"
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slangc", "build\visual-studio\slangc\slangc.vcxproj", "{D56CBCEB-1EB5-4CA8-AEC4-48EA35ED61C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test-tool", "test-tool", "{57B5AA5E-C340-1823-CC51-9B17385C7423}"
@@ -387,6 +389,18 @@ Global
{DB00DA62-0533-4AFD-B59F-A67D5B3A0808}.Release|Win32.Build.0 = Release|Win32
{DB00DA62-0533-4AFD-B59F-A67D5B3A0808}.Release|x64.ActiveCfg = Release|x64
{DB00DA62-0533-4AFD-B59F-A67D5B3A0808}.Release|x64.Build.0 = Release|x64
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Debug|aarch64.ActiveCfg = Debug aarch64|ARM
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Debug|aarch64.Build.0 = Debug aarch64|ARM
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Debug|Win32.Build.0 = Debug|Win32
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Debug|x64.ActiveCfg = Debug|x64
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Debug|x64.Build.0 = Debug|x64
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Release|aarch64.ActiveCfg = Release aarch64|ARM
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Release|aarch64.Build.0 = Release aarch64|ARM
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Release|Win32.ActiveCfg = Release|Win32
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Release|Win32.Build.0 = Release|Win32
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Release|x64.ActiveCfg = Release|x64
+ {DFC79D72-91DE-434C-871B-B3943B488BEB}.Release|x64.Build.0 = Release|x64
{D56CBCEB-1EB5-4CA8-AEC4-48EA35ED61C7}.Debug|aarch64.ActiveCfg = Debug aarch64|ARM
{D56CBCEB-1EB5-4CA8-AEC4-48EA35ED61C7}.Debug|aarch64.Build.0 = Debug aarch64|ARM
{D56CBCEB-1EB5-4CA8-AEC4-48EA35ED61C7}.Debug|Win32.ActiveCfg = Debug|Win32
diff --git a/source/compiler-core/slang-downstream-compiler.h b/source/compiler-core/slang-downstream-compiler.h
index dc9e29185..e40ffc13a 100644
--- a/source/compiler-core/slang-downstream-compiler.h
+++ b/source/compiler-core/slang-downstream-compiler.h
@@ -274,7 +274,7 @@ public:
OptimizationLevel optimizationLevel = OptimizationLevel::Default;
DebugInfoType debugInfoType = DebugInfoType::Standard;
- SlangCompileTarget targetType = SLANG_EXECUTABLE;
+ SlangCompileTarget targetType = SLANG_HOST_EXECUTABLE;
SlangSourceLanguage sourceLanguage = SLANG_SOURCE_LANGUAGE_CPP;
FloatingPointMode floatingPointMode = FloatingPointMode::Default;
PipelineType pipelineType = PipelineType::Unknown;
@@ -302,6 +302,9 @@ public:
List<String> includePaths;
List<String> libraryPaths;
+ /// Libraries to link against.
+ List<String> libraries;
+
List<CapabilityVersion> requiredCapabilityVersions;
/// For compilers/compiles that require an entry point name, else can be empty
diff --git a/source/compiler-core/slang-gcc-compiler-util.cpp b/source/compiler-core/slang-gcc-compiler-util.cpp
index b5c359247..8d1b87b68 100644
--- a/source/compiler-core/slang-gcc-compiler-util.cpp
+++ b/source/compiler-core/slang-gcc-compiler-util.cpp
@@ -415,12 +415,12 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
switch (options.targetType)
{
- case SLANG_SHARED_LIBRARY:
+ case SLANG_SHADER_SHARED_LIBRARY:
{
outPath << SharedLibrary::calcPlatformPath(options.modulePath.getUnownedSlice());
return SLANG_OK;
}
- case SLANG_EXECUTABLE:
+ case SLANG_HOST_EXECUTABLE:
{
outPath << options.modulePath;
outPath << Process::getExecutableSuffix();
@@ -547,7 +547,7 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
switch (options.targetType)
{
- case SLANG_SHARED_LIBRARY:
+ case SLANG_SHADER_SHARED_LIBRARY:
{
// Shared library
cmdLine.addArg("-shared");
@@ -559,7 +559,7 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
}
break;
}
- case SLANG_EXECUTABLE:
+ case SLANG_HOST_EXECUTABLE:
{
break;
}
@@ -601,7 +601,7 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
//cmdLine.addArg(linkOptions);
}
- if (options.targetType == SLANG_SHARED_LIBRARY)
+ if (options.targetType == SLANG_SHADER_SHARED_LIBRARY)
{
if (!PlatformUtil::isFamily(PlatformFamily::Apple, platformKind))
{
diff --git a/source/compiler-core/slang-visual-studio-compiler-util.cpp b/source/compiler-core/slang-visual-studio-compiler-util.cpp
index 9bdfd406a..2ba69c1ce 100644
--- a/source/compiler-core/slang-visual-studio-compiler-util.cpp
+++ b/source/compiler-core/slang-visual-studio-compiler-util.cpp
@@ -23,12 +23,12 @@ namespace Slang
switch (options.targetType)
{
- case SLANG_SHARED_LIBRARY:
+ case SLANG_SHADER_SHARED_LIBRARY:
{
outPath << options.modulePath << ".dll";
return SLANG_OK;
}
- case SLANG_EXECUTABLE:
+ case SLANG_HOST_EXECUTABLE:
{
outPath << options.modulePath << ".exe";
return SLANG_OK;
@@ -60,7 +60,7 @@ namespace Slang
{
outPaths.add(options.modulePath + ".ilk");
- if (options.targetType == SLANG_SHARED_LIBRARY)
+ if (options.targetType == SLANG_SHADER_SHARED_LIBRARY)
{
outPaths.add(options.modulePath + ".exp");
outPaths.add(options.modulePath + ".lib");
@@ -191,7 +191,7 @@ namespace Slang
switch (options.targetType)
{
- case SLANG_SHARED_LIBRARY:
+ case SLANG_SHADER_SHARED_LIBRARY:
{
// Create dynamic link library
if (options.debugInfoType == DebugInfoType::None)
@@ -206,7 +206,7 @@ namespace Slang
cmdLine.addPrefixPathArg("/Fe", options.modulePath, ".dll");
break;
}
- case SLANG_EXECUTABLE:
+ case SLANG_HOST_EXECUTABLE:
{
cmdLine.addPrefixPathArg("/Fe", options.modulePath, ".exe");
break;
@@ -256,6 +256,12 @@ namespace Slang
cmdLine.addPrefixPathArg("/LIBPATH:", libPath);
}
+ // Link libraries.
+ for (const auto& lib : options.libraries)
+ {
+ cmdLine.addPrefixPathArg("", lib, ".lib");
+ }
+
return SLANG_OK;
}
diff --git a/source/core/slang-common.h b/source/core/slang-common.h
index f17660e0d..694162f1d 100644
--- a/source/core/slang-common.h
+++ b/source/core/slang-common.h
@@ -94,3 +94,22 @@ template<typename T> void slang_use_obj(T&) {}
#define SLANG_UNREFERENCED_PARAMETER(P) slang_use_obj(P)
#define SLANG_UNREFERENCED_VARIABLE(P) slang_use_obj(P)
#endif
+
+#if defined(SLANG_RT_DYNAMIC)
+#if defined(_MSC_VER)
+# ifdef SLANG_RT_DYNAMIC_EXPORT
+# define SLANG_RT_API SLANG_DLL_EXPORT
+# else
+# define SLANG_RT_API __declspec(dllimport)
+# endif
+#else
+// TODO: need to consider compiler capabilities
+//# ifdef SLANG_RT_DYNAMIC_EXPORT
+# define SLANG_RT_API SLANG_DLL_EXPORT
+//# endif
+#endif
+#endif
+
+#ifndef SLANG_RT_API
+#define SLANG_RT_API
+#endif
diff --git a/source/core/slang-smart-pointer.h b/source/core/slang-smart-pointer.h
index 2e5821ffd..a6aa35906 100644
--- a/source/core/slang-smart-pointer.h
+++ b/source/core/slang-smart-pointer.h
@@ -10,7 +10,7 @@
namespace Slang
{
// Base class for all reference-counted objects
- class RefObject
+ class SLANG_RT_API RefObject
{
private:
UInt referenceCount;
@@ -86,8 +86,7 @@ namespace Slang
SLANG_FORCE_INLINE const T* as(const RefObject* obj) { return dynamicCast<T>(obj); }
// "Smart" pointer to a reference-counted object
- template<typename T>
- struct RefPtr
+ template<typename T> struct SLANG_RT_API RefPtr
{
RefPtr()
: pointer(nullptr)
diff --git a/source/core/slang-string.h b/source/core/slang-string.h
index cb13ec415..6dc3275eb 100644
--- a/source/core/slang-string.h
+++ b/source/core/slang-string.h
@@ -62,7 +62,7 @@ namespace Slang
return (((unsigned char)ch) & 0xC0) == 0x80;
}
- struct UnownedStringSlice
+ struct SLANG_RT_API UnownedStringSlice
{
public:
typedef UnownedStringSlice ThisType;
@@ -190,7 +190,7 @@ namespace Slang
// A `StringRepresentation` provides the backing storage for
// all reference-counted string-related types.
- class StringRepresentation : public RefObject
+ class SLANG_RT_API StringRepresentation : public RefObject
{
public:
Index length;
@@ -286,7 +286,7 @@ namespace Slang
- struct UnownedTerminatedStringSlice : public UnownedStringSlice
+ struct SLANG_RT_API UnownedTerminatedStringSlice : public UnownedStringSlice
{
public:
UnownedTerminatedStringSlice(char const* b)
@@ -294,7 +294,7 @@ namespace Slang
{}
};
- struct StringSlice
+ struct SLANG_RT_API StringSlice
{
public:
StringSlice();
@@ -333,7 +333,7 @@ namespace Slang
};
/// String as expected by underlying platform APIs
- class OSString
+ class SLANG_RT_API OSString
{
public:
/// Default
@@ -394,7 +394,7 @@ namespace Slang
@brief Represents a UTF-8 encoded string.
*/
- class String
+ class SLANG_RT_API String
{
friend struct StringSlice;
friend class StringBuilder;
@@ -837,7 +837,7 @@ namespace Slang
}
};
- class StringBuilder : public String
+ class SLANG_RT_API StringBuilder : public String
{
private:
enum { InitialSize = 1024 };
diff --git a/source/core/slang-token-reader.cpp b/source/core/slang-token-reader.cpp
index 3be010751..7ffbc12fa 100644
--- a/source/core/slang-token-reader.cpp
+++ b/source/core/slang-token-reader.cpp
@@ -681,9 +681,6 @@ namespace Misc {
{
switch (data[i])
{
- case ' ':
- sb << "\\s";
- break;
case '\n':
sb << "\\n";
break;
diff --git a/source/core/slang-token-reader.h b/source/core/slang-token-reader.h
index 26539732c..bf5ca4cdc 100644
--- a/source/core/slang-token-reader.h
+++ b/source/core/slang-token-reader.h
@@ -295,6 +295,8 @@ namespace Misc {
return result;
}
+ String EscapeStringLiteral(String str);
+ String UnescapeStringLiteral(String str);
} // namespace Misc
} // namespace Slang
diff --git a/source/core/slang-type-convert-util.cpp b/source/core/slang-type-convert-util.cpp
index fbf385319..6e6598357 100644
--- a/source/core/slang-type-convert-util.cpp
+++ b/source/core/slang-type-convert-util.cpp
@@ -17,6 +17,7 @@ namespace Slang
case SLANG_HLSL: return SLANG_SOURCE_LANGUAGE_HLSL;
case SLANG_C_SOURCE: return SLANG_SOURCE_LANGUAGE_C;
case SLANG_CPP_SOURCE: return SLANG_SOURCE_LANGUAGE_CPP;
+ case SLANG_HOST_CPP_SOURCE: return SLANG_SOURCE_LANGUAGE_CPP;
case SLANG_CUDA_SOURCE: return SLANG_SOURCE_LANGUAGE_CUDA;
default: break;
}
diff --git a/source/core/slang-type-text-util.cpp b/source/core/slang-type-text-util.cpp
index 5be097d15..13bf439ce 100644
--- a/source/core/slang-type-text-util.cpp
+++ b/source/core/slang-type-text-util.cpp
@@ -68,11 +68,12 @@ static const CompileTargetInfo s_compileTargetInfos[] =
{ SLANG_SPIRV_ASM, "spv.asm", "spirv-asm,spirv-assembly" },
{ SLANG_C_SOURCE, "c", "c" },
{ SLANG_CPP_SOURCE, "cpp,c++,cxx", "cpp,c++,cxx" },
- { SLANG_EXECUTABLE, "exe", "exe,executable" },
- { SLANG_SHARED_LIBRARY, "dll,so", "sharedlib,sharedlibrary,dll" },
+ { SLANG_HOST_CPP_SOURCE, "cpp,c++,cxx", "cpp,c++,cxx"},
+ { SLANG_HOST_EXECUTABLE,"exe", "exe,executable" },
+ { SLANG_SHADER_SHARED_LIBRARY, "dll,so", "sharedlib,sharedlibrary,dll" },
{ SLANG_CUDA_SOURCE, "cu", "cuda,cu" },
{ SLANG_PTX, "ptx", "ptx" },
- { SLANG_HOST_CALLABLE, "", "host-callable,callable" },
+ { SLANG_SHADER_HOST_CALLABLE, "", "host-callable,callable" },
{ SLANG_OBJECT_CODE, "obj,o", "object-code" },
};
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 779900fd5..c8e05d769 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -66,22 +66,10 @@ syntax snorm : SNormModifier;
/// Modifier to indicate that a function name should not be mangled
/// by the Slang compiler.
///
-/// The `__unmangled` modifier should only be valid on functions
-/// and is mainly useful for the experimental heterogeneous
-/// features of Slang.
+/// The `__extern_cpp` modifier makes a symbol to have unmangled
+/// name in source/output C++ code.
///
-syntax __unmangled : UnmangledModifier;
-
-/// Modifier to indicate that a function name should be exported
-/// directly. Used in tandem with `__unmangled` in heterogeneous
-/// features of Slang.
-///
-syntax __exportDirectly : __exportDirectly;
-
-/// Modifier to indicate that a struct is defined externally and
-/// should therefore not be exported by Slang.
-///
-syntax __externLib : __externLib;
+syntax __extern_cpp : ExternCppModifier;
/// A type that can be used as an operand for builtins
[sealed]
diff --git a/source/slang/slang-ast-modifier.h b/source/slang/slang-ast-modifier.h
index ae9e0924e..35a8ea317 100644
--- a/source/slang/slang-ast-modifier.h
+++ b/source/slang/slang-ast-modifier.h
@@ -28,9 +28,7 @@ class PostfixModifier : public Modifier { SLANG_AST_CLASS(PostfixModifier)};
class ExportedModifier : public Modifier { SLANG_AST_CLASS(ExportedModifier)};
class ConstExprModifier : public Modifier { SLANG_AST_CLASS(ConstExprModifier)};
class GloballyCoherentModifier : public Modifier { SLANG_AST_CLASS(GloballyCoherentModifier)};
-class UnmangledModifier : public Modifier { SLANG_AST_CLASS(UnmangledModifier)};
-class __exportDirectly : public Modifier { SLANG_AST_CLASS(__exportDirectly)};
-class __externLib : public Modifier { SLANG_AST_CLASS(__externLib)};
+class ExternCppModifier : public Modifier { SLANG_AST_CLASS(ExternCppModifier)};
/// A modifier that indicates an `InheritanceDecl` should be ignored during name lookup (and related checks).
class IgnoreForLookupModifier : public Modifier { SLANG_AST_CLASS(IgnoreForLookupModifier) };
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 39d558c01..14912d719 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -55,7 +55,19 @@ namespace Slang
// !!!!!!!!!!!!!!!!!!!!!! free functions for DiagnosicSink !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val)
+bool isHeterogeneousTarget(CodeGenTarget target)
+{
+ switch (target)
+ {
+ case CodeGenTarget::HostCPPSource:
+ case CodeGenTarget::HostExecutable:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val)
{
switch (val)
{
@@ -527,6 +539,7 @@ namespace Slang
case CodeGenTarget::HLSL:
case CodeGenTarget::CUDASource:
case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
case CodeGenTarget::CSource:
{
return PassThroughMode::None;
@@ -555,9 +568,9 @@ namespace Slang
{
return PassThroughMode::Glslang;
}
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::Executable:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::HostExecutable:
{
// We need some C/C++ compiler
return PassThroughMode::GenericCCpp;
@@ -973,12 +986,11 @@ namespace Slang
{
switch (target)
{
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::Executable:
- {
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary:
return CodeGenTarget::CPPSource;
- }
+ case CodeGenTarget::HostExecutable:
+ return CodeGenTarget::HostCPPSource;
case CodeGenTarget::PTX: return CodeGenTarget::CUDASource;
case CodeGenTarget::DXBytecode: return CodeGenTarget::HLSL;
case CodeGenTarget::DXIL: return CodeGenTarget::HLSL;
@@ -988,6 +1000,17 @@ namespace Slang
return CodeGenTarget::Unknown;
}
+ static bool _isCPUHostTarget(CodeGenTarget target)
+ {
+ switch (target)
+ {
+ case CodeGenTarget::HostCPPSource:
+ case CodeGenTarget::HostExecutable:
+ return true;
+ default:
+ return false;
+ }
+ }
SlangResult emitWithDownstreamForEntryPoints(
ComponentType* program,
@@ -1027,7 +1050,7 @@ namespace Slang
return SLANG_FAIL;
}
}
-
+
SLANG_ASSERT(compilerType != PassThroughMode::None);
// Get the required downstream compiler
@@ -1259,9 +1282,18 @@ namespace Slang
}
// If we aren't using LLVM 'host callable', we want downstream compile to produce a shared library
- if (compilerType != PassThroughMode::LLVM && target == CodeGenTarget::HostCallable)
+ if (compilerType != PassThroughMode::LLVM && target == CodeGenTarget::ShaderHostCallable)
{
- target = CodeGenTarget::SharedLibrary;
+ target = CodeGenTarget::ShaderSharedLibrary;
+ }
+
+ if (!isPassThroughEnabled(endToEndReq))
+ {
+ if (_isCPUHostTarget(target))
+ {
+ options.libraryPaths.add(Path::getParentDirectory(Path::getExecutablePath()));
+ options.libraries.add("slang-rt");
+ }
}
options.targetType = (SlangCompileTarget)target;
@@ -1527,9 +1559,9 @@ namespace Slang
case CodeGenTarget::DXIL:
case CodeGenTarget::DXBytecode:
case CodeGenTarget::PTX:
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::Executable:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::HostExecutable:
{
RefPtr<DownstreamCompileResult> downstreamResult;
@@ -1583,9 +1615,9 @@ namespace Slang
case CodeGenTarget::DXIL:
case CodeGenTarget::DXBytecode:
case CodeGenTarget::PTX:
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::Executable:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::HostExecutable:
{
RefPtr<DownstreamCompileResult> downstreamResult;
@@ -1606,6 +1638,7 @@ namespace Slang
case CodeGenTarget::HLSL:
case CodeGenTarget::CUDASource:
case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
case CodeGenTarget::CSource:
{
RefPtr<ExtensionTracker> extensionTracker = _newExtensionTracker(target);
@@ -1796,7 +1829,7 @@ namespace Slang
ComPtr<ISlangBlob> blob;
if (SLANG_FAILED(result.getBlob(blob)))
{
- if (targetReq->getTarget() == CodeGenTarget::HostCallable)
+ if (targetReq->getTarget() == CodeGenTarget::ShaderHostCallable)
{
// Some HostCallable are not directly representable as a 'binary'.
// So here, we just ignore if that appears the case, and don't output an unexpected error.
@@ -1840,9 +1873,9 @@ namespace Slang
case CodeGenTarget::PTX:
// For now we just dump PTX out as hex
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::Executable:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::HostExecutable:
HexDumpUtil::dumpWithMarkers((const uint8_t*)blobData, blobSize, 24, writer);
break;
@@ -2453,11 +2486,12 @@ namespace Slang
case CodeGenTarget::CSource: return ".c";
case CodeGenTarget::CUDASource: return ".cu";
case CodeGenTarget::CPPSource: return ".cpp";
+ case CodeGenTarget::HostCPPSource: return ".cpp";
// What these should be called is target specific, but just use these exts to make clear for now
// for now
- case CodeGenTarget::Executable: return ".exe";
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary: return ".shared-lib";
+ case CodeGenTarget::HostExecutable: return ".exe";
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary: return ".shared-lib";
default: break;
}
return nullptr;
@@ -2475,6 +2509,7 @@ namespace Slang
switch (target)
{
case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
case CodeGenTarget::CUDASource:
case CodeGenTarget::CSource:
case CodeGenTarget::DXILAssembly:
@@ -2513,9 +2548,9 @@ namespace Slang
break;
}
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::Executable:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::HostExecutable:
{
dumpIntermediateBinary(compileRequest, data, size, _getTargetExtension(target));
break;
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 5f14fb4f6..7f8257777 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -71,15 +71,18 @@ namespace Slang
DXILAssembly = SLANG_DXIL_ASM,
CSource = SLANG_C_SOURCE,
CPPSource = SLANG_CPP_SOURCE,
- Executable = SLANG_EXECUTABLE,
- SharedLibrary = SLANG_SHARED_LIBRARY,
- HostCallable = SLANG_HOST_CALLABLE,
+ HostCPPSource = SLANG_HOST_CPP_SOURCE,
+ HostExecutable = SLANG_HOST_EXECUTABLE,
+ ShaderSharedLibrary = SLANG_SHADER_SHARED_LIBRARY,
+ ShaderHostCallable = SLANG_SHADER_HOST_CALLABLE,
CUDASource = SLANG_CUDA_SOURCE,
PTX = SLANG_PTX,
ObjectCode = SLANG_OBJECT_CODE,
CountOf = SLANG_TARGET_COUNT_OF,
};
+ bool isHeterogeneousTarget(CodeGenTarget target);
+
void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val);
enum class ContainerFormat : SlangContainerFormat
@@ -1457,6 +1460,7 @@ namespace Slang
{
lineDirectiveMode = mode;
}
+
void setDumpIntermediates(bool value)
{
dumpIntermediates = value;
@@ -1658,9 +1662,6 @@ namespace Slang
bool m_obfuscateCode = false;
- // Determine whether to output heterogeneity-related code
- bool m_heterogeneous = false;
-
/// Holds any args that are destined for downstream compilers/tools etc
DownstreamArgs m_downstreamArgs;
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index d3dd0e5b8..eb178a366 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -78,6 +78,7 @@ struct CLikeSourceEmitter::ComputeEmitActionsContext
return SourceLanguage::C;
}
case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
{
return SourceLanguage::CPP;
}
@@ -741,28 +742,6 @@ String CLikeSourceEmitter::_generateUniqueName(const UnownedStringSlice& name)
String CLikeSourceEmitter::generateName(IRInst* inst)
{
- // Handle `__exportDirectly` decoration before all else
- if (inst->findDecoration<IR__exportDirectly>())
- {
- // If instruction has a NameHint, we naively emit it as a namespace
- // This is automatically handled in `getNameforNameHint` when the
- // `__exportDirectly` decoration is found, so we can just return it.
- // TODO: This is a very hacky solution.
- //
- // Another option would be to have two separate decorations, one that
- // handles this namespace, and a separate decoration for unmangled names.
- if (auto nameHintDecoration = inst->findDecoration<IRNameHintDecoration>())
- {
- return nameHintDecoration->getName();
- }
- // Otherwise, we just want the instruction to not be mangled, which is
- // similarly handled in `getMangledName`.
- if (auto linkageDecoration = inst->findDecoration<IRLinkageDecoration>())
- {
- return linkageDecoration->getMangledName();
- }
- }
-
// If the instruction names something
// that should be emitted as a target intrinsic,
// then use that name instead.
@@ -802,6 +781,13 @@ String CLikeSourceEmitter::generateName(IRInst* inst)
return generateEntryPointNameImpl(entryPointDecor);
}
+ // If the instruction has a linkage decoration, just use that.
+ if (auto externCppDecoration = inst->findDecoration<IRExternCppDecoration>())
+ {
+ // Just use the linkages mangled name directly.
+ return externCppDecoration->getName();
+ }
+
// If we have a name hint on the instruction, then we will try to use that
// to provide the basis for the actual name in the output code.
if(auto nameHintDecoration = inst->findDecoration<IRNameHintDecoration>())
@@ -2915,13 +2901,6 @@ void CLikeSourceEmitter::emitStruct(IRStructType* structType)
return;
}
- // If the selected `struct` type is externally defined
- // then we also don't want to emit anything.
- if (auto externLibDecoration = structType->findDecoration<IR__externLib>())
- {
- return;
- }
-
m_writer->emit("struct ");
emitPostKeywordTypeAttributes(structType);
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index e06aa8372..e7b7af991 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -2,7 +2,7 @@
#include "slang-emit-cpp.h"
#include "../core/slang-writer.h"
-
+#include "../core/slang-token-reader.h"
#include "slang-emit-source-writer.h"
#include "slang-mangled-lexer.h"
@@ -167,6 +167,31 @@ static UnownedStringSlice _getCTypeVecPostFix(IROp op)
}
}
+static bool _isCppTarget(CodeGenTarget target)
+{
+ switch (target)
+ {
+ case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool _isCppOrCudaTarget(CodeGenTarget target)
+{
+ switch (target)
+ {
+ case CodeGenTarget::CPPSource:
+ case CodeGenTarget::HostCPPSource:
+ case CodeGenTarget::CUDASource:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* !!!!!!!!!!!!!!!!!!!!!!!! CPPEmitHandler !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* static */ UnownedStringSlice CPPSourceEmitter::getBuiltinTypeName(IROp op)
@@ -198,7 +223,7 @@ static UnownedStringSlice _getCTypeVecPostFix(IROp op)
void CPPSourceEmitter::emitTypeDefinition(IRType* inType)
{
- if (m_target == CodeGenTarget::CPPSource)
+ if (_isCppTarget(m_target))
{
// All types are templates in C++
return;
@@ -432,7 +457,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
auto vecCount = int(getIntVal(vecType->getElementCount()));
auto elemType = vecType->getElementType();
- if (target == CodeGenTarget::CPPSource || target == CodeGenTarget::CUDASource)
+ if (_isCppOrCudaTarget(target))
{
out << "Vector<" << _getTypeName(elemType) << ", " << vecCount << ">";
}
@@ -458,7 +483,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
const auto rowCount = int(getIntVal(matType->getRowCount()));
const auto colCount = int(getIntVal(matType->getColumnCount()));
- if (target == CodeGenTarget::CPPSource || target == CodeGenTarget::CUDASource)
+ if (_isCppOrCudaTarget(target))
{
out << "Matrix<" << _getTypeName(elementType) << ", " << rowCount << ", " << colCount << ">";
}
@@ -542,6 +567,11 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
out << "TypeInfo*";
return SLANG_OK;
}
+ case kIROp_StringType:
+ {
+ out << "String";
+ return SLANG_OK;
+ }
default:
{
if (isNominalOp(type->getOp()))
@@ -2326,6 +2356,14 @@ bool CPPSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOut
m_writer->emit("))");
return true;
}
+ case kIROp_StringLit:
+ {
+ m_writer->emit("String(");
+ m_writer->emit(Slang::Misc::EscapeStringLiteral(as<IRStringLit>(inst)->getStringSlice()));
+ m_writer->emit(")");
+ return true;
+ }
+
}
}
@@ -2361,10 +2399,9 @@ void CPPSourceEmitter::emitPreprocessorDirectivesImpl()
if (m_target == CodeGenTarget::CPPSource)
{
- // Put all into an anonymous namespace
- // This includes any generated types, and generated intrinsics
- if (!m_compileRequest->getLinkage()->m_heterogeneous)
- m_writer->emit("namespace { // anonymous \n\n");
+ // When generating kernel code in C++, put all into an anonymous namespace
+ // This includes any generated types, and generated intrinsics.
+ m_writer->emit("namespace { // anonymous \n\n");
m_writer->emit("#ifdef SLANG_PRELUDE_NAMESPACE\n");
m_writer->emit("using namespace SLANG_PRELUDE_NAMESPACE;\n");
m_writer->emit("#endif\n\n");
@@ -2629,130 +2666,7 @@ void CPPSourceEmitter::_emitForwardDeclarations(const List<EmitAction>& actions)
void CPPSourceEmitter::emitModuleImpl(IRModule* module, DiagnosticSink* sink)
{
- // If we are emitting a heterogeneous program
- // Emit the binary blob of each non-CPP target
- ComponentType* program = m_compileRequest->getProgram();
- auto linkage = m_compileRequest->getLinkage();
- if (linkage->m_heterogeneous)
- {
- for (auto inst : module->getGlobalInsts())
- {
- auto func = as<IRFunc>(inst);
- if (!func)
- continue;
- if (auto entryPointDecoration = func->findDecoration<IREntryPointDecoration>())
- {
- String entryPointName = entryPointDecoration->getName()->getStringSlice();
- String moduleName = entryPointDecoration->getModuleName()->getStringSlice();
- for (int index = 0; index < program->getEntryPointCount(); index++)
- {
- auto entryPoint = program->getEntryPoint(index);
- if (entryPointName == entryPoint->getName()->text)
- {
- for (auto targetRequest : linkage->targets)
- {
- // Emit for all non-CPU targets
- switch (targetRequest->getTarget())
- {
- case(CodeGenTarget::CPPSource):
- case(CodeGenTarget::CSource):
- case(CodeGenTarget::HostCallable):
- case(CodeGenTarget::CUDASource):
-
- break;
-
- default:
-
- auto targetProgram = program->getTargetProgram(targetRequest);
- CompileResult result =
- targetProgram->getOrCreateEntryPointResult(index, sink);
-
- Slang::ComPtr<ISlangBlob> blob;
- if (SLANG_FAILED(result.getBlob(blob)))
- {
- sink->diagnoseRaw(Severity::Error,
- "Slang heterogeneous error: No blob to emit\n");
- m_writer->emit("size_t __");
- m_writer->emit(entryPointName);
- m_writer->emit("Size = 0;\n");
- m_writer->emit("unsigned char __");
- m_writer->emit(entryPointName);
- m_writer->emit("[1];\n");
- }
-
- else
- {
- // auto ptr = (const unsigned char*)blob->getBufferPointer();
-
- // m_writer->emit("size_t __");
- // m_writer->emit(entryPointName);
- // m_writer->emit("Size = ");
- // m_writer->emitInt64(blob->getBufferSize());
- // m_writer->emit(";\n");
-
- // m_writer->emit("unsigned char __");
- // m_writer->emit(entryPointName);
- // m_writer->emit("[] = {");
- // every 20 bytes, emit a newline
- // size_t j = 0;
- // for (size_t i = 0; i < blob->getBufferSize(); i++) {
- // m_writer->emitUInt64(ptr[i]);
- // m_writer->emit(", ");
- // if (j == 20)
- // {
- // m_writer->emit("\n");
- // j = 0;
- // }
- // j++;
- // }
- // m_writer->emit("};\n");
- }
- }
- }
- // Hardcode in (for now) an include for slang-gfx.h so that we can make use
- // of the gfx namespace
- //
- // TODO: Aside from making sure this approach is viable, it would also be
- // much better to allow this to be done by the programmer in the Slang file.
- m_writer->emit("#include \"slang-gfx.h\"\n\n");
-
- // Emit boilerplate that requires gfx.
- // This is required by the wrapper, so that will be the next place to look
- // as far as removing boilerplate goes.
- m_writer->emit("gfx::IShaderProgram* loadShaderProgram(gfx::IDevice* _0, char* _1, char* _2);\n");
- m_writer->emit("gfx::ITransientResourceHeap* buildTransientHeap(gfx::IDevice* _0);\n");
- m_writer->emit("gfx::IPipelineState* buildPipelineState(gfx::IDevice* _0, gfx::IShaderProgram* _1);\n");
- m_writer->emit("void dispatchComputation(gfx::IDevice* _0, gfx::ITransientResourceHeap* _1, gfx::IPipelineState* _2, gfx::IResourceView* _3, uint32_t gridDimsX, uint32_t gridDimsY, uint32_t gridDimsZ);\n");
- m_writer->emit("gfx::IResourceView* createBufferView(gfx::IDevice* _0, gfx::IBufferResource* _1);\n");
- m_writer->emit("gfx::IBufferResource* unconvertBuffer(RWStructuredBuffer<float> _0);\n\n");
-
- // Emit a wrapper function for calling the shader blob
- m_writer->emit("void ");
- m_writer->emit(entryPointName);
- m_writer->emit("_wrapper(gfx::IDevice* device, Vector<uint32_t, 3> gridDims, \n");
- m_writer->emit("\tRWStructuredBuffer<float> buffer)\n{");
- /* m_writer->emit("\n\tgfx_ShaderProgram_0* shaderProgram = loadShaderProgram_0(device, __");
- m_writer->emit(entryPointName);
- m_writer->emit(", __");
- m_writer->emit(entryPointName);
- m_writer->emit("Size);");*/
- m_writer->emit("\n\tgfx::IShaderProgram* shaderProgram = loadShaderProgram(device, \"");
- m_writer->emit(entryPointName);
- m_writer->emit("\", \"");
- m_writer->emit(moduleName);
- m_writer->emit("\");");
- m_writer->emit("\n\tgfx::ITransientResourceHeap* transientHeap = buildTransientHeap(device);");
- m_writer->emit("\n\tgfx::IPipelineState* pipelineState = ");
- m_writer->emit("buildPipelineState(device, shaderProgram);");
- m_writer->emit("\n\tgfx::IResourceView* bufferView = createBufferView(device, unconvertBuffer(buffer));");
- m_writer->emit("\n\tdispatchComputation(device, transientHeap, pipelineState, ");
- m_writer->emit("bufferView, gridDims.x, gridDims.y, gridDims.z);");
- m_writer->emit("\n}\n");
- }
- }
- }
- }
- }
+ SLANG_UNUSED(sink);
// Setup all built in types used in the module
m_typeSet.addAllBuiltinTypes(module);
@@ -2790,9 +2704,8 @@ void CPPSourceEmitter::emitModuleImpl(IRModule* module, DiagnosticSink* sink)
if (m_target == CodeGenTarget::CPPSource)
{
- // Need to close the anonymous namespace when outputting for C++
- if (!linkage->m_heterogeneous)
- m_writer->emit("} // anonymous\n\n");
+ // Need to close the anonymous namespace when outputting for C++ kernel.
+ m_writer->emit("} // anonymous\n\n");
}
// Finally we need to output dll entry points
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index a0ac30857..23f06e8e9 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -59,6 +59,8 @@
#include <assert.h>
+Slang::String get_slang_cpp_host_prelude();
+
namespace Slang {
EntryPointLayout* findEntryPointLayout(
@@ -257,6 +259,8 @@ Result linkAndOptimizeIR(
CollectEntryPointUniformParamsOptions passOptions;
switch( target )
{
+ case CodeGenTarget::HostCPPSource:
+ break;
case CodeGenTarget::CUDASource:
collectOptiXEntryPointUniformParams(irModule);
#if 0
@@ -286,7 +290,7 @@ Result linkAndOptimizeIR(
#endif
validateIRModuleIfEnabled(compileRequest, irModule);
break;
-
+ case CodeGenTarget::HostCPPSource:
case CodeGenTarget::CPPSource:
case CodeGenTarget::CUDASource:
break;
@@ -873,6 +877,11 @@ SlangResult emitEntryPointsSourceFromIR(
sourceEmitter->emitPreludeDirectives();
+ if (isHeterogeneousTarget(target))
+ {
+ sourceWriter.emit(get_slang_cpp_host_prelude());
+ }
+ else
{
// If there is a prelude emit it
const auto& prelude = compileRequest->getSession()->getPreludeForLanguage(sourceLanguage);
diff --git a/source/slang/slang-ir-inst-defs.h b/source/slang/slang-ir-inst-defs.h
index a3486ee68..bcc42ad9e 100644
--- a/source/slang/slang-ir-inst-defs.h
+++ b/source/slang/slang-ir-inst-defs.h
@@ -558,9 +558,6 @@ INST(HighLevelDeclDecoration, highLevelDecl, 1, 0)
INST(InstanceDecoration, instance, 1, 0)
INST(NumThreadsDecoration, numThreads, 3, 0)
- INST(__exportDirectly, __exportDirectly, 0, 0)
- INST(__externLib, __externLib, 0, 0)
-
// Added to IRParam parameters to an entry point
/* GeometryInputPrimitiveTypeDecoration */
INST(PointInputPrimitiveTypeDecoration, pointPrimitiveType, 0, 0)
@@ -604,6 +601,9 @@ INST(HighLevelDeclDecoration, highLevelDecl, 1, 0)
INST(ExportDecoration, export, 1, 0)
INST_RANGE(LinkageDecoration, ImportDecoration, ExportDecoration)
+ /// An extern_cpp decoration marks the inst to emit its name without mangling for C++ interop.
+ INST(ExternCppDecoration, externCpp, 1, 0)
+
/* Decorations for RTTI objects */
INST(RTTITypeSizeDecoration, RTTI_typeSize, 1, 0)
INST(AnyValueSizeDecoration, AnyValueSize, 1, 0)
diff --git a/source/slang/slang-ir-insts.h b/source/slang/slang-ir-insts.h
index 09a3bdbb3..102c48495 100644
--- a/source/slang/slang-ir-insts.h
+++ b/source/slang/slang-ir-insts.h
@@ -269,8 +269,6 @@ IR_SIMPLE_DECORATION(PublicDecoration)
IR_SIMPLE_DECORATION(KeepAliveDecoration)
IR_SIMPLE_DECORATION(RequiresNVAPIDecoration)
IR_SIMPLE_DECORATION(NoInlineDecoration)
-IR_SIMPLE_DECORATION(__exportDirectly)
-IR_SIMPLE_DECORATION(__externLib)
struct IRNVAPIMagicDecoration : IRDecoration
{
@@ -419,6 +417,19 @@ struct IRExportDecoration : IRLinkageDecoration
IR_LEAF_ISA(ExportDecoration)
};
+struct IRExternCppDecoration : IRDecoration
+{
+ enum
+ {
+ kOp = kIROp_ExternCppDecoration
+ };
+ IR_LEAF_ISA(ExternCppDecoration)
+
+ IRStringLit* getNameOperand() { return cast<IRStringLit>(getOperand(0)); }
+
+ UnownedStringSlice getName() { return getNameOperand()->getStringSlice(); }
+};
+
struct IRFormatDecoration : IRDecoration
{
enum { kOp = kIROp_FormatDecoration };
@@ -2795,6 +2806,11 @@ public:
addDecoration(value, kIROp_ExportDecoration, getStringValue(mangledName));
}
+ void addExternCppDecoration(IRInst* value, UnownedStringSlice const& mangledName)
+ {
+ addDecoration(value, kIROp_ExternCppDecoration, getStringValue(mangledName));
+ }
+
void addEntryPointDecoration(IRInst* value, Profile profile, UnownedStringSlice const& name, UnownedStringSlice const& moduleName)
{
IRInst* operands[] = { getIntValue(getIntType(), profile.raw), getStringValue(name), getStringValue(moduleName) };
@@ -2866,16 +2882,6 @@ public:
{
addDecoration(inst, kIROp_SequentialIDDecoration, getIntValue(getUIntType(), id));
}
-
- void addExportDirectlyDecoration(IRInst* value)
- {
- addDecoration(value, kIROp___exportDirectly);
- }
-
- void addExternLibDecoration(IRInst* value)
- {
- addDecoration(value, kIROp___externLib);
- }
};
void addHoistableInst(
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 9ec8c1c71..779034979 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -1047,13 +1047,9 @@ static void addLinkageDecoration(
builder->addPublicDecoration(inst);
builder->addKeepAliveDecoration(inst);
}
- if (decl->findModifier<__exportDirectly>())
+ if (decl->findModifier<ExternCppModifier>())
{
- builder->addExportDirectlyDecoration(inst);
- }
- if (decl->findModifier<__externLib>())
- {
- builder->addExternLibDecoration(inst);
+ builder->addExternCppDecoration(inst, mangledName);
}
}
@@ -1994,12 +1990,7 @@ static String getNameForNameHint(
StringBuilder sb;
sb.append(parentName);
- if (decl->hasModifier<__exportDirectly>()) {
- sb.append("::");
- }
- else {
- sb.append(".");
- }
+ sb.append(".");
sb.append(leafName->text);
return sb.ProduceString();
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp
index acb561531..e6c0a8e7f 100644
--- a/source/slang/slang-mangle.cpp
+++ b/source/slang/slang-mangle.cpp
@@ -455,9 +455,9 @@ namespace Slang
auto decl = declRef.getDecl();
- // Handle `__unmangled` modifier by simply emitting
+ // Handle `__extern_cpp` modifier by simply emitting
// the given name.
- if (decl->hasModifier<UnmangledModifier>())
+ if (decl->hasModifier<ExternCppModifier>())
{
emit(context, decl->getName()->text);
return;
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index b40dedc99..2d5e1aeea 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -1161,10 +1161,6 @@ struct OptionsParser
rawEntryPoints.add(rawEntryPoint);
}
- else if (argValue == "-heterogeneous")
- {
- requestImpl->getLinkage()->m_heterogeneous = true;
- }
else if (argValue == "-lang")
{
CommandLineArg name;
@@ -1995,9 +1991,9 @@ struct OptionsParser
case CodeGenTarget::CPPSource:
case CodeGenTarget::PTX:
case CodeGenTarget::CUDASource:
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::Executable:
- case CodeGenTarget::SharedLibrary:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::HostExecutable:
+ case CodeGenTarget::ShaderSharedLibrary:
rawOutput.isWholeProgram = true;
break;
default:
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp
index 7fbc59dc7..7bff7118e 100644
--- a/source/slang/slang-parameter-binding.cpp
+++ b/source/slang/slang-parameter-binding.cpp
@@ -3033,9 +3033,9 @@ static bool _isCPUTarget(CodeGenTarget target)
{
case CodeGenTarget::CPPSource:
case CodeGenTarget::CSource:
- case CodeGenTarget::Executable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::HostCallable:
+ case CodeGenTarget::HostExecutable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::ShaderHostCallable:
{
return true;
}
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp
index b48e70eae..cd81c6173 100644
--- a/source/slang/slang-type-layout.cpp
+++ b/source/slang/slang-type-layout.cpp
@@ -1403,9 +1403,9 @@ LayoutRulesFamilyImpl* getDefaultLayoutRulesFamilyForTarget(TargetRequest* targe
case CodeGenTarget::SPIRVAssembly:
return &kGLSLLayoutRulesFamilyImpl;
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::Executable:
- case CodeGenTarget::SharedLibrary:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::HostExecutable:
+ case CodeGenTarget::ShaderSharedLibrary:
case CodeGenTarget::CPPSource:
case CodeGenTarget::CSource:
{
@@ -1610,9 +1610,9 @@ bool isCPUTarget(TargetRequest* targetReq)
case CodeGenTarget::CPPSource:
case CodeGenTarget::CSource:
- case CodeGenTarget::HostCallable:
- case CodeGenTarget::Executable:
- case CodeGenTarget::SharedLibrary:
+ case CodeGenTarget::ShaderHostCallable:
+ case CodeGenTarget::HostExecutable:
+ case CodeGenTarget::ShaderSharedLibrary:
return true;
}
}
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index e0b11604c..e83ab2da3 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -215,8 +215,8 @@ void Session::_initCodeGenTransitionMap()
// We *don't* add a default for host callable, as we will determine what is suitable depending on what
// is available. We prefer LLVM if that's available. If it's not we can use generic C/C++ compiler
- map.addTransition(source, CodeGenTarget::SharedLibrary, PassThroughMode::GenericCCpp);
- map.addTransition(source, CodeGenTarget::Executable, PassThroughMode::GenericCCpp);
+ map.addTransition(source, CodeGenTarget::ShaderSharedLibrary, PassThroughMode::GenericCCpp);
+ map.addTransition(source, CodeGenTarget::HostExecutable, PassThroughMode::GenericCCpp);
map.addTransition(source, CodeGenTarget::ObjectCode, PassThroughMode::GenericCCpp);
}
}
@@ -666,7 +666,7 @@ SlangPassThrough Session::getDownstreamCompilerForTransition(SlangCompileTarget
}
// Special case host-callable
- if (target == CodeGenTarget::HostCallable)
+ if (target == CodeGenTarget::ShaderHostCallable)
{
if (source == CodeGenTarget::CSource || source == CodeGenTarget::CPPSource)
{
@@ -1326,9 +1326,9 @@ CapabilitySet TargetRequest::getTargetCaps()
break;
case CodeGenTarget::CPPSource:
- case CodeGenTarget::Executable:
- case CodeGenTarget::SharedLibrary:
- case CodeGenTarget::HostCallable:
+ case CodeGenTarget::HostExecutable:
+ case CodeGenTarget::ShaderSharedLibrary:
+ case CodeGenTarget::ShaderHostCallable:
atoms.add(CapabilityAtom::CPP);
break;
diff --git a/tools/gfx/cpu/render-cpu.cpp b/tools/gfx/cpu/render-cpu.cpp
index d17cf6ea8..7e1de796a 100644
--- a/tools/gfx/cpu/render-cpu.cpp
+++ b/tools/gfx/cpu/render-cpu.cpp
@@ -1143,7 +1143,7 @@ public:
{
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
- SLANG_HOST_CALLABLE,
+ SLANG_SHADER_HOST_CALLABLE,
"sm_5_1",
makeArray(slang::PreprocessorMacroDesc{ "__CPU__", "1" }).getView()));
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 81e8cd38a..aa0a60829 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -1204,7 +1204,7 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
slangPassThrough = SLANG_PASS_THROUGH_GLSLANG;
break;
case DeviceType::CPU:
- input.target = SLANG_HOST_CALLABLE;
+ input.target = SLANG_SHADER_HOST_CALLABLE;
input.profile = "";
nativeLanguage = SLANG_SOURCE_LANGUAGE_CPP;
slangPassThrough = SLANG_PASS_THROUGH_GENERIC_C_CPP;
diff --git a/tools/slang-embed/slang-embed.cpp b/tools/slang-embed/slang-embed.cpp
index 4a81c1b95..7fb865eee 100644
--- a/tools/slang-embed/slang-embed.cpp
+++ b/tools/slang-embed/slang-embed.cpp
@@ -18,7 +18,7 @@
#include "../../source/core/slang-string.h"
#include "../../source/core/slang-string-util.h"
#include "../../source/core/slang-io.h"
-
+#include "../../source/core/slang-dictionary.h"
// Utility to free pointers on scope exit
struct ScopedMemory
@@ -59,6 +59,7 @@ struct App
{
char const* appName = "slang-embed";
char const* inputPath = nullptr;
+ Slang::HashSet<Slang::String> includedFiles;
void parseOptions(int argc, char** argv)
{
@@ -89,6 +90,13 @@ struct App
{
using namespace Slang;
+ String canonicalPath;
+ if (SLANG_SUCCEEDED(Slang::Path::getCanonical(inputPath, canonicalPath)))
+ {
+ if (!includedFiles.Add(canonicalPath))
+ return;
+ }
+
// We open the input file in text mode because we are currently
// embedding textual source files. If/when this utility gets
// used for binary files another mode could be called for.
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 05be9e0de..d5f4408ed 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -759,6 +759,7 @@ static PassThroughFlags _getPassThroughFlagsForTarget(SlangCompileTarget target)
case SLANG_GLSL:
case SLANG_C_SOURCE:
case SLANG_CPP_SOURCE:
+ case SLANG_HOST_CPP_SOURCE:
case SLANG_CUDA_SOURCE:
{
return 0;
@@ -779,9 +780,9 @@ static PassThroughFlags _getPassThroughFlagsForTarget(SlangCompileTarget target)
return PassThroughFlag::Dxc;
}
- case SLANG_HOST_CALLABLE:
- case SLANG_EXECUTABLE:
- case SLANG_SHARED_LIBRARY:
+ case SLANG_SHADER_HOST_CALLABLE:
+ case SLANG_HOST_EXECUTABLE:
+ case SLANG_SHADER_SHARED_LIBRARY:
{
return PassThroughFlag::Generic_C_CPP;
}
@@ -891,7 +892,7 @@ static SlangResult _extractRenderTestRequirements(const CommandLine& cmdLine, Te
passThru = SLANG_PASS_THROUGH_GLSLANG;
break;
case RenderApiType::CPU:
- target = SLANG_HOST_CALLABLE;
+ target = SLANG_SHADER_HOST_CALLABLE;
nativeLanguage = SLANG_SOURCE_LANGUAGE_CPP;
passThru = SLANG_PASS_THROUGH_GENERIC_C_CPP;
break;
@@ -1364,7 +1365,7 @@ TestResult runSimpleTest(TestContext* context, TestInput& input)
}
// If it's executable we run it and use it's output
- if (target == SLANG_EXECUTABLE)
+ if (target == SLANG_HOST_EXECUTABLE)
{
ExecuteResult runExeRes;
if (SLANG_FAILED(_executeBinary(exeRes.standardOutput.getUnownedSlice(), runExeRes)))
@@ -1797,7 +1798,7 @@ static TestResult runCPPCompilerSharedLibrary(TestContext* context, TestInput& i
options.sourceLanguage = (ext == "c") ? SLANG_SOURCE_LANGUAGE_C : SLANG_SOURCE_LANGUAGE_CPP;
// Build a shared library
- options.targetType = SLANG_SHARED_LIBRARY;
+ options.targetType = SLANG_SHADER_SHARED_LIBRARY;
// Compile this source
options.sourceFiles.add(filePath);