summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-13 18:03:15 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-13 18:03:15 +0000
commit996bfb53528aeaaba532413bf1848a0ebc3b03f0 (patch)
treecec9681ee72a3f984745227636cabf2bd2f983ab /Graphics
parentFixed HLSL2GLSLConverterTest.CS_RWTex2D_1 test on 32-bit D3D12 (diff)
downloadDiligentCore-996bfb53528aeaaba532413bf1848a0ebc3b03f0.tar.gz
DiligentCore-996bfb53528aeaaba532413bf1848a0ebc3b03f0.zip
Unit tests: capturing debug output; fixed minor issue with viewport in Vk backend.
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GLSLTools/src/SPIRVUtils.cpp5
-rw-r--r--Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp12
-rw-r--r--Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp12
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp12
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp3
-rw-r--r--Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp6
6 files changed, 31 insertions, 19 deletions
diff --git a/Graphics/GLSLTools/src/SPIRVUtils.cpp b/Graphics/GLSLTools/src/SPIRVUtils.cpp
index 56e9b2b5..42eb2c87 100644
--- a/Graphics/GLSLTools/src/SPIRVUtils.cpp
+++ b/Graphics/GLSLTools/src/SPIRVUtils.cpp
@@ -489,7 +489,10 @@ std::vector<unsigned int> HLSLtoSPIRV(const ShaderCreateInfo& Attribs, IDataBlob
Shader.setStringsWithLengthsAndNames(ShaderStrings, ShaderStringLenghts, Names, 1);
IncluderImpl Includer(Attribs.pShaderSourceStreamFactory);
- auto SPIRV = CompileShaderInternal(Shader, messages, &Includer, SourceCode, SourceCodeLen, ppCompilerOutput);
+
+ auto SPIRV = CompileShaderInternal(Shader, messages, &Includer, SourceCode, SourceCodeLen, ppCompilerOutput);
+ if (SPIRV.empty())
+ return SPIRV;
// SPIR-V bytecode generated from HLSL must be legalized to
// turn it into a valid vulkan SPIR-V shader
diff --git a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
index 6ffb2731..161ab79c 100644
--- a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
@@ -99,12 +99,12 @@ void EngineFactoryD3D11Impl::CreateDeviceAndContextsD3D11(const EngineD3D11Creat
IRenderDevice** ppDevice,
IDeviceContext** ppContexts)
{
- if (EngineCI.APIVersion != DILIGENT_API_VERSION)
- LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
-
if (EngineCI.DebugMessageCallback != nullptr)
SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+ if (EngineCI.APIVersion != DILIGENT_API_VERSION)
+ LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
+
VERIFY(ppDevice && ppContexts, "Null pointer provided");
if (!ppDevice || !ppContexts)
return;
@@ -205,12 +205,12 @@ void EngineFactoryD3D11Impl::AttachToD3D11Device(void* pd
IRenderDevice** ppDevice,
IDeviceContext** ppContexts)
{
- if (EngineCI.APIVersion != DILIGENT_API_VERSION)
- LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
-
if (EngineCI.DebugMessageCallback != nullptr)
SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+ if (EngineCI.APIVersion != DILIGENT_API_VERSION)
+ LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
+
VERIFY(ppDevice && ppContexts, "Null pointer provided");
if (!ppDevice || !ppContexts)
return;
diff --git a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
index 545da3d3..0526f672 100644
--- a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
@@ -107,12 +107,12 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12Creat
IRenderDevice** ppDevice,
IDeviceContext** ppContexts)
{
- if (EngineCI.APIVersion != DILIGENT_API_VERSION)
- LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
-
if (EngineCI.DebugMessageCallback != nullptr)
SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+ if (EngineCI.APIVersion != DILIGENT_API_VERSION)
+ LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
+
VERIFY(ppDevice && ppContexts, "Null pointer provided");
if (!ppDevice || !ppContexts)
return;
@@ -314,12 +314,12 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd
IRenderDevice** ppDevice,
IDeviceContext** ppContexts)
{
- if (EngineCI.APIVersion != DILIGENT_API_VERSION)
- LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
-
if (EngineCI.DebugMessageCallback != nullptr)
SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+ if (EngineCI.APIVersion != DILIGENT_API_VERSION)
+ LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
+
VERIFY(pd3d12NativeDevice && ppCommandQueues && ppDevice && ppContexts, "Null pointer provided");
if (!pd3d12NativeDevice || !ppCommandQueues || !ppDevice || !ppContexts)
return;
diff --git a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
index c5544ce3..14fbd670 100644
--- a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
@@ -109,12 +109,12 @@ void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLCreateInf
const SwapChainDesc& SCDesc,
ISwapChain** ppSwapChain)
{
- if (EngineCI.APIVersion != DILIGENT_API_VERSION)
- LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
-
if (EngineCI.DebugMessageCallback != nullptr)
SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+ if (EngineCI.APIVersion != DILIGENT_API_VERSION)
+ LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
+
VERIFY(ppDevice && ppImmediateContext && ppSwapChain, "Null pointer provided");
if (!ppDevice || !ppImmediateContext || !ppSwapChain)
return;
@@ -189,12 +189,12 @@ void EngineFactoryOpenGLImpl::AttachToActiveGLContext(const EngineGLCreateInfo&
IRenderDevice** ppDevice,
IDeviceContext** ppImmediateContext)
{
- if (EngineCI.APIVersion != DILIGENT_API_VERSION)
- LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
-
if (EngineCI.DebugMessageCallback != nullptr)
SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+ if (EngineCI.APIVersion != DILIGENT_API_VERSION)
+ LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
+
VERIFY(ppDevice && ppImmediateContext, "Null pointer provided");
if (!ppDevice || !ppImmediateContext)
return;
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 86a4bce1..135b5844 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -994,6 +994,9 @@ void DeviceContextVkImpl::SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOffse
void DeviceContextVkImpl::CommitViewports()
{
+ if (m_NumViewports == 0)
+ return;
+
VkViewport VkViewports[MaxViewports]; // Do not waste time initializing array to zero
for (Uint32 vp = 0; vp < m_NumViewports; ++vp)
{
diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
index 0debf7eb..18be491e 100644
--- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
@@ -87,6 +87,9 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E
IRenderDevice** ppDevice,
IDeviceContext** ppContexts)
{
+ if (_EngineCI.DebugMessageCallback != nullptr)
+ SetDebugMessageCallback(_EngineCI.DebugMessageCallback);
+
if (_EngineCI.APIVersion != DILIGENT_API_VERSION)
LOG_ERROR_AND_THROW("Diligent Engine runtime (", _EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");
@@ -245,6 +248,9 @@ void EngineFactoryVkImpl::AttachToVulkanDevice(std::shared_ptr<VulkanUtilities::
IRenderDevice** ppDevice,
IDeviceContext** ppContexts)
{
+ if (EngineCI.DebugMessageCallback != nullptr)
+ SetDebugMessageCallback(EngineCI.DebugMessageCallback);
+
if (EngineCI.APIVersion != DILIGENT_API_VERSION)
LOG_ERROR_AND_THROW("Diligent Engine runtime (", EngineCI.APIVersion, ") is not compatible with the client API version (", DILIGENT_API_VERSION, ")");