324 lines
16 KiB
Odin
324 lines
16 KiB
Odin
package main
|
|
import sg "sokol/gfx"
|
|
import glm "core:math/linalg/glsl"
|
|
/*
|
|
#version:1# (machine generated, don't edit!)
|
|
|
|
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
|
|
|
Cmdline:
|
|
sokol-shdc -i shader.glsl -o shader.odin -l hlsl5:glsl430 -f sokol_odin
|
|
|
|
Overview:
|
|
=========
|
|
Shader program: 'quad':
|
|
Get shader desc: quad_shader_desc(sg.query_backend())
|
|
Vertex Shader: vs
|
|
Fragment Shader: fs
|
|
Attributes:
|
|
ATTR_quad_position => 0
|
|
ATTR_quad_inst_mat0 => 1
|
|
ATTR_quad_inst_mat1 => 2
|
|
ATTR_quad_inst_mat2 => 3
|
|
ATTR_quad_inst_mat3 => 4
|
|
ATTR_quad_color => 5
|
|
Bindings:
|
|
*/
|
|
ATTR_quad_position :: 0
|
|
ATTR_quad_inst_mat0 :: 1
|
|
ATTR_quad_inst_mat1 :: 2
|
|
ATTR_quad_inst_mat2 :: 3
|
|
ATTR_quad_inst_mat3 :: 4
|
|
ATTR_quad_color :: 5
|
|
/*
|
|
#version 430
|
|
|
|
layout(location = 1) in vec4 inst_mat0;
|
|
layout(location = 2) in vec4 inst_mat1;
|
|
layout(location = 3) in vec4 inst_mat2;
|
|
layout(location = 4) in vec4 inst_mat3;
|
|
layout(location = 0) in vec2 position;
|
|
layout(location = 0) out vec4 vs_color;
|
|
layout(location = 5) in vec3 color;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = mat4(inst_mat0, inst_mat1, inst_mat2, inst_mat3) * vec4(position, 0.0, 1.0);
|
|
vs_color = vec4(color, 1.0);
|
|
}
|
|
|
|
*/
|
|
@(private="file")
|
|
vs_source_glsl430 := [436]u8 {
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61,
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,
|
|
0x6d,0x61,0x74,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
|
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,
|
|
0x63,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x31,0x3b,0x0a,0x6c,0x61,
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,
|
|
0x6d,0x61,0x74,0x32,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
|
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x34,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,
|
|
0x63,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x33,0x3b,0x0a,0x6c,0x61,
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,
|
|
0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
|
|
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,
|
|
0x63,0x34,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,
|
|
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x35,
|
|
0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,
|
|
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
|
|
0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x30,
|
|
0x2c,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x31,0x2c,0x20,0x69,0x6e,0x73,
|
|
0x74,0x5f,0x6d,0x61,0x74,0x32,0x2c,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,
|
|
0x33,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,
|
|
0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,
|
|
0x63,0x34,0x28,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
|
|
0x7d,0x0a,0x0a,0x00,
|
|
}
|
|
/*
|
|
#version 430
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
layout(location = 0) in vec4 vs_color;
|
|
|
|
void main()
|
|
{
|
|
frag_color = vs_color;
|
|
}
|
|
|
|
*/
|
|
@(private="file")
|
|
fs_source_glsl430 := [141]u8 {
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61,
|
|
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
|
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
|
|
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
|
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
|
|
0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,
|
|
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,
|
|
0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
}
|
|
/*
|
|
static float4 gl_Position;
|
|
static float4 inst_mat0;
|
|
static float4 inst_mat1;
|
|
static float4 inst_mat2;
|
|
static float4 inst_mat3;
|
|
static float2 position;
|
|
static float4 vs_color;
|
|
static float3 color;
|
|
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
float2 position : TEXCOORD0;
|
|
float4 inst_mat0 : TEXCOORD1;
|
|
float4 inst_mat1 : TEXCOORD2;
|
|
float4 inst_mat2 : TEXCOORD3;
|
|
float4 inst_mat3 : TEXCOORD4;
|
|
float3 color : TEXCOORD5;
|
|
};
|
|
|
|
struct SPIRV_Cross_Output
|
|
{
|
|
float4 vs_color : TEXCOORD0;
|
|
float4 gl_Position : SV_Position;
|
|
};
|
|
|
|
void vert_main()
|
|
{
|
|
gl_Position = mul(float4(position, 0.0f, 1.0f), float4x4(inst_mat0, inst_mat1, inst_mat2, inst_mat3));
|
|
vs_color = float4(color, 1.0f);
|
|
}
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
inst_mat0 = stage_input.inst_mat0;
|
|
inst_mat1 = stage_input.inst_mat1;
|
|
inst_mat2 = stage_input.inst_mat2;
|
|
inst_mat3 = stage_input.inst_mat3;
|
|
position = stage_input.position;
|
|
color = stage_input.color;
|
|
vert_main();
|
|
SPIRV_Cross_Output stage_output;
|
|
stage_output.gl_Position = gl_Position;
|
|
stage_output.vs_color = vs_color;
|
|
return stage_output;
|
|
}
|
|
*/
|
|
@(private="file")
|
|
vs_source_hlsl5 := [1140]u8 {
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,
|
|
0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,
|
|
0x74,0x30,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x31,0x3b,0x0a,0x73,0x74,0x61,
|
|
0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,
|
|
0x6d,0x61,0x74,0x32,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x33,0x3b,0x0a,0x73,
|
|
0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,
|
|
0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x34,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,
|
|
0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x63,0x6f,0x6c,
|
|
0x6f,0x72,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,
|
|
0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,0x69,0x74,
|
|
0x69,0x6f,0x6e,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x69,0x6e,0x73,0x74,
|
|
0x5f,0x6d,0x61,0x74,0x30,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,
|
|
0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x69,0x6e,
|
|
0x73,0x74,0x5f,0x6d,0x61,0x74,0x31,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,
|
|
0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
|
0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x32,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,
|
|
0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x33,0x20,0x3a,0x20,0x54,0x45,
|
|
0x58,0x43,0x4f,0x4f,0x52,0x44,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x33,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,
|
|
0x4f,0x4f,0x52,0x44,0x35,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,
|
|
0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,
|
|
0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,
|
|
0x43,0x4f,0x4f,0x52,0x44,0x30,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,0x3a,
|
|
0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,
|
|
0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,
|
|
0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,
|
|
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x66,
|
|
0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,
|
|
0x34,0x28,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x30,0x2c,0x20,0x69,0x6e,0x73,
|
|
0x74,0x5f,0x6d,0x61,0x74,0x31,0x2c,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,
|
|
0x32,0x2c,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x33,0x29,0x29,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,
|
|
0x6c,0x6f,0x61,0x74,0x34,0x28,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x31,0x2e,0x30,
|
|
0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
|
|
0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,
|
|
0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,
|
|
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x30,0x20,0x3d,0x20,
|
|
0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x6e,0x73,0x74,
|
|
0x5f,0x6d,0x61,0x74,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x73,0x74,0x5f,
|
|
0x6d,0x61,0x74,0x31,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,
|
|
0x75,0x74,0x2e,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x31,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x32,0x20,0x3d,0x20,0x73,0x74,
|
|
0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x6e,0x73,0x74,0x5f,0x6d,
|
|
0x61,0x74,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,
|
|
0x74,0x33,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,
|
|
0x2e,0x69,0x6e,0x73,0x74,0x5f,0x6d,0x61,0x74,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,
|
|
0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,
|
|
0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,
|
|
0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,
|
|
0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,
|
|
0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
|
|
0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,
|
|
0x75,0x74,0x2e,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,
|
|
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,
|
|
0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,
|
|
0x0a,0x7d,0x0a,0x00,
|
|
}
|
|
/*
|
|
static float4 frag_color;
|
|
static float4 vs_color;
|
|
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
float4 vs_color : TEXCOORD0;
|
|
};
|
|
|
|
struct SPIRV_Cross_Output
|
|
{
|
|
float4 frag_color : SV_Target0;
|
|
};
|
|
|
|
void frag_main()
|
|
{
|
|
frag_color = vs_color;
|
|
}
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
vs_color = stage_input.vs_color;
|
|
frag_main();
|
|
SPIRV_Cross_Output stage_output;
|
|
stage_output.frag_color = frag_color;
|
|
return stage_output;
|
|
}
|
|
*/
|
|
@(private="file")
|
|
fs_source_hlsl5 := [450]u8 {
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,
|
|
0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
|
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,
|
|
0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,
|
|
0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,
|
|
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,
|
|
0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,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,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,
|
|
0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,
|
|
0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,
|
|
0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,0x5f,0x63,0x6f,
|
|
0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,
|
|
0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,
|
|
0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,
|
|
0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,
|
|
0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x73,0x5f,0x63,
|
|
0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,
|
|
0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,
|
|
0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,
|
|
0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,
|
|
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
|
|
0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
|
|
0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,
|
|
0x0a,0x00,
|
|
}
|
|
quad_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
|
desc: sg.Shader_Desc
|
|
desc.label = "quad_shader"
|
|
#partial switch backend {
|
|
case .GLCORE:
|
|
desc.vertex_func.source = transmute(cstring)&vs_source_glsl430
|
|
desc.vertex_func.entry = "main"
|
|
desc.fragment_func.source = transmute(cstring)&fs_source_glsl430
|
|
desc.fragment_func.entry = "main"
|
|
desc.attrs[0].glsl_name = "position"
|
|
desc.attrs[1].glsl_name = "inst_mat0"
|
|
desc.attrs[2].glsl_name = "inst_mat1"
|
|
desc.attrs[3].glsl_name = "inst_mat2"
|
|
desc.attrs[4].glsl_name = "inst_mat3"
|
|
desc.attrs[5].glsl_name = "color"
|
|
case .D3D11:
|
|
desc.vertex_func.source = transmute(cstring)&vs_source_hlsl5
|
|
desc.vertex_func.d3d11_target = "vs_5_0"
|
|
desc.vertex_func.entry = "main"
|
|
desc.fragment_func.source = transmute(cstring)&fs_source_hlsl5
|
|
desc.fragment_func.d3d11_target = "ps_5_0"
|
|
desc.fragment_func.entry = "main"
|
|
desc.attrs[0].hlsl_sem_name = "TEXCOORD"
|
|
desc.attrs[0].hlsl_sem_index = 0
|
|
desc.attrs[1].hlsl_sem_name = "TEXCOORD"
|
|
desc.attrs[1].hlsl_sem_index = 1
|
|
desc.attrs[2].hlsl_sem_name = "TEXCOORD"
|
|
desc.attrs[2].hlsl_sem_index = 2
|
|
desc.attrs[3].hlsl_sem_name = "TEXCOORD"
|
|
desc.attrs[3].hlsl_sem_index = 3
|
|
desc.attrs[4].hlsl_sem_name = "TEXCOORD"
|
|
desc.attrs[4].hlsl_sem_index = 4
|
|
desc.attrs[5].hlsl_sem_name = "TEXCOORD"
|
|
desc.attrs[5].hlsl_sem_index = 5
|
|
}
|
|
return desc
|
|
}
|