mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-29 17:52:18 +01:00
[d3d11] Device children actually do hold a reference to the device
This commit is contained in:
parent
12d4e68b24
commit
f484454854
@ -35,7 +35,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D11Buffer::GetDevice(ID3D11Device** ppDevice) {
|
||||
*ppDevice = ref(m_device);
|
||||
*ppDevice = m_device.ref();
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
Com<D3D11Device> m_device;
|
||||
Com<IDXGIBufferResourcePrivate> m_resource;
|
||||
D3D11_BUFFER_DESC m_desc;
|
||||
|
||||
|
@ -111,8 +111,8 @@ namespace dxvk {
|
||||
void D3D11DeviceContext::ClearState() {
|
||||
this->IASetInputLayout(nullptr);
|
||||
this->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED);
|
||||
// this->IASetVertexBuffers(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, nullptr, nullptr, nullptr);
|
||||
// this->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
|
||||
this->IASetVertexBuffers(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, nullptr, nullptr, nullptr);
|
||||
this->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
|
||||
|
||||
this->VSSetShader(nullptr, nullptr, 0);
|
||||
this->VSSetConstantBuffers(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, nullptr);
|
||||
@ -625,11 +625,17 @@ namespace dxvk {
|
||||
// are bound as UAVs or stream outputs
|
||||
for (uint32_t i = 0; i < NumBuffers; i++) {
|
||||
D3D11VertexBufferBinding binding;
|
||||
binding.buffer = static_cast<D3D11Buffer*>(ppVertexBuffers[i]);
|
||||
binding.offset = pOffsets[i];
|
||||
binding.stride = pStrides[i];
|
||||
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.offset = pOffsets[i];
|
||||
binding.stride = pStrides[i];
|
||||
}
|
||||
|
||||
DxvkBufferBinding dxvkBinding;
|
||||
|
||||
if (binding.buffer != nullptr) {
|
||||
@ -673,10 +679,12 @@ namespace dxvk {
|
||||
// formats are allowed.
|
||||
VkIndexType indexType = VK_INDEX_TYPE_UINT32;
|
||||
|
||||
switch (binding.format) {
|
||||
case DXGI_FORMAT_R16_UINT: indexType = VK_INDEX_TYPE_UINT16; break;
|
||||
case DXGI_FORMAT_R32_UINT: indexType = VK_INDEX_TYPE_UINT32; break;
|
||||
default: Logger::err(str::format("D3D11: Invalid index format: ", binding.format));
|
||||
if (binding.buffer != nullptr) {
|
||||
switch (binding.format) {
|
||||
case DXGI_FORMAT_R16_UINT: indexType = VK_INDEX_TYPE_UINT16; break;
|
||||
case DXGI_FORMAT_R32_UINT: indexType = VK_INDEX_TYPE_UINT32; break;
|
||||
default: Logger::err(str::format("D3D11: Invalid index format: ", binding.format));
|
||||
}
|
||||
}
|
||||
|
||||
m_context->bindIndexBuffer(
|
||||
|
@ -21,7 +21,6 @@ namespace dxvk {
|
||||
m_featureFlags (featureFlags),
|
||||
m_dxvkDevice (m_dxgiDevice->GetDXVKDevice()),
|
||||
m_dxvkAdapter (m_dxvkDevice->adapter()) {
|
||||
|
||||
Com<IDXGIAdapter> adapter;
|
||||
|
||||
if (FAILED(m_dxgiDevice->GetAdapter(&adapter))
|
||||
@ -56,6 +55,7 @@ namespace dxvk {
|
||||
return m_presentDevice->QueryInterface(riid, ppvObject);
|
||||
|
||||
Logger::warn("D3D11Device::QueryInterface: Unknown interface query");
|
||||
Logger::warn(str::format(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
@ -247,6 +247,10 @@ namespace dxvk {
|
||||
// Shader resource views can access pretty much anything
|
||||
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||
pResource->GetType(&resourceDim);
|
||||
|
||||
if (ppSRView != nullptr)
|
||||
*ppSRView = nullptr;
|
||||
|
||||
Logger::err("D3D11Device::CreateShaderResourceView: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D11InputLayout::GetDevice(ID3D11Device** ppDevice) {
|
||||
*ppDevice = ref(m_device);
|
||||
*ppDevice = m_device.ref();
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
Com<D3D11Device> m_device;
|
||||
|
||||
std::vector<DxvkVertexAttribute> m_attributes;
|
||||
std::vector<DxvkVertexBinding> m_bindings;
|
||||
|
@ -76,7 +76,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
void GetDevice(ID3D11Device **ppDevice) final {
|
||||
*ppDevice = ref(m_device);
|
||||
*ppDevice = m_device.ref();
|
||||
}
|
||||
|
||||
Rc<DxvkShader> GetShader() const {
|
||||
@ -85,8 +85,8 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
D3D11ShaderModule m_module;
|
||||
Com<D3D11Device> m_device;
|
||||
D3D11ShaderModule m_module;
|
||||
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D11Texture2D::GetDevice(ID3D11Device** ppDevice) {
|
||||
*ppDevice = ref(m_device);
|
||||
*ppDevice = m_device.ref();
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
Com<D3D11Device> m_device;
|
||||
Com<IDXGIImageResourcePrivate> m_resource;
|
||||
D3D11_TEXTURE2D_DESC m_desc;
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
void GetDevice(ID3D11Device** ppDevice) final {
|
||||
*ppDevice = ref(m_device);
|
||||
*ppDevice = m_device.ref();
|
||||
}
|
||||
|
||||
void GetResource(ID3D11Resource** ppResource) final {
|
||||
@ -63,7 +63,7 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
Com<D3D11Device> m_device;
|
||||
Com<ID3D11Resource> m_resource;
|
||||
DescType m_desc;
|
||||
Rc<DxvkBufferView> m_bufferView;
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
|
||||
|
||||
~TriangleApp() {
|
||||
|
||||
m_context->ClearState();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user