WinRT: removed code that unnecessarily set a blank D3D 11.1 texture's contents
authorDavid Ludwig <dludwig@pobox.com>
Sun, 31 Mar 2013 11:44:50 -0400
changeset 8452 a16533caf2b4
parent 8451 092ea651523a
child 8453 499aa167ea79
WinRT: removed code that unnecessarily set a blank D3D 11.1 texture's contents
src/render/direct3d11/SDL_render_d3d11.cpp
--- a/src/render/direct3d11/SDL_render_d3d11.cpp	Sun Mar 31 11:16:31 2013 -0400
+++ b/src/render/direct3d11/SDL_render_d3d11.cpp	Sun Mar 31 11:44:50 2013 -0400
@@ -836,8 +836,6 @@
 
     texture->driverdata = textureData;
 
-    const int pixelSizeInBytes = textureData->pixelFormat->BytesPerPixel;
-
     D3D11_TEXTURE2D_DESC textureDesc = {0};
     textureDesc.Width = texture->w;
     textureDesc.Height = texture->h;
@@ -851,24 +849,26 @@
     textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
     textureDesc.MiscFlags = 0;
 
-    const int numPixels = textureDesc.Width * textureDesc.Height;
-    std::vector<uint8> initialTexturePixels(numPixels * pixelSizeInBytes, 0x00);
-
+#if 0
     // Fill the texture with a non-black color, for debugging purposes:
-    //for (int i = 0; i < (numPixels * pixelSizeInBytes); i += pixelSizeInBytes) {
-    //    initialTexturePixels[i+0] = 0xff;
-    //    initialTexturePixels[i+1] = 0xff;
-    //    initialTexturePixels[i+2] = 0x00;
-    //    initialTexturePixels[i+3] = 0xff;
-    //}
-
+    const int numPixels = textureDesc.Width * textureDesc.Height;
+    const int pixelSizeInBytes = textureData->pixelFormat->BytesPerPixel;
+    std::vector<uint8> initialTexturePixels(numPixels * pixelSizeInBytes, 0x00);
+    for (int i = 0; i < (numPixels * pixelSizeInBytes); i += pixelSizeInBytes) {
+        initialTexturePixels[i+0] = 0xff;
+        initialTexturePixels[i+1] = 0xff;
+        initialTexturePixels[i+2] = 0x00;
+        initialTexturePixels[i+3] = 0xff;
+    }
     D3D11_SUBRESOURCE_DATA initialTextureData = {0};
     initialTextureData.pSysMem = (void *)&(initialTexturePixels[0]);
     initialTextureData.SysMemPitch = textureDesc.Width * pixelSizeInBytes;
     initialTextureData.SysMemSlicePitch = numPixels * pixelSizeInBytes;
+#endif
+
     result = rendererData->d3dDevice->CreateTexture2D(
         &textureDesc,
-        &initialTextureData,
+        NULL,   // &initialTextureData,
         &textureData->mainTexture
         );
     if (FAILED(result)) {