-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize value conversion in (unused) depth readback.
This also exposes factors we can feed into shaders to do the conversion on the GPU.
- Loading branch information
Showing
5 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,7 @@ void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int | |
|
||
int totalPixels = h == 1 ? packWidth : vfb->z_stride * h; | ||
if (format16Bit) { | ||
// TODO: We have to apply GetDepthScaleFactors here too, right? | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
unknownbrackets
Collaborator
|
||
for (int yp = 0; yp < h; ++yp) { | ||
int row_offset = vfb->z_stride * yp; | ||
for (int xp = 0; xp < packWidth; ++xp) { | ||
|
@@ -177,11 +178,13 @@ void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int | |
} | ||
} | ||
} else { | ||
// TODO: Apply this in the shader. | ||
DepthScaleFactors depthScale = GetDepthScaleFactors(); | ||
for (int yp = 0; yp < h; ++yp) { | ||
int row_offset = vfb->z_stride * yp; | ||
for (int xp = 0; xp < packWidth; ++xp) { | ||
const int i = row_offset + xp; | ||
float scaled = FromScaledDepth(packedf[i]); | ||
float scaled = depthScale.Apply(packedf[i]); | ||
if (scaled <= 0.0f) { | ||
depth[i] = 0; | ||
} else if (scaled >= 65535.0f) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No, see u_depthDownloadFactor. This path means we went through the shader.
We don't actually use any shader at all in the other path, which is why the factor is applied on the CPU.
-[Unknown]