Merge pull request #3643 from lioncash/inclass
NativeVertexFormat: Minor changes
This commit is contained in:
commit
2e35e79302
|
@ -2,6 +2,8 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "VideoBackends/D3D/D3DBase.h"
|
||||
#include "VideoBackends/D3D/D3DBlob.h"
|
||||
#include "VideoBackends/D3D/D3DState.h"
|
||||
|
@ -14,16 +16,17 @@ namespace DX11
|
|||
|
||||
class D3DVertexFormat : public NativeVertexFormat
|
||||
{
|
||||
D3D11_INPUT_ELEMENT_DESC m_elems[32];
|
||||
UINT m_num_elems;
|
||||
|
||||
ID3D11InputLayout* m_layout;
|
||||
|
||||
public:
|
||||
D3DVertexFormat(const PortableVertexDeclaration& vtx_decl);
|
||||
~D3DVertexFormat() { SAFE_RELEASE(m_layout); }
|
||||
|
||||
void SetupVertexPointers();
|
||||
void SetupVertexPointers() override;
|
||||
|
||||
private:
|
||||
std::array<D3D11_INPUT_ELEMENT_DESC, 32> m_elems{};
|
||||
UINT m_num_elems = 0;
|
||||
|
||||
ID3D11InputLayout* m_layout = nullptr;
|
||||
};
|
||||
|
||||
NativeVertexFormat* VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||
|
@ -57,10 +60,9 @@ DXGI_FORMAT VarToD3D(VarType t, int size, bool integer)
|
|||
}
|
||||
|
||||
D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& _vtx_decl)
|
||||
: m_num_elems(0), m_layout(nullptr)
|
||||
{
|
||||
this->vtx_decl = _vtx_decl;
|
||||
memset(m_elems, 0, sizeof(m_elems));
|
||||
|
||||
const AttributeFormat* format = &_vtx_decl.position;
|
||||
|
||||
if (format->enable)
|
||||
|
@ -134,7 +136,7 @@ void D3DVertexFormat::SetupVertexPointers()
|
|||
// changes.
|
||||
D3DBlob* vs_bytecode = DX11::VertexShaderCache::GetActiveShaderBytecode();
|
||||
|
||||
HRESULT hr = DX11::D3D::device->CreateInputLayout(m_elems, m_num_elems, vs_bytecode->Data(), vs_bytecode->Size(), &m_layout);
|
||||
HRESULT hr = DX11::D3D::device->CreateInputLayout(m_elems.data(), m_num_elems, vs_bytecode->Data(), vs_bytecode->Size(), &m_layout);
|
||||
if (FAILED(hr)) PanicAlert("Failed to create input layout, %s %d\n", __FILE__, __LINE__);
|
||||
DX11::D3D::SetDebugObjectName((ID3D11DeviceChild*)m_layout, "input layout used to emulate the GX pipeline");
|
||||
}
|
||||
|
|
|
@ -44,8 +44,7 @@ DXGI_FORMAT VarToD3D(VarType t, int size, bool integer)
|
|||
return retval;
|
||||
}
|
||||
|
||||
D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration &vtx_decl)
|
||||
: m_num_elems(0), m_layout12({}), m_elems()
|
||||
D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||
{
|
||||
this->vtx_decl = vtx_decl;
|
||||
|
||||
|
|
|
@ -12,20 +12,20 @@ namespace DX12
|
|||
|
||||
class D3DVertexFormat final : public NativeVertexFormat
|
||||
{
|
||||
std::array<D3D12_INPUT_ELEMENT_DESC, 15> m_elems;
|
||||
UINT m_num_elems;
|
||||
|
||||
D3D12_INPUT_LAYOUT_DESC m_layout12;
|
||||
|
||||
public:
|
||||
D3DVertexFormat(const PortableVertexDeclaration& vtx_decl);
|
||||
~D3DVertexFormat();
|
||||
|
||||
void SetupVertexPointers();
|
||||
void SetupVertexPointers() override;
|
||||
|
||||
D3D12_INPUT_LAYOUT_DESC GetActiveInputLayout12() const;
|
||||
|
||||
private:
|
||||
void AddInputElementDescFromAttributeFormatIfValid(const AttributeFormat* format, const char* semantic_name, unsigned int semantic_index);
|
||||
|
||||
std::array<D3D12_INPUT_ELEMENT_DESC, 15> m_elems{};
|
||||
UINT m_num_elems = 0;
|
||||
|
||||
D3D12_INPUT_LAYOUT_DESC m_layout12{};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue