added swap chain usage flags to core.init() options

This commit is contained in:
TheHonestHare 2024-04-07 22:08:08 -06:00 committed by Stephen Gutekanst
parent 27fd19271c
commit f369b31137
4 changed files with 4 additions and 3 deletions

View file

@ -154,6 +154,7 @@ pub const Options = struct {
power_preference: gpu.PowerPreference = .undefined,
required_features: ?[]const gpu.FeatureName = null,
required_limits: ?gpu.Limits = null,
swap_chain_usage: gpu.Texture.UsageFlags = .{ .render_attachment = true, },
};
pub fn init(options_in: Options) !void {

View file

@ -257,7 +257,7 @@ pub fn init(
const framebuffer_size = window.getFramebufferSize();
const swap_chain_desc = gpu.SwapChain.Descriptor{
.label = "main swap chain",
.usage = .{ .render_attachment = true },
.usage = options.swap_chain_usage,
.format = .bgra8_unorm,
.width = framebuffer_size.width,
.height = framebuffer_size.height,

View file

@ -977,7 +977,7 @@ pub fn init(
const swap_chain_desc = gpu.SwapChain.Descriptor{
.label = "main swap chain",
.usage = .{ .render_attachment = true },
.usage = options.swap_chain_usage,
.format = .bgra8_unorm,
.width = options.size.width,
.height = options.size.height,

View file

@ -488,7 +488,7 @@ pub fn init(
const swap_chain_desc = gpu.SwapChain.Descriptor{
.label = "main swap chain",
.usage = .{ .render_attachment = true },
.usage = options.swap_chain_usage,
.format = .bgra8_unorm,
.width = @intCast(window_attrs.width),
.height = @intCast(window_attrs.height),