add mac support
This commit is contained in:
parent
fdda343b81
commit
dc9bd3833e
@ -53,6 +53,7 @@ build_lib_arm64_release sokol_time time/sokol_time_macos_arm64_metal_rele
|
||||
build_lib_arm64_release sokol_audio audio/sokol_audio_macos_arm64_metal_release SOKOL_METAL
|
||||
build_lib_arm64_release sokol_debugtext debugtext/sokol_debugtext_macos_arm64_metal_release SOKOL_METAL
|
||||
build_lib_arm64_release sokol_shape shape/sokol_shape_macos_arm64_metal_release SOKOL_METAL
|
||||
build_lib_arm64_release sokol_fetch fetch/sokol_fetch_macos_arm64_metal_release SOKOL_METAL
|
||||
build_lib_arm64_release sokol_gl gl/sokol_gl_macos_arm64_metal_release SOKOL_METAL
|
||||
build_lib_arm64_release sokol_fontstash fontstash/sokol_fontstash_macos_arm64_metal_release SOKOL_METAL
|
||||
|
||||
@ -65,6 +66,7 @@ build_lib_arm64_debug sokol_time time/sokol_time_macos_arm64_metal_debu
|
||||
build_lib_arm64_debug sokol_audio audio/sokol_audio_macos_arm64_metal_debug SOKOL_METAL
|
||||
build_lib_arm64_debug sokol_debugtext debugtext/sokol_debugtext_macos_arm64_metal_debug SOKOL_METAL
|
||||
build_lib_arm64_debug sokol_shape shape/sokol_shape_macos_arm64_metal_debug SOKOL_METAL
|
||||
build_lib_arm64_debug sokol_fetch fetch/sokol_fetch_macos_arm64_metal_debug SOKOL_METAL
|
||||
build_lib_arm64_debug sokol_gl gl/sokol_gl_macos_arm64_metal_debug SOKOL_METAL
|
||||
|
||||
# x64 + Metal + Release
|
||||
@ -76,6 +78,7 @@ build_lib_x64_release sokol_time time/sokol_time_macos_x64_metal_release
|
||||
build_lib_x64_release sokol_audio audio/sokol_audio_macos_x64_metal_release SOKOL_METAL
|
||||
build_lib_x64_release sokol_debugtext debugtext/sokol_debugtext_macos_x64_metal_release SOKOL_METAL
|
||||
build_lib_x64_release sokol_shape shape/sokol_shape_macos_x64_metal_release SOKOL_METAL
|
||||
build_lib_x64_release sokol_fetch fetch/sokol_fetch_macos_x64_metal_release SOKOL_METAL
|
||||
build_lib_x64_release sokol_gl gl/sokol_gl_macos_x64_metal_release SOKOL_METAL
|
||||
build_lib_x64_release sokol_fontstash fontstash/sokol_fontstash_macos_x64_metal_release SOKOL_METAL
|
||||
|
||||
@ -88,6 +91,7 @@ build_lib_x64_debug sokol_time time/sokol_time_macos_x64_metal_debug SO
|
||||
build_lib_x64_debug sokol_audio audio/sokol_audio_macos_x64_metal_debug SOKOL_METAL
|
||||
build_lib_x64_debug sokol_debugtext debugtext/sokol_debugtext_macos_x64_metal_debug SOKOL_METAL
|
||||
build_lib_x64_debug sokol_shape shape/sokol_shape_macos_x64_metal_debug SOKOL_METAL
|
||||
build_lib_x64_debug sokol_fetch fetch/sokol_fetch_macos_x64_metal_debug SOKOL_METAL
|
||||
build_lib_x64_debug sokol_gl gl/sokol_gl_macos_x64_metal_debug SOKOL_METAL
|
||||
|
||||
# ARM + GL + Release
|
||||
@ -99,6 +103,7 @@ build_lib_arm64_release sokol_time time/sokol_time_macos_arm64_gl_release
|
||||
build_lib_arm64_release sokol_audio audio/sokol_audio_macos_arm64_gl_release SOKOL_GLCORE
|
||||
build_lib_arm64_release sokol_debugtext debugtext/sokol_debugtext_macos_arm64_gl_release SOKOL_GLCORE
|
||||
build_lib_arm64_release sokol_shape shape/sokol_shape_macos_arm64_gl_release SOKOL_GLCORE
|
||||
build_lib_arm64_release sokol_fetch fetch/sokol_fetch_macos_arm64_gl_release SOKOL_GLCORE
|
||||
build_lib_arm64_release sokol_gl gl/sokol_gl_macos_arm64_gl_release SOKOL_GLCORE
|
||||
build_lib_arm64_release sokol_fontstash fontstash/sokol_fontstash_macos_arm64_gl_release SOKOL_GLCORE
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,145 +0,0 @@
|
||||
//
|
||||
// This file was auto-generated using the following command:
|
||||
//
|
||||
// jai generate.jai
|
||||
//
|
||||
|
||||
|
||||
|
||||
STBI_VERSION :: 1;
|
||||
|
||||
STBI :: enum u32 {
|
||||
default :: 0;
|
||||
|
||||
grey :: 1;
|
||||
grey_alpha :: 2;
|
||||
rgb :: 3;
|
||||
rgb_alpha :: 4;
|
||||
|
||||
STBI_default :: default;
|
||||
|
||||
STBI_grey :: grey;
|
||||
STBI_grey_alpha :: grey_alpha;
|
||||
STBI_rgb :: rgb;
|
||||
STBI_rgb_alpha :: rgb_alpha;
|
||||
}
|
||||
|
||||
//
|
||||
// load image by filename, open file, or memory buffer
|
||||
//
|
||||
stbi_io_callbacks :: struct {
|
||||
read: #type (user: *void, data: *u8, size: s32) -> s32 #c_call; // fill 'data' with 'size' bytes. return number of bytes actually read
|
||||
skip: #type (user: *void, n: s32) -> void #c_call; // skip the next 'n' bytes, or 'unget' the last -n bytes if negative
|
||||
eof: #type (user: *void) -> s32 #c_call; // returns nonzero if we are at end of file/data
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
stbi_load_from_memory :: (buffer: *u8, len: s32, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u8 #foreign stb_image;
|
||||
stbi_load_from_callbacks :: (clbk: *stbi_io_callbacks, user: *void, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u8 #foreign stb_image;
|
||||
|
||||
stbi_load :: (filename: *u8, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u8 #foreign stb_image;
|
||||
stbi_load_from_file :: (f: *FILE, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u8 #foreign stb_image;
|
||||
|
||||
stbi_load_gif_from_memory :: (buffer: *u8, len: s32, delays: **s32, x: *s32, y: *s32, z: *s32, comp: *s32, req_comp: s32) -> *u8 #foreign stb_image;
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
stbi_load_16_from_memory :: (buffer: *u8, len: s32, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u16 #foreign stb_image;
|
||||
stbi_load_16_from_callbacks :: (clbk: *stbi_io_callbacks, user: *void, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u16 #foreign stb_image;
|
||||
|
||||
stbi_load_16 :: (filename: *u8, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u16 #foreign stb_image;
|
||||
stbi_load_from_file_16 :: (f: *FILE, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *u16 #foreign stb_image;
|
||||
|
||||
stbi_loadf_from_memory :: (buffer: *u8, len: s32, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *float #foreign stb_image;
|
||||
stbi_loadf_from_callbacks :: (clbk: *stbi_io_callbacks, user: *void, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *float #foreign stb_image;
|
||||
|
||||
stbi_loadf :: (filename: *u8, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *float #foreign stb_image;
|
||||
stbi_loadf_from_file :: (f: *FILE, x: *s32, y: *s32, channels_in_file: *s32, desired_channels: s32) -> *float #foreign stb_image;
|
||||
|
||||
stbi_hdr_to_ldr_gamma :: (gamma: float) -> void #foreign stb_image;
|
||||
stbi_hdr_to_ldr_scale :: (scale: float) -> void #foreign stb_image;
|
||||
|
||||
stbi_ldr_to_hdr_gamma :: (gamma: float) -> void #foreign stb_image;
|
||||
stbi_ldr_to_hdr_scale :: (scale: float) -> void #foreign stb_image;
|
||||
|
||||
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
|
||||
stbi_is_hdr_from_callbacks :: (clbk: *stbi_io_callbacks, user: *void) -> s32 #foreign stb_image;
|
||||
stbi_is_hdr_from_memory :: (buffer: *u8, len: s32) -> s32 #foreign stb_image;
|
||||
|
||||
stbi_is_hdr :: (filename: *u8) -> s32 #foreign stb_image;
|
||||
stbi_is_hdr_from_file :: (f: *FILE) -> s32 #foreign stb_image;
|
||||
|
||||
// get a VERY brief reason for failure
|
||||
// on most compilers (and ALL modern mainstream compilers) this is threadsafe
|
||||
stbi_failure_reason :: () -> *u8 #foreign stb_image;
|
||||
|
||||
// free the loaded image -- this is just free()
|
||||
stbi_image_free :: (retval_from_stbi_load: *void) -> void #foreign stb_image;
|
||||
|
||||
// get image dimensions & components without fully decoding
|
||||
stbi_info_from_memory :: (buffer: *u8, len: s32, x: *s32, y: *s32, comp: *s32) -> s32 #foreign stb_image;
|
||||
stbi_info_from_callbacks :: (clbk: *stbi_io_callbacks, user: *void, x: *s32, y: *s32, comp: *s32) -> s32 #foreign stb_image;
|
||||
stbi_is_16_bit_from_memory :: (buffer: *u8, len: s32) -> s32 #foreign stb_image;
|
||||
stbi_is_16_bit_from_callbacks :: (clbk: *stbi_io_callbacks, user: *void) -> s32 #foreign stb_image;
|
||||
|
||||
stbi_info :: (filename: *u8, x: *s32, y: *s32, comp: *s32) -> s32 #foreign stb_image;
|
||||
stbi_info_from_file :: (f: *FILE, x: *s32, y: *s32, comp: *s32) -> s32 #foreign stb_image;
|
||||
stbi_is_16_bit :: (filename: *u8) -> s32 #foreign stb_image;
|
||||
stbi_is_16_bit_from_file :: (f: *FILE) -> s32 #foreign stb_image;
|
||||
|
||||
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||
// we just return the colors as stored in the file. set this flag to force
|
||||
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
||||
stbi_set_unpremultiply_on_load :: (flag_true_if_should_unpremultiply: s32) -> void #foreign stb_image;
|
||||
|
||||
// indicate whether we should process iphone images back to canonical format,
|
||||
// or just pass them through "as-is"
|
||||
stbi_convert_iphone_png_to_rgb :: (flag_true_if_should_convert: s32) -> void #foreign stb_image;
|
||||
|
||||
// flip the image vertically, so the first pixel in the output array is the bottom left
|
||||
stbi_set_flip_vertically_on_load :: (flag_true_if_should_flip: s32) -> void #foreign stb_image;
|
||||
|
||||
// as above, but only applies to images loaded on the thread that calls the function
|
||||
// this function is only available if your compiler supports thread-local variables;
|
||||
// calling it will fail to link if your compiler doesn't
|
||||
stbi_set_unpremultiply_on_load_thread :: (flag_true_if_should_unpremultiply: s32) -> void #foreign stb_image;
|
||||
stbi_convert_iphone_png_to_rgb_thread :: (flag_true_if_should_convert: s32) -> void #foreign stb_image;
|
||||
stbi_set_flip_vertically_on_load_thread :: (flag_true_if_should_flip: s32) -> void #foreign stb_image;
|
||||
|
||||
// ZLIB client - used by PNG, available for other purposes
|
||||
stbi_zlib_decode_malloc_guesssize :: (buffer: *u8, len: s32, initial_size: s32, outlen: *s32) -> *u8 #foreign stb_image;
|
||||
stbi_zlib_decode_malloc_guesssize_headerflag :: (buffer: *u8, len: s32, initial_size: s32, outlen: *s32, parse_header: s32) -> *u8 #foreign stb_image;
|
||||
stbi_zlib_decode_malloc :: (buffer: *u8, len: s32, outlen: *s32) -> *u8 #foreign stb_image;
|
||||
stbi_zlib_decode_buffer :: (obuffer: *u8, olen: s32, ibuffer: *u8, ilen: s32) -> s32 #foreign stb_image;
|
||||
|
||||
stbi_zlib_decode_noheader_malloc :: (buffer: *u8, len: s32, outlen: *s32) -> *u8 #foreign stb_image;
|
||||
stbi_zlib_decode_noheader_buffer :: (obuffer: *u8, olen: s32, ibuffer: *u8, ilen: s32) -> s32 #foreign stb_image;
|
||||
|
||||
#scope_file
|
||||
|
||||
|
||||
#if OS == .WINDOWS {
|
||||
stb_image :: #library "windows/stb_image";
|
||||
} else #if OS == .LINUX {
|
||||
stb_image :: #library "linux/stb_image";
|
||||
} else #if OS == .MACOS {
|
||||
stb_image :: #library "macos/stb_image";
|
||||
} else #if OS == .ANDROID {
|
||||
#if CPU == .X64 {
|
||||
stb_image :: #library "android/x64/stb_image";
|
||||
} else #if CPU == .ARM64 {
|
||||
stb_image :: #library "android/arm64/stb_image";
|
||||
}
|
||||
} else #if OS == .PS5 {
|
||||
stb_image :: #library "ps5/stb_image";
|
||||
} else #if OS == .WASM {
|
||||
stb_image :: #library "wasm/stb_image";
|
||||
} else {
|
||||
#assert false;
|
||||
}
|
||||
|
||||
@ -1,151 +0,0 @@
|
||||
AT_COMPILE_TIME :: true;
|
||||
|
||||
SOURCE_PATH :: "source";
|
||||
LIB_BASE_NAME :: "stb_image";
|
||||
|
||||
#if AT_COMPILE_TIME {
|
||||
#run,stallable {
|
||||
set_build_options_dc(.{do_output=false});
|
||||
options := get_build_options();
|
||||
args := options.compile_time_command_line;
|
||||
if !generate_bindings(args, options.minimum_os_version) {
|
||||
compiler_set_workspace_status(.FAILED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#import "System";
|
||||
|
||||
main :: () {
|
||||
set_working_directory(path_strip_filename(get_path_of_running_executable()));
|
||||
if !generate_bindings(get_command_line_arguments(), #run get_build_options().minimum_os_version) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generate_bindings :: (args: [] string, minimum_os_version: type_of(Build_Options.minimum_os_version)) -> bool {
|
||||
target_android := array_find(args, "-android");
|
||||
target_x64 := array_find(args, "-x64");
|
||||
target_arm := array_find(args, "-arm64");
|
||||
compile := array_find(args, "-compile");
|
||||
compile_debug := array_find(args, "-debug");
|
||||
|
||||
os_target := OS;
|
||||
cpu_target := CPU;
|
||||
if target_android os_target = .ANDROID;
|
||||
if target_x64 cpu_target = .X64;
|
||||
if target_arm cpu_target = .ARM64;
|
||||
|
||||
lib_directory: string;
|
||||
if os_target == {
|
||||
case .WINDOWS;
|
||||
lib_directory = "windows";
|
||||
case .LINUX;
|
||||
lib_directory = "linux";
|
||||
case .MACOS;
|
||||
lib_directory = "macos";
|
||||
case .ANDROID;
|
||||
lib_directory = ifx cpu_target == .X64 then "android/x64" else "android/arm64";
|
||||
case .PS5;
|
||||
lib_directory = "ps5";
|
||||
case;
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if compile {
|
||||
source_file := tprint("%/stb_image.c", SOURCE_PATH);
|
||||
|
||||
make_directory_if_it_does_not_exist(lib_directory, recursive = true);
|
||||
lib_path := tprint("%/%", lib_directory, LIB_BASE_NAME);
|
||||
success := true;
|
||||
if os_target == .MACOS {
|
||||
lib_path_x64 := tprint("%_x64", lib_path);
|
||||
lib_path_arm64 := tprint("%_arm64", lib_path);
|
||||
macos_x64_version_arg := "-mmacos-version-min=10.13"; // Our current x64 min version
|
||||
macos_arm64_version_arg := "-mmacos-version-min=11.0"; // Earliest version that supports arm64
|
||||
// x64 variant
|
||||
success &&= build_cpp_dynamic_lib(lib_path_x64, source_file, extra = .["-arch", "x86_64", macos_x64_version_arg], debug=compile_debug);
|
||||
success &&= build_cpp_static_lib( lib_path_x64, source_file, extra = .["-arch", "x86_64", macos_x64_version_arg], debug=compile_debug);
|
||||
// arm64 variant
|
||||
success &&= build_cpp_dynamic_lib(lib_path_arm64, source_file, extra = .["-arch", "arm64", macos_arm64_version_arg], debug=compile_debug);
|
||||
success &&= build_cpp_static_lib( lib_path_arm64, source_file, extra = .["-arch", "arm64", macos_arm64_version_arg], debug=compile_debug);
|
||||
// create universal binaries
|
||||
run_result := run_command("lipo", "-create", tprint("%.dylib", lib_path_x64), tprint("%.dylib", lib_path_arm64), "-output", tprint("%.dylib", lib_path));
|
||||
success &&= (run_result.exit_code == 0);
|
||||
run_result = run_command("lipo", "-create", tprint("%.a", lib_path_x64), tprint("%.a", lib_path_arm64), "-output", tprint("%.a", lib_path));
|
||||
success &&= (run_result.exit_code == 0);
|
||||
} else {
|
||||
extra: [..] string;
|
||||
if os_target == .ANDROID {
|
||||
_, target_triple_with_sdk := get_android_target_triple(cpu_target);
|
||||
array_add(*extra, "-target", target_triple_with_sdk);
|
||||
}
|
||||
if os_target != .WINDOWS {
|
||||
array_add(*extra, "-fPIC");
|
||||
}
|
||||
|
||||
if os_target != .PS5 && os_target != .WASM {
|
||||
success &&= build_cpp_dynamic_lib(lib_path, source_file, target = os_target, debug = compile_debug, extra = extra);
|
||||
}
|
||||
success &&= build_cpp_static_lib(lib_path, source_file, target = os_target, debug = compile_debug, extra = extra);
|
||||
}
|
||||
|
||||
if !success return false;
|
||||
}
|
||||
|
||||
options: Generate_Bindings_Options;
|
||||
options.os = os_target;
|
||||
options.cpu = cpu_target;
|
||||
{
|
||||
using options;
|
||||
|
||||
array_add(*libpaths, lib_directory);
|
||||
array_add(*libnames, LIB_BASE_NAME);
|
||||
array_add(*source_files, tprint("%/stb_image.h", SOURCE_PATH));
|
||||
array_add(*typedef_prefixes_to_unwrap, "stbi_");
|
||||
|
||||
|
||||
generate_library_declarations = false;
|
||||
footer = tprint(FOOTER_TEMPLATE, LIB_BASE_NAME);
|
||||
|
||||
auto_detect_enum_prefixes = true;
|
||||
log_stripped_declarations = false;
|
||||
generate_compile_time_struct_checks = false;
|
||||
}
|
||||
|
||||
output_filename := "bindings.jai";
|
||||
return generate_bindings(options, output_filename);
|
||||
}
|
||||
|
||||
FOOTER_TEMPLATE :: #string END
|
||||
|
||||
#if OS == .WINDOWS {
|
||||
%1 :: #library "windows/%1";
|
||||
} else #if OS == .LINUX {
|
||||
%1 :: #library "linux/%1";
|
||||
} else #if OS == .MACOS {
|
||||
%1 :: #library "macos/%1";
|
||||
} else #if OS == .ANDROID {
|
||||
#if CPU == .X64 {
|
||||
%1 :: #library "android/x64/%1";
|
||||
} else #if CPU == .ARM64 {
|
||||
%1 :: #library "android/arm64/%1";
|
||||
}
|
||||
} else #if OS == .PS5 {
|
||||
%1 :: #library "ps5/%1";
|
||||
} else #if OS == .WASM {
|
||||
// Wasm will be linked with emcc.
|
||||
} else {
|
||||
#assert false;
|
||||
}
|
||||
|
||||
END
|
||||
|
||||
#import "Basic";
|
||||
#import "Bindings_Generator";
|
||||
#import "BuildCpp";
|
||||
#import "Compiler";
|
||||
#import "File";
|
||||
#import "Process";
|
||||
#import "Toolchains/Android";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
#load "bindings.jai";
|
||||
|
||||
#if OS == .WINDOWS || OS == .PS5 || OS == .WASM {
|
||||
#scope_module
|
||||
FILE :: void;
|
||||
} else #if OS_IS_UNIX {
|
||||
#import "POSIX";
|
||||
#library,system,link_always "libm";
|
||||
} else {
|
||||
#assert false;
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
#ifdef WIN32
|
||||
#define __EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define __EXPORT
|
||||
#endif
|
||||
|
||||
#define STBIDEF extern __EXPORT
|
||||
|
||||
#define STBI_NO_STDIO
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -2,6 +2,6 @@ rm -rf .jai
|
||||
|
||||
for filename in *.glsl; do
|
||||
if [ -f "$filename" ]; then
|
||||
./sokol-shdc -i "$filename" -o "./jai/${filename/.glsl/.jai}" -l glsl430:glsl300es -f sokol_jai
|
||||
./sokol-shdc -i "$filename" -o "./jai/${filename/.glsl/.jai}" -l glsl430:glsl300es:metal_macos -f sokol_jai
|
||||
fi
|
||||
done
|
||||
|
||||
7
src/shaders/compile_shaders_mac.sh
Executable file
7
src/shaders/compile_shaders_mac.sh
Executable file
@ -0,0 +1,7 @@
|
||||
rm -rf .jai
|
||||
|
||||
for filename in *.glsl; do
|
||||
if [ -f "$filename" ]; then
|
||||
./sokol-shdc-mac -i "$filename" -o "./jai/${filename/.glsl/.jai}" -l glsl430:glsl300es:metal_macos -f sokol_jai
|
||||
fi
|
||||
done
|
||||
@ -4,7 +4,7 @@
|
||||
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
||||
|
||||
Cmdline:
|
||||
sokol-shdc -i shader_triangle.glsl -o ./jai/shader_triangle.jai -l glsl430:glsl300es -f sokol_jai
|
||||
sokol-shdc -i shader_triangle.glsl -o ./jai/shader_triangle.jai -l glsl430:glsl300es:metal_macos -f sokol_jai
|
||||
|
||||
Overview:
|
||||
=========
|
||||
@ -284,6 +284,193 @@ fs_source_glsl300es := u8.[
|
||||
0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,
|
||||
0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 color [[user(locn0)]];
|
||||
float4 texcoord [[user(locn1)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 position [[attribute(0)]];
|
||||
float4 color0 [[attribute(1)]];
|
||||
float4 uv [[attribute(2)]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.gl_Position = in.position;
|
||||
out.color = in.color0;
|
||||
out.texcoord = in.uv;
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
vs_source_metal_macos := u8.[
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,
|
||||
0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,
|
||||
0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d,0x5d,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,
|
||||
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,
|
||||
0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,
|
||||
0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,
|
||||
0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,
|
||||
0x6c,0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,
|
||||
0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x34,0x20,0x75,0x76,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,
|
||||
0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,
|
||||
0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,
|
||||
0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,
|
||||
0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,
|
||||
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
|
||||
0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x74,0x65,0x78,0x63,
|
||||
0x6f,0x6f,0x72,0x64,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
|
||||
0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 frag_color [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 color [[user(locn0)]];
|
||||
float4 texcoord [[user(locn1)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
bool is_near(thread const float& a, thread const float& b)
|
||||
{
|
||||
return abs(a - b) < 0.00999999977648258209228515625;
|
||||
}
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[texture(0)]], sampler smp [[sampler(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float param = in.texcoord.x;
|
||||
float param_1 = -4.0;
|
||||
bool _33 = is_near(param, param_1);
|
||||
bool _43;
|
||||
if (_33)
|
||||
{
|
||||
float param_2 = in.texcoord.y;
|
||||
float param_3 = -2.0;
|
||||
_43 = is_near(param_2, param_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_43 = _33;
|
||||
}
|
||||
if (_43)
|
||||
{
|
||||
out.frag_color = in.color;
|
||||
}
|
||||
else
|
||||
{
|
||||
out.frag_color = tex.sample(smp, in.texcoord.xy) * in.color;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
fs_source_metal_macos := u8.[
|
||||
0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69,
|
||||
0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64,
|
||||
0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74,
|
||||
0x6f,0x74,0x79,0x70,0x65,0x73,0x22,0x0a,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,
|
||||
0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,
|
||||
0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,
|
||||
0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,
|
||||
0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,
|
||||
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,
|
||||
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,
|
||||
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,
|
||||
0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,
|
||||
0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x74,0x65,0x78,0x63,0x6f,
|
||||
0x6f,0x72,0x64,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,
|
||||
0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
|
||||
0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,
|
||||
0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,
|
||||
0x69,0x6e,0x65,0x29,0x29,0x0a,0x62,0x6f,0x6f,0x6c,0x20,0x69,0x73,0x5f,0x6e,0x65,
|
||||
0x61,0x72,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x61,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,
|
||||
0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x62,0x29,
|
||||
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x61,0x62,
|
||||
0x73,0x28,0x61,0x20,0x2d,0x20,0x62,0x29,0x20,0x3c,0x20,0x30,0x2e,0x30,0x30,0x39,
|
||||
0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,
|
||||
0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,
|
||||
0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,
|
||||
0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,
|
||||
0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,
|
||||
0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,
|
||||
0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,
|
||||
0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,
|
||||
0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,
|
||||
0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2e,0x78,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,
|
||||
0x3d,0x20,0x2d,0x34,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,
|
||||
0x20,0x5f,0x33,0x33,0x20,0x3d,0x20,0x69,0x73,0x5f,0x6e,0x65,0x61,0x72,0x28,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x34,0x33,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x33,0x33,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,
|
||||
0x6f,0x6f,0x72,0x64,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,
|
||||
0x2d,0x32,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x34,
|
||||
0x33,0x20,0x3d,0x20,0x69,0x73,0x5f,0x6e,0x65,0x61,0x72,0x28,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x34,0x33,0x20,
|
||||
0x3d,0x20,0x5f,0x33,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x69,0x66,0x20,0x28,0x5f,0x34,0x33,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,
|
||||
0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
|
||||
0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,
|
||||
0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2e,0x78,0x79,0x29,
|
||||
0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,
|
||||
0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
triangle_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc: sg_shader_desc;
|
||||
desc.label = "triangle_shader";
|
||||
@ -330,6 +517,25 @@ triangle_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.image_sampler_pairs[0].image_slot = 0;
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0;
|
||||
desc.image_sampler_pairs[0].glsl_name = "tex_smp";
|
||||
case .METAL_MACOS;
|
||||
desc.vertex_func.source = xx *vs_source_metal_macos;
|
||||
desc.vertex_func.entry = "main0";
|
||||
desc.fragment_func.source = xx *fs_source_metal_macos;
|
||||
desc.fragment_func.entry = "main0";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[2].base_type = .FLOAT;
|
||||
desc.images[0].stage = .FRAGMENT;
|
||||
desc.images[0].multisampled = false;
|
||||
desc.images[0].image_type = ._2D;
|
||||
desc.images[0].sample_type = .FLOAT;
|
||||
desc.images[0].msl_texture_n = 0;
|
||||
desc.samplers[0].stage = .FRAGMENT;
|
||||
desc.samplers[0].sampler_type = .FILTERING;
|
||||
desc.samplers[0].msl_sampler_n = 0;
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT;
|
||||
desc.image_sampler_pairs[0].image_slot = 0;
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
||||
|
||||
Cmdline:
|
||||
sokol-shdc -i shader_trixel.glsl -o ./jai/shader_trixel.jai -l glsl430:glsl300es -f sokol_jai
|
||||
sokol-shdc -i shader_trixel.glsl -o ./jai/shader_trixel.jai -l glsl430:glsl300es:metal_macos -f sokol_jai
|
||||
|
||||
Overview:
|
||||
=========
|
||||
@ -157,6 +157,124 @@ fs_trixel_source_glsl300es := u8.[
|
||||
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct vs_params
|
||||
{
|
||||
float4x4 mvp;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 color [[user(locn0)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 position [[attribute(0)]];
|
||||
float4 inst [[attribute(1)]];
|
||||
float4 inst_col [[attribute(2)]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _26 [[buffer(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.gl_Position = _26.mvp * float4(in.position.xyz + in.inst.xyz, 1.0);
|
||||
out.color = in.inst_col;
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
vs_trixel_source_metal_macos := u8.[
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a,
|
||||
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,
|
||||
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,
|
||||
0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
||||
0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,
|
||||
0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,
|
||||
0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x34,0x20,0x69,0x6e,0x73,0x74,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,
|
||||
0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x61,
|
||||
0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
|
||||
0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,
|
||||
0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x36,0x20,0x5b,0x5b,0x62,0x75,
|
||||
0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,
|
||||
0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,
|
||||
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x32,0x36,0x2e,0x6d,
|
||||
0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2b,0x20,0x69,0x6e,
|
||||
0x2e,0x69,0x6e,0x73,0x74,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
|
||||
0x20,0x69,0x6e,0x2e,0x69,0x6e,0x73,0x74,0x5f,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
|
||||
0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 frag_color [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 color [[user(locn0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.frag_color = in.color;
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
fs_trixel_source_metal_macos := u8.[
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
|
||||
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
||||
0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
|
||||
0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,
|
||||
0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,
|
||||
0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,
|
||||
0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
|
||||
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,
|
||||
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
||||
0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
trixel_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc: sg_shader_desc;
|
||||
desc.label = "trixel_shader";
|
||||
@ -195,6 +313,18 @@ trixel_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
|
||||
case .METAL_MACOS;
|
||||
desc.vertex_func.source = xx *vs_trixel_source_metal_macos;
|
||||
desc.vertex_func.entry = "main0";
|
||||
desc.fragment_func.source = xx *fs_trixel_source_metal_macos;
|
||||
desc.fragment_func.entry = "main0";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[2].base_type = .FLOAT;
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
desc.uniform_blocks[0].msl_buffer_n = 0;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
BIN
src/shaders/sokol-shdc-mac
Executable file
BIN
src/shaders/sokol-shdc-mac
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user