From 5c45995ab392100e779e7a055ca3107a397c284d Mon Sep 17 00:00:00 2001 From: Zackoric Date: Thu, 25 Dec 2025 13:06:25 -0800 Subject: [PATCH 1/3] Added HLSL Compiler Profile Arguments To ShaderCreateInfo --- Graphics/GraphicsEngine/interface/Shader.h | 4 ++-- Graphics/ShaderTools/src/DXCompiler.cpp | 2 +- Graphics/ShaderTools/src/HLSLUtils.cpp | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index f035c0d2a9..2f367d04e5 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -554,8 +554,8 @@ struct ShaderCreateInfo /// Shader compile flags (see Diligent::SHADER_COMPILE_FLAGS). SHADER_COMPILE_FLAGS CompileFlags DEFAULT_INITIALIZER(SHADER_COMPILE_FLAG_NONE); - /// Shader optimization level. See Diligent::SHADER_OPTIMIZATION_LEVEL. - SHADER_OPTIMIZATION_LEVEL ShaderOptimizationLevel DEFAULT_INITIALIZER(SHADER_OPTIMIZATION_LEVEL_DEFAULT); + /// HLSL Shader profile flags + const char* HLSLProfileArguments DEFAULT_INITIALIZER(nullptr); /// Whether to load constant buffer reflection information. diff --git a/Graphics/ShaderTools/src/DXCompiler.cpp b/Graphics/ShaderTools/src/DXCompiler.cpp index 6a3bf8f7fd..6bb6ee9270 100644 --- a/Graphics/ShaderTools/src/DXCompiler.cpp +++ b/Graphics/ShaderTools/src/DXCompiler.cpp @@ -755,7 +755,7 @@ void DXCompilerImpl::Compile(const ShaderCreateInfo& ShaderCI, ShaderModel = MaxSM; } - const String Profile = GetHLSLProfileString(ShaderCI.Desc.ShaderType, ShaderModel); + const String Profile = GetHLSLProfileString(ShaderCI.Desc.ShaderType, ShaderModel, ShaderCI.HLSLProfileArguments); const std::wstring wstrProfile{Profile.begin(), Profile.end()}; const std::wstring wstrEntryPoint{ShaderCI.EntryPoint, ShaderCI.EntryPoint + strlen(ShaderCI.EntryPoint)}; diff --git a/Graphics/ShaderTools/src/HLSLUtils.cpp b/Graphics/ShaderTools/src/HLSLUtils.cpp index 9a577111af..80198fcc39 100644 --- a/Graphics/ShaderTools/src/HLSLUtils.cpp +++ b/Graphics/ShaderTools/src/HLSLUtils.cpp @@ -62,7 +62,7 @@ String BuildHLSLSourceString(const ShaderCreateInfo& ShaderCI) noexcept(false) return HLSLSource; } -String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel) +String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel, const char* ShaderProfileArguments) { String strShaderProfile; @@ -96,6 +96,12 @@ String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel) strShaderProfile += "_"; strShaderProfile += std::to_string(ShaderModel.Minor); + if (ShaderProfileArguments) + { + strShaderProfile += " "; + strShaderProfile += std::to_string(ShaderProfileArguments); + } + return strShaderProfile; } From f90c4df9514219f8fe8505036f8cfb62466178b4 Mon Sep 17 00:00:00 2001 From: zackory137c-hash Date: Thu, 25 Dec 2025 13:13:57 -0800 Subject: [PATCH 2/3] fixed header sync --- Graphics/ShaderTools/include/HLSLUtils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Graphics/ShaderTools/include/HLSLUtils.hpp b/Graphics/ShaderTools/include/HLSLUtils.hpp index 0dc0dce2cb..7461eb2524 100644 --- a/Graphics/ShaderTools/include/HLSLUtils.hpp +++ b/Graphics/ShaderTools/include/HLSLUtils.hpp @@ -41,7 +41,7 @@ namespace Diligent String BuildHLSLSourceString(const ShaderCreateInfo& ShaderCI) noexcept(false); -String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel); +String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel, const char* ShaderProfileArguments); template void HandleHLSLCompilerResult(bool CompilationSucceeded, From 9fe4afd37d0659d45e13d665e286f1b8af30f685 Mon Sep 17 00:00:00 2001 From: zackory137c-hash Date: Fri, 6 Mar 2026 01:31:31 -0800 Subject: [PATCH 3/3] Add and expose native handles and converter for NVidia Streamline Integration --- Graphics/GraphicsEngine/interface/Shader.h | 4 ++-- Graphics/GraphicsEngineVulkan/include/TextureVkImpl.hpp | 5 +++++ .../include/VulkanTypeConversions.hpp | 2 ++ Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp | 6 +++--- Graphics/ShaderTools/include/HLSLUtils.hpp | 2 +- Graphics/ShaderTools/src/DXCompiler.cpp | 2 +- Graphics/ShaderTools/src/HLSLUtils.cpp | 8 +------- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 2f367d04e5..f035c0d2a9 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -554,8 +554,8 @@ struct ShaderCreateInfo /// Shader compile flags (see Diligent::SHADER_COMPILE_FLAGS). SHADER_COMPILE_FLAGS CompileFlags DEFAULT_INITIALIZER(SHADER_COMPILE_FLAG_NONE); - /// HLSL Shader profile flags - const char* HLSLProfileArguments DEFAULT_INITIALIZER(nullptr); + /// Shader optimization level. See Diligent::SHADER_OPTIMIZATION_LEVEL. + SHADER_OPTIMIZATION_LEVEL ShaderOptimizationLevel DEFAULT_INITIALIZER(SHADER_OPTIMIZATION_LEVEL_DEFAULT); /// Whether to load constant buffer reflection information. diff --git a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.hpp index 149d09d768..e983588a46 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.hpp @@ -89,6 +89,11 @@ class TextureVkImpl final : public TextureBase return StagingDataCPUAddress; } + VulkanUtilities::MemoryAllocation& GetMemoryAllocation() + { + return m_MemoryAllocation; + } + void InvalidateStagingRange(VkDeviceSize Offset, VkDeviceSize Size); // For non-compressed color format buffer, the offset must be a multiple of the format's texel block size. diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp b/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp index f2a1f49a20..c162cefb5c 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp +++ b/Graphics/GraphicsEngineVulkan/include/VulkanTypeConversions.hpp @@ -37,6 +37,8 @@ namespace Diligent { +struct RenderDeviceVkImpl; +VkImageCreateInfo TextureDescToVkImageCreateInfo(const TextureDesc& Desc, const RenderDeviceVkImpl* pRenderDeviceVk) noexcept; VkFormat TexFormatToVkFormat(TEXTURE_FORMAT TexFmt); TEXTURE_FORMAT VkFormatToTexFormat(VkFormat VkFmt); diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp index de997ee6f6..94a9fd72b6 100644 --- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp @@ -38,9 +38,6 @@ namespace Diligent { -namespace -{ - VkImageCreateInfo TextureDescToVkImageCreateInfo(const TextureDesc& Desc, const RenderDeviceVkImpl* pRenderDeviceVk) noexcept { const bool IsMemoryless = (Desc.MiscFlags & MISC_TEXTURE_FLAG_MEMORYLESS) != 0; @@ -147,6 +144,9 @@ VkImageCreateInfo TextureDescToVkImageCreateInfo(const TextureDesc& Desc, const return ImageCI; } +namespace +{ + VkImageLayout VkImageLayoutFromUsage(VkImageUsageFlags Usage) { if ((Usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) != 0) diff --git a/Graphics/ShaderTools/include/HLSLUtils.hpp b/Graphics/ShaderTools/include/HLSLUtils.hpp index 7461eb2524..0dc0dce2cb 100644 --- a/Graphics/ShaderTools/include/HLSLUtils.hpp +++ b/Graphics/ShaderTools/include/HLSLUtils.hpp @@ -41,7 +41,7 @@ namespace Diligent String BuildHLSLSourceString(const ShaderCreateInfo& ShaderCI) noexcept(false); -String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel, const char* ShaderProfileArguments); +String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel); template void HandleHLSLCompilerResult(bool CompilationSucceeded, diff --git a/Graphics/ShaderTools/src/DXCompiler.cpp b/Graphics/ShaderTools/src/DXCompiler.cpp index 6bb6ee9270..6a3bf8f7fd 100644 --- a/Graphics/ShaderTools/src/DXCompiler.cpp +++ b/Graphics/ShaderTools/src/DXCompiler.cpp @@ -755,7 +755,7 @@ void DXCompilerImpl::Compile(const ShaderCreateInfo& ShaderCI, ShaderModel = MaxSM; } - const String Profile = GetHLSLProfileString(ShaderCI.Desc.ShaderType, ShaderModel, ShaderCI.HLSLProfileArguments); + const String Profile = GetHLSLProfileString(ShaderCI.Desc.ShaderType, ShaderModel); const std::wstring wstrProfile{Profile.begin(), Profile.end()}; const std::wstring wstrEntryPoint{ShaderCI.EntryPoint, ShaderCI.EntryPoint + strlen(ShaderCI.EntryPoint)}; diff --git a/Graphics/ShaderTools/src/HLSLUtils.cpp b/Graphics/ShaderTools/src/HLSLUtils.cpp index 80198fcc39..9a577111af 100644 --- a/Graphics/ShaderTools/src/HLSLUtils.cpp +++ b/Graphics/ShaderTools/src/HLSLUtils.cpp @@ -62,7 +62,7 @@ String BuildHLSLSourceString(const ShaderCreateInfo& ShaderCI) noexcept(false) return HLSLSource; } -String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel, const char* ShaderProfileArguments) +String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel) { String strShaderProfile; @@ -96,12 +96,6 @@ String GetHLSLProfileString(SHADER_TYPE ShaderType, ShaderVersion ShaderModel, c strShaderProfile += "_"; strShaderProfile += std::to_string(ShaderModel.Minor); - if (ShaderProfileArguments) - { - strShaderProfile += " "; - strShaderProfile += std::to_string(ShaderProfileArguments); - } - return strShaderProfile; }