From 7418bc861f6a73faaeb0ca0e78638e633aee607f Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 30 Oct 2015 23:05:43 +0000 Subject: ddrawtrace: Fix calculation of FVF texture coord size. --- helpers/d3d7size.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'helpers') diff --git a/helpers/d3d7size.hpp b/helpers/d3d7size.hpp index 1d96cda6..5d0f6204 100644 --- a/helpers/d3d7size.hpp +++ b/helpers/d3d7size.hpp @@ -92,7 +92,20 @@ _getVertexSize(DWORD dwFVF) { for (DWORD CoordIndex = 0; CoordIndex < dwNumTextures; ++CoordIndex) { // See D3DFVF_TEXCOORDSIZE* DWORD dwTexCoordSize = (dwFVF >> (CoordIndex*2 + 16)) & 3; - size += dwTexCoordSize * sizeof(FLOAT); + switch (dwTexCoordSize) { + case D3DFVF_TEXTUREFORMAT2: + size += 2 * sizeof(FLOAT); + break; + case D3DFVF_TEXTUREFORMAT1: + size += 1 * sizeof(FLOAT); + break; + case D3DFVF_TEXTUREFORMAT3: + size += 3 * sizeof(FLOAT); + break; + case D3DFVF_TEXTUREFORMAT4: + size += 4 * sizeof(FLOAT); + break; + } } assert((dwFVF & D3DFVF_RESERVED2) == 0); -- cgit v1.2.3