1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d8] Clamp BaseVertexIndex to INT_MAX during use

This commit is contained in:
WinterSnowfall 2024-08-31 21:10:01 +03:00 committed by Robin Kertels
parent d0ea5a4a87
commit 2c23e462b3
2 changed files with 6 additions and 3 deletions

View File

@ -1168,7 +1168,7 @@ namespace dxvk {
UINT PrimitiveCount) {
return GetD3D9()->DrawIndexedPrimitive(
d3d9::D3DPRIMITIVETYPE(PrimitiveType),
m_baseVertexIndex, // set by SetIndices
static_cast<INT>(std::min(m_baseVertexIndex, static_cast<UINT>(INT_MAX))), // set by SetIndices
MinVertexIndex,
NumVertices,
StartIndex,
@ -1292,8 +1292,11 @@ namespace dxvk {
if (unlikely(ShouldRecord()))
return m_recorder->SetIndices(pIndexData, BaseVertexIndex);
if (unlikely(BaseVertexIndex > INT_MAX))
Logger::warn("BaseVertexIndex exceeds INT_MAX and will be clamped on use.");
// used by DrawIndexedPrimitive
m_baseVertexIndex = static_cast<INT>(BaseVertexIndex);
m_baseVertexIndex = BaseVertexIndex;
D3D8IndexBuffer* buffer = static_cast<D3D8IndexBuffer*>(pIndexData);

View File

@ -432,7 +432,7 @@ namespace dxvk {
std::array<D3D8VBO, d8caps::MAX_STREAMS> m_streams;
Com<D3D8IndexBuffer, false> m_indices;
INT m_baseVertexIndex = 0;
UINT m_baseVertexIndex = 0;
// TODO: Which of these should be a private ref
std::vector<Com<D3D8Surface, false>> m_backBuffers;