124 lines
5.0 KiB
C
124 lines
5.0 KiB
C
#pragma once
|
|
/*
|
|
#version:1# (machine generated, don't edit!)
|
|
|
|
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
|
|
|
Cmdline:
|
|
sokol-shdc -i ./projects/examples/samples/cube-sapp.glsl -o F:\dev\luajit\repos\sokol-luajit\bin\shaderbin\shader_gen_.h -l glsl410 -f sokol
|
|
|
|
Overview:
|
|
=========
|
|
Shader program: 'cube':
|
|
Get shader desc: cube_shader_desc(sg_query_backend());
|
|
Vertex Shader: vs_cube
|
|
Fragment Shader: fs_cube
|
|
Attributes:
|
|
ATTR_cube_position => 0
|
|
ATTR_cube_color0 => 1
|
|
Bindings:
|
|
Uniform block 'vs_params':
|
|
C struct: vs_params_t
|
|
Bind slot: UB_vs_params => 0
|
|
*/
|
|
#if !defined(SOKOL_GFX_INCLUDED)
|
|
#error "Please include sokol_gfx.h before shader_gen_.h"
|
|
#endif
|
|
#if !defined(SOKOL_SHDC_ALIGN)
|
|
#if defined(_MSC_VER)
|
|
#define SOKOL_SHDC_ALIGN(a) __declspec(align(a))
|
|
#else
|
|
#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a)))
|
|
#endif
|
|
#endif
|
|
#define ATTR_cube_position (0)
|
|
#define ATTR_cube_color0 (1)
|
|
#define UB_vs_params (0)
|
|
#pragma pack(push,1)
|
|
SOKOL_SHDC_ALIGN(16) typedef struct vs_params_t {
|
|
hmm_mat4 mvp;
|
|
} vs_params_t;
|
|
#pragma pack(pop)
|
|
/*
|
|
#version 410
|
|
|
|
uniform vec4 vs_params[4];
|
|
layout(location = 0) in vec4 position;
|
|
layout(location = 0) out vec4 color;
|
|
layout(location = 1) in vec4 color0;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position;
|
|
color = color0;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t vs_cube_source_glsl410[284] = {
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
|
|
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
|
|
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,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,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,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,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
|
|
0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,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,
|
|
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,
|
|
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,
|
|
0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,
|
|
0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,
|
|
0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,
|
|
0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
};
|
|
/*
|
|
#version 410
|
|
|
|
layout(location = 0) out vec4 frag_color;
|
|
layout(location = 0) in vec4 color;
|
|
|
|
void main()
|
|
{
|
|
frag_color = color;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t fs_cube_source_glsl410[135] = {
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,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,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,0x63,0x6f,0x6c,0x6f,
|
|
0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
};
|
|
static inline const sg_shader_desc* cube_shader_desc(sg_backend backend) {
|
|
if (backend == SG_BACKEND_GLCORE) {
|
|
static sg_shader_desc desc;
|
|
static bool valid;
|
|
if (!valid) {
|
|
valid = true;
|
|
desc.vertex_func.source = (const char*)vs_cube_source_glsl410;
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = (const char*)fs_cube_source_glsl410;
|
|
desc.fragment_func.entry = "main";
|
|
desc.attrs[0].glsl_name = "position";
|
|
desc.attrs[1].glsl_name = "color0";
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 64;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
|
|
desc.label = "cube_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
return 0;
|
|
}
|