mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 10:54:16 +01:00
[d3d10] Create constant buffer reflection objects on demand
The reported constant buffer count does not necessarily match the number of constant buffers that can be retrieved from reflection.
This commit is contained in:
parent
14946c599f
commit
21fe6a3405
@ -157,11 +157,7 @@ namespace dxvk {
|
||||
|
||||
D3D10ShaderReflection::D3D10ShaderReflection(ID3D11ShaderReflection* d3d11)
|
||||
: m_d3d11(d3d11) {
|
||||
D3D11_SHADER_DESC d3d11Desc;
|
||||
m_d3d11->GetDesc(&d3d11Desc);
|
||||
|
||||
for (uint32_t i = 0; i < d3d11Desc.ConstantBuffers; i++)
|
||||
m_constantBuffers.emplace_back(m_d3d11->GetConstantBufferByIndex(i));
|
||||
}
|
||||
|
||||
|
||||
@ -295,12 +291,19 @@ namespace dxvk {
|
||||
|
||||
ID3D10ShaderReflectionConstantBuffer* D3D10ShaderReflection::FindConstantBuffer(
|
||||
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer) {
|
||||
for (size_t i = 0; i < m_constantBuffers.size(); i++) {
|
||||
if (m_constantBuffers[i].GetD3D11Iface() == pConstantBuffer)
|
||||
return &m_constantBuffers[i];
|
||||
if (!pConstantBuffer)
|
||||
return nullptr;
|
||||
|
||||
auto entry = m_constantBuffers.find(pConstantBuffer);
|
||||
|
||||
if (entry == m_constantBuffers.end()) {
|
||||
entry = m_constantBuffers.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(pConstantBuffer),
|
||||
std::forward_as_tuple(pConstantBuffer)).first;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return &entry->second;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "d3d10_include.h"
|
||||
@ -141,7 +142,9 @@ namespace dxvk {
|
||||
|
||||
Com<ID3D11ShaderReflection> m_d3d11;
|
||||
|
||||
std::vector<D3D10ShaderReflectionConstantBuffer> m_constantBuffers;
|
||||
std::unordered_map<
|
||||
ID3D11ShaderReflectionConstantBuffer*,
|
||||
D3D10ShaderReflectionConstantBuffer> m_constantBuffers;
|
||||
|
||||
ID3D10ShaderReflectionConstantBuffer* FindConstantBuffer(
|
||||
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user