diff options
| author | Anthony <Helios747@users.noreply.github.com> | 2017-07-30 01:00:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-30 01:00:16 -0700 |
| commit | ba57605266b9ab178963bf56e146f355d1b93cd4 (patch) | |
| tree | 0ddc89cfca6db3d343d317c18b7c07c9ab83e9c4 /Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp | |
| parent | 5bad2ee4a4129e734ff4f4d861cedc4cd573df55 (diff) | |
| parent | b154edb4fbdb327920a33b44f35f34cdf2636d6f (diff) | |
Merge pull request #5702 from stenzek/ubershaders
Ubershaders 2.0
Diffstat (limited to 'Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp index 01658b66e6..fe17144bc0 100644 --- a/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/D3D/NativeVertexFormat.cpp @@ -13,20 +13,6 @@ namespace DX11 { -class D3DVertexFormat : public NativeVertexFormat -{ -public: - D3DVertexFormat(const PortableVertexDeclaration& vtx_decl); - ~D3DVertexFormat() { SAFE_RELEASE(m_layout); } - void SetupVertexPointers() override; - -private: - std::array<D3D11_INPUT_ELEMENT_DESC, 32> m_elems{}; - UINT m_num_elems = 0; - - ID3D11InputLayout* m_layout = nullptr; -}; - std::unique_ptr<NativeVertexFormat> VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) { @@ -66,7 +52,6 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& _vtx_decl) this->vtx_decl = _vtx_decl; const AttributeFormat* format = &_vtx_decl.position; - if (format->enable) { m_elems[m_num_elems].SemanticName = "POSITION"; @@ -129,15 +114,18 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& _vtx_decl) } } -void D3DVertexFormat::SetupVertexPointers() +D3DVertexFormat::~D3DVertexFormat() +{ + SAFE_RELEASE(m_layout); +} + +void D3DVertexFormat::SetInputLayout(D3DBlob* vs_bytecode) { if (!m_layout) { // CreateInputLayout requires a shader input, but it only looks at the // signature of the shader, so we don't need to recompute it if the shader // changes. - D3DBlob* vs_bytecode = DX11::VertexShaderCache::GetActiveShaderBytecode(); - HRESULT hr = DX11::D3D::device->CreateInputLayout( m_elems.data(), m_num_elems, vs_bytecode->Data(), vs_bytecode->Size(), &m_layout); if (FAILED(hr)) |
