[add] MB Spread

This commit is contained in:
kimnuri
2025-12-21 11:41:48 +09:00
parent 25f3eef86a
commit dc5b8dbe00
19 changed files with 131 additions and 26 deletions
+29 -8
View File
@@ -1503,7 +1503,13 @@ HRESULT CModel::Create_BoneMatrixVB()
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
HRESULT hr = m_pDevice->CreateBuffer(&desc, nullptr, &m_pBoneMatrixBuffer);
if (FAILED(hr)) {
return E_FAIL;
}
hr = m_pDevice->CreateBuffer(&desc, nullptr, &m_pPrevBoneMatrixBuffer);
if (FAILED(hr)) {
return E_FAIL;
}
D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc{};
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
@@ -1511,11 +1517,9 @@ HRESULT CModel::Create_BoneMatrixVB()
uavDesc.Buffer.FirstElement = 0;
uavDesc.Buffer.NumElements = (_uint)m_Bones.size();
m_pDevice->CreateUnorderedAccessView(
m_pBoneMatrixBuffer,
&uavDesc,
&m_pBoneMatrixUAV
);
if(FAILED(m_pDevice->CreateUnorderedAccessView(m_pBoneMatrixBuffer, &uavDesc, &m_pBoneMatrixUAV))){
return E_FAIL;
}
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc1 = {};
srvDesc1.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
@@ -1523,8 +1527,13 @@ HRESULT CModel::Create_BoneMatrixVB()
srvDesc1.Buffer.FirstElement = 0;
srvDesc1.Buffer.NumElements = (_uint)m_Bones.size();
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneMatrixBuffer, &srvDesc1, &m_pBoneMatrixSRV)))
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneMatrixBuffer, &srvDesc1, &m_pBoneMatrixSRV))){
return E_FAIL;
}
if (FAILED(m_pDevice->CreateShaderResourceView(m_pPrevBoneMatrixBuffer, &srvDesc1, &m_pPrevBoneMatrixSRV))){
return E_FAIL;
}
return S_OK;
@@ -1619,6 +1628,9 @@ HRESULT CModel::Create_Local()
void CModel::ComputeAnimation(_uint AnimIndex,_uint MeshIndex)
{
// MotionBlurr용 버퍼 카피
m_pContext->CopyResource(m_pPrevBoneMatrixBuffer, m_pBoneMatrixBuffer);
ComputeLocal(AnimIndex,MeshIndex);
if (m_pComputeShader == nullptr)
@@ -1754,6 +1766,13 @@ void CModel::Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex)
&m_pBoneMatrixSRV);
}
void CModel::Bind_OutPut_SRV_VS_Prev(_uint iIndex, _uint iBufferIndex)
{
m_pContext->VSSetShaderResources(iIndex,
1, // 버퍼 개수
&m_pPrevBoneMatrixSRV);
}
#ifdef _DEBUG
HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix, _uint iLevel)
@@ -2328,10 +2347,12 @@ void CModel::Free()
SAFE_RELEASE(m_pParentBuffer);
SAFE_RELEASE(m_pBoneLocalBuffer);
SAFE_RELEASE(m_pBoneMatrixBuffer);
SAFE_RELEASE(m_pPrevBoneMatrixBuffer);
SAFE_RELEASE(m_pLocalMatrixBuffer);
SAFE_RELEASE(m_pParentSRV);
SAFE_RELEASE(m_pParentSRV);
SAFE_RELEASE(m_pBoneLocalSRV);
SAFE_RELEASE(m_pBoneMatrixSRV);
SAFE_RELEASE(m_pPrevBoneMatrixSRV);
SAFE_RELEASE(m_pBoneMatrixUAV);
SAFE_RELEASE(m_pLocalMatrixSRV);
SAFE_RELEASE(m_pLocalMatrixUAV);