Skip to content

Commit

Permalink
Fix windows compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Senryoku committed Nov 14, 2024
1 parent 9304878 commit 879d8c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/gdi.zig
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,16 @@ pub const GDI = struct {
.access_mask = std.os.windows.GENERIC_READ | std.os.windows.SYNCHRONIZE,
.creation = std.os.windows.FILE_OPEN,
});
errdefer std.os.windows.CloseHandle(file_handle);

const mapping_handle = windows.CreateFileMappingA(file_handle, null, std.os.windows.PAGE_READONLY, 0, 0, null);
if (mapping_handle == null) return error.FileMapError;
errdefer std.os.windows.CloseHandle(mapping_handle.?);

const ptr = windows.MapViewOfFile(mapping_handle.?, std.os.windows.SECTION_MAP_READ, 0, 0, 0);
if (ptr == null) return error.MapViewOfFileError;
errdefer _ = windows.UnmapViewOfFile(ptr.?);

var info: std.os.windows.MEMORY_BASIC_INFORMATION = undefined;
_ = try std.os.windows.VirtualQuery(ptr, &info, @sizeOf(std.os.windows.MEMORY_BASIC_INFORMATION));

Expand All @@ -261,10 +269,10 @@ pub const GDI = struct {
.track_type = track_type,
.format = format,
.pregap = pregap,
.data = @as([]align(std.mem.page_size) const u8, @alignCast(@ptrCast(ptr)))[0..info.RegionSize],
.data = @as([*]align(std.mem.page_size) const u8, @alignCast(@ptrCast(ptr)))[0..info.RegionSize],
.platform_specific = .{
.file_handle = file_handle,
.mapping_handle = mapping_handle,
.mapping_handle = mapping_handle.?,
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ pub const Renderer = struct {
pass.draw(3 * volume.triangle_count, 1, 3 * volume.first_triangle_index, 0);
}
} else {
renderer_log.warn(termcolor.yellow("TODO: Unhandled Open Translucent Mofifier Volume!"), .{});
renderer_log.warn(termcolor.yellow("TODO: Unhandled Open Translucent Modifier Volume!"), .{});
// TODO: Almost the same thing, but the compute shader is really simple: Take the smallest
// depth value and add a volume from it to "infinity" (1.0+ depth). Or find a more efficient way :)
}
Expand Down

0 comments on commit 879d8c1

Please sign in to comment.