1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-06 22:54:16 +01:00

[d3d11] Device children actually do hold a reference to the device

This commit is contained in:
Philip Rebohle 2017-12-09 15:57:05 +01:00
parent 12d4e68b24
commit f484454854
11 changed files with 34 additions and 22 deletions

View File

@ -35,7 +35,7 @@ namespace dxvk {
void D3D11Buffer::GetDevice(ID3D11Device** ppDevice) { void D3D11Buffer::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = ref(m_device); *ppDevice = m_device.ref();
} }

View File

@ -41,7 +41,7 @@ namespace dxvk {
private: private:
D3D11Device* const m_device; Com<D3D11Device> m_device;
Com<IDXGIBufferResourcePrivate> m_resource; Com<IDXGIBufferResourcePrivate> m_resource;
D3D11_BUFFER_DESC m_desc; D3D11_BUFFER_DESC m_desc;

View File

@ -111,8 +111,8 @@ namespace dxvk {
void D3D11DeviceContext::ClearState() { void D3D11DeviceContext::ClearState() {
this->IASetInputLayout(nullptr); this->IASetInputLayout(nullptr);
this->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED); this->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED);
// this->IASetVertexBuffers(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, nullptr, nullptr, nullptr); this->IASetVertexBuffers(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, nullptr, nullptr, nullptr);
// this->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0); this->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
this->VSSetShader(nullptr, nullptr, 0); this->VSSetShader(nullptr, nullptr, 0);
this->VSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, nullptr); this->VSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, nullptr);
@ -625,10 +625,16 @@ namespace dxvk {
// are bound as UAVs or stream outputs // are bound as UAVs or stream outputs
for (uint32_t i = 0; i < NumBuffers; i++) { for (uint32_t i = 0; i < NumBuffers; i++) {
D3D11VertexBufferBinding binding; D3D11VertexBufferBinding binding;
binding.buffer = nullptr;
binding.offset = 0;
binding.stride = 0;
m_state.ia.vertexBuffers.at(StartSlot + i) = binding;
if (ppVertexBuffers != nullptr) {
binding.buffer = static_cast<D3D11Buffer*>(ppVertexBuffers[i]); binding.buffer = static_cast<D3D11Buffer*>(ppVertexBuffers[i]);
binding.offset = pOffsets[i]; binding.offset = pOffsets[i];
binding.stride = pStrides[i]; binding.stride = pStrides[i];
m_state.ia.vertexBuffers.at(StartSlot + i) = binding; }
DxvkBufferBinding dxvkBinding; DxvkBufferBinding dxvkBinding;
@ -673,11 +679,13 @@ namespace dxvk {
// formats are allowed. // formats are allowed.
VkIndexType indexType = VK_INDEX_TYPE_UINT32; VkIndexType indexType = VK_INDEX_TYPE_UINT32;
if (binding.buffer != nullptr) {
switch (binding.format) { switch (binding.format) {
case DXGI_FORMAT_R16_UINT: indexType = VK_INDEX_TYPE_UINT16; break; case DXGI_FORMAT_R16_UINT: indexType = VK_INDEX_TYPE_UINT16; break;
case DXGI_FORMAT_R32_UINT: indexType = VK_INDEX_TYPE_UINT32; break; case DXGI_FORMAT_R32_UINT: indexType = VK_INDEX_TYPE_UINT32; break;
default: Logger::err(str::format("D3D11: Invalid index format: ", binding.format)); default: Logger::err(str::format("D3D11: Invalid index format: ", binding.format));
} }
}
m_context->bindIndexBuffer( m_context->bindIndexBuffer(
dxvkBinding, indexType); dxvkBinding, indexType);

View File

@ -21,7 +21,6 @@ namespace dxvk {
m_featureFlags (featureFlags), m_featureFlags (featureFlags),
m_dxvkDevice (m_dxgiDevice->GetDXVKDevice()), m_dxvkDevice (m_dxgiDevice->GetDXVKDevice()),
m_dxvkAdapter (m_dxvkDevice->adapter()) { m_dxvkAdapter (m_dxvkDevice->adapter()) {
Com<IDXGIAdapter> adapter; Com<IDXGIAdapter> adapter;
if (FAILED(m_dxgiDevice->GetAdapter(&adapter)) if (FAILED(m_dxgiDevice->GetAdapter(&adapter))
@ -56,6 +55,7 @@ namespace dxvk {
return m_presentDevice->QueryInterface(riid, ppvObject); return m_presentDevice->QueryInterface(riid, ppvObject);
Logger::warn("D3D11Device::QueryInterface: Unknown interface query"); Logger::warn("D3D11Device::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
return E_NOINTERFACE; return E_NOINTERFACE;
} }
@ -247,6 +247,10 @@ namespace dxvk {
// Shader resource views can access pretty much anything // Shader resource views can access pretty much anything
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN; D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim); pResource->GetType(&resourceDim);
if (ppSRView != nullptr)
*ppSRView = nullptr;
Logger::err("D3D11Device::CreateShaderResourceView: Not implemented"); Logger::err("D3D11Device::CreateShaderResourceView: Not implemented");
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@ -37,7 +37,7 @@ namespace dxvk {
void D3D11InputLayout::GetDevice(ID3D11Device** ppDevice) { void D3D11InputLayout::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = ref(m_device); *ppDevice = m_device.ref();
} }

View File

@ -31,7 +31,7 @@ namespace dxvk {
private: private:
D3D11Device* const m_device; Com<D3D11Device> m_device;
std::vector<DxvkVertexAttribute> m_attributes; std::vector<DxvkVertexAttribute> m_attributes;
std::vector<DxvkVertexBinding> m_bindings; std::vector<DxvkVertexBinding> m_bindings;

View File

@ -76,7 +76,7 @@ namespace dxvk {
} }
void GetDevice(ID3D11Device **ppDevice) final { void GetDevice(ID3D11Device **ppDevice) final {
*ppDevice = ref(m_device); *ppDevice = m_device.ref();
} }
Rc<DxvkShader> GetShader() const { Rc<DxvkShader> GetShader() const {
@ -85,7 +85,7 @@ namespace dxvk {
private: private:
D3D11Device* const m_device; Com<D3D11Device> m_device;
D3D11ShaderModule m_module; D3D11ShaderModule m_module;
}; };

View File

@ -35,7 +35,7 @@ namespace dxvk {
void D3D11Texture2D::GetDevice(ID3D11Device** ppDevice) { void D3D11Texture2D::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = ref(m_device); *ppDevice = m_device.ref();
} }

View File

@ -41,7 +41,7 @@ namespace dxvk {
private: private:
D3D11Device* const m_device; Com<D3D11Device> m_device;
Com<IDXGIImageResourcePrivate> m_resource; Com<IDXGIImageResourcePrivate> m_resource;
D3D11_TEXTURE2D_DESC m_desc; D3D11_TEXTURE2D_DESC m_desc;

View File

@ -42,7 +42,7 @@ namespace dxvk {
} }
void GetDevice(ID3D11Device** ppDevice) final { void GetDevice(ID3D11Device** ppDevice) final {
*ppDevice = ref(m_device); *ppDevice = m_device.ref();
} }
void GetResource(ID3D11Resource** ppResource) final { void GetResource(ID3D11Resource** ppResource) final {
@ -63,7 +63,7 @@ namespace dxvk {
private: private:
D3D11Device* const m_device; Com<D3D11Device> m_device;
Com<ID3D11Resource> m_resource; Com<ID3D11Resource> m_resource;
DescType m_desc; DescType m_desc;
Rc<DxvkBufferView> m_bufferView; Rc<DxvkBufferView> m_bufferView;

View File

@ -175,7 +175,7 @@ public:
~TriangleApp() { ~TriangleApp() {
m_context->ClearState();
} }