Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D: Reset viewport before drawing the OSD. #497

Merged
merged 1 commit into from Jun 19, 2014

Conversation

CrossVR
Copy link
Contributor

@CrossVR CrossVR commented Jun 15, 2014

Previous code didn't reset the viewport before drawing the OSD, so the OSD was constrained to the target rectangle.

float scalex = 1 / (float)D3D::GetBackBufferWidth() * 2.f;
float scaley = 1 / (float)D3D::GetBackBufferHeight() * 2.f;
float scalex = 1 / (float)width * 2.f;
float scaley = 1 / (float)height * 2.f;

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@MayImilae
Copy link
Contributor

Pictures please!

@CrossVR
Copy link
Contributor Author

CrossVR commented Jun 16, 2014

@shuffle2
Copy link
Contributor

+1, this always annoyed me in d3d11 backend :)

@CrossVR
Copy link
Contributor Author

CrossVR commented Jun 16, 2014

The result is not the same as OpenGL yet, in OpenGL the OSD is positioned relative to the window instead of the target rectangle. However D3D has always positioned the OSD relative to the target rectangle, so I suggest we merge this PR to fix the current code before we try to improve it.

@@ -257,7 +257,9 @@ Renderer::~Renderer()

void Renderer::RenderText(const std::string& text, int left, int top, u32 color)
{
D3D::font.DrawTextScaled((float)left, (float)top, 20.f, 0.0f, color, text);
int Width = GetTargetRectangle().right - GetTargetRectangle().left;

This comment was marked as off-topic.

@CrossVR
Copy link
Contributor Author

CrossVR commented Jun 16, 2014

Comparing it to OpenGL it's become clear to me that the PR in it's current state is just fighting symptoms. I'm close to a different fix that matches the behaviour of OpenGL, please don't merge this yet.

What's happening is that D3D forgets to reset the viewport before drawing the OSD. OpenGL does that here: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoBackends/OGL/Render.cpp#L683

@CrossVR CrossVR changed the title D3D: Fix scaling of OSD. D3D: Reset viewport before drawing the OSD. Jun 16, 2014
@CrossVR
Copy link
Contributor Author

CrossVR commented Jun 16, 2014

Okay, now it's really fixed and acts the same as the OGL backend.

https://www.dropbox.com/s/7lui3rot5uwsx8i/Screenshot%202014-06-16%2023.37.01.png

@CrossVR
Copy link
Contributor Author

CrossVR commented Jun 17, 2014

I did a git blame and this is where the OSD was broken: d0f00ce#diff-8faba6592c6d673394e05ac51410dc79L928

The PR is ready for merge btw.

@lioncash
Copy link
Member

Looks good to me, for what it's worth.

neobrain added a commit that referenced this pull request Jun 19, 2014
D3D: Reset viewport before drawing the OSD.
@neobrain neobrain merged commit e642c8d into dolphin-emu:master Jun 19, 2014
@CrossVR CrossVR deleted the osd-scaling branch June 19, 2014 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants