zgpu

git clone git://git.electrosoup.com/zgpu
Log | Files | Refs | Submodules | README

shader_module.zig (1139B)


      1 const c = @import("c.zig").c;
      2 const ChainedStruct = @import("common.zig").ChainedStruct;
      3 const PipelineLayout = @import("pipeline_layout.zig").PipelineLayout;
      4 const StringView = @import("common.zig").StringView;
      5 
      6 pub const ShaderModule = opaque {
      7     pub const Descriptor = extern struct {
      8         next: Next = .{ .generic = null },
      9         label: StringView,
     10 
     11         pub const Next = extern union {
     12             generic: ?*const ChainedStruct,
     13             spirv: *const SourceSPIRV,
     14             wgsl: *const SourceWGSL,
     15         };
     16     };
     17 
     18     const SourceSPIRV = extern struct {
     19         chain: ChainedStruct = .{
     20             .next = null,
     21             .struct_type = .shader_source_spirv,
     22         },
     23         code_size: u32,
     24         code: ?[*]const u32,
     25     };
     26 
     27     const SourceWGSL = extern struct {
     28         chain: ChainedStruct = .{
     29             .next = null,
     30             .struct_type = .shader_source_wgsl,
     31         },
     32         code: StringView,
     33     };
     34 
     35     pub fn release(module: *ShaderModule) void {
     36         c.wgpuShaderModuleRelease(@ptrCast(module));
     37     }
     38 
     39     // getCompilationInfo
     40     // setLabel
     41     // reference
     42     // release
     43 };