D3D12: Remove D3D11 header references
This commit is contained in:
parent
6f3573dda8
commit
25d5da0ea3
|
@ -528,7 +528,7 @@ HRESULT Create(HWND wnd)
|
||||||
CHECK(SUCCEEDED(hr), "Retrieve back buffer texture");
|
CHECK(SUCCEEDED(hr), "Retrieve back buffer texture");
|
||||||
|
|
||||||
s_backbuf[i] = new D3DTexture2D(buf12,
|
s_backbuf[i] = new D3DTexture2D(buf12,
|
||||||
D3D11_BIND_RENDER_TARGET,
|
TEXTURE_BIND_FLAG_RENDER_TARGET,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
|
@ -795,7 +795,7 @@ unsigned int GetBackBufferHeight()
|
||||||
// Returns the maximum width/height of a texture.
|
// Returns the maximum width/height of a texture.
|
||||||
unsigned int GetMaxTextureSize()
|
unsigned int GetMaxTextureSize()
|
||||||
{
|
{
|
||||||
return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
return D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
|
@ -830,7 +830,7 @@ void Reset()
|
||||||
CHECK(SUCCEEDED(hr), "Retrieve back buffer texture");
|
CHECK(SUCCEEDED(hr), "Retrieve back buffer texture");
|
||||||
|
|
||||||
s_backbuf[i] = new D3DTexture2D(buf12,
|
s_backbuf[i] = new D3DTexture2D(buf12,
|
||||||
D3D11_BIND_RENDER_TARGET,
|
TEXTURE_BIND_FLAG_RENDER_TARGET,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <d3d11.h>
|
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <d3dcompiler.h>
|
#include <d3dcompiler.h>
|
||||||
#include <dxgi1_4.h>
|
#include <dxgi1_4.h>
|
||||||
|
|
|
@ -804,7 +804,7 @@ void STDMETHODCALLTYPE ID3D12QueuedCommandList::ResolveSubresource(
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDMETHODCALLTYPE ID3D12QueuedCommandList::IASetPrimitiveTopology(
|
void STDMETHODCALLTYPE ID3D12QueuedCommandList::IASetPrimitiveTopology(
|
||||||
_In_ D3D11_PRIMITIVE_TOPOLOGY PrimitiveTopology
|
_In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// No ignored parameters, no assumptions to DEBUGCHECK.
|
// No ignored parameters, no assumptions to DEBUGCHECK.
|
||||||
|
@ -818,7 +818,7 @@ void STDMETHODCALLTYPE ID3D12QueuedCommandList::IASetPrimitiveTopology(
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDMETHODCALLTYPE ID3D12QueuedCommandList::RSSetViewports(
|
void STDMETHODCALLTYPE ID3D12QueuedCommandList::RSSetViewports(
|
||||||
_In_range_(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT Count,
|
_In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT Count,
|
||||||
_In_reads_(Count) const D3D12_VIEWPORT* pViewports
|
_In_reads_(Count) const D3D12_VIEWPORT* pViewports
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -838,7 +838,7 @@ void STDMETHODCALLTYPE ID3D12QueuedCommandList::RSSetViewports(
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDMETHODCALLTYPE ID3D12QueuedCommandList::RSSetScissorRects(
|
void STDMETHODCALLTYPE ID3D12QueuedCommandList::RSSetScissorRects(
|
||||||
_In_range_(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT Count,
|
_In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT Count,
|
||||||
_In_reads_(Count) const D3D12_RECT* pRects
|
_In_reads_(Count) const D3D12_RECT* pRects
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -1199,7 +1199,7 @@ void STDMETHODCALLTYPE ID3D12QueuedCommandList::ClearDepthStencilView(
|
||||||
_In_reads_opt_(NumRects) const D3D12_RECT* pRect
|
_In_reads_opt_(NumRects) const D3D12_RECT* pRect
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DEBUGCHECK(ClearFlags == D3D11_CLEAR_DEPTH, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
DEBUGCHECK(ClearFlags == D3D12_CLEAR_FLAG_DEPTH, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
||||||
DEBUGCHECK(Depth == 0.0f, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
DEBUGCHECK(Depth == 0.0f, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
||||||
DEBUGCHECK(Stencil == 0, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
DEBUGCHECK(Stencil == 0, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
||||||
DEBUGCHECK(pRect == nullptr, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
DEBUGCHECK(pRect == nullptr, "Error: Invalid assumption in ID3D12QueuedCommandList.");
|
||||||
|
|
|
@ -343,8 +343,8 @@ inline D3D12_DEPTH_STENCIL_DESC StateCache::GetDesc12(ZMode state)
|
||||||
D3D12_DEPTH_STENCIL_DESC depthdc;
|
D3D12_DEPTH_STENCIL_DESC depthdc;
|
||||||
|
|
||||||
depthdc.StencilEnable = FALSE;
|
depthdc.StencilEnable = FALSE;
|
||||||
depthdc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
depthdc.StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK;
|
||||||
depthdc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
depthdc.StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK;
|
||||||
|
|
||||||
D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS };
|
D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = { D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS };
|
||||||
depthdc.FrontFace = defaultStencilOp;
|
depthdc.FrontFace = defaultStencilOp;
|
||||||
|
|
|
@ -100,7 +100,7 @@ void ReplaceRGBATexture2D(ID3D12Resource* texture12, const u8* buffer, unsigned
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D11_BIND_FLAG bind, D3D11_USAGE usage, DXGI_FORMAT fmt, unsigned int levels, unsigned int slices, D3D12_SUBRESOURCE_DATA* data)
|
D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, u32 bind, DXGI_FORMAT fmt, unsigned int levels, unsigned int slices, D3D12_SUBRESOURCE_DATA* data)
|
||||||
{
|
{
|
||||||
ID3D12Resource* texture12 = nullptr;
|
ID3D12Resource* texture12 = nullptr;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D1
|
||||||
D3D12_CLEAR_VALUE optimized_clear_value = {};
|
D3D12_CLEAR_VALUE optimized_clear_value = {};
|
||||||
optimized_clear_value.Format = fmt;
|
optimized_clear_value.Format = fmt;
|
||||||
|
|
||||||
if (bind & D3D11_BIND_RENDER_TARGET)
|
if (bind & TEXTURE_BIND_FLAG_RENDER_TARGET)
|
||||||
{
|
{
|
||||||
texdesc12.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
texdesc12.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
||||||
optimized_clear_value.Color[0] = 0.0f;
|
optimized_clear_value.Color[0] = 0.0f;
|
||||||
|
@ -124,7 +124,7 @@ D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D1
|
||||||
optimized_clear_value.Color[3] = 1.0f;
|
optimized_clear_value.Color[3] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bind & D3D11_BIND_DEPTH_STENCIL)
|
if (bind & TEXTURE_BIND_FLAG_DEPTH_STENCIL)
|
||||||
{
|
{
|
||||||
texdesc12.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
|
texdesc12.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
|
||||||
optimized_clear_value.DepthStencil.Depth = 0.0f;
|
optimized_clear_value.DepthStencil.Depth = 0.0f;
|
||||||
|
@ -210,7 +210,7 @@ D3D12_CPU_DESCRIPTOR_HANDLE D3DTexture2D::GetRTV12() const
|
||||||
return m_rtv12;
|
return m_rtv12;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DTexture2D::D3DTexture2D(ID3D12Resource* texptr, D3D11_BIND_FLAG bind,
|
D3DTexture2D::D3DTexture2D(ID3D12Resource* texptr, u32 bind,
|
||||||
DXGI_FORMAT srv_format, DXGI_FORMAT dsv_format, DXGI_FORMAT rtv_format, bool multisampled, D3D12_RESOURCE_STATES resource_state)
|
DXGI_FORMAT srv_format, DXGI_FORMAT dsv_format, DXGI_FORMAT rtv_format, bool multisampled, D3D12_RESOURCE_STATES resource_state)
|
||||||
: m_tex12(texptr), m_resource_state(resource_state), m_multisampled(multisampled)
|
: m_tex12(texptr), m_resource_state(resource_state), m_multisampled(multisampled)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ D3DTexture2D::D3DTexture2D(ID3D12Resource* texptr, D3D11_BIND_FLAG bind,
|
||||||
D3D12_DSV_DIMENSION dsv_dim12 = multisampled ? D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY : D3D12_DSV_DIMENSION_TEXTURE2DARRAY;
|
D3D12_DSV_DIMENSION dsv_dim12 = multisampled ? D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY : D3D12_DSV_DIMENSION_TEXTURE2DARRAY;
|
||||||
D3D12_RTV_DIMENSION rtv_dim12 = multisampled ? D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY : D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
|
D3D12_RTV_DIMENSION rtv_dim12 = multisampled ? D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY : D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
|
||||||
|
|
||||||
if (bind & D3D11_BIND_SHADER_RESOURCE)
|
if (bind & TEXTURE_BIND_FLAG_SHADER_RESOURCE)
|
||||||
{
|
{
|
||||||
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc = {
|
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc = {
|
||||||
srv_format, // DXGI_FORMAT Format
|
srv_format, // DXGI_FORMAT Format
|
||||||
|
@ -245,7 +245,7 @@ D3DTexture2D::D3DTexture2D(ID3D12Resource* texptr, D3D11_BIND_FLAG bind,
|
||||||
D3D::device12->CreateShaderResourceView(m_tex12, &srv_desc, m_srv12_gpu_cpu_shadow);
|
D3D::device12->CreateShaderResourceView(m_tex12, &srv_desc, m_srv12_gpu_cpu_shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bind & D3D11_BIND_DEPTH_STENCIL)
|
if (bind & TEXTURE_BIND_FLAG_DEPTH_STENCIL)
|
||||||
{
|
{
|
||||||
D3D12_DEPTH_STENCIL_VIEW_DESC dsv_desc = {
|
D3D12_DEPTH_STENCIL_VIEW_DESC dsv_desc = {
|
||||||
dsv_format, // DXGI_FORMAT Format
|
dsv_format, // DXGI_FORMAT Format
|
||||||
|
@ -262,7 +262,7 @@ D3DTexture2D::D3DTexture2D(ID3D12Resource* texptr, D3D11_BIND_FLAG bind,
|
||||||
D3D::device12->CreateDepthStencilView(m_tex12, &dsv_desc, m_dsv12);
|
D3D::device12->CreateDepthStencilView(m_tex12, &dsv_desc, m_dsv12);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bind & D3D11_BIND_RENDER_TARGET)
|
if (bind & TEXTURE_BIND_FLAG_RENDER_TARGET)
|
||||||
{
|
{
|
||||||
D3D12_RENDER_TARGET_VIEW_DESC rtv_desc = {
|
D3D12_RENDER_TARGET_VIEW_DESC rtv_desc = {
|
||||||
rtv_format, // DXGI_FORMAT Format
|
rtv_format, // DXGI_FORMAT Format
|
||||||
|
|
|
@ -5,11 +5,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <d3d11.h>
|
|
||||||
|
|
||||||
namespace DX12
|
namespace DX12
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum TEXTURE_BIND_FLAG : u32
|
||||||
|
{
|
||||||
|
TEXTURE_BIND_FLAG_SHADER_RESOURCE = (1 << 0),
|
||||||
|
TEXTURE_BIND_FLAG_RENDER_TARGET = (1 << 1),
|
||||||
|
TEXTURE_BIND_FLAG_DEPTH_STENCIL = (1 << 2)
|
||||||
|
};
|
||||||
|
|
||||||
namespace D3D
|
namespace D3D
|
||||||
{
|
{
|
||||||
void ReplaceRGBATexture2D(ID3D12Resource* pTexture, const u8* buffer, unsigned int width, unsigned int height, unsigned int src_pitch, unsigned int level, D3D12_RESOURCE_STATES current_resource_state = D3D12_RESOURCE_STATE_COMMON);
|
void ReplaceRGBATexture2D(ID3D12Resource* pTexture, const u8* buffer, unsigned int width, unsigned int height, unsigned int src_pitch, unsigned int level, D3D12_RESOURCE_STATES current_resource_state = D3D12_RESOURCE_STATE_COMMON);
|
||||||
|
@ -24,8 +30,8 @@ public:
|
||||||
// either create an ID3D12Resource object, pass it to the constructor and specify what views to create
|
// either create an ID3D12Resource object, pass it to the constructor and specify what views to create
|
||||||
// or let the texture automatically be created by D3DTexture2D::Create
|
// or let the texture automatically be created by D3DTexture2D::Create
|
||||||
|
|
||||||
D3DTexture2D(ID3D12Resource* texptr, D3D11_BIND_FLAG bind, DXGI_FORMAT srv_format = DXGI_FORMAT_UNKNOWN, DXGI_FORMAT dsv_format = DXGI_FORMAT_UNKNOWN, DXGI_FORMAT rtv_format = DXGI_FORMAT_UNKNOWN, bool multisampled = false, D3D12_RESOURCE_STATES resource_state = D3D12_RESOURCE_STATE_COMMON);
|
D3DTexture2D(ID3D12Resource* texptr, u32 bind, DXGI_FORMAT srv_format = DXGI_FORMAT_UNKNOWN, DXGI_FORMAT dsv_format = DXGI_FORMAT_UNKNOWN, DXGI_FORMAT rtv_format = DXGI_FORMAT_UNKNOWN, bool multisampled = false, D3D12_RESOURCE_STATES resource_state = D3D12_RESOURCE_STATE_COMMON);
|
||||||
static D3DTexture2D* Create(unsigned int width, unsigned int height, D3D11_BIND_FLAG bind, D3D11_USAGE usage, DXGI_FORMAT, unsigned int levels = 1, unsigned int slices = 1, D3D12_SUBRESOURCE_DATA* data = nullptr);
|
static D3DTexture2D* Create(unsigned int width, unsigned int height, u32 bind, DXGI_FORMAT fmt, unsigned int levels = 1, unsigned int slices = 1, D3D12_SUBRESOURCE_DATA* data = nullptr);
|
||||||
void TransitionToResourceState(ID3D12GraphicsCommandList* command_list, D3D12_RESOURCE_STATES state_after);
|
void TransitionToResourceState(ID3D12GraphicsCommandList* command_list, D3D12_RESOURCE_STATES state_after);
|
||||||
|
|
||||||
// reference counting, use AddRef() when creating a new reference and Release() it when you don't need it anymore
|
// reference counting, use AddRef() when creating a new reference and Release() it when you don't need it anymore
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <d3d11.h>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,12 @@ D3DTexture2D*& FramebufferManager::GetResolvedEFBColorTexture()
|
||||||
|
|
||||||
for (int i = 0; i < m_efb.slices; i++)
|
for (int i = 0; i < m_efb.slices; i++)
|
||||||
{
|
{
|
||||||
D3D::current_command_list->ResolveSubresource(m_efb.resolved_color_tex->GetTex12(), D3D11CalcSubresource(0, i, 1), m_efb.color_tex->GetTex12(), D3D11CalcSubresource(0, i, 1), DXGI_FORMAT_R8G8B8A8_UNORM);
|
D3D::current_command_list->ResolveSubresource(
|
||||||
|
m_efb.resolved_color_tex->GetTex12(),
|
||||||
|
D3D12CalcSubresource(0, i, 0, 1, m_efb.slices),
|
||||||
|
m_efb.color_tex->GetTex12(),
|
||||||
|
D3D12CalcSubresource(0, i, 0, 1, m_efb.slices),
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_efb.color_tex->TransitionToResourceState(D3D::current_command_list, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
m_efb.color_tex->TransitionToResourceState(D3D::current_command_list, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||||
|
@ -89,13 +94,13 @@ FramebufferManager::FramebufferManager()
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, m_target_width, m_target_height, m_efb.slices, 1, sample_desc.Count, sample_desc.Quality, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, m_target_width, m_target_height, m_efb.slices, 1, sample_desc.Count, sample_desc.Quality, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
|
||||||
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_clear_valueRTV, IID_PPV_ARGS(&buf12));
|
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_clear_valueRTV, IID_PPV_ARGS(&buf12));
|
||||||
|
|
||||||
m_efb.color_tex = new D3DTexture2D(buf12, (D3D11_BIND_FLAG)(D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET), DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM, (sample_desc.Count > 1), D3D12_RESOURCE_STATE_COMMON);
|
m_efb.color_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM, (sample_desc.Count > 1), D3D12_RESOURCE_STATE_COMMON);
|
||||||
SAFE_RELEASE(buf12);
|
SAFE_RELEASE(buf12);
|
||||||
|
|
||||||
// Temporary EFB color texture - used in ReinterpretPixelData
|
// Temporary EFB color texture - used in ReinterpretPixelData
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, m_target_width, m_target_height, m_efb.slices, 1, sample_desc.Count, sample_desc.Quality, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, m_target_width, m_target_height, m_efb.slices, 1, sample_desc.Count, sample_desc.Quality, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
|
||||||
CheckHR(D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_clear_valueRTV, IID_PPV_ARGS(&buf12)));
|
CheckHR(D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_clear_valueRTV, IID_PPV_ARGS(&buf12)));
|
||||||
m_efb.color_temp_tex = new D3DTexture2D(buf12, (D3D11_BIND_FLAG)(D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET), DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM, (sample_desc.Count > 1), D3D12_RESOURCE_STATE_COMMON);
|
m_efb.color_temp_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM, (sample_desc.Count > 1), D3D12_RESOURCE_STATE_COMMON);
|
||||||
SAFE_RELEASE(buf12);
|
SAFE_RELEASE(buf12);
|
||||||
D3D::SetDebugObjectName12(m_efb.color_temp_tex->GetTex12(), "EFB color temp texture");
|
D3D::SetDebugObjectName12(m_efb.color_temp_tex->GetTex12(), "EFB color temp texture");
|
||||||
|
|
||||||
|
@ -103,7 +108,7 @@ FramebufferManager::FramebufferManager()
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R32_TYPELESS, m_target_width, m_target_height, m_efb.slices, 1, sample_desc.Count, sample_desc.Quality, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R32_TYPELESS, m_target_width, m_target_height, m_efb.slices, 1, sample_desc.Count, sample_desc.Quality, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
|
||||||
CheckHR(D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_clear_valueDSV, IID_PPV_ARGS(&buf12)));
|
CheckHR(D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_clear_valueDSV, IID_PPV_ARGS(&buf12)));
|
||||||
|
|
||||||
m_efb.depth_tex = new D3DTexture2D(buf12, (D3D11_BIND_FLAG)(D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE), DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN, (sample_desc.Count > 1), D3D12_RESOURCE_STATE_COMMON);
|
m_efb.depth_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_DEPTH_STENCIL, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN, (sample_desc.Count > 1), D3D12_RESOURCE_STATE_COMMON);
|
||||||
SAFE_RELEASE(buf12);
|
SAFE_RELEASE(buf12);
|
||||||
D3D::SetDebugObjectName12(m_efb.depth_tex->GetTex12(), "EFB depth texture");
|
D3D::SetDebugObjectName12(m_efb.depth_tex->GetTex12(), "EFB depth texture");
|
||||||
|
|
||||||
|
@ -113,14 +118,14 @@ FramebufferManager::FramebufferManager()
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, m_target_width, m_target_height, m_efb.slices, 1);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, m_target_width, m_target_height, m_efb.slices, 1);
|
||||||
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&buf12));
|
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&buf12));
|
||||||
CHECK(hr == S_OK, "create EFB color resolve texture (size: %dx%d)", m_target_width, m_target_height);
|
CHECK(hr == S_OK, "create EFB color resolve texture (size: %dx%d)", m_target_width, m_target_height);
|
||||||
m_efb.resolved_color_tex = new D3DTexture2D(buf12, D3D11_BIND_SHADER_RESOURCE, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, false, D3D12_RESOURCE_STATE_COMMON);
|
m_efb.resolved_color_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_SHADER_RESOURCE, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, false, D3D12_RESOURCE_STATE_COMMON);
|
||||||
SAFE_RELEASE(buf12);
|
SAFE_RELEASE(buf12);
|
||||||
D3D::SetDebugObjectName12(m_efb.resolved_color_tex->GetTex12(), "EFB color resolve texture shader resource view");
|
D3D::SetDebugObjectName12(m_efb.resolved_color_tex->GetTex12(), "EFB color resolve texture shader resource view");
|
||||||
|
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R32_FLOAT, m_target_width, m_target_height, m_efb.slices, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R32_FLOAT, m_target_width, m_target_height, m_efb.slices, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET);
|
||||||
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&buf12));
|
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, nullptr, IID_PPV_ARGS(&buf12));
|
||||||
CHECK(hr == S_OK, "create EFB depth resolve texture (size: %dx%d; hr=%#x)", m_target_width, m_target_height, hr);
|
CHECK(hr == S_OK, "create EFB depth resolve texture (size: %dx%d; hr=%#x)", m_target_width, m_target_height, hr);
|
||||||
m_efb.resolved_depth_tex = new D3DTexture2D(buf12, (D3D11_BIND_FLAG)(D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE), DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, false, D3D12_RESOURCE_STATE_COMMON);
|
m_efb.resolved_depth_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, false, D3D12_RESOURCE_STATE_COMMON);
|
||||||
SAFE_RELEASE(buf12);
|
SAFE_RELEASE(buf12);
|
||||||
D3D::SetDebugObjectName12(m_efb.resolved_depth_tex->GetTex12(), "EFB depth resolve texture shader resource view");
|
D3D::SetDebugObjectName12(m_efb.resolved_depth_tex->GetTex12(), "EFB depth resolve texture shader resource view");
|
||||||
}
|
}
|
||||||
|
@ -155,8 +160,8 @@ void FramebufferManager::CopyToRealXFB(u32 xfbAddr, u32 fbStride, u32 fbHeight,
|
||||||
std::unique_ptr<XFBSourceBase> FramebufferManager::CreateXFBSource(unsigned int target_width, unsigned int target_height, unsigned int layers)
|
std::unique_ptr<XFBSourceBase> FramebufferManager::CreateXFBSource(unsigned int target_width, unsigned int target_height, unsigned int layers)
|
||||||
{
|
{
|
||||||
return std::make_unique<XFBSource>(D3DTexture2D::Create(target_width, target_height,
|
return std::make_unique<XFBSource>(D3DTexture2D::Create(target_width, target_height,
|
||||||
(D3D11_BIND_FLAG)(D3D11_BIND_RENDER_TARGET|D3D11_BIND_SHADER_RESOURCE),
|
TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_RENDER_TARGET,
|
||||||
D3D11_USAGE_DEFAULT, DXGI_FORMAT_R8G8B8A8_UNORM, 1, layers), layers);
|
DXGI_FORMAT_R8G8B8A8_UNORM, 1, layers), layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height)
|
void FramebufferManager::GetTargetSize(unsigned int* width, unsigned int* height)
|
||||||
|
@ -257,7 +262,7 @@ void FramebufferManager::InitializeEFBAccessCopies()
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, EFB_WIDTH, EFB_HEIGHT, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_TEXTURE_LAYOUT_UNKNOWN, 0);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, EFB_WIDTH, EFB_HEIGHT, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_TEXTURE_LAYOUT_UNKNOWN, 0);
|
||||||
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_color_clear_value, IID_PPV_ARGS(&buf12));
|
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_color_clear_value, IID_PPV_ARGS(&buf12));
|
||||||
CHECK(hr == S_OK, "create EFB access color resize buffer (hr=%#x)", hr);
|
CHECK(hr == S_OK, "create EFB access color resize buffer (hr=%#x)", hr);
|
||||||
m_efb.color_access_resize_tex = new D3DTexture2D(buf12, D3D11_BIND_RENDER_TARGET, DXGI_FORMAT_R8G8B8A8_UNORM);
|
m_efb.color_access_resize_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||||
D3D::SetDebugObjectName12(m_efb.color_access_resize_tex->GetTex12(), "EFB access color resize buffer");
|
D3D::SetDebugObjectName12(m_efb.color_access_resize_tex->GetTex12(), "EFB access color resize buffer");
|
||||||
buf12->Release();
|
buf12->Release();
|
||||||
|
|
||||||
|
@ -271,7 +276,7 @@ void FramebufferManager::InitializeEFBAccessCopies()
|
||||||
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R32_FLOAT, EFB_WIDTH, EFB_HEIGHT, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_TEXTURE_LAYOUT_UNKNOWN, 0);
|
texdesc12 = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R32_FLOAT, EFB_WIDTH, EFB_HEIGHT, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, D3D12_TEXTURE_LAYOUT_UNKNOWN, 0);
|
||||||
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_depth_clear_value, IID_PPV_ARGS(&buf12));
|
hr = D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &texdesc12, D3D12_RESOURCE_STATE_COMMON, &optimized_depth_clear_value, IID_PPV_ARGS(&buf12));
|
||||||
CHECK(hr == S_OK, "create EFB access depth resize buffer (hr=%#x)", hr);
|
CHECK(hr == S_OK, "create EFB access depth resize buffer (hr=%#x)", hr);
|
||||||
m_efb.depth_access_resize_tex = new D3DTexture2D(buf12, D3D11_BIND_RENDER_TARGET, DXGI_FORMAT_R32_FLOAT);
|
m_efb.depth_access_resize_tex = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_R32_FLOAT);
|
||||||
D3D::SetDebugObjectName12(m_efb.color_access_resize_tex->GetTex12(), "EFB access depth resize buffer");
|
D3D::SetDebugObjectName12(m_efb.color_access_resize_tex->GetTex12(), "EFB access depth resize buffer");
|
||||||
buf12->Release();
|
buf12->Release();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
private:
|
private:
|
||||||
struct ActiveQuery
|
struct ActiveQuery
|
||||||
{
|
{
|
||||||
ID3D11Query* query;
|
//ID3D11Query* query;
|
||||||
PerfQueryGroup query_type;
|
PerfQueryGroup query_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ Renderer::Renderer(void*& window_handle)
|
||||||
|
|
||||||
// Setup GX pipeline state
|
// Setup GX pipeline state
|
||||||
gx_state.blend.blend_enable = false;
|
gx_state.blend.blend_enable = false;
|
||||||
gx_state.blend.write_mask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
gx_state.blend.write_mask = D3D12_COLOR_WRITE_ENABLE_ALL;
|
||||||
gx_state.blend.src_blend = D3D12_BLEND_ONE;
|
gx_state.blend.src_blend = D3D12_BLEND_ONE;
|
||||||
gx_state.blend.dst_blend = D3D12_BLEND_ZERO;
|
gx_state.blend.dst_blend = D3D12_BLEND_ZERO;
|
||||||
gx_state.blend.blend_op = D3D12_BLEND_OP_ADD;
|
gx_state.blend.blend_op = D3D12_BLEND_OP_ADD;
|
||||||
|
|
|
@ -184,8 +184,8 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry
|
||||||
if (config.rendertarget)
|
if (config.rendertarget)
|
||||||
{
|
{
|
||||||
D3DTexture2D* texture = D3DTexture2D::Create(config.width, config.height,
|
D3DTexture2D* texture = D3DTexture2D::Create(config.width, config.height,
|
||||||
static_cast<D3D11_BIND_FLAG>((static_cast<int>(D3D11_BIND_RENDER_TARGET) | static_cast<int>(D3D11_BIND_SHADER_RESOURCE))),
|
TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_RENDER_TARGET,
|
||||||
D3D11_USAGE_DEFAULT, DXGI_FORMAT_R8G8B8A8_UNORM, 1, config.layers);
|
DXGI_FORMAT_R8G8B8A8_UNORM, 1, config.layers);
|
||||||
|
|
||||||
TCacheEntry* entry = new TCacheEntry(config, texture);
|
TCacheEntry* entry = new TCacheEntry(config, texture);
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry
|
||||||
|
|
||||||
D3DTexture2D* texture = new D3DTexture2D(
|
D3DTexture2D* texture = new D3DTexture2D(
|
||||||
texture_resource,
|
texture_resource,
|
||||||
D3D11_BIND_SHADER_RESOURCE,
|
TEXTURE_BIND_FLAG_SHADER_RESOURCE,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
DXGI_FORMAT_UNKNOWN,
|
DXGI_FORMAT_UNKNOWN,
|
||||||
|
|
|
@ -41,7 +41,7 @@ XFBEncoder::XFBEncoder()
|
||||||
IID_PPV_ARGS(&texture)));
|
IID_PPV_ARGS(&texture)));
|
||||||
|
|
||||||
m_yuyv_texture = new D3DTexture2D(texture,
|
m_yuyv_texture = new D3DTexture2D(texture,
|
||||||
(D3D11_BIND_FLAG)(D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET),
|
TEXTURE_BIND_FLAG_SHADER_RESOURCE | TEXTURE_BIND_FLAG_RENDER_TARGET,
|
||||||
DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM);
|
DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||||
SAFE_RELEASE(texture);
|
SAFE_RELEASE(texture);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue