-_indexDataSize(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, D3DFORMAT IndexDataFormat) {
- UINT IndexStride;
- switch (IndexDataFormat) {
- case D3DFMT_INDEX16:
- IndexStride = 2;
- break;
- case D3DFMT_INDEX32:
- IndexStride = 4;
- break;
- default:
- os::log("apitrace: warning: %s: unexpected index D3DFORMAT %u\n", __FUNCTION__, IndexDataFormat);
- return 0;
- }
- return _vertexCount(PrimitiveType, PrimitiveCount) * IndexStride;
-}
-
-
-#if DIRECT3D_VERSION >= 0x0800
-
-/*
- * Return the number of tokens for a given shader.
- */
-static inline size_t
-_shaderSize(const DWORD *pFunction)
-{
- DWORD dwLength = 0;
-
- while (true) {
- DWORD dwToken = pFunction[dwLength++];
-
- switch (dwToken & D3DSI_OPCODE_MASK) {
- case D3DSIO_COMMENT:
- dwLength += (dwToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
- break;
-
- case D3DSIO_END:
- if (dwToken != D3DSIO_END) {
- os::log("apitrace: warning: %s: malformed END token\n", __FUNCTION__);
- }
- return dwLength * sizeof *pFunction;
- }
- }
-}
-
-
-static size_t
-_getLockSize(D3DFORMAT Format, UINT Width, UINT Height, INT RowPitch, UINT Depth = 1, INT SlicePitch = 0) {
- if (Width == 0 || Height == 0 || Depth == 0) {
- return 0;