changeset 5708:51df0f4050ad

RT-34231: FX3D doesn't work with DirectX debug runtime Reviewed-by: kcr, ckyang
author vadim
date Wed, 13 Nov 2013 20:52:18 +0400
parents 5aeba5429cb4
children 0940705ce7f4
files modules/graphics/src/main/native-prism-d3d/D3DMesh.cc
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-prism-d3d/D3DMesh.cc	Wed Nov 13 19:00:01 2013 +0400
+++ b/modules/graphics/src/main/native-prism-d3d/D3DMesh.cc	Wed Nov 13 20:52:18 2013 +0400
@@ -105,14 +105,15 @@
 //            << ", indexBufferSize = " << ibSize << endl;
 
     IDirect3DDevice9 *device = context->Get3DDevice();
-    UINT size = vbSize * sizeof (float);
+    UINT size = vbSize * sizeof (float); // in bytes
+    UINT vbCount = size / PRIMITIVE_VERTEX_SIZE; // in vertices
     HRESULT result = D3D_OK;
 
-    if (numVertices != vbSize) {
+    if (numVertices != vbCount) {
         releaseVertexBuffer();
         result = device->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, fvf,
                 D3DPOOL_DEFAULT, &vertexBuffer, NULL);
-        numVertices = vbSize;
+        numVertices = vbCount;
     }
 
     if (SUCCEEDED(result) && (vertexBuffer != NULL)) {
@@ -151,14 +152,15 @@
 //            << ", indexBufferSize = " << ibSize << endl;
 
     IDirect3DDevice9 *device = context->Get3DDevice();
-    UINT size = vbSize * sizeof (float);
+    UINT size = vbSize * sizeof (float); // in bytes
+    UINT vbCount = size / PRIMITIVE_VERTEX_SIZE; // in vertices
     HRESULT result = D3D_OK;
 
-    if (numVertices != vbSize) {
+    if (numVertices != vbCount) {
         releaseVertexBuffer();
         result = device->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, fvf,
                 D3DPOOL_DEFAULT, &vertexBuffer, NULL);
-        numVertices = vbSize;
+        numVertices = vbCount;
     }
 
     if (SUCCEEDED(result) && (vertexBuffer != NULL)) {