diff options
| author | Markus Wick <markus+github@selfnet.de> | 2015-05-08 16:00:11 +0200 |
|---|---|---|
| committer | Markus Wick <markus+github@selfnet.de> | 2015-05-08 16:00:11 +0200 |
| commit | 4c3984053d2317bd4801affed11c6d85dbd1962f (patch) | |
| tree | 53dd2df0e52603289140855cf8768a24ecde9231 /Source/Core/VideoBackends/OGL/Render.cpp | |
| parent | cb20589d7f64d07f751551695b45c100a1b9414d (diff) | |
| parent | a94e4dd07fe48a1c0cce16add3577b152f3cb9f4 (diff) | |
Merge pull request #2378 from lioncash/ogl
OGL: Minor changes in Render.cpp.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 1c0e3df4c2..5fe2711845 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -6,6 +6,7 @@ #include <cinttypes> #include <cmath> #include <cstdio> +#include <memory> #include <string> #include <vector> @@ -1002,8 +1003,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) { case PEEK_Z: { - u32 z; - if (!s_efbCacheValid[0][cacheRectIdx]) { if (s_MSAASamples > 1) @@ -1017,19 +1016,17 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) g_renderer->RestoreAPIState(); } - float* depthMap = new float[targetPixelRcWidth * targetPixelRcHeight]; + std::unique_ptr<float> depthMap(new float[targetPixelRcWidth * targetPixelRcHeight]); glReadPixels(targetPixelRc.left, targetPixelRc.bottom, targetPixelRcWidth, targetPixelRcHeight, - GL_DEPTH_COMPONENT, GL_FLOAT, depthMap); - - UpdateEFBCache(type, cacheRectIdx, efbPixelRc, targetPixelRc, depthMap); + GL_DEPTH_COMPONENT, GL_FLOAT, depthMap.get()); - delete[] depthMap; + UpdateEFBCache(type, cacheRectIdx, efbPixelRc, targetPixelRc, depthMap.get()); } u32 xRect = x % EFB_CACHE_RECT_SIZE; u32 yRect = y % EFB_CACHE_RECT_SIZE; - z = s_efbCache[0][cacheRectIdx][yRect * EFB_CACHE_RECT_SIZE + xRect]; + u32 z = s_efbCache[0][cacheRectIdx][yRect * EFB_CACHE_RECT_SIZE + xRect]; // if Z is in 16 bit format you must return a 16 bit integer if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16) @@ -1045,9 +1042,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // Tested in Killer 7, the first 8bits represent the alpha value which is used to // determine if we're aiming at an enemy (0x80 / 0x88) or not (0x70) // Wind Waker is also using it for the pictograph to determine the color of each pixel - - u32 color; - if (!s_efbCacheValid[1][cacheRectIdx]) { if (s_MSAASamples > 1) @@ -1061,24 +1055,22 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) g_renderer->RestoreAPIState(); } - u32* colorMap = new u32[targetPixelRcWidth * targetPixelRcHeight]; + std::unique_ptr<u32> colorMap(new u32[targetPixelRcWidth * targetPixelRcHeight]); if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3) // XXX: Swap colours glReadPixels(targetPixelRc.left, targetPixelRc.bottom, targetPixelRcWidth, targetPixelRcHeight, - GL_RGBA, GL_UNSIGNED_BYTE, colorMap); + GL_RGBA, GL_UNSIGNED_BYTE, colorMap.get()); else glReadPixels(targetPixelRc.left, targetPixelRc.bottom, targetPixelRcWidth, targetPixelRcHeight, - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, colorMap); - - UpdateEFBCache(type, cacheRectIdx, efbPixelRc, targetPixelRc, colorMap); + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, colorMap.get()); - delete[] colorMap; + UpdateEFBCache(type, cacheRectIdx, efbPixelRc, targetPixelRc, colorMap.get()); } u32 xRect = x % EFB_CACHE_RECT_SIZE; u32 yRect = y % EFB_CACHE_RECT_SIZE; - color = s_efbCache[1][cacheRectIdx][yRect * EFB_CACHE_RECT_SIZE + xRect]; + u32 color = s_efbCache[1][cacheRectIdx][yRect * EFB_CACHE_RECT_SIZE + xRect]; // check what to do with the alpha channel (GX_PokeAlphaRead) PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode(); |
