Skip to content

spirv: Memory accesses with PhysicalStorageBuffer must use Aligned #23212

Closed

Description

@igaryhe

Zig Version

0.15.0-dev.34+8e0a4ca4b

Steps to Reproduce and Observed Behavior

sample code:

const std = @import("std");
const gpu = std.gpu;

const v4 = @Vector(4, f32);

const Input = struct {
    color: v4,
};

const PushConstant = extern struct {
    buffer: [*]addrspace(.global) Input,
};

extern var iid: u32 addrspace(.input);
extern var pc: PushConstant addrspace(.push_constant);
extern var color: v4 addrspace(.output);

export fn main() callconv(.spirv_vertex) void {
    gpu.location(&color, 0);
    const input = pc.buffer[iid];
    color = input.color;
}

compile with:

zig build-obj test.zig -target spirv64-vulkan -ofmt=spirv -mcpu vulkan_v1_2+int64 -fno-llvm

running spirv-val test.spv returns:

error: line 61: Memory accesses with PhysicalStorageBuffer must use Aligned.
  %input = OpLoad %test_Input %23 None

Expected Behavior

alignment should be specified when loading from a PhysicalStorageBuffer pointer. the expected behaviour is that the validator shouldn't complain about anything.

Activity

  1. added
    bug
    on Mar 12, 2025
  2. added a commit that references this issue on Mar 12, 2025
    8b9a08e
  3. added
    arch-spirv
    on Mar 13, 2025
  4. added this to the 0.15.0 milestone on Mar 13, 2025
  5. added a commit that references this issue on Mar 15, 2025
    f104d4a
  6. added 4 commits that reference this issue on Mar 17, 2025
    b050c5b
    fb6c4e9
    3c9854e
    d18eaf8
  7. modified the milestones: urgent, 0.15.0 on Jul 26, 2025
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

    arch-spirvbackend-self-hostedbug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions