Skip to content

Conversation

SirDifferential
Copy link
Contributor

This pull request optimizes OpenGL depth packet processor by reducing the CPU time of downloadToNewFrame(). In the old system textures arrive from the graphics card upside down and they are flipped on the CPU. This pull request adds some tweaks that skip the flipping on CPU and instead parses the texture coordinates as flipped in the first place.

Very Sleepy profiler output before optimization
Very Sleepy profiler output after optimization

If there are issues with this PR, please let me know.

ivec2 uv = ivec2(TexCoord.x, TexCoord.y);
ivec2 uv_flip = ivec2(TexCoord.x, 423 - TexCoord.y);

bool valid_pixel = 0.0 < texelFetch(ZTable, uv).x;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv_flip missing here?

@SirDifferential
Copy link
Contributor Author

SirDifferential commented Sep 10, 2016

christiankerl: Yes, I think so. There's also a couple in stage2.fs I did some initial tests and spent a while reading what the Z and X tables do, and it indeed seems like they need to be read using the flipped coordinates as well.

However, I also noticed an odd black region in the image that appears every 30 frames or so. I'd say hold this PR for now until I can investigate more.

@SirDifferential
Copy link
Contributor Author

SirDifferential commented Sep 12, 2016

Er, I accidentally pushed my Intel media SDK changes in the master branch. I'll see if I can fix this somehow and remove them from this PR.

EDIT: I'll make a new PR after I fix the issues. I moved my commits to a new branch, so this PR automatically closed.

@xlz
Copy link
Member

xlz commented Sep 12, 2016

While you're at it, can you make it an option to flip the image so existing users would not get unexpected results? You can leave the option variable internal, or setting it from an environment variable, so we can expose this option later through the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants