Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -0,0 +1,386 @@
|
||||
module gfx
|
||||
|
||||
pub enum Backend {
|
||||
glcore33
|
||||
gles3
|
||||
d3d11
|
||||
metal_ios
|
||||
metal_macos
|
||||
metal_simulator
|
||||
wgpu
|
||||
dummy
|
||||
}
|
||||
|
||||
// PixelFormat is C.sg_pixel_format
|
||||
pub enum PixelFormat as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
none
|
||||
|
||||
r8
|
||||
r8sn
|
||||
r8ui
|
||||
r8si
|
||||
|
||||
r16
|
||||
r16sn
|
||||
r16ui
|
||||
r16si
|
||||
r16f
|
||||
rg8
|
||||
rg8sn
|
||||
rg8ui
|
||||
rg8si
|
||||
|
||||
r32ui
|
||||
r32si
|
||||
r32f
|
||||
rg16
|
||||
rg16sn
|
||||
rg16ui
|
||||
rg16si
|
||||
rg16f
|
||||
rgba8
|
||||
srgb8a8
|
||||
rgba8sn
|
||||
rgba8ui
|
||||
rgba8si
|
||||
bgra8
|
||||
rgb10a2
|
||||
rg11b10f
|
||||
rgb9e5
|
||||
|
||||
rg32ui
|
||||
rg32si
|
||||
rg32f
|
||||
rgba16
|
||||
rgba16sn
|
||||
rgba16ui
|
||||
rgba16si
|
||||
rgba16f
|
||||
|
||||
rgba32ui
|
||||
rgba32si
|
||||
rgba32f
|
||||
|
||||
depth
|
||||
depth_stencil
|
||||
|
||||
bc1_rgba
|
||||
bc2_rgba
|
||||
bc3_rgba
|
||||
bc3_srgba
|
||||
bc4_r
|
||||
bc4_rsn
|
||||
bc5_rg
|
||||
bc5_rgsn
|
||||
bc6h_rgbf
|
||||
bc6h_rgbuf
|
||||
bc7_rgba
|
||||
bc7_srgba
|
||||
pvrtc_rgb_2bpp // deprecated
|
||||
pvrtc_rgb_4bpp // deprecated
|
||||
pvrtc_rgba_2bpp // deprecated
|
||||
pvrtc_rgba_4bpp // deprecated
|
||||
etc2_rgb8
|
||||
etc2_srgb8
|
||||
etc2_rgb8a1
|
||||
etc2_rgba8
|
||||
etc2_srgb8a8
|
||||
eac_r11
|
||||
eac_r11sn
|
||||
eac_rg11
|
||||
eac_rg11sn
|
||||
astc_4x4_rgba
|
||||
astc_4x4_srgba
|
||||
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum ResourceState as u32 {
|
||||
initial
|
||||
alloc
|
||||
valid
|
||||
failed
|
||||
invalid
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum Usage as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
immutable
|
||||
dynamic
|
||||
stream
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum BufferType as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
vertexbuffer
|
||||
indexbuffer
|
||||
storagebuffer
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum IndexType as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
none
|
||||
uint16
|
||||
uint32
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum ImageType as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
_2d
|
||||
cube
|
||||
_3d
|
||||
array
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum ImageSampleType as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
float
|
||||
depth
|
||||
sint
|
||||
uint
|
||||
unfilterable_float
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum SamplerType as u32 {
|
||||
_default
|
||||
filtering
|
||||
nonfiltering
|
||||
comparison
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum CubeFace as u32 {
|
||||
pos_x
|
||||
neg_x
|
||||
pos_y
|
||||
neg_y
|
||||
pos_z
|
||||
neg_z
|
||||
num
|
||||
_force_u32 = 0x7fffffff
|
||||
}
|
||||
|
||||
pub enum ShaderStage as u32 {
|
||||
vs
|
||||
fs
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum PrimitiveType as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
points
|
||||
lines
|
||||
line_strip
|
||||
triangles
|
||||
triangle_strip
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum Filter as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
none
|
||||
nearest
|
||||
linear
|
||||
_num
|
||||
_force_u32 = 0x7fffffff
|
||||
}
|
||||
|
||||
pub enum Wrap as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
repeat // The default wrap mode.
|
||||
clamp_to_edge
|
||||
clamp_to_border // not supported on all backends and platforms. To check for support, call sg_query_features(), and check the "clamp_to_border" boolean in the returned sg_features struct. Platforms which don't support SG_WRAP_CLAMP_TO_BORDER will silently fall back to clamp_to_edge without a validation error.
|
||||
mirrored_repeat
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum BorderColor as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
transparent_black
|
||||
opaque_black
|
||||
opaque_white
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum VertexFormat as u32 {
|
||||
invalid
|
||||
float
|
||||
float2
|
||||
float3
|
||||
float4
|
||||
byte4
|
||||
byte4n // normalized
|
||||
ubyte4
|
||||
ubyte4n
|
||||
short2
|
||||
short2n
|
||||
ushort2n
|
||||
short4
|
||||
short4n
|
||||
ushort4n
|
||||
uint10_n2
|
||||
half2
|
||||
half4
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum VertexStep as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
per_vertex
|
||||
per_instance
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum UniformType as u32 {
|
||||
invalid
|
||||
float
|
||||
float2
|
||||
float3
|
||||
float4
|
||||
int
|
||||
int2
|
||||
int3
|
||||
int4
|
||||
mat4
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum CullMode as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
none
|
||||
front
|
||||
back
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
// FaceWindin is C.sg_face_winding
|
||||
pub enum FaceWinding as u32 {
|
||||
default // value 0 reserved for default-init
|
||||
ccw
|
||||
cw
|
||||
num
|
||||
force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum CompareFunc as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
never
|
||||
less
|
||||
equal
|
||||
less_equal
|
||||
greater
|
||||
not_equal
|
||||
greater_equal
|
||||
always
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum StencilOp as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
keep
|
||||
zero
|
||||
replace
|
||||
incr_clamp
|
||||
decr_clamp
|
||||
invert
|
||||
incr_wrap
|
||||
decr_wrap
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum BlendFactor as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
zero
|
||||
one
|
||||
src_color
|
||||
one_minus_src_color
|
||||
src_alpha
|
||||
one_minus_src_alpha
|
||||
dst_color
|
||||
one_minus_dst_color
|
||||
dst_alpha
|
||||
one_minus_dst_alpha
|
||||
src_alpha_saturated
|
||||
blend_color
|
||||
one_minus_blend_color
|
||||
blend_alpha
|
||||
one_minus_blend_alpha
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum BlendOp as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
add
|
||||
subtract
|
||||
reverse_subtract
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum ColorMask as u32 {
|
||||
_default = 0 // value 0 reserved for default-init
|
||||
none = 0x10 // special value for 'all channels disabled
|
||||
r = 1
|
||||
g = 2
|
||||
rg = 3
|
||||
b = 4
|
||||
rb = 5
|
||||
gb = 6
|
||||
rgb = 7
|
||||
a = 8
|
||||
ra = 9
|
||||
ga = 0xa
|
||||
rga = 0xb
|
||||
ba = 0xc
|
||||
rba = 0xd
|
||||
gba = 0xe
|
||||
rgba = 0xf
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum LoadAction as u32 {
|
||||
_default
|
||||
clear
|
||||
load
|
||||
dontcare
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum StoreAction as u32 {
|
||||
_default
|
||||
store
|
||||
dontcare
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum UniformLayout as u32 {
|
||||
uniformlayout_default = 0 // value 0 reserved for default-init
|
||||
uniformlayout_native // default: layout depends on currently active backend
|
||||
uniformlayout_std140 // std140: memory layout according to std140
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
module gfx
|
||||
|
||||
import sokol.c as _
|
||||
import sokol.memory
|
||||
|
||||
pub const version = 1
|
||||
|
||||
// setup initialises the SOKOL's gfx library, based on the information passed in `desc`
|
||||
pub fn setup(desc &Desc) {
|
||||
if desc.allocator.alloc_fn == unsafe { nil } && desc.allocator.free_fn == unsafe { nil } {
|
||||
unsafe {
|
||||
desc.allocator.alloc_fn = memory.salloc
|
||||
desc.allocator.free_fn = memory.sfree
|
||||
desc.allocator.user_data = voidptr(0x1006fec5)
|
||||
}
|
||||
}
|
||||
if desc.logger.func == unsafe { nil } {
|
||||
unsafe {
|
||||
desc.logger.func = memory.slog
|
||||
}
|
||||
}
|
||||
C.sg_setup(desc)
|
||||
}
|
||||
|
||||
// shutdown tells the SOKOL's gfx library to shutdown, and release the resources it is using
|
||||
pub fn shutdown() {
|
||||
C.sg_shutdown()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn is_valid() bool {
|
||||
return C.sg_isvalid()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
fn ensure_initialized(op string) {
|
||||
if is_valid() {
|
||||
return
|
||||
}
|
||||
panic('sokol.gfx is not initialized; call gfx.setup(...) before ${op}')
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn reset_state_cache() {
|
||||
C.sg_reset_state_cache()
|
||||
}
|
||||
|
||||
// resource creation, destruction and updating
|
||||
// make_buffer creates a GPU buffer.
|
||||
// make_buffer requires `gfx.setup(...)` to have completed first.
|
||||
@[inline]
|
||||
pub fn make_buffer(desc &BufferDesc) Buffer {
|
||||
ensure_initialized('gfx.make_buffer(...)')
|
||||
return C.sg_make_buffer(desc)
|
||||
}
|
||||
|
||||
// make_image creates a GPU image.
|
||||
// make_image requires `gfx.setup(...)` to have completed first.
|
||||
@[inline]
|
||||
pub fn make_image(desc &ImageDesc) Image {
|
||||
ensure_initialized('gfx.make_image(...)')
|
||||
return C.sg_make_image(desc)
|
||||
}
|
||||
|
||||
// make_sampler creates a GPU sampler.
|
||||
// make_sampler requires `gfx.setup(...)` to have completed first.
|
||||
@[inline]
|
||||
pub fn make_sampler(desc &SamplerDesc) Sampler {
|
||||
ensure_initialized('gfx.make_sampler(...)')
|
||||
return C.sg_make_sampler(desc)
|
||||
}
|
||||
|
||||
// make_shader creates a GPU shader.
|
||||
// make_shader requires `gfx.setup(...)` to have completed first.
|
||||
@[inline]
|
||||
pub fn make_shader(desc &ShaderDesc) Shader {
|
||||
ensure_initialized('gfx.make_shader(...)')
|
||||
return C.sg_make_shader(desc)
|
||||
}
|
||||
|
||||
// make_pipeline creates a GPU pipeline.
|
||||
// make_pipeline requires `gfx.setup(...)` to have completed first.
|
||||
@[inline]
|
||||
pub fn make_pipeline(desc &PipelineDesc) Pipeline {
|
||||
ensure_initialized('gfx.make_pipeline(...)')
|
||||
return C.sg_make_pipeline(desc)
|
||||
}
|
||||
|
||||
// make_attachments creates an `Attachments` instance from `const_desc`.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn make_attachments(const_desc &AttachmentsDesc) Attachments {
|
||||
ensure_initialized('gfx.make_attachments(...)')
|
||||
return C.sg_make_attachments(const_desc)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn destroy_buffer(buf Buffer) {
|
||||
C.sg_destroy_buffer(buf)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn destroy_image(img Image) {
|
||||
C.sg_destroy_image(img)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn destroy_sampler(smp Sampler) {
|
||||
C.sg_destroy_sampler(smp)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn destroy_shader(shd Shader) {
|
||||
C.sg_destroy_shader(shd)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn destroy_pipeline(pip Pipeline) {
|
||||
C.sg_destroy_pipeline(pip)
|
||||
}
|
||||
|
||||
// destroy_attachments destroys the `atts` `Attachments`
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn destroy_attachments(atts Attachments) {
|
||||
C.sg_destroy_attachments(atts)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn update_buffer(buf Buffer, data &Range) {
|
||||
C.sg_update_buffer(buf, data)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn update_image(img Image, data &ImageData) {
|
||||
C.sg_update_image(img, data)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn append_buffer(buf Buffer, data &Range) int {
|
||||
return C.sg_append_buffer(buf, data)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_buffer_overflow(buf Buffer) bool {
|
||||
return C.sg_query_buffer_overflow(buf)
|
||||
}
|
||||
|
||||
// rendering functions
|
||||
|
||||
// begin_pass begins a rendering pass.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn begin_pass(const_pass &Pass) {
|
||||
C.sg_begin_pass(const_pass)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn apply_viewport(x int, y int, width int, height int, origin_top_left bool) {
|
||||
C.sg_apply_viewport(x, y, width, height, origin_top_left)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn apply_scissor_rect(x int, y int, width int, height int, origin_top_left bool) {
|
||||
C.sg_apply_scissor_rect(x, y, width, height, origin_top_left)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn apply_pipeline(pip Pipeline) {
|
||||
C.sg_apply_pipeline(pip)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn apply_bindings(bindings &Bindings) {
|
||||
C.sg_apply_bindings(bindings)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn apply_uniforms(stage ShaderStage, ub_index int, data &Range) {
|
||||
C.sg_apply_uniforms(stage, ub_index, data)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn draw(base_element int, num_elements int, num_instances int) {
|
||||
C.sg_draw(base_element, num_elements, num_instances)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn end_pass() {
|
||||
C.sg_end_pass()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn commit() {
|
||||
C.sg_commit()
|
||||
}
|
||||
|
||||
// getting information
|
||||
@[inline]
|
||||
pub fn query_desc() Desc {
|
||||
return C.sg_query_desc()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_backend() Backend {
|
||||
unsafe {
|
||||
return Backend(C.sg_query_backend())
|
||||
}
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_features() Features {
|
||||
return C.sg_query_features()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_limits() Limits {
|
||||
return C.sg_query_limits()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_pixelformat(fmt PixelFormat) PixelFormatInfo {
|
||||
return C.sg_query_pixelformat(fmt)
|
||||
}
|
||||
|
||||
// get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
|
||||
@[inline]
|
||||
pub fn query_buffer_state(buf Buffer) ResourceState {
|
||||
return ResourceState(C.sg_query_buffer_state(buf))
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_image_state(img Image) ResourceState {
|
||||
return ResourceState(C.sg_query_image_state(img))
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_shader_state(shd Shader) ResourceState {
|
||||
return ResourceState(C.sg_query_shader_state(shd))
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_pipeline_state(pip Pipeline) ResourceState {
|
||||
return ResourceState(C.sg_query_pipeline_state(pip))
|
||||
}
|
||||
|
||||
// query_attachments_state returns the current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn query_attachments_state(atts Attachments) ResourceState {
|
||||
return ResourceState(C.sg_query_attachments_state(atts))
|
||||
}
|
||||
|
||||
// get runtime information about a resource
|
||||
@[inline]
|
||||
pub fn query_buffer_info(buf Buffer) BufferInfo {
|
||||
return C.sg_query_buffer_info(buf)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_image_info(img Image) ImageInfo {
|
||||
return C.sg_query_image_info(img)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_shader_info(shd Shader) ShaderInfo {
|
||||
return C.sg_query_shader_info(shd)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_pipeline_info(pip Pipeline) PipelineInfo {
|
||||
return C.sg_query_pipeline_info(pip)
|
||||
}
|
||||
|
||||
// query_attachments_info returns runtime information about the `atts` / `Attachments`.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn query_attachments_info(atts Attachments) AttachmentsInfo {
|
||||
return C.sg_query_attachments_info(atts)
|
||||
}
|
||||
|
||||
// get resource creation desc struct with their default values replaced
|
||||
@[inline]
|
||||
pub fn query_buffer_defaults(desc &Buffer) BufferDesc {
|
||||
return C.sg_query_buffer_defaults(unsafe { &BufferDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_image_defaults(desc &Image) ImageDesc {
|
||||
return C.sg_query_image_defaults(unsafe { &ImageDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_shader_defaults(desc &Shader) ShaderDesc {
|
||||
return C.sg_query_shader_defaults(unsafe { &ShaderDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn query_pipeline_defaults(desc &Pipeline) PipelineDesc {
|
||||
return C.sg_query_pipeline_defaults(unsafe { &PipelineDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
// query_attachments_defaults returns `AttachmentsDesc` with default values replaced.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn query_attachments_defaults(desc &AttachmentsDesc) AttachmentsDesc {
|
||||
return C.sg_query_attachments_defaults(unsafe { &AttachmentsDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
// frame stats
|
||||
|
||||
// enable_frame_stats enables the sokol frame statistics.
|
||||
@[inline]
|
||||
pub fn enable_frame_stats() {
|
||||
C.sg_enable_frame_stats()
|
||||
}
|
||||
|
||||
// disable_frame_stats disables the sokol frame statistics.
|
||||
@[inline]
|
||||
pub fn disable_frame_stats() {
|
||||
C.sg_disable_frame_stats()
|
||||
}
|
||||
|
||||
// frame_stats_enabled returns `true` if the sokol frame statistics is enabled.
|
||||
@[inline]
|
||||
pub fn frame_stats_enabled() bool {
|
||||
return C.sg_frame_stats_enabled()
|
||||
}
|
||||
|
||||
// query_frame_stats returns the sokol frame statistics for the current frame.
|
||||
@[inline]
|
||||
pub fn query_frame_stats() FrameStats {
|
||||
return C.sg_query_frame_stats()
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
module gfx
|
||||
|
||||
import sokol.memory
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_allocator {
|
||||
pub mut:
|
||||
alloc_fn memory.FnAllocatorAlloc = unsafe { nil }
|
||||
free_fn memory.FnAllocatorFree = unsafe { nil }
|
||||
user_data voidptr
|
||||
}
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_logger {
|
||||
pub mut:
|
||||
func memory.FnLogCb = unsafe { nil }
|
||||
user_data voidptr
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
module gfx
|
||||
|
||||
// setup and misc functions
|
||||
fn C.sg_setup(const_desc &C.sg_desc)
|
||||
fn C.sg_shutdown()
|
||||
fn C.sg_isvalid() bool
|
||||
fn C.sg_reset_state_cache()
|
||||
fn C.sg_install_trace_hooks(const_trace_hooks &C.sg_trace_hooks) C.sg_trace_hooks
|
||||
fn C.sg_push_debug_group(const_name &char)
|
||||
fn C.sg_pop_debug_group()
|
||||
fn C.sg_add_commit_listener(listener C.sg_commit_listener) bool
|
||||
fn C.sg_remove_commit_listener(listener C.sg_commit_listener) bool
|
||||
|
||||
// resource creation, destruction and updating
|
||||
fn C.sg_make_buffer(const_desc &C.sg_buffer_desc) C.sg_buffer
|
||||
fn C.sg_make_image(const_desc &C.sg_image_desc) C.sg_image
|
||||
fn C.sg_make_sampler(const_desc &C.sg_sampler_desc) C.sg_sampler
|
||||
fn C.sg_make_shader(const_desc &C.sg_shader_desc) C.sg_shader
|
||||
fn C.sg_make_pipeline(const_desc &C.sg_pipeline_desc) C.sg_pipeline
|
||||
fn C.sg_make_attachments(const_desc &C.sg_attachments_desc) C.sg_attachments
|
||||
fn C.sg_destroy_buffer(buf C.sg_buffer)
|
||||
fn C.sg_destroy_image(img C.sg_image)
|
||||
fn C.sg_destroy_sampler(smp C.sg_sampler)
|
||||
fn C.sg_destroy_shader(shd C.sg_shader)
|
||||
fn C.sg_destroy_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_destroy_attachments(atts C.sg_attachments)
|
||||
fn C.sg_update_buffer(buf C.sg_buffer, data &C.sg_range)
|
||||
fn C.sg_update_image(img C.sg_image, data &C.sg_image_data)
|
||||
fn C.sg_append_buffer(buf C.sg_buffer, data &C.sg_range) i32
|
||||
fn C.sg_query_buffer_overflow(buf C.sg_buffer) bool
|
||||
fn C.sg_query_buffer_will_overflow(buf C.sg_buffer, size usize) bool
|
||||
|
||||
// rendering functions
|
||||
fn C.sg_begin_pass(const_pass &C.sg_pass)
|
||||
fn C.sg_apply_viewport(x i32, y i32, width i32, height i32, origin_top_left bool)
|
||||
fn C.sg_apply_viewportf(x f32, y f32, width f32, height f32, origin_top_left bool)
|
||||
fn C.sg_apply_scissor_rect(x i32, y i32, width i32, height i32, origin_top_left bool)
|
||||
fn C.sg_apply_scissor_rectf(x f32, y f32, width f32, height f32, origin_top_left bool)
|
||||
fn C.sg_apply_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_apply_bindings(bindings &C.sg_bindings)
|
||||
fn C.sg_apply_uniforms(stage ShaderStage, ub_index i32, const_data &C.sg_range)
|
||||
fn C.sg_draw(base_element i32, num_elements i32, num_instances i32)
|
||||
fn C.sg_end_pass()
|
||||
fn C.sg_commit()
|
||||
|
||||
// getting information
|
||||
fn C.sg_query_desc() C.sg_desc
|
||||
fn C.sg_query_backend() Backend
|
||||
fn C.sg_query_features() C.sg_features
|
||||
fn C.sg_query_limits() C.sg_limits
|
||||
fn C.sg_query_pixelformat(fmt PixelFormat) C.sg_pixelformat_info
|
||||
|
||||
// get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
|
||||
fn C.sg_query_buffer_state(buf C.sg_buffer) ResourceState
|
||||
fn C.sg_query_image_state(img C.sg_image) ResourceState
|
||||
fn C.sg_query_sampler_state(smp C.sg_sampler) ResourceState
|
||||
fn C.sg_query_shader_state(shd C.sg_shader) ResourceState
|
||||
fn C.sg_query_pipeline_state(pip C.sg_pipeline) ResourceState
|
||||
fn C.sg_query_attachments_state(atts C.sg_attachments) ResourceState
|
||||
|
||||
// get runtime information about a resource
|
||||
fn C.sg_query_buffer_info(buf C.sg_buffer) C.sg_buffer_info
|
||||
fn C.sg_query_image_info(img C.sg_image) C.sg_image_info
|
||||
fn C.sg_query_sampler_info(smp C.sg_sampler) C.sg_sampler_info
|
||||
fn C.sg_query_shader_info(shd C.sg_shader) C.sg_shader_info
|
||||
fn C.sg_query_pipeline_info(pip C.sg_pipeline) C.sg_pipeline_info
|
||||
fn C.sg_query_attachments_info(atts C.sg_attachments) C.sg_attachments_info
|
||||
|
||||
// get desc structs matching a specific resource (NOTE that not all creation attributes may be provided)
|
||||
fn C.sg_query_buffer_desc(buf C.sg_buffer) C.sg_buffer_desc
|
||||
fn C.sg_query_image_desc(img C.sg_image) C.sg_image_desc
|
||||
fn C.sg_query_sampler_desc(smp C.sg_sampler) C.sg_sampler_desc
|
||||
fn C.sg_query_shader_desc(shd C.sg_shader) C.sg_shader_desc
|
||||
fn C.sg_query_pipeline_desc(pip C.sg_pipeline) C.sg_pipeline_desc
|
||||
fn C.sg_query_attachments_desc(atts C.sg_attachments) C.sg_attachments_desc
|
||||
|
||||
// get resource creation desc struct with their default values replaced
|
||||
fn C.sg_query_buffer_defaults(const_desc &C.sg_buffer_desc) C.sg_buffer_desc
|
||||
fn C.sg_query_image_defaults(const_desc &C.sg_image_desc) C.sg_image_desc
|
||||
fn C.sg_query_sampler_defaults(const_desc &C.sg_sampler_desc) C.sg_sampler_desc
|
||||
fn C.sg_query_shader_defaults(const_desc &C.sg_shader_desc) C.sg_shader_desc
|
||||
fn C.sg_query_pipeline_defaults(const_desc &C.sg_pipeline_desc) C.sg_pipeline_desc
|
||||
fn C.sg_query_attachments_defaults(const_desc &C.sg_attachments_desc) C.sg_attachments_desc
|
||||
|
||||
// separate resource allocation and initialization (for async setup)
|
||||
fn C.sg_alloc_buffer() C.sg_buffer
|
||||
fn C.sg_alloc_image() C.sg_image
|
||||
fn C.sg_alloc_sampler() C.sg_sampler
|
||||
fn C.sg_alloc_shader() C.sg_shader
|
||||
fn C.sg_alloc_pipeline() C.sg_pipeline
|
||||
fn C.sg_alloc_attachments() C.sg_attachments
|
||||
fn C.sg_dealloc_buffer(buf C.sg_buffer)
|
||||
fn C.sg_dealloc_image(img C.sg_image)
|
||||
fn C.sg_dealloc_sampler(smp C.sg_sampler)
|
||||
fn C.sg_dealloc_shader(shd C.sg_shader)
|
||||
fn C.sg_dealloc_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_dealloc_attachments(atts C.sg_attachments)
|
||||
fn C.sg_init_buffer(buf C.sg_buffer, const_desc &C.sg_buffer_desc)
|
||||
fn C.sg_init_image(img C.sg_image, const_desc &C.sg_buffer_desc)
|
||||
fn C.sg_init_sampler(smg C.sg_sampler, const_desc &C.sg_sampler_desc)
|
||||
fn C.sg_init_shader(shd C.sg_shader, const_desc &C.sg_shader_desc)
|
||||
fn C.sg_init_pipeline(pip C.sg_pipeline, const_desc &C.sg_pipeline_desc)
|
||||
fn C.sg_init_attachments(atts C.sg_attachments, const_desc &C.sg_attachments_desc)
|
||||
fn C.sg_uninit_buffer(buf C.sg_buffer)
|
||||
fn C.sg_uninit_image(img C.sg_image)
|
||||
fn C.sg_uninit_sampler(smp C.sg_sampler)
|
||||
fn C.sg_uninit_shader(shd C.sg_shader)
|
||||
fn C.sg_uninit_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_uninit_attachments(atts C.sg_attachments)
|
||||
fn C.sg_fail_buffer(buf C.sg_buffer)
|
||||
fn C.sg_fail_image(img C.sg_image)
|
||||
fn C.sg_fail_sampler(smp C.sg_sampler)
|
||||
fn C.sg_fail_shader(shd C.sg_shader)
|
||||
fn C.sg_fail_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_fail_attachments(atts C.sg_attachments)
|
||||
|
||||
// frame stats
|
||||
fn C.sg_enable_frame_stats()
|
||||
fn C.sg_disable_frame_stats()
|
||||
fn C.sg_frame_stats_enabled() bool
|
||||
fn C.sg_query_frame_stats() C.sg_frame_stats
|
||||
@@ -0,0 +1,983 @@
|
||||
module gfx
|
||||
|
||||
// C.sg_desc describes
|
||||
pub struct C.sg_desc {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
buffer_pool_size int
|
||||
image_pool_size int
|
||||
sampler_pool_size int
|
||||
shader_pool_size int
|
||||
pipeline_pool_size int
|
||||
attachments_pool_size int
|
||||
uniform_buffer_size int
|
||||
max_commit_listeners int
|
||||
disable_validation bool // disable validation layer even in debug mode, useful for tests
|
||||
mtl_force_managed_storage_mode bool // for debugging: use Metal managed storage mode for resources even with UMA
|
||||
mtl_use_command_buffer_with_retained_references bool // Metal: use a managed MTLCommandBuffer which ref-counts used resources
|
||||
wgpu_disable_bindgroups_cache bool // set to true to disable the WebGPU backend BindGroup cache
|
||||
wgpu_bindgroups_cache_size int // number of slots in the WebGPU bindgroup cache (must be 2^N)
|
||||
allocator C.sg_allocator
|
||||
logger C.sg_logger // optional log function override
|
||||
environment C.sg_environment
|
||||
_end_canary u32
|
||||
}
|
||||
|
||||
pub type Desc = C.sg_desc
|
||||
|
||||
pub struct C.sg_color_target_state {
|
||||
pub mut:
|
||||
pixel_format PixelFormat
|
||||
write_mask ColorMask
|
||||
blend BlendState
|
||||
}
|
||||
|
||||
pub type ColorTargetState = C.sg_color_target_state
|
||||
|
||||
pub struct C.sg_pipeline_desc {
|
||||
pub mut:
|
||||
shader Shader
|
||||
layout VertexLayoutState
|
||||
depth DepthState
|
||||
stencil StencilState
|
||||
color_count int
|
||||
colors [4]ColorTargetState // C.SG_MAX_COLOR_ATTACHMENTS
|
||||
primitive_type PrimitiveType
|
||||
index_type IndexType
|
||||
cull_mode CullMode
|
||||
face_winding FaceWinding
|
||||
sample_count int
|
||||
blend_color Color
|
||||
alpha_to_coverage_enabled bool
|
||||
label &char = &char(unsafe { nil })
|
||||
}
|
||||
|
||||
pub type PipelineDesc = C.sg_pipeline_desc
|
||||
|
||||
pub struct C.sg_pipeline_info {
|
||||
pub:
|
||||
slot SlotInfo
|
||||
}
|
||||
|
||||
pub type PipelineInfo = C.sg_pipeline_info
|
||||
|
||||
pub struct C.sg_pipeline {
|
||||
pub:
|
||||
id u32
|
||||
}
|
||||
|
||||
pub type Pipeline = C.sg_pipeline
|
||||
|
||||
pub fn (mut p C.sg_pipeline) free() {
|
||||
C.sg_destroy_pipeline(*p)
|
||||
}
|
||||
|
||||
pub struct C.sg_attachments {
|
||||
id u32
|
||||
}
|
||||
|
||||
// Attachments represents data that can be attached to a render pass.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
pub type Attachments = C.sg_attachments
|
||||
|
||||
// free frees the resources occupied by the struct
|
||||
pub fn (mut a C.sg_attachments) free() {
|
||||
C.sg_destroy_attachments(*a)
|
||||
}
|
||||
|
||||
pub struct C.sg_attachment_desc {
|
||||
pub mut:
|
||||
image Image
|
||||
mip_level int
|
||||
slice int
|
||||
}
|
||||
|
||||
pub type AttachmentDesc = C.sg_attachment_desc
|
||||
|
||||
pub struct C.sg_attachments_desc {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
colors [4]AttachmentDesc
|
||||
resolves [4]AttachmentDesc
|
||||
depth_stencil AttachmentDesc
|
||||
label &char = unsafe { nil }
|
||||
_end_canary u32
|
||||
}
|
||||
|
||||
pub type AttachmentsDesc = C.sg_attachments_desc
|
||||
|
||||
pub struct C.sg_attachments_info {
|
||||
pub mut:
|
||||
slot SlotInfo // resource pool slot info
|
||||
}
|
||||
|
||||
pub type AttachmentsInfo = C.sg_attachments_info
|
||||
|
||||
pub struct C.sg_bindings {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
vertex_buffers [8]Buffer
|
||||
vertex_buffer_offsets [8]int
|
||||
index_buffer Buffer
|
||||
index_buffer_offset int
|
||||
vs StageBindings
|
||||
fs StageBindings
|
||||
_end_canary u32
|
||||
// vs_images [8]Image // old
|
||||
// fs_images [8]Image // old
|
||||
}
|
||||
|
||||
pub type Bindings = C.sg_bindings
|
||||
|
||||
pub fn (mut b Bindings) set_vert_image(index int, img Image) {
|
||||
b.vs.images[index] = img
|
||||
}
|
||||
|
||||
pub fn (mut b Bindings) set_frag_image(index int, img Image) {
|
||||
b.fs.images[index] = img
|
||||
}
|
||||
|
||||
pub fn (b &Bindings) update_vert_buffer(index int, data voidptr, element_size int, element_count int) {
|
||||
range := Range{
|
||||
ptr: data
|
||||
size: usize(element_size * element_count)
|
||||
}
|
||||
C.sg_update_buffer(b.vertex_buffers[index], &range)
|
||||
}
|
||||
|
||||
pub fn (b &Bindings) append_vert_buffer(index int, data voidptr, element_size int, element_count int) int {
|
||||
range := Range{
|
||||
ptr: data
|
||||
size: usize(element_size * element_count)
|
||||
}
|
||||
return C.sg_append_buffer(b.vertex_buffers[index], &range)
|
||||
}
|
||||
|
||||
pub fn (b &Bindings) update_index_buffer(data voidptr, element_size int, element_count int) {
|
||||
range := Range{
|
||||
ptr: data
|
||||
size: usize(element_size * element_count)
|
||||
}
|
||||
C.sg_update_buffer(b.index_buffer, &range)
|
||||
}
|
||||
|
||||
pub fn (b &Bindings) append_index_buffer(data voidptr, element_size int, element_count int) int {
|
||||
range := Range{
|
||||
ptr: data
|
||||
size: usize(element_size * element_count)
|
||||
}
|
||||
return C.sg_append_buffer(b.index_buffer, &range)
|
||||
}
|
||||
|
||||
pub struct C.sg_stage_bindings {
|
||||
pub mut:
|
||||
images [12]Image
|
||||
samplers [8]Sampler
|
||||
storage_buffers [8]Buffer
|
||||
}
|
||||
|
||||
pub type StageBindings = C.sg_stage_bindings
|
||||
|
||||
@[heap]
|
||||
pub struct C.sg_shader_desc {
|
||||
pub mut:
|
||||
attrs [16]ShaderAttrDesc
|
||||
vs ShaderStageDesc
|
||||
fs ShaderStageDesc
|
||||
label &char
|
||||
}
|
||||
|
||||
pub type ShaderDesc = C.sg_shader_desc
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_vert_src(src string) &ShaderDesc {
|
||||
desc.vs.source = &char(src.str)
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_frag_src(src string) &ShaderDesc {
|
||||
desc.fs.source = &char(src.str)
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_vert_image(index int, name string) &ShaderDesc {
|
||||
// desc.vs.images[index].name = &char(name.str)
|
||||
desc.vs.images[index].image_type = ._2d
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_frag_image(index int, name string) &ShaderDesc {
|
||||
// desc.fs.images[index].name = &char(name.str)
|
||||
desc.fs.images[index].image_type = ._2d
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_vert_uniform_block_size(block_index int, size usize) &ShaderDesc {
|
||||
desc.vs.uniform_blocks[block_index].size = size
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_frag_uniform_block_size(block_index int, size usize) &ShaderDesc {
|
||||
desc.fs.uniform_blocks[block_index].size = size
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_vert_uniform(block_index int, uniform_index int, name string, typ UniformType,
|
||||
array_count int) &ShaderDesc {
|
||||
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
|
||||
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].type = typ
|
||||
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].array_count = array_count
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (mut desc C.sg_shader_desc) set_frag_uniform(block_index int, uniform_index int, name string, typ UniformType,
|
||||
array_count int) &ShaderDesc {
|
||||
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
|
||||
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].type = typ
|
||||
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].array_count = array_count
|
||||
return desc
|
||||
}
|
||||
|
||||
pub fn (desc &ShaderDesc) make_shader() Shader {
|
||||
return C.sg_make_shader(desc)
|
||||
}
|
||||
|
||||
pub struct C.sg_shader_attr_desc {
|
||||
pub mut:
|
||||
name &char // GLSL vertex attribute name (only required for GLES2)
|
||||
sem_name &char // HLSL semantic name
|
||||
sem_index int // HLSL semantic index
|
||||
}
|
||||
|
||||
pub type ShaderAttrDesc = C.sg_shader_attr_desc
|
||||
|
||||
pub struct C.sg_shader_stage_desc {
|
||||
pub mut:
|
||||
source &char
|
||||
bytecode Range
|
||||
entry &char
|
||||
d3d11_target &char
|
||||
uniform_blocks [4]ShaderUniformBlockDesc
|
||||
storage_buffers [8]ShaderStorageBufferDesc
|
||||
images [12]ShaderImageDesc
|
||||
samplers [8]ShaderSamplerDesc
|
||||
image_sampler_pairs [12]ShaderImageSamplerPairDesc
|
||||
}
|
||||
|
||||
pub type ShaderStageDesc = C.sg_shader_stage_desc
|
||||
|
||||
pub fn (mut desc ShaderStageDesc) set_image(index int, name string) ShaderStageDesc {
|
||||
// desc.images[index].name = &char(name.str)
|
||||
desc.images[index].image_type = ._2d
|
||||
return *desc
|
||||
}
|
||||
|
||||
pub struct C.sg_shader_uniform_block_desc {
|
||||
pub mut:
|
||||
size usize
|
||||
layout UniformLayout
|
||||
uniforms [16]ShaderUniformDesc
|
||||
}
|
||||
|
||||
pub type ShaderUniformBlockDesc = C.sg_shader_uniform_block_desc
|
||||
|
||||
pub struct C.sg_shader_uniform_desc {
|
||||
pub mut:
|
||||
name &char
|
||||
type UniformType
|
||||
array_count int
|
||||
}
|
||||
|
||||
pub type ShaderUniformDesc = C.sg_shader_uniform_desc
|
||||
|
||||
pub struct C.sg_shader_image_desc {
|
||||
pub mut:
|
||||
used bool
|
||||
multisampled bool
|
||||
// name &char
|
||||
image_type ImageType
|
||||
sample_type ImageSampleType
|
||||
}
|
||||
|
||||
pub type ShaderImageDesc = C.sg_shader_image_desc
|
||||
|
||||
pub struct C.sg_shader_storage_buffer_desc {
|
||||
pub mut:
|
||||
used bool
|
||||
readonly bool
|
||||
}
|
||||
|
||||
pub type ShaderStorageBufferDesc = C.sg_shader_storage_buffer_desc
|
||||
|
||||
pub struct C.sg_shader_sampler_desc {
|
||||
pub mut:
|
||||
used bool
|
||||
sampler_type SamplerType
|
||||
}
|
||||
|
||||
pub type ShaderSamplerDesc = C.sg_shader_sampler_desc
|
||||
|
||||
pub struct C.sg_shader_image_sampler_pair_desc {
|
||||
pub mut:
|
||||
used bool
|
||||
image_slot int
|
||||
sampler_slot int
|
||||
glsl_name &char
|
||||
}
|
||||
|
||||
pub type ShaderImageSamplerPairDesc = C.sg_shader_image_sampler_pair_desc
|
||||
|
||||
pub struct C.sg_shader_info {
|
||||
pub:
|
||||
slot SlotInfo
|
||||
}
|
||||
|
||||
pub type ShaderInfo = C.sg_shader_info
|
||||
|
||||
pub struct C.sg_range {
|
||||
pub mut:
|
||||
ptr voidptr
|
||||
size usize
|
||||
}
|
||||
|
||||
pub type Range = C.sg_range
|
||||
|
||||
pub struct C.sg_color {
|
||||
pub mut:
|
||||
r f32
|
||||
g f32
|
||||
b f32
|
||||
a f32
|
||||
}
|
||||
|
||||
pub type Color = C.sg_color
|
||||
|
||||
pub struct C.sg_shader {
|
||||
pub:
|
||||
id u32
|
||||
}
|
||||
|
||||
pub type Shader = C.sg_shader
|
||||
|
||||
pub fn (mut s Shader) free() {
|
||||
C.sg_destroy_shader(*s)
|
||||
}
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_gl {
|
||||
num_bind_buffer u32
|
||||
num_active_texture u32
|
||||
num_bind_texture u32
|
||||
num_bind_sampler u32
|
||||
num_use_program u32
|
||||
num_render_state u32
|
||||
num_vertex_attrib_pointer u32
|
||||
num_vertex_attrib_divisor u32
|
||||
num_enable_vertex_attrib_array u32
|
||||
num_disable_vertex_attrib_array u32
|
||||
num_uniform u32
|
||||
}
|
||||
|
||||
pub type FrameStatsGL = C.sg_frame_stats_gl
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_d3d11_pass {
|
||||
num_om_set_render_targets u32
|
||||
num_clear_render_target_view u32
|
||||
num_clear_depth_stencil_view u32
|
||||
num_resolve_subresource u32
|
||||
}
|
||||
|
||||
pub type FrameStatsD3D11Pass = C.sg_frame_stats_d3d11_pass
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_d3d11_pipeline {
|
||||
num_rs_set_state u32
|
||||
num_om_set_depth_stencil_state u32
|
||||
num_om_set_blend_state u32
|
||||
num_ia_set_primitive_topology u32
|
||||
num_ia_set_input_layout u32
|
||||
num_vs_set_shader u32
|
||||
num_vs_set_constant_buffers u32
|
||||
num_ps_set_shader u32
|
||||
num_ps_set_constant_buffers u32
|
||||
}
|
||||
|
||||
pub type FrameStatsD3D11Pipeline = C.sg_frame_stats_d3d11_pipeline
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_d3d11_bindings {
|
||||
num_ia_set_vertex_buffers u32
|
||||
num_ia_set_index_buffer u32
|
||||
num_vs_set_shader_resources u32
|
||||
num_ps_set_shader_resources u32
|
||||
num_vs_set_samplers u32
|
||||
num_ps_set_samplers u32
|
||||
}
|
||||
|
||||
pub type FrameStatsD3D11Bindings = C.sg_frame_stats_d3d11_bindings
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_d3d11_uniforms {
|
||||
num_update_subresource u32
|
||||
}
|
||||
|
||||
pub type FrameStatsD3D11Uniforms = C.sg_frame_stats_d3d11_uniforms
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_d3d11_draw {
|
||||
num_draw_indexed_instanced u32
|
||||
num_draw_indexed u32
|
||||
num_draw_instanced u32
|
||||
num_draw u32
|
||||
}
|
||||
|
||||
pub type FrameStatsD3D11Draw = C.sg_frame_stats_d3d11_draw
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_d3d11 {
|
||||
pass FrameStatsD3D11Pass
|
||||
pipeline FrameStatsD3D11Pipeline
|
||||
bindings FrameStatsD3D11Bindings
|
||||
uniforms FrameStatsD3D11Uniforms
|
||||
draw FrameStatsD3D11Draw
|
||||
num_map u32
|
||||
num_unmap u32
|
||||
}
|
||||
|
||||
pub type FrameStatsD3D11 = C.sg_frame_stats_d3d11
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_metal_idpool {
|
||||
num_added u32
|
||||
num_released u32
|
||||
num_garbage_collected u32
|
||||
}
|
||||
|
||||
pub type FrameStatsMetalIdpool = C.sg_frame_stats_metal_idpool
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_metal_pipeline {
|
||||
num_set_blend_color u32
|
||||
num_set_cull_mode u32
|
||||
num_set_front_facing_winding u32
|
||||
num_set_stencil_reference_value u32
|
||||
num_set_depth_bias u32
|
||||
num_set_render_pipeline_state u32
|
||||
num_set_depth_stencil_state u32
|
||||
}
|
||||
|
||||
pub type FrameStatsMetalPipeline = C.sg_frame_stats_metal_pipeline
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_metal_bindings {
|
||||
num_set_vertex_buffer u32
|
||||
num_set_vertex_texture u32
|
||||
num_set_vertex_sampler_state u32
|
||||
num_set_fragment_buffer u32
|
||||
num_set_fragment_texture u32
|
||||
num_set_fragment_sampler_state u32
|
||||
}
|
||||
|
||||
pub type FrameStatsMetalBindings = C.sg_frame_stats_metal_bindings
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_metal_uniforms {
|
||||
num_set_vertex_buffer_offset u32
|
||||
num_set_fragment_buffer_offset u32
|
||||
}
|
||||
|
||||
pub type FrameStatsMetalUniforms = C.sg_frame_stats_metal_uniforms
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_metal {
|
||||
idpool FrameStatsMetalIdpool
|
||||
pipeline FrameStatsMetalPipeline
|
||||
bindings FrameStatsMetalBindings
|
||||
uniforms FrameStatsMetalUniforms
|
||||
}
|
||||
|
||||
pub type FrameStatsMetal = C.sg_frame_stats_metal
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_wgpu_uniforms {
|
||||
num_set_bindgroup u32
|
||||
size_write_buffer u32
|
||||
}
|
||||
|
||||
pub type FrameStatsWGPUUniforms = C.sg_frame_stats_wgpu_uniforms
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_wgpu_bindings {
|
||||
num_set_vertex_buffer u32
|
||||
num_skip_redundant_vertex_buffer u32
|
||||
num_set_index_buffer u32
|
||||
num_skip_redundant_index_buffer u32
|
||||
num_create_bindgroup u32
|
||||
num_discard_bindgroup u32
|
||||
num_set_bindgroup u32
|
||||
num_skip_redundant_bindgroup u32
|
||||
num_bindgroup_cache_hits u32
|
||||
num_bindgroup_cache_misses u32
|
||||
num_bindgroup_cache_collisions u32
|
||||
num_bindgroup_cache_hash_vs_key_mismatch u32
|
||||
}
|
||||
|
||||
pub type FrameStatsWGPUBindings = C.sg_frame_stats_wgpu_bindings
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_wgpu {
|
||||
uniforms FrameStatsWGPUUniforms
|
||||
bindings FrameStatsWGPUBindings
|
||||
}
|
||||
|
||||
pub type FrameStatsWGPU = C.sg_frame_stats_wgpu
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats {
|
||||
frame_index u32 // current frame counter, starts at 0
|
||||
|
||||
num_passes u32
|
||||
num_apply_viewport u32
|
||||
num_apply_scissor_rect u32
|
||||
num_apply_pipeline u32
|
||||
num_apply_bindings u32
|
||||
num_apply_uniforms u32
|
||||
num_draw u32
|
||||
num_update_buffer u32
|
||||
num_append_buffer u32
|
||||
num_update_image u32
|
||||
|
||||
size_apply_uniforms u32
|
||||
size_update_buffer u32
|
||||
size_append_buffer u32
|
||||
size_update_image u32
|
||||
|
||||
gl FrameStatsGL
|
||||
d3d11 FrameStatsD3D11
|
||||
metal FrameStatsMetal
|
||||
wgpu FrameStatsWGPU
|
||||
}
|
||||
|
||||
pub type FrameStats = C.sg_frame_stats
|
||||
|
||||
pub struct C.sg_pass_action {
|
||||
pub mut:
|
||||
colors [4]ColorAttachmentAction
|
||||
depth DepthAttachmentAction
|
||||
stencil StencilAttachmentAction
|
||||
}
|
||||
|
||||
pub type PassAction = C.sg_pass_action
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_metal_swapchain {
|
||||
pub mut:
|
||||
current_drawable voidptr
|
||||
depth_stencil_texture voidptr // MTLTexture
|
||||
msaa_color_texture voidptr // MTLTexture
|
||||
}
|
||||
|
||||
pub type MetalSwapchain = C.sg_metal_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_d3d11_swapchain {
|
||||
pub mut:
|
||||
render_view voidptr // ID3D11RenderTargetView
|
||||
resolve_view voidptr // ID3D11RenderTargetView
|
||||
depth_stencil_view voidptr // ID3D11DepthStencilView
|
||||
}
|
||||
|
||||
pub type D3d11Swapchain = C.sg_d3d11_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_wgpu_swapchain {
|
||||
pub mut:
|
||||
render_view voidptr // WGPUTextureView
|
||||
resolve_view voidptr // WGPUTextureView
|
||||
depth_stencil_view voidptr // WGPUTextureView
|
||||
}
|
||||
|
||||
pub type WgpuSwapchain = C.sg_wgpu_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_gl_swapchain {
|
||||
pub mut:
|
||||
framebuffer u32
|
||||
}
|
||||
|
||||
pub type GlSwapchain = C.sg_gl_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_swapchain {
|
||||
pub mut:
|
||||
width int
|
||||
height int
|
||||
sample_count int
|
||||
color_format PixelFormat
|
||||
depth_format PixelFormat
|
||||
metal MetalSwapchain
|
||||
d3d11 D3d11Swapchain
|
||||
wgpu WgpuSwapchain
|
||||
gl GlSwapchain
|
||||
}
|
||||
|
||||
pub type Swapchain = C.sg_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_pass {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
action PassAction
|
||||
attachments Attachments
|
||||
swapchain Swapchain
|
||||
label &char = unsafe { nil }
|
||||
_end_canary u32
|
||||
}
|
||||
|
||||
pub type Pass = C.sg_pass
|
||||
|
||||
pub struct C.sg_buffer_desc {
|
||||
pub mut:
|
||||
size usize
|
||||
type BufferType
|
||||
usage Usage
|
||||
data Range
|
||||
label &char
|
||||
// backend-specific resources
|
||||
gl_buffers [2]u32
|
||||
mtl_buffers [2]voidptr
|
||||
d3d11_buffer voidptr
|
||||
wgpu_buffer voidptr
|
||||
}
|
||||
|
||||
pub type BufferDesc = C.sg_buffer_desc
|
||||
|
||||
pub struct C.sg_slot_info {
|
||||
state ResourceState
|
||||
res_id u32
|
||||
ctx_id u32
|
||||
}
|
||||
|
||||
pub type SlotInfo = C.sg_slot_info
|
||||
|
||||
pub struct C.sg_buffer_info {
|
||||
pub:
|
||||
slot SlotInfo
|
||||
update_frame_index u32
|
||||
append_frame_index u32
|
||||
append_pos int
|
||||
append_overflow bool
|
||||
num_slots int
|
||||
active_slot int
|
||||
}
|
||||
|
||||
pub type BufferInfo = C.sg_buffer_info
|
||||
|
||||
pub struct C.sg_buffer {
|
||||
id u32
|
||||
}
|
||||
|
||||
pub type Buffer = C.sg_buffer
|
||||
|
||||
pub fn (mut b Buffer) free() {
|
||||
C.sg_destroy_buffer(*b)
|
||||
}
|
||||
|
||||
pub struct C.sg_image_desc {
|
||||
pub mut:
|
||||
type ImageType
|
||||
render_target bool
|
||||
width int
|
||||
height int
|
||||
num_slices int
|
||||
num_mipmaps int
|
||||
usage Usage
|
||||
pixel_format PixelFormat
|
||||
sample_count int
|
||||
// min_filter Filter
|
||||
// mag_filter Filter
|
||||
// wrap_u Wrap
|
||||
// wrap_v Wrap
|
||||
// wrap_w Wrap
|
||||
// border_color BorderColor
|
||||
// max_anisotropy u32
|
||||
// min_lod f32
|
||||
// max_lod f32
|
||||
data ImageData
|
||||
label &char
|
||||
// backend-specific resources
|
||||
gl_textures [2]u32
|
||||
gl_texture_target u32
|
||||
mtl_textures [2]voidptr
|
||||
d3d11_texture voidptr
|
||||
d3d11_shader_resource_view voidptr
|
||||
wgpu_texture voidptr
|
||||
}
|
||||
|
||||
pub type ImageDesc = C.sg_image_desc
|
||||
|
||||
pub struct C.sg_sampler_desc {
|
||||
min_filter Filter
|
||||
mag_filter Filter
|
||||
mipmap_filter Filter
|
||||
wrap_u Wrap
|
||||
wrap_v Wrap
|
||||
wrap_w Wrap
|
||||
min_lod f32
|
||||
max_lod f32
|
||||
border_color BorderColor
|
||||
compare CompareFunc
|
||||
max_anisotropy u32
|
||||
label &char
|
||||
// backend-specific resources
|
||||
gl_sampler u32
|
||||
mtl_sampler voidptr
|
||||
d3d11_sampler voidptr
|
||||
wgpu_sampler voidptr
|
||||
}
|
||||
|
||||
pub type SamplerDesc = C.sg_sampler_desc
|
||||
|
||||
pub struct C.sg_image_info {
|
||||
pub mut:
|
||||
slot SlotInfo // resource pool slot info
|
||||
upd_frame_index u32 // frame index of last sg_update_image()
|
||||
num_slots int // number of renaming-slots for dynamically updated images
|
||||
active_slot int // currently active write-slot for dynamically updated images
|
||||
}
|
||||
|
||||
pub type ImageInfo = C.sg_image_info
|
||||
|
||||
pub struct C.sg_image {
|
||||
pub mut:
|
||||
id u32
|
||||
}
|
||||
|
||||
pub type Image = C.sg_image
|
||||
|
||||
pub fn (mut i Image) free() {
|
||||
C.sg_destroy_image(*i)
|
||||
}
|
||||
|
||||
pub struct C.sg_sampler {
|
||||
pub mut:
|
||||
id u32
|
||||
}
|
||||
|
||||
pub type Sampler = C.sg_sampler
|
||||
|
||||
pub const sg_cubeface_num = 6
|
||||
|
||||
pub const sg_max_mipmaps = 16
|
||||
|
||||
pub struct C.sg_image_data {
|
||||
pub mut:
|
||||
subimage [sg_cubeface_num][sg_max_mipmaps]Range
|
||||
}
|
||||
|
||||
pub type ImageData = C.sg_image_data
|
||||
|
||||
pub struct C.sg_features {
|
||||
pub:
|
||||
origin_top_left bool // framebuffer and texture origin is in top left corner
|
||||
image_clamp_to_border bool // border color and clamp-to-border UV-wrap mode is supported
|
||||
mrt_independent_blend_state bool // multiple-render-target rendering can use per-render-target blend state
|
||||
mrt_independent_write_mask bool // multiple-render-target rendering can use per-render-target color write masks
|
||||
storage_buffer bool // storage buffers are supported
|
||||
}
|
||||
|
||||
pub type Features = C.sg_features
|
||||
|
||||
pub struct C.sg_limits {
|
||||
pub:
|
||||
max_image_size_2d int // max width/height of SG_IMAGETYPE_2D images
|
||||
max_image_size_cube int // max width/height of SG_IMAGETYPE_CUBE images
|
||||
max_image_size_3d int // max width/height/depth of SG_IMAGETYPE_3D images
|
||||
max_image_size_array int // max width/height pf SG_IMAGETYPE_ARRAY images
|
||||
max_image_array_layers int // max number of layers in SG_IMAGETYPE_ARRAY images
|
||||
max_vertex_attrs int // <= SG_MAX_VERTEX_ATTRIBUTES (only on some GLES2 impls)
|
||||
gl_max_vertex_uniform_components int // <= GL_MAX_VERTEX_UNIFORM_COMPONENTS (only on GL backends)
|
||||
gl_max_combined_texture_image_units int // <= GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (only on GL backends)
|
||||
}
|
||||
|
||||
pub type Limits = C.sg_limits
|
||||
|
||||
pub struct C.sg_vertex_layout_state {
|
||||
pub mut:
|
||||
buffers [8]VertexBufferLayoutState
|
||||
attrs [16]VertexAttrDesc
|
||||
}
|
||||
|
||||
pub type VertexLayoutState = C.sg_vertex_layout_state
|
||||
|
||||
pub struct C.sg_vertex_buffer_layout_state {
|
||||
pub mut:
|
||||
stride int
|
||||
step_func VertexStep
|
||||
step_rate int
|
||||
}
|
||||
|
||||
pub type VertexBufferLayoutState = C.sg_vertex_buffer_layout_state
|
||||
|
||||
pub struct C.sg_vertex_attr_state {
|
||||
pub mut:
|
||||
buffer_index int
|
||||
offset int
|
||||
format VertexFormat
|
||||
}
|
||||
|
||||
pub type VertexAttrDesc = C.sg_vertex_attr_state
|
||||
|
||||
pub struct C.sg_stencil_state {
|
||||
enabled bool
|
||||
front StencilFaceState
|
||||
back StencilFaceState
|
||||
read_mask u8
|
||||
write_mask u8
|
||||
ref u8
|
||||
}
|
||||
|
||||
pub type StencilState = C.sg_stencil_state
|
||||
|
||||
pub struct C.sg_depth_state {
|
||||
pixel_format PixelFormat
|
||||
compare CompareFunc
|
||||
write_enabled bool
|
||||
bias f32
|
||||
bias_slope_scale f32
|
||||
bias_clamp f32
|
||||
}
|
||||
|
||||
pub type DepthState = C.sg_depth_state
|
||||
|
||||
pub struct C.sg_stencil_face_state {
|
||||
compare CompareFunc
|
||||
fail_op StencilOp
|
||||
depth_fail_op StencilOp
|
||||
pass_op StencilOp
|
||||
}
|
||||
|
||||
pub type StencilFaceState = C.sg_stencil_face_state
|
||||
|
||||
pub struct C.sg_blend_state {
|
||||
pub mut:
|
||||
enabled bool
|
||||
src_factor_rgb BlendFactor
|
||||
dst_factor_rgb BlendFactor
|
||||
op_rgb BlendOp
|
||||
src_factor_alpha BlendFactor
|
||||
dst_factor_alpha BlendFactor
|
||||
op_alpha BlendOp
|
||||
}
|
||||
|
||||
pub type BlendState = C.sg_blend_state
|
||||
|
||||
pub struct C.sg_color_attachment_action {
|
||||
pub mut:
|
||||
load_action LoadAction
|
||||
store_action StoreAction
|
||||
clear_value Color
|
||||
}
|
||||
|
||||
pub type ColorAttachmentAction = C.sg_color_attachment_action
|
||||
|
||||
/*
|
||||
pub fn (mut action C.sg_color_attachment_action) set_color_values(r, g, b, a f32) {
|
||||
action.val[0] = r
|
||||
action.val[1] = g
|
||||
action.val[2] = b
|
||||
action.val[3] = a
|
||||
}
|
||||
*/
|
||||
pub struct C.sg_depth_attachment_action {
|
||||
pub mut:
|
||||
load_action LoadAction
|
||||
store_action StoreAction
|
||||
clear_value f32
|
||||
}
|
||||
|
||||
pub type DepthAttachmentAction = C.sg_depth_attachment_action
|
||||
|
||||
pub struct C.sg_stencil_attachment_action {
|
||||
pub mut:
|
||||
load_action LoadAction
|
||||
store_action StoreAction
|
||||
clear_value u8
|
||||
}
|
||||
|
||||
pub type StencilAttachmentAction = C.sg_stencil_attachment_action
|
||||
|
||||
pub struct C.sg_pixelformat_info {
|
||||
pub:
|
||||
sample bool // pixel format can be sampled in shaders
|
||||
filter bool // pixel format can be sampled with filtering
|
||||
render bool // pixel format can be used as render target
|
||||
blend bool // alpha-blending is supported
|
||||
msaa bool // pixel format can be used as MSAA render target
|
||||
depth bool // pixel format is a depth format
|
||||
}
|
||||
|
||||
pub type PixelFormatInfo = C.sg_pixelformat_info
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_environment_defaults {
|
||||
pub mut:
|
||||
color_format PixelFormat
|
||||
depth_format PixelFormat
|
||||
sample_count int
|
||||
}
|
||||
|
||||
pub type EnvironmentDefaults = C.sg_environment_defaults
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_metal_environment {
|
||||
pub mut:
|
||||
device voidptr
|
||||
}
|
||||
|
||||
pub type MetalEnvironment = C.sg_metal_environment
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_d3d11_environment {
|
||||
pub mut:
|
||||
device voidptr
|
||||
device_context voidptr
|
||||
}
|
||||
|
||||
pub type D3d11Environment = C.sg_d3d11_environment
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_wgpu_environment {
|
||||
pub mut:
|
||||
device voidptr
|
||||
}
|
||||
|
||||
pub type WgpuEnvironment = C.sg_wgpu_environment
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_environment {
|
||||
pub mut:
|
||||
defaults EnvironmentDefaults
|
||||
metal MetalEnvironment
|
||||
d3d11 D3d11Environment
|
||||
wgpu WgpuEnvironment
|
||||
}
|
||||
|
||||
pub type Environment = C.sg_environment
|
||||
|
||||
// C.sg_commit_listener is used with sg_add_commit_listener, to add a callback,
|
||||
// which will be called in sg_commit(). This is useful for libraries building
|
||||
// on top of sokol-gfx to be notified about when a frame ends (instead of having
|
||||
// to guess, or add a manual 'new-frame' function).
|
||||
pub struct C.sg_commit_listener {
|
||||
pub:
|
||||
func fn (user_data voidptr)
|
||||
user_data voidptr
|
||||
}
|
||||
|
||||
pub type CommitListener = C.sg_commit_listener
|
||||
|
||||
pub struct C.sg_trace_hooks {}
|
||||
|
||||
// pub struct C.sg_resource_state {} enum
|
||||
pub struct C.sg_sampler_info {}
|
||||
@@ -0,0 +1,29 @@
|
||||
// vtest build: !msvc
|
||||
// vtest flaky: true
|
||||
// vtest retry: 1
|
||||
module gfx
|
||||
|
||||
import os
|
||||
|
||||
fn assert_program_panics(source string, expected string) {
|
||||
source_path := os.join_path(os.temp_dir(),
|
||||
'sokol_gfx_make_image_requires_setup_${os.getpid()}.v')
|
||||
os.write_file(source_path, source) or { panic(err) }
|
||||
defer {
|
||||
os.rm(source_path) or {}
|
||||
}
|
||||
res := os.execute('${os.quoted_path(@VEXE)} run ${os.quoted_path(source_path)}')
|
||||
assert res.exit_code != 0, 'expected the test program to fail'
|
||||
assert res.output.contains(expected), 'expected `${expected}` in `${res.output}`'
|
||||
}
|
||||
|
||||
fn test_make_image_requires_setup() {
|
||||
assert_program_panics('import sokol.gfx
|
||||
|
||||
fn main() {
|
||||
mut desc := gfx.ImageDesc{}
|
||||
_ = gfx.make_image(&desc)
|
||||
}
|
||||
',
|
||||
'sokol.gfx is not initialized; call gfx.setup(...) before gfx.make_image(...)')
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
module gfx
|
||||
|
||||
// create_clear_pass_action returns a *clearing* `PassAction` that clears the `Pass`
|
||||
// with the color defined by the color components `r`ed,`g`reen, `b`lue and `a`lpha.
|
||||
pub fn create_clear_pass_action(r f32, g f32, b f32, a f32) PassAction {
|
||||
mut color_action := ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
clear_value: Color{
|
||||
r: r
|
||||
g: g
|
||||
b: b
|
||||
a: a
|
||||
}
|
||||
}
|
||||
// color_action.set_color_values(r, g, b, a)
|
||||
mut pass_action := PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
return pass_action
|
||||
}
|
||||
Reference in new issue
Block a user