Skip to content

Instantly share code, notes, and snippets.

@froody
Created February 18, 2024 06:56
Show Gist options
  • Save froody/f1d4ec656a2110191ea1618187806ba1 to your computer and use it in GitHub Desktop.
Save froody/f1d4ec656a2110191ea1618187806ba1 to your computer and use it in GitHub Desktop.
msl vertex 20
[2024-02-18T06:54:18Z DEBUG wgpu_hal::metal] PrivateCapabilities {
family_check: true,
msl_version: V2_4,
fragment_rw_storage: true,
read_write_texture_tier: Tier2,
msaa_desktop: true,
msaa_apple3: true,
msaa_apple7: true,
resource_heaps: true,
argument_buffers: true,
shared_textures: false,
mutable_comparison_samplers: true,
sampler_clamp_to_border: true,
indirect_draw_dispatch: true,
base_vertex_first_instance_drawing: true,
dual_source_blending: true,
low_power: false,
headless: false,
layered_rendering: true,
function_specialization: true,
depth_clip_mode: true,
texture_cube_array: true,
supports_float_filtering: true,
format_depth24_stencil8: false,
format_depth32_stencil8_filter: true,
format_depth32_stencil8_none: false,
format_min_srgb_channels: 4,
format_b5: false,
format_bc: true,
format_eac_etc: true,
format_astc: true,
format_astc_hdr: true,
format_any8_unorm_srgb_all: true,
format_any8_unorm_srgb_no_write: false,
format_any8_snorm_all: true,
format_r16_norm_all: true,
format_r32_all: false,
format_r32_no_write: false,
format_r32float_no_write_no_filter: false,
format_r32float_no_filter: false,
format_r32float_all: true,
format_rgba8_srgb_all: true,
format_rgba8_srgb_no_write: false,
format_rgb10a2_unorm_all: true,
format_rgb10a2_unorm_no_write: false,
format_rgb10a2_uint_write: true,
format_rg11b10_all: true,
format_rg11b10_no_write: false,
format_rgb9e5_all: true,
format_rgb9e5_no_write: false,
format_rgb9e5_filter_only: true,
format_rg32_color: true,
format_rg32_color_write: true,
format_rg32float_all: true,
format_rg32float_color_blend: true,
format_rg32float_no_filter: false,
format_rgba32int_color: true,
format_rgba32int_color_write: true,
format_rgba32float_color: true,
format_rgba32float_color_write: true,
format_rgba32float_all: true,
format_depth16unorm: true,
format_depth32float_filter: true,
format_depth32float_none: false,
format_bgr10a2_all: true,
format_bgr10a2_no_write: false,
max_buffers_per_stage: 31,
max_vertex_buffers: 16,
max_textures_per_stage: 128,
max_samplers_per_stage: 16,
buffer_alignment: 256,
max_buffer_size: 38654705664,
max_texture_size: 16384,
max_texture_3d_size: 2048,
max_texture_layers: 2048,
max_fragment_input_components: 124,
max_color_render_targets: 8,
max_color_attachment_bytes_per_sample: 64,
max_varying_components: 124,
max_threads_per_group: 1024,
max_total_threadgroup_memory: 32768,
sample_count_mask: TextureFormatCapabilities(
MULTISAMPLE_X2 | MULTISAMPLE_X4,
),
supports_debug_markers: true,
supports_binary_archives: true,
supports_capture_manager: true,
can_set_maximum_drawables_count: true,
can_set_display_sync: true,
can_set_next_drawable_timeout: true,
supports_arrays_of_textures: true,
supports_arrays_of_textures_write: true,
supports_mutability: true,
supports_depth_clip_control: true,
supports_preserve_invariance: true,
supports_shader_primitive_index: true,
has_unified_memory: Some(
true,
),
timestamp_query_support: TimestampQuerySupport(
STAGE_BOUNDARIES,
),
}
[2024-02-18T06:54:18Z DEBUG wgpu_hal::metal::device] Naga generated shader for entry point 'main' and stage Compute
// language: metal2.4
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
struct DefaultConstructible {
template<typename T>
operator T() && {
return T {};
}
};
struct _mslBufferSizes {
uint size0;
uint size1;
uint size2;
uint size3;
uint size4;
};
typedef uint type_1[1];
struct Vertex20_ {
metal::packed_uint3 values;
float padding;
uint padding2_;
};
struct Vertex32_ {
metal::packed_uint3 values;
float padding;
uint padding2_;
uint padding3_;
uint padding4_;
uint padding5_;
};
typedef Vertex20_ type_4[1];
typedef Vertex32_ type_5[1];
uint collatz_iterations(
uint n_base
) {
uint n = {};
uint i = 0u;
n = n_base;
while(true) {
uint _e4 = n;
if (_e4 <= 1u) {
break;
}
uint _e7 = n;
if ((_e7 % 2u) == 0u) {
uint _e12 = n;
n = _e12 / 2u;
} else {
uint _e15 = n;
if (_e15 >= 1431655765u) {
return 4294967295u;
}
uint _e20 = n;
n = (3u * _e20) + 1u;
}
uint _e24 = i;
i = _e24 + 1u;
}
uint _e27 = i;
return _e27;
}
struct main_Input {
};
kernel void main_(
metal::uint3 global_id [[thread_position_in_grid]]
, device type_1& v_indices [[buffer(0)]]
, constant _mslBufferSizes& _buffer_sizes [[buffer(1)]]
) {
uint _e2 = global_id.x;
uint _e5 = global_id.x;
uint _e7 = uint(_e5) < 1 + (_buffer_sizes.size0 - 0 - 4) / 4 ? v_indices[_e5] : DefaultConstructible();
uint _e8 = collatz_iterations(_e7);
if (uint(_e2) < 1 + (_buffer_sizes.size0 - 0 - 4) / 4) {
v_indices[_e2] = _e8;
}
return;
}
[2024-02-18T06:54:18Z DEBUG wgpu_hal::metal::device] Naga generated shader for entry point 'main_20' and stage Compute
// language: metal2.4
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
struct DefaultConstructible {
template<typename T>
operator T() && {
return T {};
}
};
struct _mslBufferSizes {
uint size0;
uint size1;
uint size2;
uint size3;
uint size4;
};
typedef uint type_1[1];
struct Vertex20_ {
metal::packed_uint3 values;
float padding;
uint padding2_;
};
struct Vertex32_ {
metal::packed_uint3 values;
float padding;
uint padding2_;
uint padding3_;
uint padding4_;
uint padding5_;
};
typedef Vertex20_ type_4[1];
typedef Vertex32_ type_5[1];
uint collatz_iterations(
uint n_base
) {
uint n = {};
uint i = 0u;
n = n_base;
while(true) {
uint _e4 = n;
if (_e4 <= 1u) {
break;
}
uint _e7 = n;
if ((_e7 % 2u) == 0u) {
uint _e12 = n;
n = _e12 / 2u;
} else {
uint _e15 = n;
if (_e15 >= 1431655765u) {
return 4294967295u;
}
uint _e20 = n;
n = (3u * _e20) + 1u;
}
uint _e24 = i;
i = _e24 + 1u;
}
uint _e27 = i;
return _e27;
}
struct main_20_Input {
};
kernel void main_20_(
metal::uint3 global_id_1 [[thread_position_in_grid]]
, device type_1& v20_indices [[buffer(0)]]
, device type_4 const& v20_ [[buffer(1)]]
, constant _mslBufferSizes& _buffer_sizes [[buffer(2)]]
) {
uint _e2 = global_id_1.x;
uint _e5 = global_id_1.x;
uint _e9 = uint(_e5) < 1 + (_buffer_sizes.size2 - 0 - 32) / 32 ? v20_[_e5].values[0] : DefaultConstructible();
if (uint(_e2) < 1 + (_buffer_sizes.size1 - 0 - 4) / 4) {
v20_indices[_e2] = _e9;
}
return;
}
[2024-02-18T06:54:18Z DEBUG wgpu_hal::metal::device] Naga generated shader for entry point 'main_32' and stage Compute
// language: metal2.4
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
struct DefaultConstructible {
template<typename T>
operator T() && {
return T {};
}
};
struct _mslBufferSizes {
uint size0;
uint size1;
uint size2;
uint size3;
uint size4;
};
typedef uint type_1[1];
struct Vertex20_ {
metal::packed_uint3 values;
float padding;
uint padding2_;
};
struct Vertex32_ {
metal::packed_uint3 values;
float padding;
uint padding2_;
uint padding3_;
uint padding4_;
uint padding5_;
};
typedef Vertex20_ type_4[1];
typedef Vertex32_ type_5[1];
uint collatz_iterations(
uint n_base
) {
uint n = {};
uint i = 0u;
n = n_base;
while(true) {
uint _e4 = n;
if (_e4 <= 1u) {
break;
}
uint _e7 = n;
if ((_e7 % 2u) == 0u) {
uint _e12 = n;
n = _e12 / 2u;
} else {
uint _e15 = n;
if (_e15 >= 1431655765u) {
return 4294967295u;
}
uint _e20 = n;
n = (3u * _e20) + 1u;
}
uint _e24 = i;
i = _e24 + 1u;
}
uint _e27 = i;
return _e27;
}
struct main_32_Input {
};
kernel void main_32_(
metal::uint3 global_id_2 [[thread_position_in_grid]]
, device type_1& v32_indices [[buffer(0)]]
, device type_5 const& v32_ [[buffer(1)]]
, constant _mslBufferSizes& _buffer_sizes [[buffer(2)]]
) {
uint _e2 = global_id_2.x;
uint _e5 = global_id_2.x;
uint _e9 = uint(_e5) < 1 + (_buffer_sizes.size4 - 0 - 32) / 32 ? v32_[_e5].values[0] : DefaultConstructible();
if (uint(_e2) < 1 + (_buffer_sizes.size3 - 0 - 4) / 4) {
v32_indices[_e2] = _e9;
}
return;
}
result: 189
result with vertex 20: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0]
result with vertex 32: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment