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

Switching between renderers #66

Closed
wants to merge 15 commits into from
Closed

Conversation

vklachkov
Copy link

@vklachkov vklachkov commented Sep 15, 2021

Description

Xash3D FWGS engine already has a mechanism for switching renderers via the r_refdll сvar. But now it's broken. The vulkan is not in the list, switching renderers causes glitches, and the window is not recreated.

Plan

In this PR, I want to fix the switching of renderers, as well as all related problems.

Behavior changing

The -ref option will override the r_refdll variable and after restarting the render will remain the same as the last time

Todo

Engine

  • Fix r_refdll
  • Recreate window if r_reddll changed
  • Reinitialize renderer
  • Reload all textures
  • Reinit studio models
  • Draw map after render changed

Refactoring

  • Call R_Free_Video out of renderer

Settings gui

  • Add vulkan renderer into the video modes menu
  • Add vulkan rtx flag into the video modes menu
  • Add note in the video modes settings
  • Do not change render before "apply" clicked

Refused todos

  • Fix fullscreen glitches
  • Fix resolution changes

Thats draft, switch is not working properly!

@w23
Copy link
Owner

w23 commented Sep 16, 2021

Switching between vk and any other renderer requires full window teardown and recreation with different SDL flags. I'm not entirely sure, but I suspect that this would require quite a bit of work on Xash3D engine side.

Can you check that VID_CreateWindow gets called when changing renderers?

@vklachkov
Copy link
Author

Switching between vk and any other renderer requires full window teardown and recreation with different SDL flags. I'm not entirely sure, but I suspect that this would require quite a bit of work on Xash3D engine side.

Can you check that VID_CreateWindow gets called when changing renderers?

The advice helped! To switch correctly, we need to recreate the window. With some hacks, it worked. Well... Almost

https://youtu.be/-FhE6jTWogY

@vklachkov
Copy link
Author

@w23 We may need your help and a lot of fixes to switch render correctly

@vklachkov
Copy link
Author

vklachkov commented Sep 19, 2021

At the moment, switching the renderer is working. But it has three problems that prevent from playing comfortably:

  • Broken textures in menu, console, hud
  • Broken model's textures
  • Broken textures on levels, until the level change occurs

VK renderer crashes are caused by problems with textures.
It seems that the initialization order is not correct or a function was missed somewhere

@vklachkov
Copy link
Author

Closed. After creating the texture manager, PR will be cleaned and re-opened in the parent repository

@vklachkov vklachkov closed this Sep 21, 2021
@vklachkov vklachkov mentioned this pull request Jan 14, 2022
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants