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

Add None WSI #3365

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add None WSI #3365

wants to merge 3 commits into from

Conversation

expipiplus1
Copy link
Contributor

@expipiplus1 expipiplus1 commented Apr 19, 2023

This, of course, is unable to create windows.

TODO:

  • VK_EXT_headless surface support? (I think this could be a separate PR if desired)
  • Testing
  • Does this violate assumptions elsewhere? (Nothing that doesn't require createSurface succeeding first)

src/wsi/meson.build Outdated Show resolved Hide resolved
@expipiplus1
Copy link
Contributor Author

I couldn't find any tests or builds for the non-windows wsi. Do these exist somewhere I've not checked?

@pchome
Copy link
Contributor

pchome commented Apr 22, 2023

idk,

#define DXVK_WSI_NONE 1
#include <d3d11.h>
#include <cstdio>

int main(int argc, char** argv) {
  ID3D11Device* device;
  ID3D11DeviceContext* ctx;
  D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_11_1;
  D3D_FEATURE_LEVEL level2 = D3D_FEATURE_LEVEL_11_1;
  HRESULT hr = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, &level, 1, D3D11_SDK_VERSION, &device, &level2, &ctx);

  if (FAILED(hr)) {
    printf("ko\n");
    return 1;
  }

  // TODO: do something
  // ...
  ctx->Flush();

  printf("done\n");
  return 0;
}

Run
DXVK_LOG_LEVEL=debug DXVK_LOG_PATH=none ./native_test_wsi_none

Output

info:  Game: native_test_wsi_none
info:  DXVK: v2.1
info:  Vulkan: Found vkGetInstanceProcAddr in libvulkan.so @ 0x7f009c8bb920
info:  Built-in extension providers:
info:    No WSI
...

@expipiplus1
Copy link
Contributor Author

@pchome sure, writing such a test isn't hard, but there doesn't seem to be any infrastructure from which to call the test.

@Joshua-Ashton
Copy link
Collaborator

I did have some tests at one point -- but currently unmerged. I think they are in the sample branch.

@expipiplus1
Copy link
Contributor Author

in that case, if there aren't tests for the less-trivial glfw and sdl2 paths in main, perhaps it's ok to defer tests here?

@Joshua-Ashton
Copy link
Collaborator

Yeah sure.

Should probably hook up headless surface though.

@expipiplus1
Copy link
Contributor Author

ok, I've put a call to vkCreateHeadlessSurfaceEXT in there.

@expipiplus1 expipiplus1 force-pushed the wsi-none branch 2 times, most recently from 190a574 to a4a6cbe Compare July 30, 2023 02:45
@expipiplus1
Copy link
Contributor Author

@Joshua-Ashton is this good to merge?

@expipiplus1
Copy link
Contributor Author

FWIW in terms of "testing", I've been using this since april without issue.

@flibitijibibo
Copy link
Contributor

@expipiplus1, do you have time to review the conversation in #3451 to see how this MR would best fit into an "official" WSI system for dxvk? Once we have a working system it should be easy to include a None implementation as part of that work.

@expipiplus1
Copy link
Contributor Author

@flibitijibibo It looks as though it would fit in with the API @Joshua-Ashton proposed there. As long as nothing requires getting a window or monitor then it's all fine. CreateSurface here just ignores the window parameter.

I would be keen to get this merged, and can commit to porting it to the IDXVKWsi when it lands.

@flibitijibibo
Copy link
Contributor

That makes sense to me - the absolute earliest I'll be able to look at DxvkWsi is December (if that; SDL_ActionSet work starts January so it's a tiny window), so this should probably go in first so that the implementer knows for sure that all backends still work correctly.

@flibitijibibo
Copy link
Contributor

The dynamic WSI patch series can now be found at #3738. Definitely give this a try whenever you have time; it's mostly the same at the backend level but with a C++ interface to allow for multiple simultaneous implementations in the official binary.

@flibitijibibo
Copy link
Contributor

This got stepped on by #3738, but the good news is that this should now be possible to support in the same binary as SDL/GLFW.

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.

None yet

4 participants