mirror of https://github.com/RPCS3/rpcs3.git
d3d12: Fix indexed quad draw
We were not positionning the index buffer correctly in the heap.
This commit is contained in:
parent
82545a7b56
commit
e9fab57a0e
|
@ -320,9 +320,14 @@ std::pair<std::vector<D3D12_VERTEX_BUFFER_VIEW>, D3D12_INDEX_BUFFER_VIEW> D3D12G
|
||||||
{
|
{
|
||||||
D3D12_INDEX_BUFFER_VIEW indexBufferView = {};
|
D3D12_INDEX_BUFFER_VIEW indexBufferView = {};
|
||||||
size_t indexSize;
|
size_t indexSize;
|
||||||
|
|
||||||
|
if (!indexed_draw)
|
||||||
|
indexBufferView.Format = DXGI_FORMAT_R16_UINT;
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (m_indexed_array.m_type)
|
switch (m_indexed_array.m_type)
|
||||||
{
|
{
|
||||||
default: // If it's not indexed draw, use 16 bits unsigned short
|
default: abort();
|
||||||
case CELL_GCM_DRAW_INDEX_ARRAY_TYPE_16:
|
case CELL_GCM_DRAW_INDEX_ARRAY_TYPE_16:
|
||||||
indexBufferView.Format = DXGI_FORMAT_R16_UINT;
|
indexBufferView.Format = DXGI_FORMAT_R16_UINT;
|
||||||
indexSize = 2;
|
indexSize = 2;
|
||||||
|
@ -332,6 +337,7 @@ std::pair<std::vector<D3D12_VERTEX_BUFFER_VIEW>, D3D12_INDEX_BUFFER_VIEW> D3D12G
|
||||||
indexSize = 4;
|
indexSize = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (indexed_draw && !m_forcedIndexBuffer)
|
if (indexed_draw && !m_forcedIndexBuffer)
|
||||||
indexCount = m_indexed_array.m_data.size() / indexSize;
|
indexCount = m_indexed_array.m_data.size() / indexSize;
|
||||||
|
@ -347,7 +353,7 @@ std::pair<std::vector<D3D12_VERTEX_BUFFER_VIEW>, D3D12_INDEX_BUFFER_VIEW> D3D12G
|
||||||
ID3D12Resource *indexBuffer;
|
ID3D12Resource *indexBuffer;
|
||||||
check(m_device->CreatePlacedResource(
|
check(m_device->CreatePlacedResource(
|
||||||
getCurrentResourceStorage().m_vertexIndexBuffersHeap,
|
getCurrentResourceStorage().m_vertexIndexBuffersHeap,
|
||||||
D3D12_HEAP_FLAG_NONE,
|
bufferHeapOffset,
|
||||||
&getBufferResourceDesc(subBufferSize),
|
&getBufferResourceDesc(subBufferSize),
|
||||||
D3D12_RESOURCE_STATE_GENERIC_READ,
|
D3D12_RESOURCE_STATE_GENERIC_READ,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -393,9 +399,6 @@ std::pair<std::vector<D3D12_VERTEX_BUFFER_VIEW>, D3D12_INDEX_BUFFER_VIEW> D3D12G
|
||||||
indexBufferView.SizeInBytes = (UINT)subBufferSize;
|
indexBufferView.SizeInBytes = (UINT)subBufferSize;
|
||||||
indexBufferView.BufferLocation = indexBuffer->GetGPUVirtualAddress();
|
indexBufferView.BufferLocation = indexBuffer->GetGPUVirtualAddress();
|
||||||
|
|
||||||
if (m_forcedIndexBuffer)
|
|
||||||
indexBufferView.Format = DXGI_FORMAT_R16_UINT;
|
|
||||||
|
|
||||||
result.second = indexBufferView;
|
result.second = indexBufferView;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue