mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-28 17:19:11 +01:00
DX12/DX11 hookup, improved adapter selection
This commit is contained in:
1 parent
b414b9f373
commit
175e992149
11 files changed
+323
-90
No files matched your search
@@ -17,7 +17,7 @@ int main(
|
||||
char *argv[]) {
|
||||
|
||||
if (argc != 5) {
|
||||
printf("You must pass 4 positive integers!");
|
||||
printf("You must pass 4 positive integers!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
WGPUU32Array read_file(const char *name) {
|
||||
FILE *file = fopen(name, "rb");
|
||||
if (!file) {
|
||||
printf("Unable to open %s\n", name);
|
||||
exit(1);
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
long length = ftell(file);
|
||||
unsigned char *bytes = malloc(length);
|
||||
@@ -27,7 +31,7 @@ void read_buffer_map(
|
||||
(void)userdata;
|
||||
if (status == WGPUBufferMapAsyncStatus_Success) {
|
||||
uint32_t *times = (uint32_t *) data;
|
||||
printf("Times: [%d, %d, %d, %d]",
|
||||
printf("Times: [%d, %d, %d, %d]\n",
|
||||
times[0],
|
||||
times[1],
|
||||
times[2],
|
||||
|
||||
@@ -36,6 +36,7 @@ int main() {
|
||||
WGPUAdapterId adapter = wgpu_request_adapter(
|
||||
&(WGPURequestAdapterOptions){
|
||||
.power_preference = WGPUPowerPreference_LowPower,
|
||||
.backends = 2 | 4 | 8,
|
||||
});
|
||||
|
||||
WGPUDeviceId device = wgpu_adapter_request_device(adapter,
|
||||
@@ -155,7 +156,7 @@ int main() {
|
||||
[ns_window.contentView setWantsLayer:YES];
|
||||
metal_layer = [CAMetalLayer layer];
|
||||
[ns_window.contentView setLayer:metal_layer];
|
||||
surface = wgpu_create_surface_from_macos_layer(metal_layer);
|
||||
surface = wgpu_create_surface_from_metal_layer(metal_layer);
|
||||
}
|
||||
#elif WGPU_TARGET == WGPU_TARGET_LINUX
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user