diff --git a/Windows_Libs/Dev/Render/RendererCore.cpp b/Windows_Libs/Dev/Render/RendererCore.cpp index be321d5..b50af4b 100644 --- a/Windows_Libs/Dev/Render/RendererCore.cpp +++ b/Windows_Libs/Dev/Render/RendererCore.cpp @@ -29,7 +29,7 @@ SOFTWARE. Renderer InternalRenderManager; DWORD Renderer::tlsIdx = TlsAlloc(); -_RTL_CRITICAL_SECTION Renderer::totalAllocCS; +_RTL_CRITICAL_SECTION Renderer::totalAllocCS = {}; DWORD Renderer::s_auiWidths[] = { 1920, 512, 256, 128, 64, 0 }; DWORD Renderer::s_auiHeights[] = { 1080, 512, 256, 128, 64 }; @@ -540,6 +540,8 @@ void Renderer::Initialise(ID3D11Device *pDevice, IDXGISwapChain *pSwapChain) fanIndexData.pSysMem = fanIndices; m_pDevice->CreateBuffer(&fanIndexDesc, &fanIndexData, &fanIndexBuffer); delete[] fanIndices; + + InitializeCriticalSection(&Renderer::totalAllocCS); } ID3D11DeviceContext *Renderer::InitialiseContext(bool fromPresent) diff --git a/Windows_Libs/Dev/Render/RendererTexture.cpp b/Windows_Libs/Dev/Render/RendererTexture.cpp index 90920a6..f14b6a4 100644 --- a/Windows_Libs/Dev/Render/RendererTexture.cpp +++ b/Windows_Libs/Dev/Render/RendererTexture.cpp @@ -30,7 +30,7 @@ unsigned char* dataStart; unsigned char *dataCurr; unsigned char *dataEnd; -DXGI_FORMAT Renderer::textureFormats[] = { DXGI_FORMAT_R8G8B8A8_UNORM }; +DXGI_FORMAT Renderer::textureFormats[] = { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN }; void user_write_data_init(unsigned char* pBuffer, int size) { @@ -264,7 +264,7 @@ HRESULT Renderer::LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcIn //if ((image.format & 3u) > 1) // return -1; - image.format = PNG_FORMAT_RGBA; + image.format = PNG_FORMAT_BGRA; *ppDataOut = new int[image.width * image.height]; if (!*ppDataOut || !png_image_finish_read(&image, NULL, *ppDataOut, 0, NULL)) @@ -289,7 +289,7 @@ HRESULT Renderer::LoadTextureData(BYTE* pbData, DWORD dwBytes, D3DXIMAGE_INFO* p //if ((image.format & 3u) > 1) // return -1; - image.format = PNG_FORMAT_RGBA; + image.format = PNG_FORMAT_BGRA; *ppDataOut = new int[image.width * image.height]; if (!*ppDataOut || !png_image_finish_read(&image, NULL, *ppDataOut, 0, NULL)) @@ -308,7 +308,7 @@ HRESULT Renderer::SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcIn image.width = pSrcInfo->Width; image.height = pSrcInfo->Height; image.version = PNG_IMAGE_VERSION; - image.format = PNG_FORMAT_RGBA; + image.format = PNG_FORMAT_BGRA; png_image_write_to_file(&image, szFilename, 0, ppDataOut, 0, NULL); return S_OK; @@ -322,7 +322,7 @@ HRESULT Renderer::SaveTextureDataToMemory(void* pOutput, int outputCapacity, int image.width = width; image.height = height; image.version = PNG_IMAGE_VERSION; - image.format = PNG_FORMAT_RGBA; + image.format = PNG_FORMAT_BGRA; dataEnd = (BYTE*)pOutput + outputCapacity; dataStart = (BYTE*)pOutput;