diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2016-08-20 06:38:41 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2016-08-20 06:38:41 +0000 |
| commit | 8077ddaf62bdbff2169973eca565a5752501587d (patch) | |
| tree | 0532180e74cf5215736fd4e053216e291326fbcb /RenderScript | |
| parent | One more update to android build configuration (diff) | |
| download | DiligentTools-8077ddaf62bdbff2169973eca565a5752501587d.tar.gz DiligentTools-8077ddaf62bdbff2169973eca565a5752501587d.zip | |
Updated to Diligent Engine 2.0
Diffstat (limited to 'RenderScript')
76 files changed, 1822 insertions, 1147 deletions
diff --git a/RenderScript/build/WindowsStore/RenderScript.Windows/RenderScript.Windows.vcxproj b/RenderScript/build/UWP/RenderScript.vcxproj index 250c7b6..6cc4c9d 100644 --- a/RenderScript/build/WindowsStore/RenderScript.Windows/RenderScript.Windows.vcxproj +++ b/RenderScript/build/UWP/RenderScript.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|ARM"> <Configuration>Debug</Configuration> @@ -27,88 +27,89 @@ </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> - <ProjectGuid>{1911bc2f-d78f-49c7-8847-b10b333da85a}</ProjectGuid> + <ProjectGuid>{6295c316-2ca6-4512-ae9b-f5f70dbd6d33}</ProjectGuid> + <Keyword>StaticLibrary</Keyword> <RootNamespace>RenderScript</RootNamespace> <DefaultLanguage>en-US</DefaultLanguage> - <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> + <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> <AppContainerApplication>true</AppContainerApplication> <ApplicationType>Windows Store</ApplicationType> - <ApplicationTypeRevision>8.1</ApplicationTypeRevision> - <ConvergedProjectType>CodeSharingStaticLibrary</ConvergedProjectType> + <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion> + <ApplicationTypeRevision>10.0</ApplicationTypeRevision> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <Import Project="..\RenderScript.Shared\RenderScript.Shared.vcxitems" Label="Shared" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + <Import Project="..\Windows.Shared\RenderScript.Shared.vcxitems" Label="Shared" /> + </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" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStore32Dbg.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> + <Import Project="..\..\..\..\diligentcore\Shared\build\UWP\UWP_Win32Dbg.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </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" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStore32Rel.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> + <Import Project="..\..\..\..\diligentcore\Shared\build\UWP\UWP_Win32Rel.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStoreArmDbg.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> + <Import Project="..\..\..\..\diligentcore\Shared\build\UWP\UWP_ArmDbg.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStoreArmRel.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> + <Import Project="..\..\..\..\diligentcore\Shared\build\UWP\UWP_ArmRel.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </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" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStore64Dbg.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> + <Import Project="..\..\..\..\diligentcore\Shared\build\UWP\UWP_X64Dbg.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </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" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStore64Rel.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> + <Import Project="..\..\..\..\diligentcore\Shared\build\UWP\UWP_X64Rel.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <GenerateManifest>false</GenerateManifest> </PropertyGroup> @@ -129,7 +130,6 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> <CompileAsWinRT>false</CompileAsWinRT> <SDLCheck>true</SDLCheck> </ClCompile> @@ -141,7 +141,6 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> <CompileAsWinRT>false</CompileAsWinRT> <SDLCheck>true</SDLCheck> </ClCompile> @@ -153,7 +152,6 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'"> <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> <CompileAsWinRT>false</CompileAsWinRT> <SDLCheck>true</SDLCheck> </ClCompile> @@ -165,7 +163,6 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'"> <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> <CompileAsWinRT>false</CompileAsWinRT> <SDLCheck>true</SDLCheck> </ClCompile> @@ -177,7 +174,6 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> <CompileAsWinRT>false</CompileAsWinRT> <SDLCheck>true</SDLCheck> </ClCompile> @@ -189,7 +185,6 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> <CompileAsWinRT>false</CompileAsWinRT> <SDLCheck>true</SDLCheck> </ClCompile> diff --git a/RenderScript/build/UWP/RenderScript.vcxproj.filters b/RenderScript/build/UWP/RenderScript.vcxproj.filters new file mode 100644 index 0000000..c31757e --- /dev/null +++ b/RenderScript/build/UWP/RenderScript.vcxproj.filters @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
\ No newline at end of file diff --git a/RenderScript/build/Windows/RenderScript-Debug.vgdbsettings b/RenderScript/build/Win32/RenderScript-Debug.vgdbsettings index 3f5b24b..3f5b24b 100644 --- a/RenderScript/build/Windows/RenderScript-Debug.vgdbsettings +++ b/RenderScript/build/Win32/RenderScript-Debug.vgdbsettings diff --git a/RenderScript/build/Windows/RenderScript-Release.vgdbsettings b/RenderScript/build/Win32/RenderScript-Release.vgdbsettings index 669691f..669691f 100644 --- a/RenderScript/build/Windows/RenderScript-Release.vgdbsettings +++ b/RenderScript/build/Win32/RenderScript-Release.vgdbsettings diff --git a/RenderScript/build/Windows/RenderScript.vcxproj b/RenderScript/build/Win32/RenderScript.vcxproj index 3ea8d8e..403dd93 100644 --- a/RenderScript/build/Windows/RenderScript.vcxproj +++ b/RenderScript/build/Win32/RenderScript.vcxproj @@ -67,31 +67,27 @@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> - <Import Project="..\WindowsStore\RenderScript.Shared\RenderScript.Shared.vcxitems" Label="Shared" Condition="Exists('..\WindowsStore\RenderScript.Shared\RenderScript.Shared.vcxitems')" /> + <Import Project="..\Windows.Shared\RenderScript.Shared.vcxitems" Label="Shared" Condition="Exists('..\Windows.Shared\RenderScript.Shared.vcxitems')" /> </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" /> <Import Project="..\..\..\..\diligentcore\Shared\build\Windows\Win32d.props" /> - <Import Project="EngineRoot.props" /> - <Import Project="RenderScript.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\..\..\diligentcore\Shared\build\Windows\Win64d.props" /> - <Import Project="EngineRoot.props" /> - <Import Project="RenderScript.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </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" /> <Import Project="..\..\..\..\diligentcore\Shared\build\Windows\Win32r.props" /> - <Import Project="EngineRoot.props" /> - <Import Project="RenderScript.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\..\..\diligentcore\Shared\build\Windows\Win64r.props" /> - <Import Project="EngineRoot.props" /> - <Import Project="RenderScript.props" /> + <Import Project="..\Windows.Shared\RenderScript.props" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <Import Project="..\..\..\..\diligentcore\Shared\build\Windows\Android32d.props" /> @@ -163,7 +159,7 @@ <None Include="jni\Application.mk" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\src\BlendStateParser.cpp"> + <ClCompile Include="..\..\src\BlendStateDescParser.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> @@ -181,7 +177,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\..\src\DepthStencilStateParser.cpp"> + <ClCompile Include="..\..\src\DepthStencilStateDescParser.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> @@ -211,7 +207,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\..\src\LayoutDescParser.cpp"> + <ClCompile Include="..\..\src\InputLayoutDescParser.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> @@ -241,7 +237,13 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\..\src\RasterizerStateParser.cpp"> + <ClCompile Include="..\..\src\PSODescParser.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\src\RasterizerStateDescParser.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> @@ -277,6 +279,12 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> + <ClCompile Include="..\..\src\ShaderResourceBindingParser.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </ClCompile> <ClCompile Include="..\..\src\ShaderVariableParser.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> diff --git a/RenderScript/build/Windows/RenderScript.vcxproj.filters b/RenderScript/build/Win32/RenderScript.vcxproj.filters index 4ef09d5..fda009a 100644 --- a/RenderScript/build/Windows/RenderScript.vcxproj.filters +++ b/RenderScript/build/Win32/RenderScript.vcxproj.filters @@ -17,7 +17,7 @@ </None> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\src\BlendStateParser.cpp"> + <ClCompile Include="..\..\src\BlendStateDescParser.cpp"> <Filter>android_src</Filter> </ClCompile> <ClCompile Include="..\..\src\BufferParser.cpp"> @@ -26,7 +26,7 @@ <ClCompile Include="..\..\src\BufferViewParser.cpp"> <Filter>android_src</Filter> </ClCompile> - <ClCompile Include="..\..\src\DepthStencilStateParser.cpp"> + <ClCompile Include="..\..\src\DepthStencilStateDescParser.cpp"> <Filter>android_src</Filter> </ClCompile> <ClCompile Include="..\..\src\DeviceContextFuncBindings.cpp"> @@ -41,7 +41,7 @@ <ClCompile Include="..\..\src\EnumMappings.cpp"> <Filter>android_src</Filter> </ClCompile> - <ClCompile Include="..\..\src\LayoutDescParser.cpp"> + <ClCompile Include="..\..\src\InputLayoutDescParser.cpp"> <Filter>android_src</Filter> </ClCompile> <ClCompile Include="..\..\src\LuaBindings.cpp"> @@ -56,7 +56,10 @@ <ClCompile Include="..\..\src\ParsingErrors.cpp"> <Filter>android_src</Filter> </ClCompile> - <ClCompile Include="..\..\src\RasterizerStateParser.cpp"> + <ClCompile Include="..\..\src\PSODescParser.cpp"> + <Filter>android_src</Filter> + </ClCompile> + <ClCompile Include="..\..\src\RasterizerStateDescParser.cpp"> <Filter>android_src</Filter> </ClCompile> <ClCompile Include="..\..\src\ResourceMappingParser.cpp"> @@ -74,6 +77,12 @@ <ClCompile Include="..\..\src\ShaderParser.cpp"> <Filter>android_src</Filter> </ClCompile> + <ClCompile Include="..\..\src\ShaderResourceBindingParser.cpp"> + <Filter>android_src</Filter> + </ClCompile> + <ClCompile Include="..\..\src\ShaderVariableParser.cpp"> + <Filter>android_src</Filter> + </ClCompile> <ClCompile Include="..\..\src\TextureParser.cpp"> <Filter>android_src</Filter> </ClCompile> @@ -83,8 +92,5 @@ <ClCompile Include="..\..\src\ViewportParser.cpp"> <Filter>android_src</Filter> </ClCompile> - <ClCompile Include="..\..\src\ShaderVariableParser.cpp"> - <Filter>android_src</Filter> - </ClCompile> </ItemGroup> </Project>
\ No newline at end of file diff --git a/RenderScript/build/Windows/jni/Android.mk b/RenderScript/build/Win32/jni/Android.mk index d629a4f..d968fcc 100644 --- a/RenderScript/build/Windows/jni/Android.mk +++ b/RenderScript/build/Win32/jni/Android.mk @@ -26,6 +26,6 @@ LOCAL_C_INCLUDES += $(CORE_ROOT)/Platforms/interface # Source files #VisualGDBAndroid: AutoUpdateSourcesInNextLine -LOCAL_SRC_FILES := ../../../src/BlendStateParser.cpp ../../../src/BufferParser.cpp ../../../src/BufferViewParser.cpp ../../../src/DepthStencilStateParser.cpp ../../../src/DeviceContextFuncBindings.cpp ../../../src/DrawAttribsParser.cpp ../../../src/EngineObjectParserBase.cpp ../../../src/EnumMappings.cpp ../../../src/LayoutDescParser.cpp ../../../src/LuaBindings.cpp ../../../src/LuaFunctionBinding.cpp ../../../src/LuaWrappers.cpp ../../../src/ParsingErrors.cpp ../../../src/RasterizerStateParser.cpp ../../../src/ResourceMappingParser.cpp ../../../src/SamplerParser.cpp ../../../src/ScissorRectParser.cpp ../../../src/ScriptParser.cpp ../../../src/ShaderParser.cpp ../../../src/ShaderVariableParser.cpp ../../../src/TextureParser.cpp ../../../src/TextureViewParser.cpp ../../../src/ViewportParser.cpp +LOCAL_SRC_FILES := ../../../src/BlendStateDescParser.cpp ../../../src/BufferParser.cpp ../../../src/BufferViewParser.cpp ../../../src/DepthStencilStateDescParser.cpp ../../../src/DeviceContextFuncBindings.cpp ../../../src/DrawAttribsParser.cpp ../../../src/EngineObjectParserBase.cpp ../../../src/EnumMappings.cpp ../../../src/InputLayoutDescParser.cpp ../../../src/LuaBindings.cpp ../../../src/LuaFunctionBinding.cpp ../../../src/LuaWrappers.cpp ../../../src/ParsingErrors.cpp ../../../src/PSODescParser.cpp ../../../src/RasterizerStateDescParser.cpp ../../../src/ResourceMappingParser.cpp ../../../src/SamplerParser.cpp ../../../src/ScissorRectParser.cpp ../../../src/ScriptParser.cpp ../../../src/ShaderParser.cpp ../../../src/ShaderResourceBindingParser.cpp ../../../src/ShaderVariableParser.cpp ../../../src/TextureParser.cpp ../../../src/TextureViewParser.cpp ../../../src/ViewportParser.cpp include $(BUILD_STATIC_LIBRARY) diff --git a/RenderScript/build/Windows/jni/Application.mk b/RenderScript/build/Win32/jni/Application.mk index 1c80ded..1c80ded 100644 --- a/RenderScript/build/Windows/jni/Application.mk +++ b/RenderScript/build/Win32/jni/Application.mk diff --git a/RenderScript/build/Windows.Shared/RenderScript.Shared.vcxitems b/RenderScript/build/Windows.Shared/RenderScript.Shared.vcxitems new file mode 100644 index 0000000..97ee3ba --- /dev/null +++ b/RenderScript/build/Windows.Shared/RenderScript.Shared.vcxitems @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="Globals"> + <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> + <HasSharedItems>true</HasSharedItems> + <ItemsProjectGuid>{ac843cd8-70c4-4bf9-bbfb-bb8e5979f81e}</ItemsProjectGuid> + <ItemsRootNamespace>RenderScript</ItemsRootNamespace> + <ItemsProjectName>RenderScript.Shared</ItemsProjectName> + <CodeSharingProject>248F659F-DAC5-46E8-AC09-60EC9FC95053</CodeSharingProject> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ProjectCapability Include="SourceItemsFromImports" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\BlendStateDescParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\BufferParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\BufferViewParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ClassMethodBinding.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ConvenienceFunctions.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\Debug.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\DepthStencilStateDescParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\DeviceContextFuncBindings.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\DrawAttribsParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\EngineObjectParserBase.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\EngineObjectParserCommon.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\EnumMappings.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\InputLayoutDescParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\LuaBindings.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\LuaFunctionBinding.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\LuaWrappers.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ParsingErrors.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\pch.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\PSODescParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\RasterizerStateDescParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ResourceMappingParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\SamplerParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ScissorRectParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ScriptParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ShaderParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ShaderResourceBindingParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ShaderVariableParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\TextureParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\TextureViewParser.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ViewportParser.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\BlendStateDescParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\BufferParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\BufferViewParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\DepthStencilStateDescParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\DeviceContextFuncBindings.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\DrawAttribsParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\EngineObjectParserBase.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\EnumMappings.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\InputLayoutDescParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\LuaBindings.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\LuaFunctionBinding.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\LuaWrappers.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ParsingErrors.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\pch.cpp"> + <PrecompiledHeader>Create</PrecompiledHeader> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\PSODescParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RasterizerStateDescParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ResourceMappingParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\SamplerParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ScissorRectParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ScriptParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ShaderParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ShaderResourceBindingParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ShaderVariableParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\TextureParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\TextureViewParser.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ViewportParser.cpp" /> + </ItemGroup> + <ItemGroup> + <Text Include="$(MSBuildThisFileDirectory)..\..\CMakeLists.txt"> + <DeploymentContent>false</DeploymentContent> + </Text> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/RenderScript/build/Windows.Shared/RenderScript.Shared.vcxitems.filters b/RenderScript/build/Windows.Shared/RenderScript.Shared.vcxitems.filters new file mode 100644 index 0000000..cd3aa41 --- /dev/null +++ b/RenderScript/build/Windows.Shared/RenderScript.Shared.vcxitems.filters @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{69ff86a9-0ff4-402f-817b-e18bb6685329}</UniqueIdentifier> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{6e3f6948-d5fa-4225-b192-0354c9935989}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ConvenienceFunctions.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\Debug.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\DeviceContextFuncBindings.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\DrawAttribsParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\EngineObjectParserBase.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\EngineObjectParserCommon.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\EnumMappings.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\LuaBindings.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\LuaFunctionBinding.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\LuaWrappers.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ParsingErrors.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ResourceMappingParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\SamplerParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ScissorRectParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ScriptParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ShaderParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\TextureParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\TextureViewParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ViewportParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\BufferParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\BufferViewParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ClassMethodBinding.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\pch.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ShaderVariableParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\BlendStateDescParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\PSODescParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\RasterizerStateDescParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\DepthStencilStateDescParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\InputLayoutDescParser.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\include\ShaderResourceBindingParser.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\LuaFunctionBinding.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\LuaWrappers.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ParsingErrors.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\pch.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ResourceMappingParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\SamplerParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ScissorRectParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ScriptParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ShaderParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\TextureParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\TextureViewParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ViewportParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\BufferParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\BufferViewParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\DeviceContextFuncBindings.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\DrawAttribsParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\EngineObjectParserBase.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\EnumMappings.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\LuaBindings.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ShaderVariableParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\PSODescParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\BlendStateDescParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RasterizerStateDescParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\DepthStencilStateDescParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\InputLayoutDescParser.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\ShaderResourceBindingParser.cpp"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <Text Include="$(MSBuildThisFileDirectory)..\..\CMakeLists.txt" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/RenderScript/build/Windows/EngineRoot.props b/RenderScript/build/Windows.Shared/RenderScript.props index 92b5517..844625f 100644 --- a/RenderScript/build/Windows/EngineRoot.props +++ b/RenderScript/build/Windows.Shared/RenderScript.props @@ -8,7 +8,9 @@ <CoreRoot>$(EngineRoot)\diligentcore</CoreRoot> <GraphicsRoot>$(CoreRoot)\Graphics</GraphicsRoot> </PropertyGroup> - <PropertyGroup /> + <PropertyGroup> + <IncludePath>$(ProjectRoot)\include;$(CoreRoot)\Common\include;$(CoreRoot)\Common\interface;$(GraphicsRoot)\GraphicsEngine\interface;$(ToolsRoot)\External\lua-5.2.3\src;$(CoreRoot)\Platforms\interface;$(GraphicsRoot)\GraphicsTools\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath> + </PropertyGroup> <ItemDefinitionGroup /> <ItemGroup> <BuildMacro Include="ProjectRoot"> diff --git a/RenderScript/build/Windows/RenderScript.props b/RenderScript/build/Windows/RenderScript.props deleted file mode 100644 index 8dd0ca6..0000000 --- a/RenderScript/build/Windows/RenderScript.props +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets" /> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <IncludePath>$(ProjectRoot)\include;$(CoreRoot)\Common\include;$(CoreRoot)\Common\interface;$(GraphicsRoot)\GraphicsEngine\interface;$(ToolsRoot)\External\lua-5.2.3\src;$(CoreRoot)\Platforms\interface;$(GraphicsRoot)\GraphicsTools\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath> - </PropertyGroup> - <ItemDefinitionGroup /> - <ItemGroup /> -</Project>
\ No newline at end of file diff --git a/RenderScript/build/WindowsStore/EngineRoot.props b/RenderScript/build/WindowsStore/EngineRoot.props deleted file mode 100644 index 79dc389..0000000 --- a/RenderScript/build/WindowsStore/EngineRoot.props +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets" /> - <PropertyGroup Label="UserMacros"> - <ProjectRoot>..\..\..</ProjectRoot> - <ToolsRoot>$(ProjectRoot)\..</ToolsRoot> - <EngineRoot>$(ToolsRoot)\..</EngineRoot> - <CoreRoot>$(EngineRoot)\diligentcore</CoreRoot> - <GraphicsRoot>$(CoreRoot)\Graphics</GraphicsRoot> - </PropertyGroup> - <PropertyGroup /> - <ItemDefinitionGroup /> - <ItemGroup> - <BuildMacro Include="ProjectRoot"> - <Value>$(ProjectRoot)</Value> - </BuildMacro> - <BuildMacro Include="ToolsRoot"> - <Value>$(ToolsRoot)</Value> - </BuildMacro> - <BuildMacro Include="EngineRoot"> - <Value>$(EngineRoot)</Value> - </BuildMacro> - <BuildMacro Include="CoreRoot"> - <Value>$(CoreRoot)</Value> - </BuildMacro> - <BuildMacro Include="GraphicsRoot"> - <Value>$(GraphicsRoot)</Value> - </BuildMacro> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/RenderScript/build/WindowsStore/RenderScript.Shared/RenderScript.Shared.vcxitems b/RenderScript/build/WindowsStore/RenderScript.Shared/RenderScript.Shared.vcxitems deleted file mode 100644 index cb66637..0000000 --- a/RenderScript/build/WindowsStore/RenderScript.Shared/RenderScript.Shared.vcxitems +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup Label="Globals"> - <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> - <HasSharedItems>true</HasSharedItems> - <ItemsProjectGuid>{ac843cd8-70c4-4bf9-bbfb-bb8e5979f81e}</ItemsProjectGuid> - <ItemsRootNamespace>RenderScript</ItemsRootNamespace> - <ItemsProjectName>RenderScript.Shared</ItemsProjectName> - <CodeSharingProject>248F659F-DAC5-46E8-AC09-60EC9FC95053</CodeSharingProject> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ProjectCapability Include="SourceItemsFromImports" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BlendStateParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BufferParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BufferViewParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ClassMethodBinding.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ConvenienceFunctions.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\Debug.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\DepthStencilStateParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\DeviceContextFuncBindings.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\DrawAttribsParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\EngineObjectParserBase.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\EngineObjectParserCommon.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\EnumMappings.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LayoutDescParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LuaBindings.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LuaFunctionBinding.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LuaWrappers.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ParsingErrors.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\pch.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\RasterizerStateParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ResourceMappingParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\SamplerParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ScissorRectParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ScriptParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ShaderParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ShaderVariableParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\TextureParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\TextureViewParser.h" /> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ViewportParser.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BlendStateParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BufferParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BufferViewParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\DepthStencilStateParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\DeviceContextFuncBindings.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\DrawAttribsParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\EngineObjectParserBase.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\EnumMappings.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LayoutDescParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LuaBindings.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LuaFunctionBinding.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LuaWrappers.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ParsingErrors.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\pch.cpp"> - <PrecompiledHeader>Create</PrecompiledHeader> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\RasterizerStateParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ResourceMappingParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\SamplerParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ScissorRectParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ScriptParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ShaderParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ShaderVariableParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\TextureParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\TextureViewParser.cpp" /> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ViewportParser.cpp" /> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/RenderScript/build/WindowsStore/RenderScript.Shared/RenderScript.Shared.vcxitems.filters b/RenderScript/build/WindowsStore/RenderScript.Shared/RenderScript.Shared.vcxitems.filters deleted file mode 100644 index a82a379..0000000 --- a/RenderScript/build/WindowsStore/RenderScript.Shared/RenderScript.Shared.vcxitems.filters +++ /dev/null @@ -1,171 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{69ff86a9-0ff4-402f-817b-e18bb6685329}</UniqueIdentifier> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{6e3f6948-d5fa-4225-b192-0354c9935989}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ConvenienceFunctions.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\Debug.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\DepthStencilStateParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\DeviceContextFuncBindings.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\DrawAttribsParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\EngineObjectParserBase.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\EngineObjectParserCommon.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\EnumMappings.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LayoutDescParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LuaBindings.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LuaFunctionBinding.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\LuaWrappers.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ParsingErrors.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\RasterizerStateParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ResourceMappingParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\SamplerParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ScissorRectParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ScriptParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ShaderParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\TextureParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\TextureViewParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ViewportParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BlendStateParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BufferParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BufferViewParser.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ClassMethodBinding.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\pch.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ShaderVariableParser.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LuaFunctionBinding.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LuaWrappers.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ParsingErrors.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\pch.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\RasterizerStateParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ResourceMappingParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\SamplerParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ScissorRectParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ScriptParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ShaderParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\TextureParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\TextureViewParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ViewportParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BlendStateParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BufferParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BufferViewParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\DepthStencilStateParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\DeviceContextFuncBindings.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\DrawAttribsParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\EngineObjectParserBase.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\EnumMappings.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LayoutDescParser.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\LuaBindings.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\ShaderVariableParser.cpp"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/RenderScript/build/WindowsStore/RenderScript.Windows/RenderScript.Windows.vcxproj.filters b/RenderScript/build/WindowsStore/RenderScript.Windows/RenderScript.Windows.vcxproj.filters deleted file mode 100644 index a7761ab..0000000 --- a/RenderScript/build/WindowsStore/RenderScript.Windows/RenderScript.Windows.vcxproj.filters +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - </ItemGroup> -</Project> diff --git a/RenderScript/build/WindowsStore/RenderScript.WindowsPhone/RenderScript.WindowsPhone.vcxproj b/RenderScript/build/WindowsStore/RenderScript.WindowsPhone/RenderScript.WindowsPhone.vcxproj deleted file mode 100644 index 1bb30a3..0000000 --- a/RenderScript/build/WindowsStore/RenderScript.WindowsPhone/RenderScript.WindowsPhone.vcxproj +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|ARM"> - <Configuration>Debug</Configuration> - <Platform>ARM</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM"> - <Configuration>Release</Configuration> - <Platform>ARM</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{c6d20522-f184-47e4-afa0-31341a71495f}</ProjectGuid> - <RootNamespace>RenderScript</RootNamespace> - <DefaultLanguage>en-US</DefaultLanguage> - <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> - <AppContainerApplication>true</AppContainerApplication> - <ApplicationType>Windows Phone</ApplicationType> - <ApplicationTypeRevision>8.1</ApplicationTypeRevision> - <ConvergedProjectType>CodeSharingStaticLibrary</ConvergedProjectType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_wp81</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_wp81</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120_wp81</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v120_wp81</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <Import Project="..\RenderScript.Shared\RenderScript.Shared.vcxitems" Label="Shared" /> - <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" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStore32Dbg.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> - </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" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStore32Rel.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStoreArmDbg.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\..\diligentcore\Shared\build\WindowsStore\WinStoreArmRel.props" /> - <Import Project="..\EngineRoot.props" /> - <Import Project="..\..\Windows\RenderScript.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <GenerateManifest>false</GenerateManifest> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <GenerateManifest>false</GenerateManifest> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> - <GenerateManifest>false</GenerateManifest> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> - <GenerateManifest>false</GenerateManifest> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> - <CompileAsWinRT>false</CompileAsWinRT> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <GenerateWindowsMetadata>false</GenerateWindowsMetadata> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> - <CompileAsWinRT>false</CompileAsWinRT> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <GenerateWindowsMetadata>false</GenerateWindowsMetadata> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'"> - <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> - <CompileAsWinRT>false</CompileAsWinRT> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <GenerateWindowsMetadata>false</GenerateWindowsMetadata> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'"> - <ClCompile> - <PrecompiledHeader>Use</PrecompiledHeader> - <CompileAsWinRT>false</CompileAsWinRT> - <SDLCheck>true</SDLCheck> - </ClCompile> - <Link> - <SubSystem>Console</SubSystem> - <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> - <GenerateWindowsMetadata>false</GenerateWindowsMetadata> - </Link> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/RenderScript/build/WindowsStore/RenderScript.WindowsPhone/RenderScript.WindowsPhone.vcxproj.filters b/RenderScript/build/WindowsStore/RenderScript.WindowsPhone/RenderScript.WindowsPhone.vcxproj.filters deleted file mode 100644 index a7761ab..0000000 --- a/RenderScript/build/WindowsStore/RenderScript.WindowsPhone/RenderScript.WindowsPhone.vcxproj.filters +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - </ItemGroup> -</Project> diff --git a/RenderScript/include/BlendStateDescParser.h b/RenderScript/include/BlendStateDescParser.h new file mode 100644 index 0000000..59f5664 --- /dev/null +++ b/RenderScript/include/BlendStateDescParser.h @@ -0,0 +1,41 @@ +/* Copyright 2015-2016 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "PipelineState.h" +#include "LuaBindings.h" + +namespace Diligent +{ + template<> + class MemberBinder<BlendStateDesc> : public MemberBinderBase + { + public: + MemberBinder( size_t MemberOffset, size_t Dummy ) ; + virtual void GetValue( lua_State *L, const void* pBasePointer )override; + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override; + private: + BindingsMapType m_Bindings; + }; +} diff --git a/RenderScript/include/BufferParser.h b/RenderScript/include/BufferParser.h index e9a6053..e375d19 100644 --- a/RenderScript/include/BufferParser.h +++ b/RenderScript/include/BufferParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/BufferViewParser.h b/RenderScript/include/BufferViewParser.h index a1b003d..03e6b10 100644 --- a/RenderScript/include/BufferViewParser.h +++ b/RenderScript/include/BufferViewParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/ClassMethodBinding.h b/RenderScript/include/ClassMethodBinding.h index 90c4259..141261a 100644 --- a/RenderScript/include/ClassMethodBinding.h +++ b/RenderScript/include/ClassMethodBinding.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/ConvenienceFunctions.h b/RenderScript/include/ConvenienceFunctions.h index 2a4df13..23a08f4 100644 --- a/RenderScript/include/ConvenienceFunctions.h +++ b/RenderScript/include/ConvenienceFunctions.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,9 @@ #include "ScriptParser.h" #include "DataBlobImpl.h" #ifdef _WIN32 -# define NOMINMAX +# ifndef NOMINMAX +# define NOMINMAX +# endif # include <Windows.h> #endif @@ -39,7 +41,7 @@ Diligent::RefCntAutoPtr<Diligent::ScriptParser> CreateRenderScriptFromFile( cons { bool bSuccess = true; Diligent::RefCntAutoPtr<Diligent::ScriptParser> pScriptParser; -#ifdef PLATFORM_WINDOWS +#ifdef PLATFORM_WIN32 do { #endif @@ -69,7 +71,7 @@ Diligent::RefCntAutoPtr<Diligent::ScriptParser> CreateRenderScriptFromFile( cons ErrorMsg = err.what(); } -#ifdef PLATFORM_WINDOWS +#ifdef PLATFORM_WIN32 if( !bSuccess ) { if( IDRETRY != MessageBoxA( NULL, "Failed to parse the script. Retry?", "Lua parser error", MB_ICONERROR | MB_ABORTRETRYIGNORE ) ) diff --git a/RenderScript/include/Debug.h b/RenderScript/include/Debug.h index bd22bfb..cd19f10 100644 --- a/RenderScript/include/Debug.h +++ b/RenderScript/include/Debug.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/DepthStencilStateParser.h b/RenderScript/include/DepthStencilStateDescParser.h index fb0f2cb..340d05e 100644 --- a/RenderScript/include/DepthStencilStateParser.h +++ b/RenderScript/include/DepthStencilStateDescParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,30 +23,21 @@ #pragma once -#include "LuaWrappers.h" +#include "PipelineState.h" #include "LuaBindings.h" -#include "EngineObjectParserCommon.h" -#include "ClassMethodBinding.h" +#include "EnumMappings.h" namespace Diligent { - class DepthStencilStateParser : public EngineObjectParserCommon<IDepthStencilState> + template<> + class MemberBinder<DepthStencilStateDesc> : public MemberBinderBase { public: - DepthStencilStateParser( IRenderDevice *pRenderDevice, lua_State *L ); - static const Char* DepthStencilStateLibName; - - protected: - virtual void CreateObj( lua_State *L ); - + MemberBinder( size_t MemberOffset, size_t Dummy ) ; + virtual void GetValue( lua_State *L, const void* pBasePointer )override; + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override; private: - // DepthStencilStateDesc structure does not provide storage for the Name field. - // We need to use ObjectDescWrapper<> to be able to store the field. - typedef ObjectDescWrapper<DepthStencilStateDesc> SDSSDescWrapper; - - int SetDepthStencilState( lua_State *L ); - ClassMethodCaller<DepthStencilStateParser> m_SetDepthStencilBinding; - + BindingsMapType m_Bindings; ComparisonFuncEnumMapping m_CmpFuncEnumMapping; }; } diff --git a/RenderScript/include/DeviceContextFuncBindings.h b/RenderScript/include/DeviceContextFuncBindings.h index bb2f880..a03c3f0 100644 --- a/RenderScript/include/DeviceContextFuncBindings.h +++ b/RenderScript/include/DeviceContextFuncBindings.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,17 @@ #include "LuaBindings.h" #include "ClassMethodBinding.h" +namespace std +{ + DEFINE_ENUM_HASH( Diligent::COMMIT_SHADER_RESOURCES_FLAG ) +} + namespace Diligent { class DeviceContextFuncBindings { public: - DeviceContextFuncBindings( IRenderDevice *pRenderDevice, lua_State *L, class TextureViewParser *pTexViewPasrser ); + DeviceContextFuncBindings( IRenderDevice *pRenderDevice, lua_State *L, class TextureViewParser *pTexViewPasrser, class ShaderResourceBindingParser *pSRBParser, class PSODescParser *pPSOParser ); private: int SetRenderTargets( lua_State * ); @@ -44,6 +49,22 @@ namespace Diligent int ClearDepthStencil( lua_State * ); ClassMethodCaller<DeviceContextFuncBindings> m_ClearDepthStencilBinding; + int SetStencilRef( lua_State * ); + ClassMethodCaller<DeviceContextFuncBindings> m_SetStencilRefBinding; + + int SetBlendFactors( lua_State * ); + ClassMethodCaller<DeviceContextFuncBindings> m_SetBlendFactorsBinding; + + int CommitShaderResources( lua_State * ); + ClassMethodCaller<DeviceContextFuncBindings> m_CommitShaderResourcesBinding; + + int TransitionShaderResources( lua_State * ); + ClassMethodCaller<DeviceContextFuncBindings> m_TransitionShaderResourcesBinding; + + EnumMapping<COMMIT_SHADER_RESOURCES_FLAG> m_CommitShaderResFlagsEnumMapping; + String m_TexViewMetatableName; + String m_ShaderResBindingMetatableName; + String m_PSOMetatableName; }; } diff --git a/RenderScript/include/DrawAttribsParser.h b/RenderScript/include/DrawAttribsParser.h index 0b855ac..88da020 100644 --- a/RenderScript/include/DrawAttribsParser.h +++ b/RenderScript/include/DrawAttribsParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/EngineObjectParserBase.h b/RenderScript/include/EngineObjectParserBase.h index 55c0baa..7e0265c 100644 --- a/RenderScript/include/EngineObjectParserBase.h +++ b/RenderScript/include/EngineObjectParserBase.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/EngineObjectParserCommon.h b/RenderScript/include/EngineObjectParserCommon.h index ba55e21..dfef174 100644 --- a/RenderScript/include/EngineObjectParserCommon.h +++ b/RenderScript/include/EngineObjectParserCommon.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/EnumMappings.h b/RenderScript/include/EnumMappings.h index 6b61161..bc8c76c 100644 --- a/RenderScript/include/EnumMappings.h +++ b/RenderScript/include/EnumMappings.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ template<>struct hash<Type> \ namespace std { - DEFINE_ENUM_HASH( Diligent::TEXTURE_TYPE ) + DEFINE_ENUM_HASH( Diligent::RESOURCE_DIMENSION ) DEFINE_ENUM_HASH( Diligent::TEXTURE_FORMAT ) DEFINE_ENUM_HASH( Diligent::VALUE_TYPE ) DEFINE_ENUM_HASH( Diligent::USAGE ) @@ -46,6 +46,7 @@ namespace std DEFINE_ENUM_HASH( Diligent::CPU_ACCESS_FLAG ) DEFINE_ENUM_HASH( Diligent::COMPARISON_FUNCTION ) DEFINE_ENUM_HASH( Diligent::BIND_SHADER_RESOURCES_FLAGS ) + DEFINE_ENUM_HASH( Diligent::SHADER_TYPE ) } namespace Diligent @@ -82,10 +83,10 @@ namespace Diligent TextureFormatEnumMapping(); }; - class TextureTypeEnumMapping : public EnumMapping < Diligent::TEXTURE_TYPE > + class ResourceDimEnumMapping : public EnumMapping < Diligent::RESOURCE_DIMENSION > { public: - TextureTypeEnumMapping(); + ResourceDimEnumMapping(); }; class ValueTypeEnumMapping : public EnumMapping < Diligent::VALUE_TYPE > @@ -105,4 +106,10 @@ namespace Diligent public: BindShaderResourcesFlagEnumMapping(); }; + + class ShaderTypeEnumMapping : public EnumMapping<SHADER_TYPE> + { + public: + ShaderTypeEnumMapping(); + }; } diff --git a/RenderScript/include/LayoutDescParser.h b/RenderScript/include/InputLayoutDescParser.h index 62d32dd..2da56ca 100644 --- a/RenderScript/include/LayoutDescParser.h +++ b/RenderScript/include/InputLayoutDescParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,31 +25,27 @@ #include "LuaWrappers.h" #include "LuaBindings.h" -#include "EngineObjectParserCommon.h" -#include "ClassMethodBinding.h" + +namespace std +{ + DEFINE_ENUM_HASH( Diligent::LayoutElement::FREQUENCY ) +} namespace Diligent { - class LayoutDescParser : public EngineObjectParserCommon<IVertexDescription> + template<> + class MemberBinder<InputLayoutDesc> : public MemberBinderBase { public: - LayoutDescParser( IRenderDevice *pRenderDevice, lua_State *L ); - static const Char* LayoutDescLibName; - - protected: - virtual void CreateObj( lua_State *L ); - + MemberBinder( size_t InputLayoutOffset, size_t ElementsBufferOffset ); + virtual void GetValue( lua_State *L, const void* pBasePointer )override; + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override; + private: - // LayoutDesc structure does not provide storage for the Name field, - // nor does it provide storage for layout elements. - // We need to use LayoutDescWrapper to be able to store the data. - struct LayoutDescWrapper : ObjectDescWrapper < LayoutDesc > - { - std::vector<LayoutElement> ElementsBuffer; - }; - - - int SetInputLayout( lua_State *L ); - ClassMethodCaller<LayoutDescParser> m_SetInputLayoutBinding; + BindingsMapType m_Bindings; + ValueTypeEnumMapping m_ValueTypeEnumMapping; + EnumMapping < LayoutElement::FREQUENCY > m_FrequencyEnumMapping; + size_t m_LayoutElementsBufferOffset; }; + } diff --git a/RenderScript/include/LuaBindings.h b/RenderScript/include/LuaBindings.h index b9dcace..2799bd1 100644 --- a/RenderScript/include/LuaBindings.h +++ b/RenderScript/include/LuaBindings.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -226,7 +226,8 @@ namespace Diligent }; - inline void ParseLuaTable( lua_State *L, int Index, void* pBasePointer, BindingsMapType &Bindings ) + template<typename TableElementParser> + inline void ParseLuaTable( lua_State *L, int Index, void* pBasePointer, TableElementParser ElemParser ) { CheckType( L, Index, LUA_TTABLE ); @@ -248,20 +249,31 @@ namespace Diligent // The string is always zero-terminated and Lua ensures that this pointer is valid as long // as the corresponding value is in the stack. auto Key = lua_tostring( L, -2 ); - auto Binding = Bindings.find( Key ); - if( Binding != Bindings.end() ) - { - Binding->second->SetValue( L, -1, pBasePointer ); - } - else - { - SCRIPT_PARSING_ERROR( L, "Unknown Member ", Key ); - } + ElemParser(-1, pBasePointer, Key); + // Pop value from the stack, but KEEP Key for the next iteration lua_pop( L, 1 ); } } + inline void ParseLuaTable( lua_State *L, int Index, void* pBasePointer, BindingsMapType &Bindings ) + { + ParseLuaTable( L, Index, pBasePointer, + [&](int Index, void* pBasePointer, const char *Key) + { + auto Binding = Bindings.find( Key ); + if( Binding != Bindings.end() ) + { + Binding->second->SetValue( L, Index, pBasePointer ); + } + else + { + SCRIPT_PARSING_ERROR( L, "Unknown Member \"", Key, '\"' ); + } + } + ); + } + template<class ArrayElemParser> inline void ParseLuaArray( lua_State *L, int Index, void* pBasePointer, ArrayElemParser ElemParser ) { @@ -326,7 +338,7 @@ namespace Diligent } else { - SCRIPT_PARSING_ERROR( L, "Unknown Member ", Field ); + SCRIPT_PARSING_ERROR( L, "Unknown Member \"", Field, '\"' ); } } @@ -339,7 +351,7 @@ namespace Diligent } else { - SCRIPT_PARSING_ERROR( L, "Unknown Member ", Field ); + SCRIPT_PARSING_ERROR( L, "Unknown Member \"", Field, '\"' ); } } @@ -413,7 +425,7 @@ namespace Diligent } else { - UNEXPECTED( "Enum value not found in the map" ); + UNEXPECTED( "Enum value (", Val, ") not found in the map" ); SCRIPT_PARSING_ERROR( L, "Enum value (", Val, ") not found in the map" ); } } @@ -584,14 +596,21 @@ namespace Diligent VERIFY( Metatables.size() == 1, "Ambiguous metatable" ); const auto& MetatableName = *Metatables.begin(); auto pObject = GetMemberByOffest<ObjectType*>( pBasePointer, m_MemberOffset ); - auto ppNewObject = reinterpret_cast<ObjectType**>(lua_newuserdata( L, sizeof( ObjectType* ) )); - *ppNewObject = pObject; - pObject->AddRef(); - // Push onto the stack the metatable associated with name given in the registry - luaL_getmetatable( L, MetatableName.c_str() ); // -0 | +1 -> +1 - // Pop a table from the top of the stack and set it as the new metatable - // for the value at the given index (which is where the new user datum is) - lua_setmetatable( L, -2 ); // -1 | +0 -> -1 + if( pObject ) + { + auto ppNewObject = reinterpret_cast<ObjectType**>(lua_newuserdata( L, sizeof( ObjectType* ) )); + *ppNewObject = pObject; + pObject->AddRef(); + // Push onto the stack the metatable associated with name given in the registry + luaL_getmetatable( L, MetatableName.c_str() ); // -0 | +1 -> +1 + // Pop a table from the top of the stack and set it as the new metatable + // for the value at the given index (which is where the new user datum is) + lua_setmetatable( L, -2 ); // -1 | +0 -> -1 + } + else + { + lua_pushnil(L); + } } virtual void SetValue( lua_State *L, int Index, void* pBasePointer ) diff --git a/RenderScript/include/LuaFunctionBinding.h b/RenderScript/include/LuaFunctionBinding.h index a51a7b9..863becd 100644 --- a/RenderScript/include/LuaFunctionBinding.h +++ b/RenderScript/include/LuaFunctionBinding.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/LuaWrappers.h b/RenderScript/include/LuaWrappers.h index 6e17a65..bf7d653 100644 --- a/RenderScript/include/LuaWrappers.h +++ b/RenderScript/include/LuaWrappers.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/BlendStateParser.h b/RenderScript/include/PSODescParser.h index 9589488..01d8fc8 100644 --- a/RenderScript/include/BlendStateParser.h +++ b/RenderScript/include/PSODescParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,25 +27,30 @@ #include "LuaBindings.h" #include "EngineObjectParserCommon.h" #include "ClassMethodBinding.h" - +#include "PipelineState.h" namespace Diligent { - class BlendStateParser : public EngineObjectParserCommon<IBlendState> + class PSODescParser : public EngineObjectParserCommon<IPipelineState> { public: - BlendStateParser( IRenderDevice *pRenderDevice, lua_State *L ); - static const Char* BlendStateLibName; + PSODescParser( IRenderDevice *pRenderDevice, lua_State *L ); + static const Char* PSODescLibName; protected: virtual void CreateObj( lua_State *L ); private: - // BlendStateDesc structure does not provide storage for the Name field. + // PipelineStateDesc structure does not provide storage for the Name field. // We need to use ObjectDescWrapper<> to be able to store the field. - typedef ObjectDescWrapper<BlendStateDesc> SBSDescWrapper; + struct PSODescWrapper : PipelineStateDesc + { + String NameBuffer; + std::vector<LayoutElement> LayoutElementsBuffer; + }; + friend class MemberBinder<GraphicsPipelineDesc>; - int SetBlendState( lua_State *L ); - ClassMethodCaller<BlendStateParser> m_SetBlendBinding; + int SetPSO( lua_State *L ); + ClassMethodCaller<PSODescParser> m_SetPSOBinding; }; } diff --git a/RenderScript/include/ParsingErrors.h b/RenderScript/include/ParsingErrors.h index 5b7f860..8ca794b 100644 --- a/RenderScript/include/ParsingErrors.h +++ b/RenderScript/include/ParsingErrors.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/RasterizerStateParser.h b/RenderScript/include/RasterizerStateDescParser.h index 22ab5e9..78a0023 100644 --- a/RenderScript/include/RasterizerStateParser.h +++ b/RenderScript/include/RasterizerStateDescParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,11 +23,8 @@ #pragma once -#include "LuaWrappers.h" +#include "PipelineState.h" #include "LuaBindings.h" -#include "EngineObjectParserCommon.h" -#include "ClassMethodBinding.h" - namespace std { @@ -37,22 +34,15 @@ namespace std namespace Diligent { - class RasterizerStateParser : public EngineObjectParserCommon<IRasterizerState> + template<> + class MemberBinder<RasterizerStateDesc> : public MemberBinderBase { public: - RasterizerStateParser( IRenderDevice *pRenderDevice, lua_State *L ); - static const Char* RasterizerStateLibName; - - protected: - virtual void CreateObj( lua_State *L ); - + MemberBinder( size_t MemberOffset, size_t Dummy ) ; + virtual void GetValue( lua_State *L, const void* pBasePointer )override; + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override; private: - // RasterizerStateDesc structure does not provide storage for the Name field. - // We need to use ObjectDescWrapper<> to be able to store the field. - typedef ObjectDescWrapper<RasterizerStateDesc> SRSDescWrapper; - - int SetRasterizerState( lua_State *L ); - ClassMethodCaller<RasterizerStateParser> m_SetRasterizerBinding; + BindingsMapType m_Bindings; EnumMapping < FILL_MODE > m_FillModeEnumMapping; EnumMapping < CULL_MODE > m_CullModeEnumMapping; diff --git a/RenderScript/include/ResourceMappingParser.h b/RenderScript/include/ResourceMappingParser.h index d191647..8be5f0a 100644 --- a/RenderScript/include/ResourceMappingParser.h +++ b/RenderScript/include/ResourceMappingParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,9 +50,6 @@ namespace Diligent virtual void PushExistingObject( lua_State *L, const void *pObject ); virtual void DestroyObj( void *pData ); - int BindShaderResources( lua_State *L ); - ClassMethodCaller < ResourceMappingParser > m_BindShaderResourcesBinding; - BindingsMapType m_Bindings; TextureViewParser *m_pTexViewParser; diff --git a/RenderScript/include/SamplerParser.h b/RenderScript/include/SamplerParser.h index 5829067..c3f0eb6 100644 --- a/RenderScript/include/SamplerParser.h +++ b/RenderScript/include/SamplerParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,57 @@ namespace std namespace Diligent { + template<typename StructType> + void InitSamplerParserBindings(BindingsMapType &Bindings, + EnumMapping<FILTER_TYPE> &FilterTypeEnumMapping, + EnumMapping<TEXTURE_ADDRESS_MODE> &TexAddrModeEnumMapping, + ComparisonFuncEnumMapping &CmpFuncEnumMapping) + { + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_POINT ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_LINEAR ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_ANISOTROPIC ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_COMPARISON_POINT ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_COMPARISON_LINEAR ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_COMPARISON_ANISOTROPIC ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MINIMUM_POINT ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MINIMUM_LINEAR ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MINIMUM_ANISOTROPIC ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MAXIMUM_POINT ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MAXIMUM_LINEAR ); + DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MAXIMUM_ANISOTROPIC ); + VERIFY( FilterTypeEnumMapping.m_Str2ValMap.size() == FILTER_TYPE_NUM_FILTERS - 1, "Unexpected map size. Did you update FILTER_TYPE enum?" ); + VERIFY( FilterTypeEnumMapping.m_Val2StrMap.size() == FILTER_TYPE_NUM_FILTERS - 1, "Unexpected map size. Did you update FILTER_TYPE enum?" ); + DEFINE_ENUM_BINDER( Bindings, StructType, MinFilter, FILTER_TYPE, FilterTypeEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, MagFilter, FILTER_TYPE, FilterTypeEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, MipFilter, FILTER_TYPE, FilterTypeEnumMapping ) + + + DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_WRAP ); + DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_MIRROR ); + DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_CLAMP ); + DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_BORDER ); + DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_MIRROR_ONCE ); + VERIFY( TexAddrModeEnumMapping.m_Str2ValMap.size() == TEXTURE_ADDRESS_NUM_MODES - 1, "Unexpected map size. Did you update TEXTURE_ADDRESS_MODE enum?" ); + VERIFY( TexAddrModeEnumMapping.m_Val2StrMap.size() == TEXTURE_ADDRESS_NUM_MODES - 1, "Unexpected map size. Did you update TEXTURE_ADDRESS_MODE enum?" ); + DEFINE_ENUM_BINDER( Bindings, StructType, AddressU, TEXTURE_ADDRESS_MODE, TexAddrModeEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, AddressV, TEXTURE_ADDRESS_MODE, TexAddrModeEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, AddressW, TEXTURE_ADDRESS_MODE, TexAddrModeEnumMapping ) + + + Validator<Float32> DummyValidatorF( SkipValidationFunc<float> ); + DEFINE_BINDER( Bindings, StructType, MipLODBias, Float32, DummyValidatorF ) + + Validator<Uint32> MaxAnisotropyValidator( "Max Anisotropy", 0, 32 ); + DEFINE_BINDER( Bindings, StructType, MaxAnisotropy, Uint32, MaxAnisotropyValidator ) + + DEFINE_ENUM_BINDER( Bindings, StructType, ComparisonFunc, COMPARISON_FUNCTION, CmpFuncEnumMapping ) + + DEFINE_BINDER( Bindings, StructType, BorderColor, RGBALoader, 0 ) + + DEFINE_BINDER( Bindings, StructType, MinLOD, Float32, DummyValidatorF ) + DEFINE_BINDER( Bindings, StructType, MaxLOD, Float32, DummyValidatorF ) + } + class SamplerParser : public EngineObjectParserCommon<ISampler> { public: diff --git a/RenderScript/include/ScissorRectParser.h b/RenderScript/include/ScissorRectParser.h index b887afc..e33544b 100644 --- a/RenderScript/include/ScissorRectParser.h +++ b/RenderScript/include/ScissorRectParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/ScriptParser.h b/RenderScript/include/ScriptParser.h index 8c960d8..93d47d1 100644 --- a/RenderScript/include/ScriptParser.h +++ b/RenderScript/include/ScriptParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,16 +66,13 @@ namespace Diligent void GetSamplerByName( const Char *SamplerName, ISampler** ppSampler ); - void GetVertexDescriptionByName( const Char *VertDescName, IVertexDescription** ppVertDesc ); void GetShaderByName( const Char *ShaderName, IShader** ppShader ); void GetBufferByName( const Char *BufferName, IBuffer** ppBuffer ); void GetTextureByName( const Char *TextureName, ITexture** ppTexture ); void GetResourceMappingByName( const Char *ResourceMappingName, IResourceMapping** ppResourceMapping ); void GetTextureViewByName( const Char *TextureViewName, ITextureView** ppTextureView ); void GetBufferViewByName( const Char *BufferViewName, IBufferView** ppTextureView ); - void GetDepthStencilStateByName( const Char *DSStateName, IDepthStencilState** ppDSState ); - void GetRasterizerStateByName( const Char *RSName, IRasterizerState** ppRS ); - void GetBlendStateByName( const Char *BSName, IBlendState** ppRS ); + void GetPipelineStateByName( const Char *PSOName, IPipelineState** ppPSO ); void GetShaderVariableByName( const Char *ShaderVarName, IShaderVariable** ppShaderVar ); template<typename ValType> @@ -96,8 +93,6 @@ namespace Diligent void PushFuncStub( lua_State *L, const ISampler* pSampler ); void PushFuncStub( lua_State *L, const RefCntAutoPtr<ISampler> &pSampler ); - void PushFuncStub( lua_State *L, const IVertexDescription* pVertDesc ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr<IVertexDescription> &pVertDesc ); void PushFuncStub( lua_State *L, const IShader* pShader ); void PushFuncStub( lua_State *L, const RefCntAutoPtr<IShader> &pShader ); void PushFuncStub( lua_State *L, const IBuffer* pBuffer ); @@ -111,16 +106,14 @@ namespace Diligent void PushFuncStub( lua_State *L, const RefCntAutoPtr<ITextureView> &pTextureView ); void PushFuncStub( lua_State *L, const IBufferView* pBufferView ); void PushFuncStub( lua_State *L, const RefCntAutoPtr<IBufferView> &pBufferView ); - void PushFuncStub( lua_State *L, const IDepthStencilState* pDSState ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr<IDepthStencilState> &pDSState ); - void PushFuncStub( lua_State *L, const IRasterizerState* pRS ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr<IRasterizerState> &pRS ); - void PushFuncStub( lua_State *L, const IBlendState* pBS ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr<IBlendState> &pBS ); + void PushFuncStub( lua_State *L, const IPipelineState* pPSO ); + void PushFuncStub( lua_State *L, const RefCntAutoPtr<IPipelineState> &pPSO ); void PushFuncStub( lua_State *L, const Viewport &Viewport ); void PushFuncStub( lua_State *L, const Rect &Rect ); void PushFuncStub( lua_State *L, const IShaderVariable* pShaderVar ); void PushFuncStub( lua_State *L, const RefCntAutoPtr<IShaderVariable> &pShaderVar ); + void PushFuncStub( lua_State *L, const IShaderResourceBinding* pShaderVar ); + void PushFuncStub( lua_State *L, const RefCntAutoPtr<IShaderResourceBinding> &pShaderVar ); private: ScriptParser *m_pScriptParser; @@ -132,7 +125,6 @@ namespace Diligent Diligent::RefCntAutoPtr<IRenderDevice> m_pRenderDevice; LuaState m_LuaState; std::unique_ptr<class SamplerParser> m_pSamplerParser; - std::unique_ptr<class LayoutDescParser> m_pLayoutDescParser; std::unique_ptr<class ShaderParser> m_pShaderParser; std::unique_ptr<class BufferParser> m_pBufferParser; std::unique_ptr<class TextureParser> m_pTextureParser; @@ -140,12 +132,11 @@ namespace Diligent std::unique_ptr<class ResourceMappingParser> m_pResourceMappingParser; std::unique_ptr<class TextureViewParser> m_pTextureViewParser; std::unique_ptr<class BufferViewParser> m_pBufferViewParser; - std::unique_ptr<class DepthStencilStateParser> m_pDSStateParser; - std::unique_ptr<class RasterizerStateParser> m_pRSParser; - std::unique_ptr<class BlendStateParser> m_pBSParser; + std::unique_ptr<class PSODescParser> m_pPSOParser; std::unique_ptr<class DeviceContextFuncBindings> m_pDeviceCtxFuncBindings; std::unique_ptr<class ViewportParser> m_pViewportParser; std::unique_ptr<class ScissorRectParser> m_pScissorRectParser; std::unique_ptr<class ShaderVariableParser> m_pShaderVariableParser; + std::unique_ptr<class ShaderResourceBindingParser> m_pShaderResBindingParser; }; } diff --git a/RenderScript/include/ShaderParser.h b/RenderScript/include/ShaderParser.h index 2967dd5..fdfb3da 100644 --- a/RenderScript/include/ShaderParser.h +++ b/RenderScript/include/ShaderParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,9 +48,14 @@ namespace Diligent struct ShaderCreationAttribsWrapper : ShaderCreationAttribs { String NameBuffer; + String SourceBuffer; String FilePathBuffer; String EntryPointBuffer; String SearchDirectoriesBuffer; + std::vector<ShaderVariableDesc> m_VarDescBuffer; + std::vector<String> m_VarNamesBuffer; + std::vector<StaticSamplerDesc> m_StaticSamplersBuffer; + std::vector<String> m_StaticSamplerTexNamesBuffer; }; protected: @@ -59,9 +64,6 @@ namespace Diligent private: - int SetShaders( lua_State *L ); - ClassMethodCaller < ShaderParser > m_SetShadersBinding; - ClassMethodCaller< ShaderParser > m_BindResourcesBinding; int BindResources( lua_State *L ); diff --git a/RenderScript/include/ShaderResourceBindingParser.h b/RenderScript/include/ShaderResourceBindingParser.h new file mode 100644 index 0000000..281ac54 --- /dev/null +++ b/RenderScript/include/ShaderResourceBindingParser.h @@ -0,0 +1,69 @@ +/* Copyright 2015-2016 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "LuaWrappers.h" +#include "LuaBindings.h" +#include "EngineObjectParserBase.h" +#include "ClassMethodBinding.h" +#include "EngineObjectParserCommon.h" + +namespace Diligent +{ + class ShaderResourceBindingParser : public EngineObjectParserBase + { + public: + ShaderResourceBindingParser( IRenderDevice *pRenderDevice, lua_State *L, + const String &PSOLibMetatableName, + const String &ResMappingMetatableName, + const String &ShaderVarMetatableRegistryName); + static const Char* ShaderResourceBindingLibName; + + virtual void GetObjectByName( lua_State *L, const Char *ShaderName, IShaderResourceBinding** ppObject ); + + protected: + virtual void CreateObj( lua_State *L ); + virtual void DestroyObj( void *pData ); + virtual void ReadField( lua_State *L, void *pData, const Char *Field ); + virtual void UpdateField( lua_State *L, void *pData, const Char *Field ); + virtual void PushExistingObject( lua_State *L, const void *pObject ); + + private: + String m_PSOLibMetatableName; + String m_ResMappingMetatableName; + String m_ShaderVarMetatableRegistryName; + + BindShaderResourcesFlagEnumMapping m_BindShaderResFlagEnumMapping; + ShaderTypeEnumMapping m_ShaderTypeEnumMapping; + + int BindResources( lua_State *L ); + ClassMethodCaller < ShaderResourceBindingParser > m_BindResourcesBinding; + + int GetVariable( lua_State *L ); + ClassMethodCaller < ShaderResourceBindingParser > m_GetVariableBinding; + + int CreateShaderResourceBinding( lua_State *L ); + ClassMethodCaller<ShaderResourceBindingParser> m_CreateShaderResourceBinding; + }; +} diff --git a/RenderScript/include/ShaderVariableParser.h b/RenderScript/include/ShaderVariableParser.h index 5263e16..5641939 100644 --- a/RenderScript/include/ShaderVariableParser.h +++ b/RenderScript/include/ShaderVariableParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/TextureParser.h b/RenderScript/include/TextureParser.h index d6eb6a0..20aea0e 100644 --- a/RenderScript/include/TextureParser.h +++ b/RenderScript/include/TextureParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ namespace Diligent // We need to use ObjectDescWrapper<> to be able to store the field. typedef ObjectDescWrapper<TextureDesc> STexDescWrapper; - TextureTypeEnumMapping m_TexTypeEnumMapping; + ResourceDimEnumMapping m_TexTypeEnumMapping; TextureFormatEnumMapping m_TexFormatEnumMapping; // Note that different bind flags are allowed for different objects, diff --git a/RenderScript/include/TextureViewParser.h b/RenderScript/include/TextureViewParser.h index c97f28a..3ea135e 100644 --- a/RenderScript/include/TextureViewParser.h +++ b/RenderScript/include/TextureViewParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ namespace Diligent int SetSampler( lua_State * ); EnumMapping<TEXTURE_VIEW_TYPE> m_ViewTypeEnumMapping; - TextureTypeEnumMapping m_TexTypeEnumMapping; + ResourceDimEnumMapping m_TexTypeEnumMapping; TextureFormatEnumMapping m_TexFormatEnumMapping; EnumMemberBinder<TEXTURE_VIEW_TYPE> m_ViewTypeParser; EnumMapping<UAV_ACCESS_FLAG> m_UAVAccessFlagEnumMapping; diff --git a/RenderScript/include/ViewportParser.h b/RenderScript/include/ViewportParser.h index 86cfaa0..9633f5e 100644 --- a/RenderScript/include/ViewportParser.h +++ b/RenderScript/include/ViewportParser.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/include/pch.h b/RenderScript/include/pch.h index 9bb451f..86aa6a5 100644 --- a/RenderScript/include/pch.h +++ b/RenderScript/include/pch.h @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/BlendStateParser.cpp b/RenderScript/src/BlendStateDescParser.cpp index adf26ae..13458e3 100644 --- a/RenderScript/src/BlendStateParser.cpp +++ b/RenderScript/src/BlendStateDescParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,10 @@ */ #include "pch.h" -#include "BlendStateParser.h" +#include "BlendStateDescParser.h" +#include "LuaWrappers.h" +#include "ClassMethodBinding.h" + namespace std { @@ -33,10 +36,10 @@ namespace std namespace Diligent { - class RenderTargetBlendStateParser; + class RenderTargetBlendDescArrayParser; template<> - class MemberBinder<RenderTargetBlendStateParser> : public MemberBinderBase + class MemberBinder<RenderTargetBlendDescArrayParser> : public MemberBinderBase { public: MemberBinder( size_t MemberOffset, size_t Dummy ) : @@ -126,71 +129,26 @@ namespace Diligent EnumMapping < BLEND_OPERATION > m_BlendOpEnumMapping; EnumMapping < COLOR_MASK > m_ColorMaskEnumMapping; }; + - - const Char* BlendStateParser::BlendStateLibName = "BlendState"; - - BlendStateParser::BlendStateParser( IRenderDevice *pRenderDevice, lua_State *L ) : - EngineObjectParserCommon<IBlendState>( pRenderDevice, L, BlendStateLibName ), - m_SetBlendBinding( this, L, "Context", "SetBlendState", &BlendStateParser::SetBlendState ) + MemberBinder<BlendStateDesc> :: MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinderBase( MemberOffset ) { - DEFINE_BUFFERED_STRING_BINDER( m_Bindings, SBSDescWrapper, Name, NameBuffer ) + DEFINE_BINDER( m_Bindings, BlendStateDesc, AlphaToCoverageEnable, Bool, Validator<Bool>() ) + DEFINE_BINDER( m_Bindings, BlendStateDesc, IndependentBlendEnable, Bool, Validator<Bool>() ) - DEFINE_BINDER( m_Bindings, SBSDescWrapper, AlphaToCoverageEnable, Bool, Validator<Bool>() ) - DEFINE_BINDER( m_Bindings, SBSDescWrapper, IndependentBlendEnable, Bool, Validator<Bool>() ) - - DEFINE_BINDER( m_Bindings, SBSDescWrapper, RenderTargets, RenderTargetBlendStateParser, 0 ) - }; + DEFINE_BINDER( m_Bindings, BlendStateDesc, RenderTargets, RenderTargetBlendDescArrayParser, 0 ) + } - void BlendStateParser::CreateObj( lua_State *L ) + void MemberBinder<BlendStateDesc> ::GetValue(lua_State *L, const void* pBasePointer) { - INIT_LUA_STACK_TRACKING( L ); - - SBSDescWrapper BlendDesc; - ParseLuaTable( L, 1, &BlendDesc, m_Bindings ); - - CHECK_LUA_STACK_HEIGHT(); - - auto ppBlendState = reinterpret_cast<IBlendState**>(lua_newuserdata( L, sizeof( IBlendState* ) )); - *ppBlendState = nullptr; - m_pRenderDevice->CreateBlendState( BlendDesc, ppBlendState ); - if( *ppBlendState == nullptr ) - SCRIPT_PARSING_ERROR( L, "Failed to create blend state object" ) - - CHECK_LUA_STACK_HEIGHT( +1 ); + const auto &BlendDesc = GetMemberByOffest< BlendStateDesc >(pBasePointer, m_MemberOffset); + PushLuaTable(L, &BlendDesc, m_Bindings); } - int BlendStateParser::SetBlendState( lua_State *L ) + void MemberBinder<BlendStateDesc> ::SetValue(lua_State *L, int Index, void* pBasePointer) { - auto *pBS = *GetUserData<IBlendState**>( L, 1, m_MetatableRegistryName.c_str() ); - - auto NumArgs = lua_gettop( L ); - float BlendFactors[4] = { 1, 1, 1, 1 }; - if( NumArgs >= 2 ) - { - INIT_LUA_STACK_TRACKING( L ); - - ParseLuaArray( L, 2, BlendFactors, [&]( void* _pBasePointer, int StackIndex, int NewArrayIndex ) - { - VERIFY( BlendFactors == _pBasePointer, "Sanity check" ); - if( !(NewArrayIndex >= 1 && NewArrayIndex <= 4) ) - SCRIPT_PARSING_ERROR( L, "Incorrect blend factor index ", NewArrayIndex, ". Only 1..4 are allowed." ); - - BlendFactors[NewArrayIndex - 1] = ReadValueFromLua<Float32>( L, StackIndex ); - } - ); - - CHECK_LUA_STACK_HEIGHT(); - } - - Uint32 SampleMask = 0xFFFFFFFF; - if( NumArgs >= 3 ) - { - SampleMask = ReadValueFromLua<Uint32>( L, 3 ); - } - - auto *pContext = LoadDeviceContextFromRegistry( L ); - pContext->SetBlendState( pBS, BlendFactors, SampleMask ); - return 0; + auto &BlendDesc = GetMemberByOffest< BlendStateDesc>( pBasePointer, m_MemberOffset ); + ParseLuaTable( L, Index, &BlendDesc, m_Bindings ); } } diff --git a/RenderScript/src/BufferParser.cpp b/RenderScript/src/BufferParser.cpp index efa2d2a..0dffd13 100644 --- a/RenderScript/src/BufferParser.cpp +++ b/RenderScript/src/BufferParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/BufferViewParser.cpp b/RenderScript/src/BufferViewParser.cpp index c86bace..a1bff10 100644 --- a/RenderScript/src/BufferViewParser.cpp +++ b/RenderScript/src/BufferViewParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/DepthStencilStateParser.cpp b/RenderScript/src/DepthStencilStateDescParser.cpp index 4f95623..aed7235 100644 --- a/RenderScript/src/DepthStencilStateParser.cpp +++ b/RenderScript/src/DepthStencilStateDescParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ */ #include "pch.h" -#include "DepthStencilStateParser.h" +#include "DepthStencilStateDescParser.h" namespace std { @@ -31,8 +31,6 @@ namespace std namespace Diligent { - const Char* DepthStencilStateParser::DepthStencilStateLibName = "DepthStencilState"; - template<> class MemberBinder<StencilOpDesc> : public MemberBinderBase { @@ -77,51 +75,29 @@ namespace Diligent EnumMapping < STENCIL_OP > m_StencilOpEnumMapping; }; - DepthStencilStateParser::DepthStencilStateParser( IRenderDevice *pRenderDevice, lua_State *L ) : - EngineObjectParserCommon<IDepthStencilState>( pRenderDevice, L, DepthStencilStateLibName ), - m_SetDepthStencilBinding( this, L, "Context", "SetDepthStencilState", &DepthStencilStateParser::SetDepthStencilState ) + MemberBinder<DepthStencilStateDesc>::MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinderBase( MemberOffset ) { - DEFINE_BUFFERED_STRING_BINDER( m_Bindings, SDSSDescWrapper, Name, NameBuffer ) - - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, DepthEnable, Bool, Validator<Bool>() ) - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, DepthWriteEnable, Bool, Validator<Bool>() ) - DEFINE_ENUM_BINDER( m_Bindings, SDSSDescWrapper, DepthFunc, COMPARISON_FUNCTION, m_CmpFuncEnumMapping ) - - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, StencilEnable, Bool, Validator<Bool>() ) - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, StencilReadMask, Uint8, Validator<Uint8>() ) - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, StencilWriteMask, Uint8, Validator<Uint8>() ) - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, FrontFace, StencilOpDesc, 0 ) - DEFINE_BINDER( m_Bindings, SDSSDescWrapper, BackFace, StencilOpDesc, 0 ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, DepthEnable, Bool, Validator<Bool>() ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, DepthWriteEnable, Bool, Validator<Bool>() ) + DEFINE_ENUM_BINDER( m_Bindings, DepthStencilStateDesc, DepthFunc, COMPARISON_FUNCTION, m_CmpFuncEnumMapping ) + + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilEnable, Bool, Validator<Bool>() ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilReadMask, Uint8, Validator<Uint8>() ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilWriteMask, Uint8, Validator<Uint8>() ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, FrontFace, StencilOpDesc, 0 ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, BackFace, StencilOpDesc, 0 ) }; - void DepthStencilStateParser::CreateObj( lua_State *L ) + void MemberBinder<DepthStencilStateDesc> ::GetValue(lua_State *L, const void* pBasePointer) { - INIT_LUA_STACK_TRACKING( L ); - - SDSSDescWrapper DepthStencilDesc; - ParseLuaTable( L, 1, &DepthStencilDesc, m_Bindings ); - - CHECK_LUA_STACK_HEIGHT(); - - auto ppDepthStencilState = reinterpret_cast<IDepthStencilState**>(lua_newuserdata( L, sizeof( IDepthStencilState* ) )); - *ppDepthStencilState = nullptr; - m_pRenderDevice->CreateDepthStencilState( DepthStencilDesc, ppDepthStencilState ); - if( *ppDepthStencilState == nullptr ) - SCRIPT_PARSING_ERROR(L, "Failed to create depth stencil state") - - CHECK_LUA_STACK_HEIGHT( +1 ); + const auto &DSSDesc = GetMemberByOffest< DepthStencilStateDesc >(pBasePointer, m_MemberOffset); + PushLuaTable(L, &DSSDesc, m_Bindings); } - int DepthStencilStateParser::SetDepthStencilState( lua_State *L ) + void MemberBinder<DepthStencilStateDesc> ::SetValue(lua_State *L, int Index, void* pBasePointer) { - auto pVertDesc = *GetUserData<IDepthStencilState**>( L, 1, m_MetatableRegistryName.c_str() ); - Uint8 StencilRef = 0; - if( lua_gettop( L ) > 1 ) - { - StencilRef = ReadValueFromLua<Uint8>( L, 2 ); - } - auto *pContext = LoadDeviceContextFromRegistry( L ); - pContext->SetDepthStencilState( pVertDesc, StencilRef ); - return 0; + auto &DSSDesc = GetMemberByOffest< DepthStencilStateDesc>( pBasePointer, m_MemberOffset ); + ParseLuaTable( L, Index, &DSSDesc, m_Bindings ); } } diff --git a/RenderScript/src/DeviceContextFuncBindings.cpp b/RenderScript/src/DeviceContextFuncBindings.cpp index 9525cf2..bf7e402 100644 --- a/RenderScript/src/DeviceContextFuncBindings.cpp +++ b/RenderScript/src/DeviceContextFuncBindings.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,15 +26,27 @@ #include "GraphicsUtilities.h" #include "TextureViewParser.h" #include "EngineObjectParserBase.h" +#include "ShaderResourceBindingParser.h" +#include "PSODescParser.h" namespace Diligent { - DeviceContextFuncBindings::DeviceContextFuncBindings( IRenderDevice *pRenderDevice, lua_State *L, TextureViewParser *pTexViewPasrser ) : + DeviceContextFuncBindings::DeviceContextFuncBindings( IRenderDevice *pRenderDevice, lua_State *L, + TextureViewParser *pTexViewPasrser, + ShaderResourceBindingParser *pSRBParser, + PSODescParser *pPSOParser) : m_SetRenderTargetsBinding(this, L, "Context", "SetRenderTargets", &DeviceContextFuncBindings::SetRenderTargets), m_ClearRenderTargetBinding(this, L, "Context", "ClearRenderTarget", &DeviceContextFuncBindings::ClearRenderTarget), m_ClearDepthStencilBinding(this, L, "Context", "ClearDepthStencil", &DeviceContextFuncBindings::ClearDepthStencil), - m_TexViewMetatableName( pTexViewPasrser->GetMetatableName() ) + m_SetStencilRefBinding(this, L, "Context", "SetStencilRef", &DeviceContextFuncBindings::SetStencilRef), + m_SetBlendFactorsBinding(this, L, "Context", "SetBlendFactors", &DeviceContextFuncBindings::SetBlendFactors), + m_CommitShaderResourcesBinding(this, L, "Context", "CommitShaderResources", &DeviceContextFuncBindings::CommitShaderResources), + m_TransitionShaderResourcesBinding(this, L, "Context", "TransitionShaderResources", &DeviceContextFuncBindings::TransitionShaderResources), + m_TexViewMetatableName( pTexViewPasrser->GetMetatableName() ), + m_ShaderResBindingMetatableName( pSRBParser->GetMetatableName() ), + m_PSOMetatableName(pPSOParser->GetMetatableName()) { + DEFINE_ENUM_ELEMENT_MAPPING( m_CommitShaderResFlagsEnumMapping, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES ); }; int DeviceContextFuncBindings::SetRenderTargets( lua_State *L ) @@ -142,4 +154,101 @@ namespace Diligent return 0; } + + int DeviceContextFuncBindings::SetStencilRef( lua_State *L ) + { + auto NumArgs = lua_gettop( L ); + + Uint32 StencilRef = 0; + if(NumArgs >= 1 ) + StencilRef = ReadValueFromLua<Uint32>( L, 1 ); + + auto *pContext = EngineObjectParserBase::LoadDeviceContextFromRegistry( L ); + pContext->SetStencilRef( StencilRef ); + + // Return no values to Lua + return 0; + } + + int DeviceContextFuncBindings::SetBlendFactors( lua_State *L ) + { + float BlendFactors[4] = {}; + auto NumArgs = lua_gettop( L ); + + for(int bf=0; bf < std::min(NumArgs, 4); ++bf) + BlendFactors[bf] = ReadValueFromLua<Float32>( L, bf+1 ); + + auto *pContext = EngineObjectParserBase::LoadDeviceContextFromRegistry( L ); + pContext->SetBlendFactors( BlendFactors ); + + // Return no values to Lua + return 0; + } + + int DeviceContextFuncBindings::CommitShaderResources( lua_State *L ) + { + auto NumArgs = lua_gettop( L ); + IShaderResourceBinding *pShaderResBinding = nullptr; + int CurrArg = 1; + if(NumArgs >= CurrArg ) + { + if( lua_type( L, CurrArg ) == LUA_TUSERDATA ) + { + pShaderResBinding = *GetUserData<IShaderResourceBinding**>( L, CurrArg, m_ShaderResBindingMetatableName.c_str() ); + ++CurrArg; + } + } + + Uint32 Flags = 0; + if(NumArgs >= CurrArg && + (lua_type( L, CurrArg ) == LUA_TSTRING || + lua_type( L, CurrArg ) == LUA_TTABLE ) ) + { + FlagsLoader<COMMIT_SHADER_RESOURCES_FLAG> CommitShaderResFlagsLoader(0, "CommitShaderResourcesFlag", m_CommitShaderResFlagsEnumMapping); + CommitShaderResFlagsLoader.SetValue( L, CurrArg, &Flags ); + ++CurrArg; + } + + auto *pContext = EngineObjectParserBase::LoadDeviceContextFromRegistry( L ); + pContext->CommitShaderResources( pShaderResBinding, Flags ); + + return 0; + } + + int DeviceContextFuncBindings::TransitionShaderResources( lua_State *L ) + { + auto NumArgs = lua_gettop( L ); + IPipelineState *pPSO = nullptr; + int CurrArg = 1; + + if(NumArgs >= CurrArg ) + { + if( lua_type( L, CurrArg ) == LUA_TUSERDATA ) + { + pPSO = *GetUserData<IPipelineState**>( L, CurrArg, m_PSOMetatableName.c_str() ); + ++CurrArg; + } + } + + if( !pPSO ) + { + SCRIPT_PARSING_ERROR( L, "PSO is expected as the first argument" ); + } + + IShaderResourceBinding *pShaderResBinding = nullptr; + if(NumArgs >= CurrArg ) + { + if( lua_type( L, CurrArg ) == LUA_TUSERDATA ) + { + pShaderResBinding = *GetUserData<IShaderResourceBinding**>( L, CurrArg, m_ShaderResBindingMetatableName.c_str() ); + ++CurrArg; + } + } + + auto *pContext = EngineObjectParserBase::LoadDeviceContextFromRegistry( L ); + pContext->TransitionShaderResources( pPSO, pShaderResBinding ); + + return 0; + } + } diff --git a/RenderScript/src/DrawAttribsParser.cpp b/RenderScript/src/DrawAttribsParser.cpp index a1d9d3e..1c8a8c2 100644 --- a/RenderScript/src/DrawAttribsParser.cpp +++ b/RenderScript/src/DrawAttribsParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/EngineObjectParserBase.cpp b/RenderScript/src/EngineObjectParserBase.cpp index 5790e60..a1ac853 100644 --- a/RenderScript/src/EngineObjectParserBase.cpp +++ b/RenderScript/src/EngineObjectParserBase.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/EnumMappings.cpp b/RenderScript/src/EnumMappings.cpp index 3bc9349..33c87c1 100644 --- a/RenderScript/src/EnumMappings.cpp +++ b/RenderScript/src/EnumMappings.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ namespace Diligent TextureFormatEnumMapping::TextureFormatEnumMapping() { + DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEX_FORMAT_UNKNOWN ); DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEX_FORMAT_RGBA32_TYPELESS ); DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEX_FORMAT_RGBA32_FLOAT ); DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEX_FORMAT_RGBA32_UINT ); @@ -144,26 +145,27 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEX_FORMAT_BC7_UNORM ); DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEX_FORMAT_BC7_UNORM_SRGB ); static_assert(TEX_FORMAT_NUM_FORMATS == TEX_FORMAT_BC7_UNORM_SRGB + 1, "Not all texture formats initialized."); - VERIFY( m_Str2ValMap.size() == TEX_FORMAT_NUM_FORMATS - 1, + VERIFY( m_Str2ValMap.size() == TEX_FORMAT_NUM_FORMATS, "Unexpected map size. Did you update TEXTURE_FORMAT enum?" ); - VERIFY( m_Val2StrMap.size() == TEX_FORMAT_NUM_FORMATS - 1, + VERIFY( m_Val2StrMap.size() == TEX_FORMAT_NUM_FORMATS, "Unexpected map size. Did you update TEXTURE_FORMAT enum?" ); } - TextureTypeEnumMapping::TextureTypeEnumMapping() + ResourceDimEnumMapping::ResourceDimEnumMapping() { - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_1D ); - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_1D_ARRAY ); - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_2D ); - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_2D_ARRAY ); - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_3D ); - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_CUBE ); - DEFINE_ENUM_ELEMENT_MAPPING( (*this), TEXTURE_TYPE_CUBE_ARRAY ); - static_assert(TEXTURE_TYPE_NUM_TYPES == TEXTURE_TYPE_CUBE_ARRAY + 1, "Not all texture types initialized."); - VERIFY( m_Str2ValMap.size() == TEXTURE_TYPE_NUM_TYPES - 1, - "Unexpected map size. Did you update TEXTURE_TYPE enum?" ); - VERIFY( m_Val2StrMap.size() == TEXTURE_TYPE_NUM_TYPES - 1, - "Unexpected map size. Did you update TEXTURE_TYPE enum?" ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_BUFFER ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_1D ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_1D_ARRAY ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_2D ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_2D_ARRAY ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_3D ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_CUBE ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), RESOURCE_DIM_TEX_CUBE_ARRAY ); + static_assert(RESOURCE_DIM_NUM_DIMENSIONS == RESOURCE_DIM_TEX_CUBE_ARRAY + 1, "Not all texture types initialized."); + VERIFY( m_Str2ValMap.size() == RESOURCE_DIM_NUM_DIMENSIONS - 1, + "Unexpected map size. Did you update RESOURCE_DIMENSION enum?" ); + VERIFY( m_Val2StrMap.size() == RESOURCE_DIM_NUM_DIMENSIONS - 1, + "Unexpected map size. Did you update RESOURCE_DIMENSION enum?" ); } ValueTypeEnumMapping::ValueTypeEnumMapping() @@ -207,4 +209,15 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( (*this), BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED ); DEFINE_ENUM_ELEMENT_MAPPING( (*this), BIND_SHADER_RESOURCES_ALL_RESOLVED ); } + + ShaderTypeEnumMapping::ShaderTypeEnumMapping() + { + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_UNKNOWN ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_VERTEX ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_PIXEL ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_GEOMETRY ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_HULL ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_DOMAIN ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_TYPE_COMPUTE ); + } } diff --git a/RenderScript/src/InputLayoutDescParser.cpp b/RenderScript/src/InputLayoutDescParser.cpp new file mode 100644 index 0000000..b063c55 --- /dev/null +++ b/RenderScript/src/InputLayoutDescParser.cpp @@ -0,0 +1,87 @@ +/* Copyright 2015-2016 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include "InputLayoutDescParser.h" + +namespace Diligent +{ + MemberBinder<InputLayoutDesc> :: MemberBinder( size_t InputLayoutOffset, size_t ElementsBufferOffset ) : + MemberBinderBase( InputLayoutOffset ), + m_LayoutElementsBufferOffset(ElementsBufferOffset) + { + DEFINE_BINDER( m_Bindings, LayoutElement, InputIndex, Uint32, Validator<Uint32>( "Input Index", 0, 32 ) ) + DEFINE_BINDER( m_Bindings, LayoutElement, BufferSlot, Uint32, Validator<Uint32>( "Buffer Slot", 0, MaxBufferSlots ) ) + DEFINE_BINDER( m_Bindings, LayoutElement, NumComponents, Uint32, Validator<Uint32>( "Num Components", 1, 4 ) ) + + DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, ValueType, VALUE_TYPE, m_ValueTypeEnumMapping ) + + DEFINE_BINDER( m_Bindings, LayoutElement, IsNormalized, Bool, Validator<Bool>() ) + DEFINE_BINDER( m_Bindings, LayoutElement, RelativeOffset, Uint32, Validator<Uint32>() ) + + + m_FrequencyEnumMapping.AddMapping( "FREQUENCY_PER_VERTEX", LayoutElement::FREQUENCY_PER_VERTEX ); + m_FrequencyEnumMapping.AddMapping( "FREQUENCY_PER_INSTANCE", LayoutElement::FREQUENCY_PER_INSTANCE ); + VERIFY( m_FrequencyEnumMapping.m_Str2ValMap.size() == LayoutElement::FREQUENCY_NUM_FREQUENCIES - 1, + "Unexpected map size. Did you update LayoutElement::FREQUENCY_PER_VERTEX enum?" ); + VERIFY( m_FrequencyEnumMapping.m_Val2StrMap.size() == LayoutElement::FREQUENCY_NUM_FREQUENCIES - 1, + "Unexpected map size. Did you update LayoutElement::FREQUENCY_PER_VERTEX enum?" ); + DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, Frequency, LayoutElement::FREQUENCY, m_FrequencyEnumMapping ) + + DEFINE_BINDER( m_Bindings, LayoutElement, InstanceDataStepRate, Uint32, Validator<Uint32>() ) + } + + void MemberBinder<InputLayoutDesc> :: GetValue( lua_State *L, const void* pBasePointer ) + { + // Use raw pointer to push the value to Lua because the buffer + // most likely does not exist + const auto &InputLayout = GetMemberByOffest<const InputLayoutDesc>(pBasePointer, m_MemberOffset); + PushLuaArray( L, InputLayout.LayoutElements, InputLayout.LayoutElements + InputLayout.NumElements, [&]( const LayoutElement &Elem ) + { + PushLuaTable( L, &Elem, m_Bindings ); + } + ); + } + + void MemberBinder<InputLayoutDesc> :: SetValue( lua_State *L, int Index, void* pBasePointer ) + { + ParseLuaArray( L, Index, pBasePointer, [&]( void* _pBasePointer, int StackIndex, int NewArrayIndex ) + { + VERIFY( pBasePointer == _pBasePointer, "Sanity check failed" ); + auto &Elements = GetMemberByOffest<std::vector<LayoutElement> >( pBasePointer, m_LayoutElementsBufferOffset); + auto CurrIndex = Elements.size(); + if( CurrIndex != NewArrayIndex - 1 ) + SCRIPT_PARSING_ERROR( L, "Explicit array indices are not allowed in layout description. Provided index ", NewArrayIndex - 1, " conflicts with actual index ", CurrIndex, "." ); + Elements.resize( CurrIndex + 1 ); + ParseLuaTable( L, StackIndex, &(Elements)[CurrIndex], m_Bindings ); + if( Elements[CurrIndex].ValueType == VT_UNDEFINED ) + SCRIPT_PARSING_ERROR( L, "Valid value type must be specified for layout element #", CurrIndex ); + } + ); + + auto &ElementsBuffer = GetMemberByOffest<std::vector<LayoutElement> >( pBasePointer, m_LayoutElementsBufferOffset ); + auto &InputLayout = GetMemberByOffest< InputLayoutDesc >( pBasePointer, m_MemberOffset ); + InputLayout.LayoutElements = ElementsBuffer.data(); + InputLayout.NumElements = static_cast<Uint32>( ElementsBuffer.size() ); + } +} diff --git a/RenderScript/src/LayoutDescParser.cpp b/RenderScript/src/LayoutDescParser.cpp deleted file mode 100644 index a5bbda1..0000000 --- a/RenderScript/src/LayoutDescParser.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright 2015 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "pch.h" -#include "LayoutDescParser.h" - -namespace std -{ - DEFINE_ENUM_HASH( Diligent::LayoutElement::FREQUENCY ) -} - -namespace Diligent -{ - const Char* LayoutDescParser::LayoutDescLibName = "LayoutDesc"; - - class LayoutElementLoader; // Used only as a template switch - - template<> - class MemberBinder<LayoutElementLoader> : public MemberBinderBase - { - public: - MemberBinder( size_t LayoutElementsOffset, size_t ElementsBufferOffset, size_t NumElementsOffset ) : - MemberBinderBase( ElementsBufferOffset ), - m_LayoutElementsOffset(LayoutElementsOffset), - m_NumElementsOffset(NumElementsOffset) - { - DEFINE_BINDER( m_Bindings, LayoutElement, InputIndex, Uint32, Validator<Uint32>( "Input Index", 0, 32 ) ) - DEFINE_BINDER( m_Bindings, LayoutElement, BufferSlot, Uint32, Validator<Uint32>( "Buffer Slot", 0, MaxBufferSlots ) ) - DEFINE_BINDER( m_Bindings, LayoutElement, NumComponents, Uint32, Validator<Uint32>( "Num Components", 1, 4 ) ) - - DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, ValueType, VALUE_TYPE, m_ValueTypeEnumMapping ) - - DEFINE_BINDER( m_Bindings, LayoutElement, IsNormalized, Bool, Validator<Bool>() ) - DEFINE_BINDER( m_Bindings, LayoutElement, RelativeOffset, Uint32, Validator<Uint32>() ) - - - m_FrequencyEnumMapping.AddMapping( "FREQUENCY_PER_VERTEX", LayoutElement::FREQUENCY_PER_VERTEX ); - m_FrequencyEnumMapping.AddMapping( "FREQUENCY_PER_INSTANCE", LayoutElement::FREQUENCY_PER_INSTANCE ); - VERIFY( m_FrequencyEnumMapping.m_Str2ValMap.size() == LayoutElement::FREQUENCY_NUM_FREQUENCIES - 1, - "Unexpected map size. Did you update LayoutElement::FREQUENCY_PER_VERTEX enum?" ); - VERIFY( m_FrequencyEnumMapping.m_Val2StrMap.size() == LayoutElement::FREQUENCY_NUM_FREQUENCIES - 1, - "Unexpected map size. Did you update LayoutElement::FREQUENCY_PER_VERTEX enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, Frequency, LayoutElement::FREQUENCY, m_FrequencyEnumMapping ) - - DEFINE_BINDER( m_Bindings, LayoutElement, InstanceDataStepRate, Uint32, Validator<Uint32>() ) - } - - virtual void GetValue( lua_State *L, const void* pBasePointer ) - { - // Use raw pointer to push the value to Lua because the buffer - // most likely does not exist - const auto *Elements = GetMemberByOffest<const LayoutElement*>(pBasePointer, m_LayoutElementsOffset); - const auto &NumElements = GetMemberByOffest< Uint32 >( pBasePointer, m_NumElementsOffset ); - PushLuaArray( L, Elements, Elements + NumElements, [&]( const LayoutElement &Elem ) - { - PushLuaTable( L, &Elem, m_Bindings ); - } - ); - } - - virtual void SetValue( lua_State *L, int Index, void* pBasePointer ) - { - ParseLuaArray( L, Index, pBasePointer, [&]( void* _pBasePointer, int StackIndex, int NewArrayIndex ) - { - VERIFY( pBasePointer == _pBasePointer, "Sanity check failed" ); - auto &Elements = GetMemberByOffest<std::vector<LayoutElement> >( pBasePointer, m_MemberOffset ); - auto CurrIndex = Elements.size(); - if( CurrIndex != NewArrayIndex - 1 ) - SCRIPT_PARSING_ERROR( L, "Explicit array indices are not allowed in layout description. Provided index ", NewArrayIndex - 1, " conflicts with actual index ", CurrIndex, "." ); - Elements.resize( CurrIndex + 1 ); - ParseLuaTable( L, StackIndex, &(Elements)[CurrIndex], m_Bindings ); - if( Elements[CurrIndex].ValueType == VT_UNDEFINED ) - SCRIPT_PARSING_ERROR( L, "Valid value type must be specified for layout element #", CurrIndex ); - } - ); - - auto &ElementsBuffer = GetMemberByOffest<std::vector<LayoutElement> >( pBasePointer, m_MemberOffset ); - auto &LayoutElements = GetMemberByOffest< LayoutElement* >( pBasePointer, m_LayoutElementsOffset ); - auto &NumElements = GetMemberByOffest< Uint32 >( pBasePointer, m_NumElementsOffset ); - LayoutElements = ElementsBuffer.data(); - NumElements = static_cast<Uint32>( ElementsBuffer.size() ); - } - private: - BindingsMapType m_Bindings; - ValueTypeEnumMapping m_ValueTypeEnumMapping; - EnumMapping < LayoutElement::FREQUENCY > m_FrequencyEnumMapping; - size_t m_LayoutElementsOffset; - size_t m_NumElementsOffset; - }; - - LayoutDescParser::LayoutDescParser( IRenderDevice *pRenderDevice, lua_State *L ) : - EngineObjectParserCommon<IVertexDescription>( pRenderDevice, L, LayoutDescLibName ), - m_SetInputLayoutBinding( this, L, "Context", "SetInputLayout", &LayoutDescParser::SetInputLayout ) - { - DEFINE_BUFFERED_STRING_BINDER( m_Bindings, LayoutDescWrapper, Name, NameBuffer ) - - auto *pLayoutElemBinder = - new MemberBinder<LayoutElementLoader>( - offsetof(LayoutDescWrapper, LayoutElements), - offsetof(LayoutDescWrapper, ElementsBuffer), - offsetof(LayoutDescWrapper, NumElements) - ); - m_Bindings.insert( std::make_pair( "LayoutElements", std::unique_ptr<MemberBinderBase>(pLayoutElemBinder) ) ); - }; - - void LayoutDescParser::CreateObj( lua_State *L ) - { - INIT_LUA_STACK_TRACKING( L ); - - LayoutDescWrapper LayoutDesc; - ParseLuaTable( L, -2, &LayoutDesc, m_Bindings ); - CHECK_LUA_STACK_HEIGHT(); - - auto ppVertexShader = GetUserData<IShader**>( L, -1, "Metatables.Shader" ); - auto ppVertDesc = reinterpret_cast<IVertexDescription**>(lua_newuserdata( L, sizeof( IVertexDescription* ) )); - *ppVertDesc = nullptr; - m_pRenderDevice->CreateVertexDescription( LayoutDesc, *ppVertexShader, ppVertDesc ); - if( *ppVertDesc == nullptr ) - SCRIPT_PARSING_ERROR(L, "Failed to create vertex description") - - CHECK_LUA_STACK_HEIGHT( +1 ); - } - - int LayoutDescParser::SetInputLayout( lua_State *L ) - { - auto pVertDesc = *GetUserData<IVertexDescription**>( L, 1, m_MetatableRegistryName.c_str() ); - auto *pContext = LoadDeviceContextFromRegistry( L ); - pContext->SetVertexDescription( pVertDesc ); - return 0; - } -} diff --git a/RenderScript/src/LuaBindings.cpp b/RenderScript/src/LuaBindings.cpp index 707a33c..9217b67 100644 --- a/RenderScript/src/LuaBindings.cpp +++ b/RenderScript/src/LuaBindings.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/LuaFunctionBinding.cpp b/RenderScript/src/LuaFunctionBinding.cpp index d81634e..a3a3dd1 100644 --- a/RenderScript/src/LuaFunctionBinding.cpp +++ b/RenderScript/src/LuaFunctionBinding.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/LuaWrappers.cpp b/RenderScript/src/LuaWrappers.cpp index 939fdac..1a0e119 100644 --- a/RenderScript/src/LuaWrappers.cpp +++ b/RenderScript/src/LuaWrappers.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/PSODescParser.cpp b/RenderScript/src/PSODescParser.cpp new file mode 100644 index 0000000..9f00f95 --- /dev/null +++ b/RenderScript/src/PSODescParser.cpp @@ -0,0 +1,257 @@ +/* Copyright 2015-2016 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include "PSODescParser.h" +#include "BlendStateDescParser.h" +#include "RasterizerStateDescParser.h" +#include "DepthStencilStateDescParser.h" +#include "InputLayoutDescParser.h" + +namespace std +{ + DEFINE_ENUM_HASH( Diligent::PRIMITIVE_TOPOLOGY_TYPE ) +} + +namespace Diligent +{ + class RTVFormatsParser; + + template<> + class MemberBinder<RTVFormatsParser> : public MemberBinderBase + { + public: + MemberBinder( size_t /*MemberOffset*/, size_t /*Dummy*/ ) : + // We will use a pointer to the GraphicsPipelineDesc structure itself + MemberBinderBase( 0 ), + m_TexFmtLoader(0, "RTVFormats", m_TexFmtEnumMapping) + { + } + + virtual void GetValue( lua_State *L, const void* pBasePointer )override + { + const auto &GraphicsPipeline = GetMemberByOffest< GraphicsPipelineDesc >(pBasePointer, m_MemberOffset); + PushLuaArray( L, GraphicsPipeline.RTVFormats, GraphicsPipeline.RTVFormats + GraphicsPipeline.NumRenderTargets, [&]( const TEXTURE_FORMAT &Fmt ) + { + m_TexFmtLoader.GetValue(L, &Fmt); + }); + } + + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override + { + auto &GraphicsPipeline = GetMemberByOffest< GraphicsPipelineDesc >( pBasePointer, m_MemberOffset ); + if(lua_type(L,Index) == LUA_TTABLE) + { + ParseLuaArray( L, Index, pBasePointer, [&]( void* _pBasePointer, int StackIndex, int NewArrayIndex ) + { + // Lua array indices are 1-based + NewArrayIndex -= 1; + VERIFY( pBasePointer == _pBasePointer, "Sanity check failed" ); + if( NewArrayIndex < 0 || NewArrayIndex >= MaxRenderTargets ) + SCRIPT_PARSING_ERROR( L, "Render target array index ", NewArrayIndex," is out of allowed range [", 0, ' ', MaxRenderTargets-1, ']' ); + + m_TexFmtLoader.SetValue(L, StackIndex, &GraphicsPipeline.RTVFormats[NewArrayIndex]); + GraphicsPipeline.NumRenderTargets = std::max(GraphicsPipeline.NumRenderTargets, static_cast<Uint32>(NewArrayIndex+1)); + } + ); + } + else if(lua_type(L,Index) == LUA_TSTRING) + { + m_TexFmtLoader.SetValue(L, Index, &GraphicsPipeline.RTVFormats[0]); + GraphicsPipeline.NumRenderTargets = 1; + } + else + { + SCRIPT_PARSING_ERROR( L, "Unexpected type ", lua_typename(L, Index), ". Table of strings or a string are expected" ); + } + } + private: + TextureFormatEnumMapping m_TexFmtEnumMapping; + EnumMemberBinder<TEXTURE_FORMAT> m_TexFmtLoader; + }; + + + template<> + class MemberBinder<SampleDesc> : public MemberBinderBase + { + public: + MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinderBase( MemberOffset ) + { + DEFINE_BINDER( m_Bindings, SampleDesc, Count, Uint32, Validator<Uint32>("Count", 1,32) ); + DEFINE_BINDER( m_Bindings, SampleDesc, Quality, Uint32, Validator<Uint32>("Quality", 0,std::numeric_limits<Uint32>::max()) ); + } + + virtual void GetValue( lua_State *L, const void* pBasePointer )override + { + const auto &SmplDesc = GetMemberByOffest< SampleDesc >(pBasePointer, m_MemberOffset); + PushLuaTable(L, &SmplDesc, m_Bindings); + } + + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override + { + auto &SmplDesc = GetMemberByOffest< SampleDesc >( pBasePointer, m_MemberOffset ); + ParseLuaTable( L, Index, &SmplDesc, m_Bindings ); + } + + private: + BindingsMapType m_Bindings; + }; + + template<> + class MemberBinder<GraphicsPipelineDesc> : public MemberBinderBase + { + public: + MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinderBase( MemberOffset ) + { + std::vector<String> AllowedMetatable = { "Metatables.Shader" }; + + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pVS, EngineObjectPtrLoader<IShader>, AllowedMetatable ); + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pPS, EngineObjectPtrLoader<IShader>, AllowedMetatable ); + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pDS, EngineObjectPtrLoader<IShader>, AllowedMetatable ); + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pHS, EngineObjectPtrLoader<IShader>, AllowedMetatable ); + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pGS, EngineObjectPtrLoader<IShader>, AllowedMetatable ); + + //D3D12_STREAM_OUTPUT_DESC StreamOutput; + + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, BlendDesc, BlendStateDesc, 0 ) + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, SampleMask, Uint32, Validator<Uint32>() ) + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, RasterizerDesc, RasterizerStateDesc, 0 ) + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, DepthStencilDesc, DepthStencilStateDesc, 0 ) + + auto *pLayoutElemBinder = + new MemberBinder<InputLayoutDesc>( + offsetof(GraphicsPipelineDesc, InputLayout), + offsetof(PSODescParser::PSODescWrapper, LayoutElementsBuffer) - offsetof(PSODescParser::PSODescWrapper, GraphicsPipeline) + ); + m_Bindings.insert( std::make_pair( "InputLayout", std::unique_ptr<MemberBinderBase>(pLayoutElemBinder) ) ); + + //D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue; + + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_POINT ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_LINE ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_PATCH ); + VERIFY( m_PrimTopologyTypeEnumMapping.m_Str2ValMap.size() == PRIMITIVE_TOPOLOGY_TYPE_NUM_TYPES, + "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY_TYPE enum?" ); + VERIFY( m_PrimTopologyTypeEnumMapping.m_Val2StrMap.size() == PRIMITIVE_TOPOLOGY_TYPE_NUM_TYPES, + "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY_TYPE enum?" ); + DEFINE_ENUM_BINDER( m_Bindings, GraphicsPipelineDesc, PrimitiveTopologyType, PRIMITIVE_TOPOLOGY_TYPE, m_PrimTopologyTypeEnumMapping ); + + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, RTVFormats, RTVFormatsParser, 0 ); + DEFINE_ENUM_BINDER( m_Bindings, GraphicsPipelineDesc, DSVFormat, TEXTURE_FORMAT, m_TexFmtEnumMapping ); + + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, SmplDesc, SampleDesc, 0 ); + + //Uint32 NodeMask; + } + + virtual void GetValue( lua_State *L, const void* pBasePointer )override + { + const auto &GraphicsPipeline = GetMemberByOffest< GraphicsPipelineDesc >(pBasePointer, m_MemberOffset); + PushLuaTable(L, &GraphicsPipeline, m_Bindings); + } + + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override + { + auto &GraphicsPipeline = GetMemberByOffest< GraphicsPipelineDesc >( pBasePointer, m_MemberOffset ); + ParseLuaTable( L, Index, &GraphicsPipeline, m_Bindings ); + } + private: + TextureFormatEnumMapping m_TexFmtEnumMapping; + EnumMapping < PRIMITIVE_TOPOLOGY_TYPE > m_PrimTopologyTypeEnumMapping; + BindingsMapType m_Bindings; + }; + + + template<> + class MemberBinder<ComputePipelineDesc> : public MemberBinderBase + { + public: + MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinderBase( MemberOffset ) + { + std::vector<String> AllowedMetatable = { "Metatables.Shader" }; + DEFINE_BINDER( m_Bindings, ComputePipelineDesc, pCS, EngineObjectPtrLoader<IShader>, AllowedMetatable ); + } + + virtual void GetValue( lua_State *L, const void* pBasePointer )override + { + const auto &ComputePipeline = GetMemberByOffest< ComputePipelineDesc >(pBasePointer, m_MemberOffset); + PushLuaTable(L, &ComputePipeline, m_Bindings); + } + + virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override + { + auto &ComputePipeline = GetMemberByOffest< ComputePipelineDesc >( pBasePointer, m_MemberOffset ); + ParseLuaTable( L, Index, &ComputePipeline, m_Bindings ); + } + private: + BindingsMapType m_Bindings; + }; + + + const Char* PSODescParser::PSODescLibName = "PipelineState"; + PSODescParser::PSODescParser( IRenderDevice *pRenderDevice, lua_State *L ) : + EngineObjectParserCommon<IPipelineState>( pRenderDevice, L, PSODescLibName ), + m_SetPSOBinding( this, L, "Context", "SetPipelineState", &PSODescParser::SetPSO ) + { + DEFINE_BUFFERED_STRING_BINDER( m_Bindings, PSODescWrapper, Name, NameBuffer ) + + DEFINE_BINDER( m_Bindings, PSODescWrapper, IsComputePipeline, Bool, Validator<Bool>() ) + DEFINE_BINDER( m_Bindings, PSODescWrapper, SRBAllocationGranularity, Uint32, Validator<Uint32>("SRBAllocationGranularity", 1, 65536) ) + + DEFINE_BINDER( m_Bindings, PSODescWrapper, GraphicsPipeline, GraphicsPipelineDesc, 0 ) + DEFINE_BINDER( m_Bindings, PSODescWrapper, ComputePipeline, ComputePipelineDesc, 0 ) + }; + + void PSODescParser::CreateObj( lua_State *L ) + { + INIT_LUA_STACK_TRACKING( L ); + + PSODescWrapper PSODesc; + ParseLuaTable( L, 1, &PSODesc, m_Bindings ); + + CHECK_LUA_STACK_HEIGHT(); + + auto ppPSO = reinterpret_cast<IPipelineState**>(lua_newuserdata( L, sizeof( IPipelineState* ) )); + *ppPSO = nullptr; + m_pRenderDevice->CreatePipelineState( PSODesc, ppPSO ); + if( *ppPSO == nullptr ) + SCRIPT_PARSING_ERROR( L, "Failed to create Pipeline State Object state object" ) + + CHECK_LUA_STACK_HEIGHT( +1 ); + } + + int PSODescParser::SetPSO( lua_State *L ) + { + auto *pPSO = *GetUserData<IPipelineState**>( L, 1, m_MetatableRegistryName.c_str() ); + + auto *pContext = LoadDeviceContextFromRegistry( L ); + pContext->SetPipelineState( pPSO ); + + return 0; + } +} diff --git a/RenderScript/src/ParsingErrors.cpp b/RenderScript/src/ParsingErrors.cpp index bb78387..e3db2b0 100644 --- a/RenderScript/src/ParsingErrors.cpp +++ b/RenderScript/src/ParsingErrors.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/RasterizerStateDescParser.cpp b/RenderScript/src/RasterizerStateDescParser.cpp new file mode 100644 index 0000000..3032874 --- /dev/null +++ b/RenderScript/src/RasterizerStateDescParser.cpp @@ -0,0 +1,70 @@ +/* Copyright 2015-2016 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include "RasterizerStateDescParser.h" + +namespace Diligent +{ + + MemberBinder<RasterizerStateDesc>::MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinderBase(MemberOffset) + { + DEFINE_ENUM_ELEMENT_MAPPING( m_FillModeEnumMapping, FILL_MODE_WIREFRAME ); + DEFINE_ENUM_ELEMENT_MAPPING( m_FillModeEnumMapping, FILL_MODE_SOLID ); + VERIFY( m_FillModeEnumMapping.m_Str2ValMap.size() == FILL_MODE_NUM_MODES-1, + "Unexpected map size. Did you update FILL_MODE enum?" ); + VERIFY( m_FillModeEnumMapping.m_Val2StrMap.size() == FILL_MODE_NUM_MODES-1, + "Unexpected map size. Did you update FILL_MODE enum?" ); + DEFINE_ENUM_BINDER( m_Bindings, RasterizerStateDesc, FillMode, FILL_MODE, m_FillModeEnumMapping ); + + DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_NONE ); + DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_FRONT ); + DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_BACK ); + VERIFY( m_CullModeEnumMapping.m_Str2ValMap.size() == CULL_MODE_NUM_MODES-1, + "Unexpected map size. Did you update CULL_MODE enum?" ); + VERIFY( m_CullModeEnumMapping.m_Val2StrMap.size() == CULL_MODE_NUM_MODES-1, + "Unexpected map size. Did you update CULL_MODE enum?" ); + DEFINE_ENUM_BINDER( m_Bindings, RasterizerStateDesc, CullMode, CULL_MODE, m_CullModeEnumMapping ); + + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, FrontCounterClockwise, Bool, Validator<Bool>() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthBias, Int32, Validator<Int32>() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthBiasClamp, Float32, Validator<Float32>() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, SlopeScaledDepthBias, Float32, Validator<Float32>() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthClipEnable, Bool, Validator<Bool>() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, ScissorEnable, Bool, Validator<Bool>() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, AntialiasedLineEnable, Bool, Validator<Bool>() ); + }; + + void MemberBinder<RasterizerStateDesc> ::GetValue(lua_State *L, const void* pBasePointer) + { + const auto &RasterizerDesc = GetMemberByOffest< RasterizerStateDesc >(pBasePointer, m_MemberOffset); + PushLuaTable(L, &RasterizerDesc, m_Bindings); + } + + void MemberBinder<RasterizerStateDesc> ::SetValue(lua_State *L, int Index, void* pBasePointer) + { + auto &RasterizerDesc = GetMemberByOffest< RasterizerStateDesc>( pBasePointer, m_MemberOffset ); + ParseLuaTable( L, Index, &RasterizerDesc, m_Bindings ); + } +} diff --git a/RenderScript/src/RasterizerStateParser.cpp b/RenderScript/src/RasterizerStateParser.cpp deleted file mode 100644 index 1cac9ed..0000000 --- a/RenderScript/src/RasterizerStateParser.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2015 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "pch.h" -#include "RasterizerStateParser.h" - - -namespace Diligent -{ - const Char* RasterizerStateParser::RasterizerStateLibName = "RasterizerState"; - - RasterizerStateParser::RasterizerStateParser( IRenderDevice *pRenderDevice, lua_State *L ) : - EngineObjectParserCommon<IRasterizerState>( pRenderDevice, L, RasterizerStateLibName ), - m_SetRasterizerBinding( this, L, "Context", "SetRasterizerState", &RasterizerStateParser::SetRasterizerState ) - { - DEFINE_BUFFERED_STRING_BINDER( m_Bindings, SRSDescWrapper, Name, NameBuffer ) - - DEFINE_ENUM_ELEMENT_MAPPING( m_FillModeEnumMapping, FILL_MODE_WIREFRAME ); - DEFINE_ENUM_ELEMENT_MAPPING( m_FillModeEnumMapping, FILL_MODE_SOLID ); - VERIFY( m_FillModeEnumMapping.m_Str2ValMap.size() == FILL_MODE_NUM_MODES-1, - "Unexpected map size. Did you update FILL_MODE enum?" ); - VERIFY( m_FillModeEnumMapping.m_Val2StrMap.size() == FILL_MODE_NUM_MODES-1, - "Unexpected map size. Did you update FILL_MODE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, SRSDescWrapper, FillMode, FILL_MODE, m_FillModeEnumMapping ); - - DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_NONE ); - DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_FRONT ); - DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_BACK ); - VERIFY( m_CullModeEnumMapping.m_Str2ValMap.size() == CULL_MODE_NUM_MODES-1, - "Unexpected map size. Did you update CULL_MODE enum?" ); - VERIFY( m_CullModeEnumMapping.m_Val2StrMap.size() == CULL_MODE_NUM_MODES-1, - "Unexpected map size. Did you update CULL_MODE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, SRSDescWrapper, CullMode, CULL_MODE, m_CullModeEnumMapping ); - - DEFINE_BINDER( m_Bindings, SRSDescWrapper, FrontCounterClockwise, Bool, Validator<Bool>() ); - DEFINE_BINDER( m_Bindings, SRSDescWrapper, DepthBias, Int32, Validator<Int32>() ); - DEFINE_BINDER( m_Bindings, SRSDescWrapper, DepthBiasClamp, Float32, Validator<Float32>() ); - DEFINE_BINDER( m_Bindings, SRSDescWrapper, SlopeScaledDepthBias, Float32, Validator<Float32>() ); - DEFINE_BINDER( m_Bindings, SRSDescWrapper, DepthClipEnable, Bool, Validator<Bool>() ); - DEFINE_BINDER( m_Bindings, SRSDescWrapper, ScissorEnable, Bool, Validator<Bool>() ); - DEFINE_BINDER( m_Bindings, SRSDescWrapper, AntialiasedLineEnable, Bool, Validator<Bool>() ); - }; - - void RasterizerStateParser::CreateObj( lua_State *L ) - { - INIT_LUA_STACK_TRACKING( L ); - - SRSDescWrapper RasterizerDesc; - ParseLuaTable( L, 1, &RasterizerDesc, m_Bindings ); - - CHECK_LUA_STACK_HEIGHT(); - - auto ppRasterizerState = reinterpret_cast<IRasterizerState**>(lua_newuserdata( L, sizeof( IRasterizerState* ) )); - *ppRasterizerState = nullptr; - m_pRenderDevice->CreateRasterizerState( RasterizerDesc, ppRasterizerState ); - if( *ppRasterizerState == nullptr ) - SCRIPT_PARSING_ERROR(L, "Failed to create rasterizer state") - - CHECK_LUA_STACK_HEIGHT( +1 ); - } - - int RasterizerStateParser::SetRasterizerState( lua_State *L ) - { - auto *pRS = *GetUserData<IRasterizerState**>( L, 1, m_MetatableRegistryName.c_str() ); - auto *pContext = LoadDeviceContextFromRegistry( L ); - pContext->SetRasterizerState( pRS ); - return 0; - } -} diff --git a/RenderScript/src/ResourceMappingParser.cpp b/RenderScript/src/ResourceMappingParser.cpp index e3f4918..558685e 100644 --- a/RenderScript/src/ResourceMappingParser.cpp +++ b/RenderScript/src/ResourceMappingParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ namespace Diligent BufferParser *pBuffParser, BufferViewParser *pBuffViewParser ) : EngineObjectParserBase( pRenderDevice, L, ResourceMappingLibName), - m_BindShaderResourcesBinding( this, L, "Context", "BindShaderResources", &ResourceMappingParser::BindShaderResources ), m_pTexViewParser( pTexViewParser ), m_pBuffParser( pBuffParser ), m_pBuffViewParser( pBuffViewParser ), @@ -131,25 +130,6 @@ namespace Diligent } } - int ResourceMappingParser::BindShaderResources( lua_State *L ) - { - auto *pContext = LoadDeviceContextFromRegistry( L ); - auto pResMapping = *GetUserData<IResourceMapping**>( L, 1, m_MetatableRegistryName.c_str() ); - Uint32 Flags = 0; - auto NumArgs = lua_gettop( L ); - // The last argument may be flags - const int FlagsArgInd = 2; - if( NumArgs >= FlagsArgInd && - (lua_type( L, FlagsArgInd ) == LUA_TSTRING || lua_type( L, FlagsArgInd ) == LUA_TTABLE ) ) - { - FlagsLoader<BIND_SHADER_RESOURCES_FLAGS> FlagsLoader(0, "BindShaderResourceFlags", m_BindShaderResFlagEnumMapping); - FlagsLoader.SetValue( L, FlagsArgInd, &Flags ); - } - - pContext->BindShaderResources( pResMapping, Flags ); - return 0; - } - void ResourceMappingParser::GetObjectByName( lua_State *L, const Char *ShaderName, IResourceMapping** ppObject ) { auto pObject = *GetGlobalObject<IResourceMapping**>( L, ShaderName, m_MetatableRegistryName.c_str() ); diff --git a/RenderScript/src/SamplerParser.cpp b/RenderScript/src/SamplerParser.cpp index 74aa71f..864a5df 100644 --- a/RenderScript/src/SamplerParser.cpp +++ b/RenderScript/src/SamplerParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,43 +33,7 @@ namespace Diligent { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, SSamDescWrapper, Name, NameBuffer ) - DEFINE_ENUM_ELEMENT_MAPPING( m_FilterTypeEnumMapping, FILTER_TYPE_POINT ); - DEFINE_ENUM_ELEMENT_MAPPING( m_FilterTypeEnumMapping, FILTER_TYPE_LINEAR ); - DEFINE_ENUM_ELEMENT_MAPPING( m_FilterTypeEnumMapping, FILTER_TYPE_ANISOTROPIC ); - DEFINE_ENUM_ELEMENT_MAPPING( m_FilterTypeEnumMapping, FILTER_TYPE_COMPARISON_POINT ); - DEFINE_ENUM_ELEMENT_MAPPING( m_FilterTypeEnumMapping, FILTER_TYPE_COMPARISON_LINEAR ); - DEFINE_ENUM_ELEMENT_MAPPING( m_FilterTypeEnumMapping, FILTER_TYPE_COMPARISON_ANISOTROPIC ); - VERIFY( m_FilterTypeEnumMapping.m_Str2ValMap.size() == FILTER_TYPE_NUM_FILTERS - 1, "Unexpected map size. Did you update FILTER_TYPE enum?" ); - VERIFY( m_FilterTypeEnumMapping.m_Val2StrMap.size() == FILTER_TYPE_NUM_FILTERS - 1, "Unexpected map size. Did you update FILTER_TYPE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, MinFilter, FILTER_TYPE, m_FilterTypeEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, MagFilter, FILTER_TYPE, m_FilterTypeEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, MipFilter, FILTER_TYPE, m_FilterTypeEnumMapping ) - - - DEFINE_ENUM_ELEMENT_MAPPING( m_TexAddrModeEnumMapping, TEXTURE_ADDRESS_WRAP ); - DEFINE_ENUM_ELEMENT_MAPPING( m_TexAddrModeEnumMapping, TEXTURE_ADDRESS_MIRROR ); - DEFINE_ENUM_ELEMENT_MAPPING( m_TexAddrModeEnumMapping, TEXTURE_ADDRESS_CLAMP ); - DEFINE_ENUM_ELEMENT_MAPPING( m_TexAddrModeEnumMapping, TEXTURE_ADDRESS_BORDER ); - DEFINE_ENUM_ELEMENT_MAPPING( m_TexAddrModeEnumMapping, TEXTURE_ADDRESS_MIRROR_ONCE ); - VERIFY( m_TexAddrModeEnumMapping.m_Str2ValMap.size() == TEXTURE_ADDRESS_NUM_MODES - 1, "Unexpected map size. Did you update TEXTURE_ADDRESS_MODE enum?" ); - VERIFY( m_TexAddrModeEnumMapping.m_Val2StrMap.size() == TEXTURE_ADDRESS_NUM_MODES - 1, "Unexpected map size. Did you update TEXTURE_ADDRESS_MODE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, AddressU, TEXTURE_ADDRESS_MODE, m_TexAddrModeEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, AddressV, TEXTURE_ADDRESS_MODE, m_TexAddrModeEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, AddressW, TEXTURE_ADDRESS_MODE, m_TexAddrModeEnumMapping ) - - - Validator<Float32> DummyValidatorF( SkipValidationFunc<float> ); - DEFINE_BINDER( m_Bindings, SSamDescWrapper, MipLODBias, Float32, DummyValidatorF ) - - Validator<Uint32> MaxAnisotropyValidator( "Max Anisotropy", 0, 32 ); - DEFINE_BINDER( m_Bindings, SSamDescWrapper, MaxAnisotropy, Uint32, MaxAnisotropyValidator ) - - DEFINE_ENUM_BINDER( m_Bindings, SSamDescWrapper, ComparisonFunc, COMPARISON_FUNCTION, m_CmpFuncEnumMapping ) - - DEFINE_BINDER( m_Bindings, SSamDescWrapper, BorderColor, RGBALoader, 0 ) - - DEFINE_BINDER( m_Bindings, SSamDescWrapper, MinLOD, Float32, DummyValidatorF ) - DEFINE_BINDER( m_Bindings, SSamDescWrapper, MaxLOD, Float32, DummyValidatorF ) + InitSamplerParserBindings<SSamDescWrapper>(m_Bindings, m_FilterTypeEnumMapping, m_TexAddrModeEnumMapping, m_CmpFuncEnumMapping); }; void SamplerParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/ScissorRectParser.cpp b/RenderScript/src/ScissorRectParser.cpp index 3f81087..dc573e4 100644 --- a/RenderScript/src/ScissorRectParser.cpp +++ b/RenderScript/src/ScissorRectParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/ScriptParser.cpp b/RenderScript/src/ScriptParser.cpp index 3331eac..6147f1b 100644 --- a/RenderScript/src/ScriptParser.cpp +++ b/RenderScript/src/ScriptParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ #include "ScriptParser.h" #include "LuaBindings.h" #include "SamplerParser.h" -#include "LayoutDescParser.h" #include "ShaderParser.h" #include "BufferParser.h" #include "TextureParser.h" @@ -34,13 +33,12 @@ #include "ResourceMappingParser.h" #include "TextureViewParser.h" #include "BufferViewParser.h" -#include "DepthStencilStateParser.h" -#include "RasterizerStateParser.h" -#include "BlendStateParser.h" +#include "PSODescParser.h" #include "DeviceContextFuncBindings.h" #include "ViewportParser.h" #include "ScissorRectParser.h" #include "ShaderVariableParser.h" +#include "ShaderResourceBindingParser.h" using namespace Diligent; using namespace Diligent; @@ -61,17 +59,15 @@ namespace Diligent } IMPLEMENT_PUSH_FUNC_STUBS( ISampler, m_pSamplerParser) - IMPLEMENT_PUSH_FUNC_STUBS( IVertexDescription, m_pLayoutDescParser ) IMPLEMENT_PUSH_FUNC_STUBS( IShader, m_pShaderParser ) IMPLEMENT_PUSH_FUNC_STUBS( IBuffer, m_pBufferParser ) IMPLEMENT_PUSH_FUNC_STUBS( ITexture, m_pTextureParser ) IMPLEMENT_PUSH_FUNC_STUBS( IResourceMapping, m_pResourceMappingParser ) IMPLEMENT_PUSH_FUNC_STUBS( ITextureView, m_pTextureViewParser ) IMPLEMENT_PUSH_FUNC_STUBS( IBufferView, m_pBufferViewParser ) - IMPLEMENT_PUSH_FUNC_STUBS( IDepthStencilState, m_pDSStateParser ) - IMPLEMENT_PUSH_FUNC_STUBS( IRasterizerState, m_pRSParser ) - IMPLEMENT_PUSH_FUNC_STUBS( IBlendState, m_pBSParser ) + IMPLEMENT_PUSH_FUNC_STUBS( IPipelineState, m_pPSOParser ) IMPLEMENT_PUSH_FUNC_STUBS( IShaderVariable, m_pShaderVariableParser ) + IMPLEMENT_PUSH_FUNC_STUBS( IShaderResourceBinding, m_pShaderResBindingParser ) void ScriptParser::SpecialPushFuncs::PushFuncStub( lua_State *L, const DrawAttribs &DrawAttribs ) @@ -103,7 +99,6 @@ namespace Diligent DefineGlobalConstants(m_LuaState); m_pSamplerParser.reset( new SamplerParser( pRenderDevice, m_LuaState ) ); - m_pLayoutDescParser.reset( new LayoutDescParser( pRenderDevice, m_LuaState ) ); m_pBufferParser.reset( new BufferParser( pRenderDevice, m_LuaState ) ); m_pTextureParser.reset( new TextureParser( pRenderDevice, m_LuaState ) ); m_pDrawAttribsParser.reset( new DrawAttribsParser( m_pBufferParser.get(), pRenderDevice, m_LuaState ) ); @@ -113,13 +108,12 @@ namespace Diligent m_pBufferViewParser.reset( new BufferViewParser( m_pBufferParser.get(), pRenderDevice, m_LuaState ) ); m_pResourceMappingParser.reset( new ResourceMappingParser( pRenderDevice, m_LuaState, m_pTextureViewParser.get(), m_pBufferParser.get(), m_pBufferViewParser.get() ) ); m_pShaderParser.reset( new ShaderParser( pRenderDevice, m_LuaState, m_pResourceMappingParser->GetMetatableName() ) ); - m_pDSStateParser.reset( new DepthStencilStateParser( pRenderDevice, m_LuaState ) ); - m_pRSParser.reset( new RasterizerStateParser( pRenderDevice, m_LuaState ) ); - m_pBSParser.reset( new BlendStateParser( pRenderDevice, m_LuaState ) ); - m_pDeviceCtxFuncBindings.reset( new DeviceContextFuncBindings( pRenderDevice, m_LuaState, m_pTextureViewParser.get() ) ); + m_pPSOParser.reset( new PSODescParser( pRenderDevice, m_LuaState ) ); m_pViewportParser.reset( new ViewportParser( pRenderDevice, m_LuaState ) ); m_pScissorRectParser.reset( new ScissorRectParser( pRenderDevice, m_LuaState ) ); m_pShaderVariableParser.reset( new ShaderVariableParser( pRenderDevice, m_LuaState, m_pShaderParser->GetMetatableName(), m_pBufferParser->GetMetatableName(), m_pBufferViewParser->GetMetatableName(), m_pTextureViewParser->GetMetatableName() ) ); + m_pShaderResBindingParser.reset( new ShaderResourceBindingParser( pRenderDevice, m_LuaState, m_pPSOParser->GetMetatableName(), m_pResourceMappingParser->GetMetatableName(), m_pShaderVariableParser->GetMetatableName() ) ); + m_pDeviceCtxFuncBindings.reset( new DeviceContextFuncBindings( pRenderDevice, m_LuaState, m_pTextureViewParser.get(), m_pShaderResBindingParser.get(), m_pPSOParser.get() ) ); } ScriptParser::~ScriptParser() @@ -148,8 +142,12 @@ namespace Diligent pDeviceStr = "OpenGLES"; break; - case DeviceType::DirectX: - pDeviceStr = "DirectX"; + case DeviceType::D3D11: + pDeviceStr = "D3D11"; + break; + + case DeviceType::D3D12: + pDeviceStr = "D3D12"; break; default: @@ -201,11 +199,6 @@ namespace Diligent m_pSamplerParser->GetObjectByName( m_LuaState, SamplerName, ppSampler ); } - void ScriptParser::GetVertexDescriptionByName( const Char *VertDescName, IVertexDescription** ppVertDesc ) - { - m_pLayoutDescParser->GetObjectByName( m_LuaState, VertDescName, ppVertDesc ); - } - void ScriptParser::GetShaderByName( const Char *ShaderName, IShader** ppShader ) { m_pShaderParser->GetObjectByName( m_LuaState, ShaderName, ppShader ); @@ -236,19 +229,9 @@ namespace Diligent m_pBufferViewParser->GetObjectByName( m_LuaState, BufferViewName, ppBufferView ); } - void ScriptParser::GetDepthStencilStateByName( const Char *DepthStencilStateName, IDepthStencilState** ppDepthStencilState ) - { - m_pDSStateParser->GetObjectByName( m_LuaState, DepthStencilStateName, ppDepthStencilState ); - } - - void ScriptParser::GetRasterizerStateByName( const Char *RasterizerStateName, IRasterizerState** ppRasterizerState ) - { - m_pRSParser->GetObjectByName( m_LuaState, RasterizerStateName, ppRasterizerState ); - } - - void ScriptParser::GetBlendStateByName( const Char *BlendStateName, IBlendState** ppBlendState ) + void ScriptParser::GetPipelineStateByName( const Char *PSOName, IPipelineState** ppPSO ) { - m_pBSParser->GetObjectByName( m_LuaState, BlendStateName, ppBlendState ); + m_pPSOParser->GetObjectByName( m_LuaState, PSOName, ppPSO ); } void ScriptParser::GetShaderVariableByName( const Char *ShaderVarName, IShaderVariable** ppShaderVar ) diff --git a/RenderScript/src/ShaderParser.cpp b/RenderScript/src/ShaderParser.cpp index 38bdee3..de85150 100644 --- a/RenderScript/src/ShaderParser.cpp +++ b/RenderScript/src/ShaderParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,23 +24,261 @@ #include "pch.h" #include "ShaderParser.h" #include "BasicShaderSourceStreamFactory.h" +#include "SamplerParser.h" + namespace std { - DEFINE_ENUM_HASH( Diligent::SHADER_TYPE ) + DEFINE_ENUM_HASH( Diligent::SHADER_VARIABLE_TYPE ) } namespace Diligent { const Char* ShaderParser::ShaderLibName = "Shader"; + + class ShaderVariableTypeEnumMapping : public EnumMapping < Diligent::SHADER_VARIABLE_TYPE > + { + public: + ShaderVariableTypeEnumMapping() + { + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_VARIABLE_TYPE_STATIC ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_VARIABLE_TYPE_MUTABLE ); + DEFINE_ENUM_ELEMENT_MAPPING( (*this), SHADER_VARIABLE_TYPE_DYNAMIC ); + } + }; + + class ShaderVariableDescArrayParser; + template<> + class MemberBinder<ShaderVariableDescArrayParser> : public MemberBinderBase + { + public: + MemberBinder( size_t VariableDescOffset, + size_t NumVariablesOffset, + size_t VarDescBufferOffset, + size_t VarNamesBufferOffset ) : + MemberBinderBase( VariableDescOffset ), + m_NumVariablesOffset(NumVariablesOffset), + m_VarDescBufferOffset(VarDescBufferOffset), + m_VarNamesBufferOffset(VarNamesBufferOffset) + { + DEFINE_ENUM_BINDER( m_Bindings, ShaderVariableDesc, Type, SHADER_VARIABLE_TYPE, m_ShaderVarTypeEnumMapping ) + } + + virtual void GetValue( lua_State *L, const void* pBasePointer )override + { + // Use raw pointer to push the value to Lua because the buffer + // most likely does not exist + const auto &VarDesc = GetMemberByOffest<ShaderVariableDesc*>( pBasePointer, m_MemberOffset); + const auto &NumVars = GetMemberByOffest<Uint32>( pBasePointer, m_NumVariablesOffset); + + PushLuaArray( L, VarDesc, VarDesc + NumVars, [&]( const ShaderVariableDesc &VarDesc ) + { + // Push variable type. The function will leave the new table on top + // of the stack + PushLuaTable( L, &VarDesc, m_Bindings ); // Stack: +1 + + // Push name into the same table + lua_pushstring( L, "Name" ); // Stack: +2 + lua_pushstring( L, VarDesc.Name); // Stack: +3 + lua_settable( L, -3 ); // Stack: +1 + } + ); + } + + virtual void SetValue( lua_State *L, int Index, void* pBasePointer ) + { + auto &ShaderVarDescBuffer = GetMemberByOffest<std::vector<ShaderVariableDesc>>( pBasePointer, m_VarDescBufferOffset); + auto &ShaderNamesBuffer = GetMemberByOffest<std::vector<String>>( pBasePointer, m_VarNamesBufferOffset); + + ParseLuaArray( L, Index, pBasePointer, + [&]( void* _pBasePointer, int StackIndex, int NewArrayIndex ) + { + VERIFY_EXPR( pBasePointer == _pBasePointer ); + + auto CurrIndex = ShaderVarDescBuffer.size(); + if( CurrIndex != NewArrayIndex - 1 ) + SCRIPT_PARSING_ERROR( L, "Explicit array indices are not allowed in shader name description. Provided index ", NewArrayIndex - 1, " conflicts with actual index ", CurrIndex, "." ); + ShaderVarDescBuffer.resize( CurrIndex + 1 ); + ShaderNamesBuffer.resize( CurrIndex + 1 ); + ParseLuaTable( L, StackIndex, &(ShaderVarDescBuffer)[CurrIndex], + [&](int TblStackInd, void* __pBasePointer, const char *Key) + { + auto Binding = m_Bindings.find( Key ); + if( Binding != m_Bindings.end() ) + { + Binding->second->SetValue( L, TblStackInd, __pBasePointer ); + } + else if (strcmp(Key, "Name") == 0) + { + auto Name = ReadValueFromLua<const Char*>(L, TblStackInd); + ShaderNamesBuffer[CurrIndex] = Name; + } + else + { + SCRIPT_PARSING_ERROR( L, "Unknown Member \"", Key, '\"' ); + } + } + ); + + if( ShaderNamesBuffer[CurrIndex].length() == 0 ) + SCRIPT_PARSING_ERROR(L, "Missing shader variable name") + } + ); + + for(size_t v=0; v < ShaderVarDescBuffer.size(); ++v) + { + ShaderVarDescBuffer[v].Name = ShaderNamesBuffer[v].c_str(); + } + + auto &VarDesc = GetMemberByOffest<ShaderVariableDesc*>( pBasePointer, m_MemberOffset); + auto &NumVars = GetMemberByOffest<Uint32>( pBasePointer, m_NumVariablesOffset); + NumVars = static_cast<Uint32>(ShaderVarDescBuffer.size()); + VarDesc = NumVars ? ShaderVarDescBuffer.data() : nullptr; + } + private: + BindingsMapType m_Bindings; + ShaderVariableTypeEnumMapping m_ShaderVarTypeEnumMapping; + ShaderTypeEnumMapping m_ShaderTypeEnumMapping; + size_t m_NumVariablesOffset; + size_t m_VarDescBufferOffset; + size_t m_VarNamesBufferOffset; + }; + + + class StaticSamplerDescArrayParser; + template<> + class MemberBinder<StaticSamplerDescArrayParser> : public MemberBinderBase + { + public: + MemberBinder( size_t StaticSamplerDescOffset, + size_t NumStaticSamplersOffset, + size_t StaticSamplersBufferOffset, + size_t StaticSamplerTexNamesBufferOffset ) : + MemberBinderBase( StaticSamplerDescOffset ), + m_NumStaticSamplersOffset(NumStaticSamplersOffset), + m_StaticSamplersBufferOffset(StaticSamplersBufferOffset), + m_StaticSamplerTexNamesBufferOffset(StaticSamplerTexNamesBufferOffset) + { + InitSamplerParserBindings<SamplerDesc>(m_Bindings, m_FilterTypeEnumMapping, m_TexAddrModeEnumMapping, m_CmpFuncEnumMapping); + } + + virtual void GetValue( lua_State *L, const void* pBasePointer )override + { + // Use raw pointer to push the value to Lua because the buffer + // most likely does not exist + const auto &StaticSamplers = GetMemberByOffest<StaticSamplerDesc*>( pBasePointer, m_MemberOffset); + const auto &NumStaticSamplers = GetMemberByOffest<Uint32>( pBasePointer, m_NumStaticSamplersOffset); + + PushLuaArray( L, StaticSamplers, StaticSamplers + NumStaticSamplers, [&]( const StaticSamplerDesc &SamDesc ) + { + // Push new table to hold variables of StaticSamplerDesc struct + lua_newtable(L); // Stack: +1 + + // Push "Desc" field + lua_pushstring( L, "Desc" ); // Stack: +2 + // Push members of StaticSamplerDesc::Desc. The function will leave new table on top + // of the stack + PushLuaTable( L, &SamDesc.Desc, m_Bindings ); // Stack: +3 + // Push the table from the top into the parent table + lua_settable( L, -3 ); // Stack: +1 + + // Push "TextureName" field + lua_pushstring( L, "TextureName" ); // Stack: +2 + lua_pushstring( L, SamDesc.TextureName); // Stack: +3 + lua_settable( L, -3 ); // Stack: +1 + } + ); + } + + virtual void SetValue( lua_State *L, int Index, void* pBasePointer ) + { + auto &StaticSamplersBuffer = GetMemberByOffest<std::vector<StaticSamplerDesc>>( pBasePointer, m_StaticSamplersBufferOffset); + auto &StaticSamplerTexNamesBuffer = GetMemberByOffest<std::vector<String>>( pBasePointer, m_StaticSamplerTexNamesBufferOffset); + + ParseLuaArray( L, Index, pBasePointer, + [&]( void* _pBasePointer, int StackIndex, int NewArrayIndex ) + { + VERIFY_EXPR( pBasePointer == _pBasePointer ); + + auto CurrIndex = StaticSamplersBuffer.size(); + if( CurrIndex != NewArrayIndex - 1 ) + SCRIPT_PARSING_ERROR( L, "Explicit array indices are not allowed in static sampler description. Provided index ", NewArrayIndex - 1, " conflicts with actual index ", CurrIndex, "." ); + StaticSamplersBuffer.resize( CurrIndex + 1 ); + StaticSamplerTexNamesBuffer.resize( CurrIndex + 1 ); + ParseLuaTable( L, StackIndex, &(StaticSamplersBuffer)[CurrIndex], + [&](int TblStackInd, void* __pBasePointer, const char *Key) + { + if (strcmp(Key, "Desc") == 0) + { + ParseLuaTable( L, StackIndex, &(StaticSamplersBuffer)[CurrIndex].Desc, + [&](int TblStackInd, void* __pBasePointer, const char *Key) + { + if (strcmp(Key, "Name") == 0) + { + UNSUPPORTED("Parsing of the static sampler name is not implemented") + } + else + { + auto Binding = m_Bindings.find( Key ); + if (Binding != m_Bindings.end()) + { + Binding->second->SetValue( L, TblStackInd, __pBasePointer ); + } + else + { + SCRIPT_PARSING_ERROR( L, "Unknown Member \"", Key, '\"' ); + } + } + } + ); + } + else if (strcmp(Key, "TextureName") == 0) + { + auto Name = ReadValueFromLua<const Char*>(L, TblStackInd); + StaticSamplerTexNamesBuffer[CurrIndex] = Name; + } + else + { + SCRIPT_PARSING_ERROR( L, "Unknown Member \"", Key, '\"' ); + } + } + ); + + if( StaticSamplerTexNamesBuffer[CurrIndex].length() == 0 ) + SCRIPT_PARSING_ERROR(L, "Missing static sampler texture name") + } + ); + + for(size_t v=0; v < StaticSamplersBuffer.size(); ++v) + { + StaticSamplersBuffer[v].TextureName = StaticSamplerTexNamesBuffer[v].c_str(); + } + + auto &StaticSamplers = GetMemberByOffest<StaticSamplerDesc*>( pBasePointer, m_MemberOffset); + auto &NumStaticSamplers = GetMemberByOffest<Uint32>( pBasePointer, m_NumStaticSamplersOffset); + NumStaticSamplers = static_cast<Uint32>(StaticSamplersBuffer.size()); + StaticSamplers = NumStaticSamplers ? StaticSamplersBuffer.data() : nullptr; + } + private: + BindingsMapType m_Bindings; + EnumMapping<FILTER_TYPE> m_FilterTypeEnumMapping; + EnumMapping<TEXTURE_ADDRESS_MODE> m_TexAddrModeEnumMapping; + ComparisonFuncEnumMapping m_CmpFuncEnumMapping; + + size_t m_NumStaticSamplersOffset; + size_t m_StaticSamplersBufferOffset; + size_t m_StaticSamplerTexNamesBufferOffset; + }; + + class ShaderDescLoader; template<> class MemberBinder<ShaderDescLoader> : public MemberBinderBase { public: - MemberBinder( size_t MemberOffset, size_t Dummy ) : + MemberBinder( size_t MemberOffset, size_t VarDescBufferOffset, size_t VarNamesBufferOffset, size_t StaticSamplersBufferOffset, size_t StaticSamplerTexNamesBufferOffset ) : MemberBinderBase( MemberOffset ) { auto *pNameBinder = new BufferedStringBinder( offsetof( ShaderDesc, Name ), @@ -51,14 +289,27 @@ namespace Diligent // keep pointer to it m_Bindings.insert( std::make_pair( "Name", std::unique_ptr<MemberBinderBase>(pNameBinder) ) ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_UNKNOWN ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_VERTEX ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_PIXEL ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_GEOMETRY ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_HULL ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_DOMAIN ); - DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderTypeEnumMapping, SHADER_TYPE_COMPUTE ); DEFINE_ENUM_BINDER( m_Bindings, ShaderDesc, ShaderType, SHADER_TYPE, m_ShaderTypeEnumMapping ) + + DEFINE_ENUM_BINDER( m_Bindings, ShaderDesc, DefaultVariableType, SHADER_VARIABLE_TYPE, m_ShaderVarTypeEnumMapping ) + + auto *pShaderDescBinder = + new MemberBinder<ShaderVariableDescArrayParser>( + offsetof(ShaderDesc, VariableDesc), + offsetof(ShaderDesc, NumVariables), + VarDescBufferOffset, + VarNamesBufferOffset + ); + m_Bindings.insert( std::make_pair( "VariableDesc", std::unique_ptr<MemberBinderBase>(pShaderDescBinder) ) ); + + auto *pStaticSamplerDescBinder = + new MemberBinder<StaticSamplerDescArrayParser>( + offsetof(ShaderDesc, StaticSamplers), + offsetof(ShaderDesc, NumStaticSamplers), + StaticSamplersBufferOffset, + StaticSamplerTexNamesBufferOffset + ); + m_Bindings.insert( std::make_pair( "StaticSamplers", std::unique_ptr<MemberBinderBase>(pStaticSamplerDescBinder) ) ); } virtual void GetValue( lua_State *L, const void* pBasePointer ) @@ -75,16 +326,17 @@ namespace Diligent private: BindingsMapType m_Bindings; - EnumMapping<SHADER_TYPE> m_ShaderTypeEnumMapping; + ShaderTypeEnumMapping m_ShaderTypeEnumMapping; + ShaderVariableTypeEnumMapping m_ShaderVarTypeEnumMapping; }; ShaderParser::ShaderParser( IRenderDevice *pRenderDevice, lua_State *L, const String& ResMappingMetatableName ) : EngineObjectParserCommon<IShader>( pRenderDevice, L, ShaderLibName ), - m_SetShadersBinding( this, L, "Context", "SetShaders", &ShaderParser::SetShaders ), m_BindResourcesBinding( this, L, m_MetatableRegistryName.c_str(), "BindResources", &ShaderParser::BindResources ), m_ResMappingMetatableName(ResMappingMetatableName) { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, FilePath, FilePathBuffer ) + DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, Source, SourceBuffer ) DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, EntryPoint, EntryPointBuffer ) DEFINE_BUFFERED_STRING_BINDER( m_Bindings, ShaderCreationAttribsWrapper, SearchDirectories, SearchDirectoriesBuffer ) @@ -93,7 +345,15 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_GLSL ); DEFINE_ENUM_BINDER( m_Bindings, ShaderCreationAttribsWrapper, SourceLanguage, SHADER_SOURCE_LANGUAGE, m_ShaderSourceLangEnumMapping ); - DEFINE_BINDER( m_Bindings, ShaderCreationAttribsWrapper, Desc, ShaderDescLoader, 0 ) + auto *pShaderDescBinder = + new MemberBinder<ShaderDescLoader>( + offsetof(ShaderCreationAttribsWrapper, Desc), + offsetof(ShaderCreationAttribsWrapper, m_VarDescBuffer) - offsetof(ShaderCreationAttribsWrapper, Desc), + offsetof(ShaderCreationAttribsWrapper, m_VarNamesBuffer) - offsetof(ShaderCreationAttribsWrapper, Desc), + offsetof(ShaderCreationAttribsWrapper, m_StaticSamplersBuffer) - offsetof(ShaderCreationAttribsWrapper, Desc), + offsetof(ShaderCreationAttribsWrapper, m_StaticSamplerTexNamesBuffer) - offsetof(ShaderCreationAttribsWrapper, Desc) + ); + m_Bindings.insert( std::make_pair( "Desc", std::unique_ptr<MemberBinderBase>(pShaderDescBinder) ) ); }; void ShaderParser::CreateObj( lua_State *L ) @@ -124,8 +384,8 @@ namespace Diligent ShaderCreationAttrs.Desc = (*ppShader)->GetDesc(); PushField( L, &ShaderCreationAttrs, Field, m_Bindings ); } - - int ShaderParser::SetShaders( lua_State *L ) + + int ShaderParser::BindResources( lua_State *L ) { // In order to communicate properly with Lua, a C function must use the following protocol, // which defines the way parameters and results are passed : a C function receives its arguments @@ -137,24 +397,6 @@ namespace Diligent // Any other value in the stack below the results will be properly discarded by Lua. // Like a Lua function, a C function called by Lua can also return many results. - auto NumArgs = lua_gettop( L ); - const int MaxShaders = 6; - IShader* pShaders[MaxShaders] = {}; - VERIFY( NumArgs <= MaxShaders, "Too many shaders are being set" ); - NumArgs = std::min<int>( NumArgs, MaxShaders ); - for( int i = 0; i < NumArgs; ++i ) - { - pShaders[i] = *GetUserData<IShader**>(L, i+1, m_MetatableRegistryName.c_str() ); - } - auto *pContext = LoadDeviceContextFromRegistry( L ); - pContext->SetShaders( pShaders, NumArgs ); - - // Returning no arguments - return 0; - } - - int ShaderParser::BindResources( lua_State *L ) - { try { auto NumArgs = lua_gettop( L ); diff --git a/RenderScript/src/ShaderResourceBindingParser.cpp b/RenderScript/src/ShaderResourceBindingParser.cpp new file mode 100644 index 0000000..4daf2aa --- /dev/null +++ b/RenderScript/src/ShaderResourceBindingParser.cpp @@ -0,0 +1,192 @@ +/* Copyright 2015-2016 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include "ShaderResourceBindingParser.h" + +namespace Diligent +{ + const Char* ShaderResourceBindingParser::ShaderResourceBindingLibName = "ShaderResourceBinding"; + + ShaderResourceBindingParser::ShaderResourceBindingParser( IRenderDevice *pRenderDevice, lua_State *L, + const String &PSOLibMetatableName, + const String &ResMappingMetatableName, + const String &ShaderVarMetatableRegistryName ) : + m_PSOLibMetatableName(PSOLibMetatableName), + m_ResMappingMetatableName(ResMappingMetatableName), + m_ShaderVarMetatableRegistryName(ShaderVarMetatableRegistryName), + EngineObjectParserBase( pRenderDevice, L, ShaderResourceBindingLibName ), + m_BindResourcesBinding( this, L, m_MetatableRegistryName.c_str(), "BindResources", &ShaderResourceBindingParser::BindResources ), + m_GetVariableBinding( this, L, m_MetatableRegistryName.c_str(), "GetVariable", &ShaderResourceBindingParser::GetVariable ), + m_CreateShaderResourceBinding( this, L, PSOLibMetatableName.c_str(), "CreateShaderResourceBinding", &ShaderResourceBindingParser::CreateShaderResourceBinding ) + { + + } + + + void ShaderResourceBindingParser::CreateObj( lua_State *L ) + { + INIT_LUA_STACK_TRACKING(L); + + // Shader should be the first argument + auto *pPSO = *GetUserData<IPipelineState**>( L, 1, m_PSOLibMetatableName.c_str() ); + + auto pNewShaderResBndngLuaObj = reinterpret_cast<IShaderResourceBinding**>(lua_newuserdata( L, sizeof( IShaderResourceBinding* ) )); + pPSO->CreateShaderResourceBinding(pNewShaderResBndngLuaObj); + + CHECK_LUA_STACK_HEIGHT( +1 ); + } + + void ShaderResourceBindingParser::DestroyObj( void *pData ) + { + if( pData != nullptr ) + { + auto ppShaderResBinding = reinterpret_cast<IShaderResourceBinding**>(pData); + if( *ppShaderResBinding != nullptr ) + (*ppShaderResBinding)->Release(); + } + } + + void ShaderResourceBindingParser::ReadField( lua_State *L, void *pData, const Char *Field ) + { + SCRIPT_PARSING_ERROR(L, "Shader resource binding have no fields that can be read") + } + + void ShaderResourceBindingParser::UpdateField( lua_State *L, void *pData, const Char *Field ) + { + SCRIPT_PARSING_ERROR(L, "Shader resource binding have no fields that can be updated") + } + + + void ShaderResourceBindingParser::PushExistingObject( lua_State *L, const void *pObject ) + { + auto pShaderResourceBinding = reinterpret_cast<IShaderResourceBinding**>(lua_newuserdata( L, sizeof( IShaderResourceBinding* ) )); + *pShaderResourceBinding = reinterpret_cast<IShaderResourceBinding*>( const_cast<void*>(pObject) ); + (*pShaderResourceBinding)->AddRef(); + } + + + int ShaderResourceBindingParser::CreateShaderResourceBinding( lua_State *L ) + { + return LuaCreate(L); + } + + int ShaderResourceBindingParser::BindResources( lua_State *L ) + { + try + { + auto NumArgs = lua_gettop( L ); + if( NumArgs < 3 ) + { + SCRIPT_PARSING_ERROR( L, "At least 2 arguments (shader flags and resource mapping) are expected" ); + } + + + int ArgStackInd = 1; + + auto *pResBinding = *GetUserData<IShaderResourceBinding**>( L, ArgStackInd, m_MetatableRegistryName.c_str() ); + VERIFY( pResBinding, "Resource mapping pointer is null" ); + if( !pResBinding )return 0; + + ++ArgStackInd; + Uint32 ShaderFlags = 0; + { + FlagsLoader<SHADER_TYPE> FlagsLoader(0, "BindShaderResourceFlags", m_ShaderTypeEnumMapping); + FlagsLoader.SetValue( L, ArgStackInd, &ShaderFlags ); + } + + ++ArgStackInd; + auto *pResourceMapping = *GetUserData<IResourceMapping**>( L, ArgStackInd, m_ResMappingMetatableName.c_str() ); + if( !pResourceMapping ) + { + SCRIPT_PARSING_ERROR( L, "Incorrect 2nd argument type: resource mapping is expected" ); + } + + ++ArgStackInd; + Uint32 Flags = 0; + // The last argument may be flags + if( NumArgs >= ArgStackInd && + (lua_type( L, ArgStackInd ) == LUA_TSTRING || lua_type( L, ArgStackInd ) == LUA_TTABLE ) ) + { + FlagsLoader<BIND_SHADER_RESOURCES_FLAGS> FlagsLoader(0, "BindShaderResourceFlags", m_BindShaderResFlagEnumMapping); + FlagsLoader.SetValue( L, ArgStackInd, &Flags ); + } + + pResBinding->BindResources( ShaderFlags, pResourceMapping, Flags ); + } + catch( const std::runtime_error& ) + { + + } + return 0; + } + + int ShaderResourceBindingParser::GetVariable( lua_State *L ) + { + auto NumArgs = lua_gettop( L ); + if( NumArgs < 3 ) + { + SCRIPT_PARSING_ERROR( L, "2 arguments (shader type and variable name) are expected" ); + } + + INIT_LUA_STACK_TRACKING(L); + + int ArgStackInd = 1; + + // The object itself goes first + auto *pShaderResBinding = *GetUserData<IShaderResourceBinding**>( L, ArgStackInd, m_MetatableRegistryName.c_str() ); + + // Shader type should be the first argument + ++ArgStackInd; + SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN; + EnumMemberBinder<SHADER_TYPE> ShaderTypeParser(0, "ShaderType", m_ShaderTypeEnumMapping); + ShaderTypeParser.SetValue(L, ArgStackInd, &ShaderType); + + ++ArgStackInd; + // Variable name should be the second argument + auto VarName = ReadValueFromLua<String>( L, ArgStackInd ); + + auto pVar = pShaderResBinding->GetVariable(ShaderType, VarName.c_str()); + + auto pNewShaderVarLuaObj = reinterpret_cast<IShaderVariable**>(lua_newuserdata( L, sizeof( IShaderVariable* ) )); + *pNewShaderVarLuaObj = pVar; + pVar->AddRef(); + + // Push onto the stack the metatable associated with name given in the registry + luaL_getmetatable( L, m_ShaderVarMetatableRegistryName.c_str() ); // -0 | +1 -> +1 + // Pop a table from the top of the stack and set it as the new metatable + // for the value at the given index (which is where the new user datum is) + lua_setmetatable( L, -2 ); // -1 | +0 -> -1 + + CHECK_LUA_STACK_HEIGHT( +1 ); + + return 1; + } + + void ShaderResourceBindingParser::GetObjectByName( lua_State *L, const Char *ShaderName, IShaderResourceBinding** ppObject ) + { + auto pObject = *GetGlobalObject<IShaderResourceBinding**>( L, ShaderName, m_MetatableRegistryName.c_str() ); + *ppObject = pObject; + pObject->AddRef(); + } +} diff --git a/RenderScript/src/ShaderVariableParser.cpp b/RenderScript/src/ShaderVariableParser.cpp index 35b5361..62dc8ba 100644 --- a/RenderScript/src/ShaderVariableParser.cpp +++ b/RenderScript/src/ShaderVariableParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/TextureParser.cpp b/RenderScript/src/TextureParser.cpp index 628c9a1..a7ac219 100644 --- a/RenderScript/src/TextureParser.cpp +++ b/RenderScript/src/TextureParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,12 +29,69 @@ namespace Diligent { const Char* TextureParser::TextureLibName = "Texture"; + template<> + class MemberBinder<DepthStencilClearValue> : public MemberBinderBase + { + public: + MemberBinder(size_t MemberOffset, int /*Dummy*/) : + MemberBinderBase(MemberOffset) + { + DEFINE_BINDER( m_Bindings, DepthStencilClearValue, Depth, Float32, Validator<Float32>("Depth clear value", 0.f, 1.f) ) + DEFINE_BINDER( m_Bindings, DepthStencilClearValue, Stencil, Uint8, Validator<Uint8>() ) + } + + virtual void GetValue(lua_State *L, const void* pBasePointer)override + { + const auto *pDSClearValue = &GetMemberByOffest<DepthStencilClearValue>( pBasePointer, m_MemberOffset ); + PushLuaTable( L, pDSClearValue, m_Bindings ); + } + + virtual void SetValue(lua_State *L, int Index, void* pBasePointer)override + { + auto *pDSClearValue = &GetMemberByOffest<DepthStencilClearValue>(pBasePointer, m_MemberOffset); + ParseLuaTable( L, Index, pDSClearValue, m_Bindings ); + } + + private: + BindingsMapType m_Bindings; + }; + + template<> + class MemberBinder<OptimizedClearValue> : public MemberBinderBase + { + public: + MemberBinder(size_t MemberOffset, int /*Dummy*/) : + MemberBinderBase(MemberOffset) + { + DEFINE_ENUM_BINDER( m_Bindings, OptimizedClearValue, Format, TEXTURE_FORMAT, m_TexFmtEnumMapping ); + DEFINE_BINDER( m_Bindings, OptimizedClearValue, Color, RGBALoader, 0 ) + DEFINE_BINDER( m_Bindings, OptimizedClearValue, DepthStencil, DepthStencilClearValue, 0 ) + } + + virtual void GetValue(lua_State *L, const void* pBasePointer)override + { + const auto *pClearValue = &GetMemberByOffest<OptimizedClearValue>( pBasePointer, m_MemberOffset ); + PushLuaTable( L, pClearValue, m_Bindings ); + } + + virtual void SetValue(lua_State *L, int Index, void* pBasePointer)override + { + auto *pClearValue = &GetMemberByOffest<OptimizedClearValue>(pBasePointer, m_MemberOffset); + ParseLuaTable( L, Index, pClearValue, m_Bindings ); + } + + private: + BindingsMapType m_Bindings; + TextureFormatEnumMapping m_TexFmtEnumMapping; + }; + + TextureParser::TextureParser( IRenderDevice *pRenderDevice, lua_State *L ) : EngineObjectParserCommon<ITexture>( pRenderDevice, L, TextureLibName ) { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, STexDescWrapper, Name, NameBuffer ) - DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Type, TEXTURE_TYPE, m_TexTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Type, RESOURCE_DIMENSION, m_TexTypeEnumMapping ); DEFINE_BINDER( m_Bindings, STexDescWrapper, Width, Uint32, Validator<Uint32>( "Width", 1, 16384 ) ); DEFINE_BINDER( m_Bindings, STexDescWrapper, Height, Uint32, Validator<Uint32>( "Heihght", 1, 16384 ) ); @@ -64,6 +121,8 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( m_MiscFlagEnumMapping, MISC_TEXTURE_FLAG_GENERATE_MIPS ); DEFINE_FLAGS_BINDER( m_Bindings, STexDescWrapper, MiscFlags, Diligent::MISC_TEXTURE_FLAG, m_MiscFlagEnumMapping ); + + DEFINE_BINDER( m_Bindings, STexDescWrapper, ClearValue, OptimizedClearValue, 0 ); }; void TextureParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/TextureViewParser.cpp b/RenderScript/src/TextureViewParser.cpp index 20ddabb..c4b82d5 100644 --- a/RenderScript/src/TextureViewParser.cpp +++ b/RenderScript/src/TextureViewParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ namespace Diligent "Unexpected map size. Did you update TEXTURE_VIEW_TYPE enum?" ); DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, ViewType, TEXTURE_VIEW_TYPE, m_ViewTypeEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, TextureType, TEXTURE_TYPE, m_TexTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, TextureDim, RESOURCE_DIMENSION, m_TexTypeEnumMapping ); DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, Format, TEXTURE_FORMAT, m_TexFormatEnumMapping ); DEFINE_BINDER( m_Bindings, STexViewDescWrapper, MostDetailedMip, Uint32, Validator<Uint32>( "MostDetailedMip", 0, 16384 ) ); diff --git a/RenderScript/src/ViewportParser.cpp b/RenderScript/src/ViewportParser.cpp index 7afbfe6..91e4c31 100644 --- a/RenderScript/src/ViewportParser.cpp +++ b/RenderScript/src/ViewportParser.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/RenderScript/src/pch.cpp b/RenderScript/src/pch.cpp index 4a893f2..964b3f1 100644 --- a/RenderScript/src/pch.cpp +++ b/RenderScript/src/pch.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 Egor Yusov +/* Copyright 2015-2016 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. |
