mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
gedbg: Show scaled depth values properly.
This commit is contained in:
parent
b80c02c272
commit
6ef97f72d2
3 changed files with 8 additions and 2 deletions
|
@ -504,6 +504,10 @@ float ToScaledDepth(u16 z) {
|
|||
return z * (1.0f / depthSliceFactor) * (1.0f / 65535.0f) + (0.5f / depthSliceFactor);
|
||||
}
|
||||
|
||||
float FromScaledDepth(float z) {
|
||||
return (z - (0.5f / depthSliceFactor)) * depthSliceFactor * 65535.0f;
|
||||
}
|
||||
|
||||
float ToScaledDepthFromInteger(float z) {
|
||||
return z * (1.0f / depthSliceFactor) * (1.0f / 65535.0f) + (0.5f / depthSliceFactor);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ struct ViewportAndScissor {
|
|||
};
|
||||
void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, float renderHeight, int bufferWidth, int bufferHeight, ViewportAndScissor &out);
|
||||
float ToScaledDepth(u16 z);
|
||||
float FromScaledDepth(float z);
|
||||
|
||||
// These are common to all modern APIs and can be easily converted with a lookup table.
|
||||
enum class BlendFactor : uint8_t {
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "Windows/main.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include "GPU/Common/GPUStateUtils.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/Debugger/Breakpoints.h"
|
||||
#include "GPU/Debugger/Stepping.h"
|
||||
|
@ -398,7 +399,7 @@ void CGEDebugger::DescribePixel(u32 pix, GPUDebugBufferFormat fmt, int x, int y,
|
|||
|
||||
case GPU_DBG_FORMAT_24BIT_8X:
|
||||
// These are only ever going to be depth values, so let's also show scaled to 16 bit.
|
||||
_snwprintf(desc, 256, L"%d,%d: %d / %f / %f", x, y, pix & 0x00FFFFFF, (pix & 0x00FFFFFF) * (1.0f / 16777215.0f), (pix & 0x00FFFFFF) * (65535.0f / 16777215.0f));
|
||||
_snwprintf(desc, 256, L"%d,%d: %d / %f / %f", x, y, pix & 0x00FFFFFF, (pix & 0x00FFFFFF) * (1.0f / 16777215.0f), FromScaledDepth((pix & 0x00FFFFFF) * (1.0f / 16777215.0f)));
|
||||
break;
|
||||
|
||||
case GPU_DBG_FORMAT_24X_8BIT:
|
||||
|
@ -406,7 +407,7 @@ void CGEDebugger::DescribePixel(u32 pix, GPUDebugBufferFormat fmt, int x, int y,
|
|||
break;
|
||||
|
||||
case GPU_DBG_FORMAT_FLOAT:
|
||||
_snwprintf(desc, 256, L"%d,%d: %f / %f", x, y, *(float *)&pix, *(float *)&pix * 65535.0f);
|
||||
_snwprintf(desc, 256, L"%d,%d: %f / %f", x, y, *(float *)&pix, FromScaledDepth(*(float *)&pix));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue