gpu: internalize TextureView types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
e9dcb49328
commit
0dae027602
4 changed files with 28 additions and 31 deletions
|
|
@ -196,7 +196,7 @@ pub fn Interface(comptime T: type) type {
|
||||||
assertDecl(T, "swapChainPresent", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
assertDecl(T, "swapChainPresent", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
||||||
assertDecl(T, "swapChainReference", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
assertDecl(T, "swapChainReference", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
||||||
assertDecl(T, "swapChainRelease", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
assertDecl(T, "swapChainRelease", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
||||||
assertDecl(T, "textureCreateView", fn (texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) callconv(.Inline) *gpu.TextureView);
|
assertDecl(T, "textureCreateView", fn (texture: *gpu.Texture, descriptor: ?*const gpu.TextureView.Descriptor) callconv(.Inline) *gpu.TextureView);
|
||||||
assertDecl(T, "textureDestroy", fn (texture: *gpu.Texture) callconv(.Inline) void);
|
assertDecl(T, "textureDestroy", fn (texture: *gpu.Texture) callconv(.Inline) void);
|
||||||
assertDecl(T, "textureGetDepthOrArrayLayers", fn (texture: *gpu.Texture) callconv(.Inline) u32);
|
assertDecl(T, "textureGetDepthOrArrayLayers", fn (texture: *gpu.Texture) callconv(.Inline) u32);
|
||||||
assertDecl(T, "textureGetDimension", fn (texture: *gpu.Texture) callconv(.Inline) gpu.TextureDimension);
|
assertDecl(T, "textureGetDimension", fn (texture: *gpu.Texture) callconv(.Inline) gpu.TextureDimension);
|
||||||
|
|
@ -1136,7 +1136,7 @@ pub fn Export(comptime T: type) type {
|
||||||
}
|
}
|
||||||
|
|
||||||
// WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor /* nullable */);
|
// WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor /* nullable */);
|
||||||
export fn wgpuTextureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) *gpu.TextureView {
|
export fn wgpuTextureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureView.Descriptor) *gpu.TextureView {
|
||||||
return T.textureCreateView(texture, descriptor);
|
return T.textureCreateView(texture, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2349,7 +2349,7 @@ pub const StubInterface = Interface(struct {
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn textureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureViewDescriptor) *gpu.TextureView {
|
pub inline fn textureCreateView(texture: *gpu.Texture, descriptor: ?*const gpu.TextureView.Descriptor) *gpu.TextureView {
|
||||||
_ = texture;
|
_ = texture;
|
||||||
_ = descriptor;
|
_ = descriptor;
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const ChainedStruct = @import("types.zig").ChainedStruct;
|
const ChainedStruct = @import("types.zig").ChainedStruct;
|
||||||
const TextureView = @import("texture_view.zig").TextureView;
|
const TextureView = @import("texture_view.zig").TextureView;
|
||||||
const TextureViewDimension = @import("texture_view.zig").TextureViewDimension;
|
|
||||||
const TextureViewDescriptor = @import("texture_view.zig").TextureViewDescriptor;
|
|
||||||
const Extent3D = @import("types.zig").Extent3D;
|
const Extent3D = @import("types.zig").Extent3D;
|
||||||
const Impl = @import("interface.zig").Impl;
|
const Impl = @import("interface.zig").Impl;
|
||||||
const copy_stride_undefined = @import("main.zig").copy_stride_undefined;
|
const copy_stride_undefined = @import("main.zig").copy_stride_undefined;
|
||||||
|
|
||||||
pub const Texture = opaque {
|
pub const Texture = opaque {
|
||||||
pub inline fn createView(texture: *Texture, descriptor: ?*const TextureViewDescriptor) *TextureView {
|
pub inline fn createView(texture: *Texture, descriptor: ?*const TextureView.Descriptor) *TextureView {
|
||||||
return Impl.textureCreateView(texture, descriptor);
|
return Impl.textureCreateView(texture, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -217,7 +215,7 @@ pub const TextureUsageFlags = packed struct {
|
||||||
pub const TextureBindingLayout = extern struct {
|
pub const TextureBindingLayout = extern struct {
|
||||||
next_in_chain: ?*const ChainedStruct = null,
|
next_in_chain: ?*const ChainedStruct = null,
|
||||||
sample_type: TextureSampleType = .undef,
|
sample_type: TextureSampleType = .undef,
|
||||||
view_dimension: TextureViewDimension = .dimension_undef,
|
view_dimension: TextureView.Dimension = .dimension_undef,
|
||||||
multisampled: bool = false,
|
multisampled: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,28 @@ const mip_level_count_undefined = @import("main.zig").mip_level_count_undefined;
|
||||||
const array_layer_count_undefined = @import("main.zig").array_layer_count_undefined;
|
const array_layer_count_undefined = @import("main.zig").array_layer_count_undefined;
|
||||||
|
|
||||||
pub const TextureView = opaque {
|
pub const TextureView = opaque {
|
||||||
|
pub const Dimension = enum(u32) {
|
||||||
|
dimension_undef = 0x00000000,
|
||||||
|
dimension_1d = 0x00000001,
|
||||||
|
dimension_2d = 0x00000002,
|
||||||
|
dimension_2d_array = 0x00000003,
|
||||||
|
dimension_cube = 0x00000004,
|
||||||
|
dimension_cube_array = 0x00000005,
|
||||||
|
dimension_3d = 0x00000006,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const Descriptor = extern struct {
|
||||||
|
next_in_chain: ?*const ChainedStruct = null,
|
||||||
|
label: ?[*:0]const u8 = null,
|
||||||
|
format: TextureFormat = .undef,
|
||||||
|
dimension: Dimension = .dimension_undef,
|
||||||
|
base_mip_level: u32 = 0,
|
||||||
|
mip_level_count: u32 = mip_level_count_undefined,
|
||||||
|
base_array_layer: u32 = 0,
|
||||||
|
array_layer_count: u32 = array_layer_count_undefined,
|
||||||
|
aspect: TextureAspect = .all,
|
||||||
|
};
|
||||||
|
|
||||||
pub inline fn setLabel(texture_view: *TextureView, label: [*:0]const u8) void {
|
pub inline fn setLabel(texture_view: *TextureView, label: [*:0]const u8) void {
|
||||||
Impl.textureViewSetLabel(texture_view, label);
|
Impl.textureViewSetLabel(texture_view, label);
|
||||||
}
|
}
|
||||||
|
|
@ -19,25 +41,3 @@ pub const TextureView = opaque {
|
||||||
Impl.textureViewRelease(texture_view);
|
Impl.textureViewRelease(texture_view);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const TextureViewDimension = enum(u32) {
|
|
||||||
dimension_undef = 0x00000000,
|
|
||||||
dimension_1d = 0x00000001,
|
|
||||||
dimension_2d = 0x00000002,
|
|
||||||
dimension_2d_array = 0x00000003,
|
|
||||||
dimension_cube = 0x00000004,
|
|
||||||
dimension_cube_array = 0x00000005,
|
|
||||||
dimension_3d = 0x00000006,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const TextureViewDescriptor = extern struct {
|
|
||||||
next_in_chain: ?*const ChainedStruct = null,
|
|
||||||
label: ?[*:0]const u8 = null,
|
|
||||||
format: TextureFormat = .undef,
|
|
||||||
dimension: TextureViewDimension = .dimension_undef,
|
|
||||||
base_mip_level: u32 = 0,
|
|
||||||
mip_level_count: u32 = mip_level_count_undefined,
|
|
||||||
base_array_layer: u32 = 0,
|
|
||||||
array_layer_count: u32 = array_layer_count_undefined,
|
|
||||||
aspect: TextureAspect = .all,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ const TextureFormat = @import("texture.zig").TextureFormat;
|
||||||
const TextureAspect = @import("texture.zig").TextureAspect;
|
const TextureAspect = @import("texture.zig").TextureAspect;
|
||||||
const TextureDataLayout = @import("texture.zig").TextureDataLayout;
|
const TextureDataLayout = @import("texture.zig").TextureDataLayout;
|
||||||
const TextureView = @import("texture_view.zig").TextureView;
|
const TextureView = @import("texture_view.zig").TextureView;
|
||||||
const TextureViewDimension = @import("texture_view.zig").TextureViewDimension;
|
|
||||||
const Buffer = @import("buffer.zig").Buffer;
|
const Buffer = @import("buffer.zig").Buffer;
|
||||||
const ShaderModule = @import("shader_module.zig").ShaderModule;
|
const ShaderModule = @import("shader_module.zig").ShaderModule;
|
||||||
const limit_u32_undefined = @import("main.zig").limit_u32_undefined;
|
const limit_u32_undefined = @import("main.zig").limit_u32_undefined;
|
||||||
|
|
@ -511,7 +510,7 @@ pub const StorageTextureBindingLayout = extern struct {
|
||||||
next_in_chain: ?*const ChainedStruct = null,
|
next_in_chain: ?*const ChainedStruct = null,
|
||||||
access: StorageTextureAccess = .undef,
|
access: StorageTextureAccess = .undef,
|
||||||
format: TextureFormat = .undef,
|
format: TextureFormat = .undef,
|
||||||
view_dimension: TextureViewDimension = .dimension_undef,
|
view_dimension: TextureView.Dimension = .dimension_undef,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const VertexAttribute = extern struct {
|
pub const VertexAttribute = extern struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue