From d359125adafd13e80d79267e742a5f599f6fc390 Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 13 Nov 2020 14:22:50 -0800 Subject: Added comparison operators for LayoutElement and InputLayoutDesc; updated texture test to support Metal. --- Graphics/GraphicsEngine/interface/InputLayout.h | 39 ++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/InputLayout.h b/Graphics/GraphicsEngine/interface/InputLayout.h index c7b18965..308a6a8c 100644 --- a/Graphics/GraphicsEngine/interface/InputLayout.h +++ b/Graphics/GraphicsEngine/interface/InputLayout.h @@ -60,7 +60,6 @@ enum INPUT_ELEMENT_FREQUENCY /// Description of a single element of the input layout struct LayoutElement { - /// HLSL semantic. Default value ("ATTRIB") allows HLSL shaders to be converted /// to GLSL and used in OpenGL backend as well as compiled to SPIRV and used /// in Vulkan backend. @@ -172,6 +171,25 @@ struct LayoutElement Frequency {_Frequency }, InstanceDataStepRate{_InstanceDataStepRate } {} + + bool operator == (const LayoutElement& rhs) const + { + return strcmp(HLSLSemantic, rhs.HLSLSemantic) == 0 && + InputIndex == rhs.InputIndex && + BufferSlot == rhs.BufferSlot && + NumComponents == rhs.NumComponents && + ValueType == rhs.ValueType && + IsNormalized == rhs.IsNormalized && + RelativeOffset == rhs.RelativeOffset && + Stride == rhs.Stride && + Frequency == rhs.Frequency && + InstanceDataStepRate == rhs.InstanceDataStepRate; + } + + bool operator != (const LayoutElement& rhs) const + { + return !(*this == rhs); + } #endif }; typedef struct LayoutElement LayoutElement; @@ -195,6 +213,25 @@ struct InputLayoutDesc LayoutElements{_LayoutElements}, NumElements {_NumElements } {} + + bool operator == (const InputLayoutDesc& rhs) const + { + if (NumElements != rhs.NumElements) + return false; + + for (Uint32 i=0; i < NumElements; ++i) + { + if (LayoutElements[i] != rhs.LayoutElements[i]) + return false; + } + + return true; + } + + bool operator != (const InputLayoutDesc& rhs) const + { + return !(*this == rhs); + } #endif }; typedef struct InputLayoutDesc InputLayoutDesc; -- cgit v1.2.3 From 4714a832246f4bb44c672452866cfcb9cb758449 Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 13 Nov 2020 15:31:43 -0800 Subject: Fixed linux build error --- Graphics/GraphicsEngine/interface/InputLayout.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/InputLayout.h b/Graphics/GraphicsEngine/interface/InputLayout.h index 308a6a8c..f39b2868 100644 --- a/Graphics/GraphicsEngine/interface/InputLayout.h +++ b/Graphics/GraphicsEngine/interface/InputLayout.h @@ -32,6 +32,8 @@ /// \file /// Definition input layout +#include + #include "GraphicsTypes.h" DILIGENT_BEGIN_NAMESPACE(Diligent) -- cgit v1.2.3 From 7ec8d3a43bcb45c81246f13e60415afe58113f58 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 14 Nov 2020 22:16:29 -0800 Subject: Added DynamicHeapPageSize member to EngineMtlCreateInfo --- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index e77c3830..d85540ac 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -2073,8 +2073,8 @@ struct EngineD3D12CreateInfo DILIGENT_DERIVE(EngineCreateInfo) Uint32 NumCommandsToFlushCmdList DEFAULT_INITIALIZER(256); /// A device context uses dynamic heap when it needs to allocate temporary - /// CPU-accessible memory to update a resource via IBufer::UpdateData() or - /// ITexture::UpdateData(), or to map dynamic resources. + /// CPU-accessible memory to update a resource via IDeviceContext::UpdateBuffer() or + /// IDeviceContext::UpdateTexture(), or to map dynamic resources. /// Device contexts first request a chunk of memory from global dynamic /// resource manager and then suballocate from this chunk in a lock-free /// fashion. DynamicHeapPageSize defines the size of this chunk. @@ -2215,7 +2215,8 @@ struct EngineVkCreateInfo DILIGENT_DERIVE(EngineCreateInfo) /// Page size of the upload heap that is allocated by immediate/deferred /// contexts from the global memory manager to perform lock-free dynamic /// suballocations. - /// Upload heap is used to update resources with UpdateData() + /// Upload heap is used to update resources with IDeviceContext::UpdateBuffer() + /// and IDeviceContext::UpdateTexture(). Uint32 UploadHeapPageSize DEFAULT_INITIALIZER(1 << 20); /// Size of the dynamic heap (the buffer that is used to suballocate @@ -2250,6 +2251,13 @@ typedef struct EngineVkCreateInfo EngineVkCreateInfo; /// Attributes of the Metal-based engine implementation struct EngineMtlCreateInfo DILIGENT_DERIVE(EngineCreateInfo) + /// A device context uses dynamic heap when it needs to allocate temporary + /// CPU-accessible memory to update a resource via IDeviceContext::UpdateBuffer() or + /// IDeviceContext::UpdateTexture(), or to map dynamic resources. + /// Device contexts first request a chunk of memory from global dynamic + /// resource manager and then suballocate from this chunk in a lock-free + /// fashion. DynamicHeapPageSize defines the size of this chunk. + Uint32 DynamicHeapPageSize DEFAULT_INITIALIZER(4 << 20); }; typedef struct EngineMtlCreateInfo EngineMtlCreateInfo; -- cgit v1.2.3