1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 04:24:11 +01:00

[d3d11] Remove redundant D3D11Buffer::GetSize method

This commit is contained in:
Philip Rebohle 2018-11-02 15:43:46 +01:00
parent 851d9fb726
commit d5481ac013
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 10 additions and 14 deletions

View File

@ -64,11 +64,11 @@ namespace dxvk {
} }
DxvkBufferSlice GetBufferSlice() const { DxvkBufferSlice GetBufferSlice() const {
return DxvkBufferSlice(m_buffer, 0, m_buffer->info().size); return GetBufferSlice(0, m_desc.ByteWidth);
} }
DxvkBufferSlice GetBufferSlice(VkDeviceSize offset) const { DxvkBufferSlice GetBufferSlice(VkDeviceSize offset) const {
return DxvkBufferSlice(m_buffer, offset, m_buffer->info().size - offset); return GetBufferSlice(offset, m_desc.ByteWidth - offset);
} }
DxvkBufferSlice GetBufferSlice(VkDeviceSize offset, VkDeviceSize length) const { DxvkBufferSlice GetBufferSlice(VkDeviceSize offset, VkDeviceSize length) const {
@ -79,10 +79,6 @@ namespace dxvk {
return m_soCounter; return m_soCounter;
} }
VkDeviceSize GetSize() const {
return m_desc.ByteWidth;
}
DxvkPhysicalBufferSlice DiscardSlice() { DxvkPhysicalBufferSlice DiscardSlice() {
m_mapped = m_buffer->allocPhysicalSlice(); m_mapped = m_buffer->allocPhysicalSlice();
return m_mapped; return m_mapped;

View File

@ -3041,7 +3041,7 @@ namespace dxvk {
UINT constantOffset = 0; UINT constantOffset = 0;
UINT constantCount = newBuffer != nullptr UINT constantCount = newBuffer != nullptr
? newBuffer->GetSize() / 16 ? newBuffer->Desc()->ByteWidth / 16
: 0; : 0;
if (newBuffer != nullptr && pFirstConstant != nullptr && pNumConstants != nullptr) { if (newBuffer != nullptr && pFirstConstant != nullptr && pNumConstants != nullptr) {

View File

@ -167,8 +167,8 @@ namespace dxvk {
pMapEntry->pResource = pResource; pMapEntry->pResource = pResource;
pMapEntry->Subresource = 0; pMapEntry->Subresource = 0;
pMapEntry->MapType = D3D11_MAP_WRITE_DISCARD; pMapEntry->MapType = D3D11_MAP_WRITE_DISCARD;
pMapEntry->RowPitch = pBuffer->GetSize(); pMapEntry->RowPitch = pBuffer->Desc()->ByteWidth;
pMapEntry->DepthPitch = pBuffer->GetSize(); pMapEntry->DepthPitch = pBuffer->Desc()->ByteWidth;
if (pBuffer->Desc()->Usage == D3D11_USAGE_DYNAMIC && m_parent->GetOptions()->dcMapSpeedHack) { if (pBuffer->Desc()->Usage == D3D11_USAGE_DYNAMIC && m_parent->GetOptions()->dcMapSpeedHack) {
// For resources that cannot be written by the GPU, // For resources that cannot be written by the GPU,
@ -179,7 +179,7 @@ namespace dxvk {
} else { } else {
// For GPU-writable resources, we need a data slice // For GPU-writable resources, we need a data slice
// to perform the update operation at execution time. // to perform the update operation at execution time.
pMapEntry->DataSlice = AllocUpdateBufferSlice(pBuffer->GetSize()); pMapEntry->DataSlice = AllocUpdateBufferSlice(pBuffer->Desc()->ByteWidth);
pMapEntry->MapPointer = pMapEntry->DataSlice.ptr(); pMapEntry->MapPointer = pMapEntry->DataSlice.ptr();
} }

View File

@ -345,8 +345,8 @@ namespace dxvk {
// only way to invalidate a buffer is by mapping it. // only way to invalidate a buffer is by mapping it.
auto physicalSlice = pResource->DiscardSlice(); auto physicalSlice = pResource->DiscardSlice();
pMappedResource->pData = physicalSlice.mapPtr(0); pMappedResource->pData = physicalSlice.mapPtr(0);
pMappedResource->RowPitch = pResource->GetSize(); pMappedResource->RowPitch = pResource->Desc()->ByteWidth;
pMappedResource->DepthPitch = pResource->GetSize(); pMappedResource->DepthPitch = pResource->Desc()->ByteWidth;
EmitCs([ EmitCs([
cBuffer = std::move(buffer), cBuffer = std::move(buffer),
@ -369,8 +369,8 @@ namespace dxvk {
DxvkPhysicalBufferSlice physicalSlice = pResource->GetMappedSlice(); DxvkPhysicalBufferSlice physicalSlice = pResource->GetMappedSlice();
pMappedResource->pData = physicalSlice.mapPtr(0); pMappedResource->pData = physicalSlice.mapPtr(0);
pMappedResource->RowPitch = pResource->GetSize(); pMappedResource->RowPitch = pResource->Desc()->ByteWidth;
pMappedResource->DepthPitch = pResource->GetSize(); pMappedResource->DepthPitch = pResource->Desc()->ByteWidth;
return S_OK; return S_OK;
} }
} }