Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WinRT: removed code that unnecessarily set a blank D3D 11.1 texture's…
Browse files Browse the repository at this point in the history
… contents
  • Loading branch information
DavidLudwig committed Mar 31, 2013
1 parent ecb925d commit dc87662
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/render/direct3d11/SDL_render_d3d11.cpp
Expand Up @@ -836,8 +836,6 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)

texture->driverdata = textureData;

const int pixelSizeInBytes = textureData->pixelFormat->BytesPerPixel;

D3D11_TEXTURE2D_DESC textureDesc = {0};
textureDesc.Width = texture->w;
textureDesc.Height = texture->h;
Expand All @@ -851,24 +849,26 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
textureDesc.MiscFlags = 0;

#if 0
// Fill the texture with a non-black color, for debugging purposes:
const int numPixels = textureDesc.Width * textureDesc.Height;
const int pixelSizeInBytes = textureData->pixelFormat->BytesPerPixel;
std::vector<uint8> initialTexturePixels(numPixels * pixelSizeInBytes, 0x00);

// 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;
//}

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)) {
Expand Down

0 comments on commit dc87662

Please sign in to comment.