Skip to content

Commit

Permalink
xrRender: Moved dcl_equal function to BufferUtils.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Apr 27, 2023
1 parent a5dce77 commit b3ccfdc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
10 changes: 10 additions & 0 deletions src/Layers/xrRender/BufferUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ u32 GetFVFVertexSize(u32 FVF);
u32 GetDeclVertexSize(const VertexElement* decl, u32 Stream);
u32 GetDeclLength(const VertexElement* decl);

inline bool dcl_equal(VertexElement* a, VertexElement* b)
{
// check sizes
const auto a_size = GetDeclLength(a);
const auto b_size = GetDeclLength(b);
if (a_size != b_size)
return false;
return 0 == memcmp(a, b, a_size * sizeof(VertexElement));
}

struct SDeclaration;

void ConvertVertexDeclaration(u32 FVF, SDeclaration* decl);
Expand Down
9 changes: 0 additions & 9 deletions src/Layers/xrRenderDX11/dx11ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,6 @@ void CResourceManager::_DeleteCS(const SCS* CS) { DestroyShader(CS); }
#endif

//--------------------------------------------------------------------------------------------------------------
static BOOL dcl_equal(D3DVERTEXELEMENT9* a, D3DVERTEXELEMENT9* b)
{
// check sizes
u32 a_size = GetDeclLength(a);
u32 b_size = GetDeclLength(b);
if (a_size != b_size)
return FALSE;
return 0 == memcmp(a, b, a_size * sizeof(D3DVERTEXELEMENT9));
}

SDeclaration* CResourceManager::_CreateDecl(D3DVERTEXELEMENT9* dcl)
{
Expand Down
9 changes: 0 additions & 9 deletions src/Layers/xrRenderDX9/dx9ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ SPass* CResourceManager::_CreatePass(const SPass& proto)
}

//--------------------------------------------------------------------------------------------------------------
static BOOL dcl_equal(VertexElement* a, VertexElement* b)
{
// check sizes
u32 a_size = GetDeclLength(a);
u32 b_size = GetDeclLength(b);
if (a_size != b_size)
return FALSE;
return 0 == memcmp(a, b, a_size * sizeof(VertexElement));
}

SDeclaration* CResourceManager::_CreateDecl(VertexElement* dcl)
{
Expand Down
8 changes: 0 additions & 8 deletions src/Layers/xrRenderGL/glResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ SPass* CResourceManager::_CreatePass(const SPass& proto)
}

//--------------------------------------------------------------------------------------------------------------
static BOOL dcl_equal(D3DVERTEXELEMENT9* a, D3DVERTEXELEMENT9* b)
{
// check sizes
u32 a_size = GetDeclLength(a);
u32 b_size = GetDeclLength(b);
if (a_size != b_size) return FALSE;
return 0 == memcmp(a, b, a_size * sizeof(D3DVERTEXELEMENT9));
}

SDeclaration* CResourceManager::_CreateDecl(u32 FVF)
{
Expand Down

0 comments on commit b3ccfdc

Please sign in to comment.