[remove] OMSet Doubling

This commit is contained in:
kimnuri
2026-01-04 06:09:09 +09:00
parent 2a4fdec3ab
commit 6feda15560
3 changed files with 41 additions and 17 deletions
@@ -65,8 +65,6 @@ HRESULT CRenderTarget_Manager::Begin_MRT(const _wstring& strMultiRenderTargetKey
_uint iNumRenderTargets = { 0 };
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {};
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
if (nullptr != pDSV) {
m_pContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.f, 0);
}
@@ -97,8 +95,6 @@ HRESULT CRenderTarget_Manager::Begin_MRT_NonClear(const _wstring& strMultiRender
_uint iNumRenderTargets = { 0 };
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {};
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
if (nullptr != pDSV) {
m_pContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.f, 0);
}
@@ -127,8 +123,6 @@ HRESULT CRenderTarget_Manager::Begin_MRT_Include_BackBuffer(const _wstring& strM
_uint iNumRenderTargets = { 0 };
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {};
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
if (nullptr != pDSV) {
m_pContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.f, 0);
}
@@ -168,8 +162,6 @@ HRESULT CRenderTarget_Manager::Begin_MRT_NO_DepthStencil(const _wstring& strMRTT
_uint iNumRenderTargets = { 0 };
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {};
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
for (auto& pRenderTarget : *pMRTList)
{
pRenderTarget->Clear();
@@ -303,7 +295,6 @@ HRESULT CRenderTarget_Manager::Accumulate_RenderTarget(CVIBuffer_Rect* pVIBuffer
{ // Bind RTVs
_uint iNumRenderTargets = { 1 };
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = { pOutput->Get_RTV(), };
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
m_pContext->OMSetRenderTargets(iNumRenderTargets, pRenderTargetViews, nullptr);
}
@@ -400,7 +391,6 @@ HRESULT CRenderTarget_Manager::Refit_RenderTarget(CVIBuffer_Rect* pVIBuffer, CSh
{ // Bind RTVs
_uint iNumRenderTargets = { 1 };
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = { pOutput->Get_RTV(), };
m_pContext->OMSetRenderTargets(0, nullptr, nullptr);
m_pContext->OMSetRenderTargets(iNumRenderTargets, pRenderTargetViews, nullptr);
}
@@ -529,9 +519,9 @@ HRESULT CRenderTarget_Manager::Finish_RenderTarget(CVIBuffer_Rect* pVIBuffer, CS
HRESULT CRenderTarget_Manager::End_MRT()
{
ID3D11RenderTargetView* pRenderTargets[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = { m_pBackBufferRTV };
m_pContext->OMSetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, pRenderTargets, m_pOriginalDSV);
// 1개만 채워넣어도 나머지 언급되지 않은 7개 타겟들은 전부 null로 채워지는 기본동작을 함
// https://learn.microsoft.com/ko-kr/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-omsetrendertargets
m_pContext->OMSetRenderTargets(1, &m_pBackBufferRTV, m_pOriginalDSV);
SAFE_RELEASE(m_pBackBufferRTV);
SAFE_RELEASE(m_pOriginalDSV);
+36 -4
View File
@@ -98,21 +98,53 @@ HRESULT CShader::Bind_Matrices(const _char* pConstantName, const _float4x4* pMat
HRESULT CShader::Bind_SRV(const _char* pConstantName, ID3D11ShaderResourceView* pSRV)
{
SHADERVARIABLE* pTagVariable = Find_VariableByName(pConstantName);
if (nullptr == pTagVariable) {
if (nullptr == pTagVariable || nullptr == pTagVariable->pSRV){
return E_FAIL;
}
return pTagVariable->pSRV->SetResource(pSRV);
if (pSRV == pTagVariable->pBeforeBindedSRV){
return S_OK;
}
HRESULT hr = pTagVariable->pSRV->SetResource(pSRV);
if (SUCCEEDED(hr)){
pTagVariable->pBeforeBindedSRV = pSRV;
}
return hr;
}
HRESULT CShader::Bind_SRVs(const _char* pConstantName, ID3D11ShaderResourceView** ppSRV, _uint iNumSRVs)
{
SHADERVARIABLE* pTagVariable = Find_VariableByName(pConstantName);
if (nullptr == pTagVariable) {
if (nullptr == pTagVariable || nullptr == pTagVariable->pSRV){
return E_FAIL;
}
return pTagVariable->pSRV->SetResourceArray(ppSRV, 0, iNumSRVs);
if (iNumSRVs == 0){
return S_OK;
}
if (ppSRV == nullptr){
return E_INVALIDARG;
}
if (pTagVariable->beforeBindedSRVs.size() == iNumSRVs)
{
if (0 == memcmp(pTagVariable->beforeBindedSRVs.data(), ppSRV,
sizeof(ID3D11ShaderResourceView*) * iNumSRVs))
{
return S_OK;
}
}
HRESULT hr = pTagVariable->pSRV->SetResourceArray(ppSRV, 0, iNumSRVs);
if (SUCCEEDED(hr))
{
pTagVariable->beforeBindedSRVs.assign(ppSRV, ppSRV + iNumSRVs);
pTagVariable->pBeforeBindedSRV = ppSRV[0];
}
return hr;
}
HRESULT CShader::Bind_IntArray(const _char* pConstantName, const int* pData, _uint elementCount)
+2
View File
@@ -19,6 +19,8 @@ class ENGINE_DLL CShader final : public CComponent
ID3DX11EffectShaderResourceVariable* pSRV;
ID3DX11EffectSamplerVariable* pSampler;
};
ID3D11ShaderResourceView* pBeforeBindedSRV = nullptr;
vector<ID3D11ShaderResourceView*> beforeBindedSRVs;
}SHADERVARIABLE;
private: