Skip to content

Any plans to use slices in descriptors? #23

Description

@TotoShampoin

Basically, with how descriptors currently work, when I pass layouts to a pipeline, I have to either know in advance how many I have, or I have to make it in a const before passing its length and pointer

// either
const attachments = &[_]wgpu.ColorAttachment{
    .{
        .view = next.view,
        .load_op = .clear,
        .store_op = .store,
        .clear_value = .{ .r = 0, .g = 0, .b = 0, .a = 1 },
    }
};
const pass = encoder.beginRenderPass(&.{
    .color_attachment_count = attachments.len,
    .color_attachments = attachments.ptr,
}).?

// or
const pass = encoder.beginRenderPass(&.{
    .color_attachment_count = 1,
    .color_attachments = &.{
        .{
            .view = next.view,
            .load_op = .clear,
            .store_op = .store,
            .clear_value = .{ .r = 0, .g = 0, .b = 0, .a = 1 },
        },
    },
}).?;

I wish I could do something as simple as this

const pass = encoder.beginRenderPass(&.{
    .color_attachments = &.{   // <-- []const wgpu.ColorAttachment, which has a .len and .ptr
        .{
            .view = next.view,
            .load_op = .clear,
            .store_op = .store,
            .clear_value = .{ .r = 0, .g = 0, .b = 0, .a = 1 },
        },
    },
}).?;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions