2018-01-11 12:23:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../dxvk/dxvk_device.h"
|
|
|
|
|
2018-08-11 23:19:28 +02:00
|
|
|
#include "../d3d10/d3d10_view_srv.h"
|
|
|
|
|
2018-01-11 12:23:55 +01:00
|
|
|
#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;
|
|
|
|
|
|
|
|
/**
|
2018-02-05 22:35:23 +01:00
|
|
|
* \brief Shader resource view
|
2018-01-11 12:23:55 +01:00
|
|
|
*/
|
2018-02-05 22:35:23 +01:00
|
|
|
class D3D11ShaderResourceView : public D3D11DeviceChild<ID3D11ShaderResourceView> {
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2018-02-05 22:35:23 +01:00
|
|
|
D3D11ShaderResourceView(
|
2018-08-05 19:20:12 +02:00
|
|
|
D3D11Device* pDevice,
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc);
|
2018-01-11 12:23:55 +01:00
|
|
|
|
2018-02-05 22:35:23 +01:00
|
|
|
~D3D11ShaderResourceView();
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice) final;
|
|
|
|
|
|
|
|
void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource) final;
|
|
|
|
|
2018-02-05 22:35:23 +01:00
|
|
|
void STDMETHODCALLTYPE GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* 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-26 18:08:05 +02:00
|
|
|
BOOL TestHazards() const {
|
|
|
|
return m_info.BindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_UNORDERED_ACCESS);
|
|
|
|
}
|
|
|
|
|
2018-01-11 12:23:55 +01:00
|
|
|
D3D11_RESOURCE_DIMENSION GetResourceType() const {
|
|
|
|
D3D11_RESOURCE_DIMENSION type;
|
|
|
|
m_resource->GetType(&type);
|
|
|
|
return type;
|
|
|
|
}
|
2019-06-13 03:15:59 +02:00
|
|
|
|
|
|
|
D3D11_COMMON_RESOURCE_DESC GetResourceDesc() const {
|
|
|
|
D3D11_COMMON_RESOURCE_DESC desc;
|
|
|
|
GetCommonResourceDesc(m_resource, &desc);
|
|
|
|
return desc;
|
|
|
|
}
|
2018-01-11 12:23:55 +01:00
|
|
|
|
|
|
|
Rc<DxvkBufferView> GetBufferView() const {
|
|
|
|
return m_bufferView;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rc<DxvkImageView> GetImageView() const {
|
|
|
|
return m_imageView;
|
|
|
|
}
|
2018-08-11 23:19:28 +02:00
|
|
|
|
|
|
|
D3D10ShaderResourceView* GetD3D10Iface() {
|
|
|
|
return &m_d3d10;
|
|
|
|
}
|
2018-01-11 12:23:55 +01:00
|
|
|
|
2018-03-17 13:42:37 +01:00
|
|
|
static HRESULT GetDescFromResource(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc);
|
|
|
|
|
|
|
|
static HRESULT NormalizeDesc(
|
|
|
|
ID3D11Resource* pResource,
|
|
|
|
D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc);
|
|
|
|
|
2018-01-11 12:23:55 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
Com<D3D11Device> m_device;
|
2018-08-05 20:56:04 +02:00
|
|
|
ID3D11Resource* m_resource;
|
2018-02-05 22:35:23 +01:00
|
|
|
D3D11_SHADER_RESOURCE_VIEW_DESC 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;
|
2018-08-11 23:19:28 +02:00
|
|
|
D3D10ShaderResourceView m_d3d10;
|
|
|
|
|
2018-01-11 12:23:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|