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

Graphics backend enhancements etc. #163

Merged
merged 3 commits into from
Apr 18, 2022

Conversation

Emill
Copy link
Contributor

@Emill Emill commented Apr 12, 2022

This change simplifies and unifies how the framebuffers concept is implemented in the different gfx backends.

This allows SSAA, MSAA and N64 mode to be implemented by both the OpenGL and Direct3D 11 backends in the same way. The ImGUI gui has been updated accordingly.

When rendering for unscaled resolution, the OpenGL renderer now renders directly to the back buffer instead of to a texture which is then rendered to the back buffer, in order to save some performance.

The glClipControl usage is now removed and the y flipping has been moved to software. This should only result in a tiny performance decrease but will allow framebuffers to not be rendered upside-down on old hardware/drivers. It should also remove the need to use GLEW on Linux.

Another huge improvement that drastically reduces CPU% and GPU% in Kokiri forest is the batching of all read depth value calls to a single one, to avoid ping-ponging the GPU for every pixel that should be read (11 in Kokiri Forest and 26 in that grotto outside Shadow Temple). The OpenGL renderer now also avoids a read pixel "slow path" when the Intel driver was used that made it slower at higher resolutions.

I also moved audio to a separate thread, so it can be parallelized with the gfx rendering. It's still synchronized to the game though so the audio thread never does any job while the game logic runs. This also avoids the audio to drift in case the game or graphics would lag, which might be important in cutscenes.

@Emill Emill requested review from Kenix3 and KiritoDv April 13, 2022 21:39
@@ -256,29 +248,29 @@ namespace SohImGui {
}
}

void Draw() {

void Draw1() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should change this to something more recognizable like RenderMenu and RenderFramebuffer for Draw2

@@ -1007,7 +1007,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6
return held;
}

void ImGui::ImageRotated(ImTextureID tex_id, ImVec2 center, ImVec2 size, float angle) {
void ImGui::ImageSimple(ImTextureID tex_id, ImVec2 center, ImVec2 size) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this function and change it to ImGui::Image

ImGui::Text("Internal Resolution:");
ImGui::SliderInt("Mul", reinterpret_cast<int*>(&gfx_current_dimensions.internal_mul), 1, 8);
}
ImGui::Text("Internal Resolution:");
Copy link
Contributor

Choose a reason for hiding this comment

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

This was my fault, but it would be cool if you move this into a Graphics category on the menubar

@Emill Emill requested a review from KiritoDv April 14, 2022 20:36
@Emill Emill merged commit ceef4a9 into HarbourMasters:develop Apr 18, 2022
PurpleHato pushed a commit to PurpleHato/Shipwright that referenced this pull request Jun 23, 2022
Kenix3 pushed a commit to Kenix3/Shipwright that referenced this pull request Oct 19, 2022
Malkierian pushed a commit to Malkierian/Shipwright that referenced this pull request Nov 20, 2023
Malkierian pushed a commit to Malkierian/Shipwright that referenced this pull request Nov 20, 2023
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