2018-01-11 12:23:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../dxvk/dxvk_device.h"
|
|
|
|
|
|
|
|
#include "d3d11_device_child.h"
|
2019-08-26 14:46:40 +02:00
|
|
|
#include "d3d11_view.h"
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
class D3D11Device;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Unordered access view
|
|
|
|
*
|
|
|
|
* Unordered access views are special in that they can
|
|
|
|
* have counters, which can be used inside shaders to
|
|
|
|
* atomically append or consume structures.
|
|
|
|
*/
|
2019-09-16 14:37:33 +02:00
|
|
|
class D3D11UnorderedAccessView : public D3D11DeviceChild<ID3D11UnorderedAccessView1> {
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
D3D11UnorderedAccessView(
|
2019-09-16 14:37:33 +02:00
|
|
|
D3D11Device* pDevice,
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
const D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc);
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
~D3D11UnorderedAccessView();
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc) final;
|
2019-09-16 14:37:33 +02:00
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDesc1(D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc) final;
|
2018-01-11 12:23:55 +01:00
|
|
|
|
2019-08-26 14:46:40 +02:00
|
|
|
const D3D11_VK_VIEW_INFO& GetViewInfo() const {
|
|
|
|
return m_info;
|
|
|
|
}
|
|
|
|
|
2019-08-29 18:30:28 +02:00
|
|
|
BOOL HasBindFlag(UINT Flags) const {
|
|
|
|
return m_info.BindFlags & Flags;
|
|
|
|
}
|
|
|
|
|
2018-01-11 12:23:55 +01:00
|
|
|
D3D11_RESOURCE_DIMENSION GetResourceType() const {
|
|
|
|
D3D11_RESOURCE_DIMENSION type;
|
|
|
|
m_resource->GetType(&type);
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rc<DxvkBufferView> GetBufferView() const {
|
|
|
|
return m_bufferView;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rc<DxvkImageView> GetImageView() const {
|
|
|
|
return m_imageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
DxvkBufferSlice GetCounterSlice() const {
|
2019-10-26 15:40:58 +02:00
|
|
|
return m_counterBuffer != nullptr
|
|
|
|
? DxvkBufferSlice(m_counterBuffer)
|
|
|
|
: DxvkBufferSlice();
|
2018-01-11 12:23:55 +01:00
|
|
|
}
|
|
|
|
|
2018-03-17 13:42:37 +01:00
|
|
|
static HRESULT GetDescFromResource(
|
2019-09-16 14:37:33 +02:00
|
|
|
ID3D11Resource* pResource,
|
|
|
|
D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc);
|
|
|
|
|
|
|
|
static D3D11_UNORDERED_ACCESS_VIEW_DESC1 PromoteDesc(
|
2021-05-28 16:20:24 +02:00
|
|
|
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
|
|
|
|
UINT Plane);
|
2018-03-17 13:42:37 +01:00
|
|
|
|
|
|
|
static HRESULT NormalizeDesc(
|
2019-09-16 14:37:33 +02:00
|
|
|
ID3D11Resource* pResource,
|
|
|
|
D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc);
|
2018-03-17 13:42:37 +01:00
|
|
|
|
2021-05-28 16:20:24 +02:00
|
|
|
static UINT GetPlaneSlice(
|
|
|
|
const D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc);
|
|
|
|
|
2018-01-11 12:23:55 +01:00
|
|
|
private:
|
|
|
|
|
2018-08-05 20:56:04 +02:00
|
|
|
ID3D11Resource* m_resource;
|
2019-09-16 14:37:33 +02:00
|
|
|
D3D11_UNORDERED_ACCESS_VIEW_DESC1 m_desc;
|
2019-08-26 14:46:40 +02:00
|
|
|
D3D11_VK_VIEW_INFO m_info;
|
2018-01-11 12:23:55 +01:00
|
|
|
Rc<DxvkBufferView> m_bufferView;
|
|
|
|
Rc<DxvkImageView> m_imageView;
|
2019-10-26 15:40:58 +02:00
|
|
|
Rc<DxvkBuffer> m_counterBuffer;
|
|
|
|
|
|
|
|
Rc<DxvkBuffer> CreateCounterBuffer();
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|