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