void RosUmdResource::Standup( RosUmdDevice *pUmdDevice, const D3D11DDIARG_CREATERESOURCE* pCreateResource, D3D10DDI_HRTRESOURCE hRTResource) { UNREFERENCED_PARAMETER(pUmdDevice); assert(m_signature == _SIGNATURE::CONSTRUCTED); m_resourceDimension = pCreateResource->ResourceDimension; m_mip0Info = *pCreateResource->pMipInfoList; m_usage = pCreateResource->Usage; m_bindFlags = pCreateResource->BindFlags; m_mapFlags = pCreateResource->MapFlags; m_miscFlags = pCreateResource->MiscFlags; m_format = pCreateResource->Format; m_sampleDesc = pCreateResource->SampleDesc; m_mipLevels = pCreateResource->MipLevels; m_arraySize = pCreateResource->ArraySize; if (pCreateResource->pPrimaryDesc) { assert( (pCreateResource->MiscFlags & D3DWDDM2_0DDI_RESOURCE_MISC_DISPLAYABLE_SURFACE) && (pCreateResource->BindFlags & D3D10_DDI_BIND_PRESENT) && (pCreateResource->pPrimaryDesc->ModeDesc.Width != 0)); m_isPrimary = true; m_primaryDesc = *pCreateResource->pPrimaryDesc; } else { m_isPrimary = false; ZeroMemory(&m_primaryDesc, sizeof(m_primaryDesc)); } CalculateMemoryLayout(); m_hRTResource = hRTResource; // Zero out internal state m_hKMResource = 0; m_hKMAllocation = 0; // Mark that the resource is not referenced by a command buffer (.i.e. null fence value) m_mostRecentFence = RosUmdCommandBuffer::s_nullFence; m_allocationListIndex = 0; m_pData = nullptr; m_pSysMemCopy = nullptr; m_signature = _SIGNATURE::INITIALIZED; }
void RosUmdResource::InitSharedResourceFromExistingAllocation ( const RosAllocationExchange* ExistingAllocationPtr, D3D10DDI_HKMRESOURCE hKMResource, D3DKMT_HANDLE hKMAllocation, // can this be a D3D10DDI_HKMALLOCATION? D3D10DDI_HRTRESOURCE hRTResource ) { assert(m_signature == _SIGNATURE::CONSTRUCTED); ROS_LOG_TRACE( "Opening existing resource. " "(ExistingAllocationPtr->m_hwWidth/HeightPixels = %u,%u " "ExistingAllocationPtr->m_hwSizeBytes = %u, " "ExistingAllocationPtr->m_isPrimary = %d, " "hRTResource = 0x%p, " "hKMResource= 0x%x, " "hKMAllocation = 0x%x)", ExistingAllocationPtr->m_hwWidthPixels, ExistingAllocationPtr->m_hwHeightPixels, ExistingAllocationPtr->m_hwSizeBytes, ExistingAllocationPtr->m_isPrimary, hRTResource.handle, hKMResource.handle, hKMAllocation); // copy members from the existing allocation into this object RosAllocationExchange* basePtr = this; *basePtr = *ExistingAllocationPtr; // HW specific information calculated based on the fields above CalculateMemoryLayout(); NT_ASSERT( (m_hwLayout == ExistingAllocationPtr->m_hwLayout) && (m_hwWidthPixels == ExistingAllocationPtr->m_hwWidthPixels) && (m_hwHeightPixels == ExistingAllocationPtr->m_hwHeightPixels) && (m_hwSizeBytes == ExistingAllocationPtr->m_hwSizeBytes)); m_hRTResource = hRTResource; m_hKMResource = hKMResource.handle; m_hKMAllocation = hKMAllocation; m_mostRecentFence = RosUmdCommandBuffer::s_nullFence; m_allocationListIndex = 0; m_pData = nullptr; m_pSysMemCopy = nullptr; m_signature = _SIGNATURE::INITIALIZED; }
void RosUmdResource::Standup( RosUmdDevice *pUmdDevice, const D3D11DDIARG_CREATERESOURCE* pCreateResource, D3D10DDI_HRTRESOURCE hRTResource) { UNREFERENCED_PARAMETER(pUmdDevice); m_resourceDimension = pCreateResource->ResourceDimension; m_mip0Info = *pCreateResource->pMipInfoList; m_usage = pCreateResource->Usage; m_bindFlags = pCreateResource->BindFlags; m_mapFlags = pCreateResource->MapFlags; m_miscFlags = pCreateResource->MiscFlags; m_format = pCreateResource->Format; m_sampleDesc = pCreateResource->SampleDesc; m_mipLevels = pCreateResource->MipLevels; m_arraySize = pCreateResource->ArraySize; if (pCreateResource->pPrimaryDesc) { m_primaryDesc = *pCreateResource->pPrimaryDesc; } else { ZeroMemory(&m_primaryDesc, sizeof(m_primaryDesc)); } CalculateMemoryLayout(); m_hRTResource = hRTResource; // Zero out internal state m_hKMResource = 0; m_hKMAllocation = 0; // Mark that the resource is not referenced by a command buffer (.i.e. null fence value) m_mostRecentFence = RosUmdCommandBuffer::s_nullFence; m_allocationListIndex = 0; }