Trying to fix no available video device :(
This commit is contained in:
parent
cbd4b0f0e9
commit
5a1a85885a
4 changed files with 78 additions and 4 deletions
52
flake.lock
52
flake.lock
|
|
@ -1,6 +1,55 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659877975,
|
||||||
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixgl": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1713543440,
|
||||||
|
"narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixGL",
|
||||||
|
"rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixGL",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1660551188,
|
||||||
|
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744463964,
|
"lastModified": 1744463964,
|
||||||
"narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=",
|
"narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=",
|
||||||
|
|
@ -18,7 +67,8 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixgl": "nixgl",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,16 @@
|
||||||
description = "Development Environment";
|
description = "Development Environment";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
nixgl.url = "github:nix-community/nixGL";
|
||||||
nixpkgs.url= "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url= "github:nixos/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {self, nixpkgs, ...}:
|
outputs = {self, nixpkgs, nixgl,...}:
|
||||||
let
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
overlays = [ nixgl.overlay ];
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
devShells.x86_64-linux.default = (import ./shell.nix { inherit pkgs; });
|
devShells.x86_64-linux.default = (import ./shell.nix { inherit pkgs; });
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ pkgs.mkShell
|
||||||
cglm
|
cglm
|
||||||
sdl3
|
sdl3
|
||||||
sdl3-image
|
sdl3-image
|
||||||
|
nixgl.nixVulkanIntel
|
||||||
|
vulkan-headers
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export PS1="(webgpu) $PS1"
|
export PS1="(webgpu) $PS1"
|
||||||
|
|
|
||||||
19
src/main.c
19
src/main.c
|
|
@ -1,6 +1,11 @@
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_video.h>
|
||||||
|
#include <SDL3/SDL_vulkan.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
#include <vulkan/vulkan_core.h>
|
||||||
#include <webgpu/webgpu.h>
|
#include <webgpu/webgpu.h>
|
||||||
|
|
||||||
static void OnRequestAdapter(WGPURequestAdapterStatus status,
|
static void OnRequestAdapter(WGPURequestAdapterStatus status,
|
||||||
|
|
@ -35,6 +40,20 @@ void requestAdapterSync(WGPUInstance instance,
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
SDL_Window *window = NULL;
|
||||||
|
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||||
|
fprintf(stderr, "SDL failed to initialise: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
window = SDL_CreateWindow("SDL3 Example", 800, 600, SDL_WINDOW_VULKAN);
|
||||||
|
if (window == NULL) {
|
||||||
|
fprintf(stderr, "SDL window failed to initialise: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *driver = SDL_GetCurrentVideoDriver();
|
||||||
|
printf("Driver: %s\n", driver);
|
||||||
|
|
||||||
// We create a descriptor
|
// We create a descriptor
|
||||||
WGPUInstanceDescriptor desc = {};
|
WGPUInstanceDescriptor desc = {};
|
||||||
desc.nextInChain = NULL;
|
desc.nextInChain = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue