693 lines
38 KiB
C++
693 lines
38 KiB
C++
#pragma once
|
|
/*
|
|
#version:1# (machine generated, don't edit!)
|
|
|
|
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
|
|
|
Cmdline:
|
|
sokol-shdc --input E:/box/box3d/samples/shaders/post/depth_only_geom.glsl --output E:/box/box3d/samples/shaders/generated/depth_only_geom.glsl.h --slang hlsl5:metal_macos:glsl430
|
|
|
|
Overview:
|
|
=========
|
|
Shader program: 'prog':
|
|
Get shader desc: depth_only_geom_prog_shader_desc(sg_query_backend());
|
|
Vertex Shader: vs
|
|
Fragment Shader: fs
|
|
Attributes:
|
|
ATTR_depth_only_geom_prog_in_pos => 0
|
|
Bindings:
|
|
Uniform block 'ub_draw':
|
|
C struct: depth_only_geom_ub_draw_t
|
|
Bind slot: UB_depth_only_geom_ub_draw => 2
|
|
Uniform block 'ub_frame':
|
|
C struct: depth_only_geom_ub_frame_t
|
|
Bind slot: UB_depth_only_geom_ub_frame => 0
|
|
Storage buffer 'instances':
|
|
C struct: depth_only_geom_instance_t
|
|
Bind slot: VIEW_depth_only_geom_instances => 0
|
|
Readonly: true
|
|
*/
|
|
#if !defined(SOKOL_GFX_INCLUDED)
|
|
#error "Please include sokol_gfx.h before depth_only_geom.glsl.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_depth_only_geom_prog_in_pos (0)
|
|
#define UB_depth_only_geom_ub_draw (2)
|
|
#define UB_depth_only_geom_ub_frame (0)
|
|
#define VIEW_depth_only_geom_instances (0)
|
|
#pragma pack(push,1)
|
|
SOKOL_SHDC_ALIGN(16) typedef struct depth_only_geom_ub_draw_t {
|
|
int inst_base[4];
|
|
} depth_only_geom_ub_draw_t;
|
|
#pragma pack(pop)
|
|
#pragma pack(push,1)
|
|
SOKOL_SHDC_ALIGN(16) typedef struct depth_only_geom_ub_frame_t {
|
|
Mat4 view_proj;
|
|
Mat4 view;
|
|
} depth_only_geom_ub_frame_t;
|
|
#pragma pack(pop)
|
|
#pragma pack(push,1)
|
|
SOKOL_SHDC_ALIGN(16) typedef struct depth_only_geom_instance_t {
|
|
Vec4 xform_row0;
|
|
Vec4 xform_row1;
|
|
Vec4 xform_row2;
|
|
Vec4 base_color;
|
|
Vec4 scale;
|
|
Vec4 material;
|
|
} depth_only_geom_instance_t;
|
|
#pragma pack(pop)
|
|
/*
|
|
#version 430
|
|
|
|
struct instance
|
|
{
|
|
vec4 xform_row0;
|
|
vec4 xform_row1;
|
|
vec4 xform_row2;
|
|
vec4 base_color;
|
|
vec4 scale;
|
|
vec4 material;
|
|
};
|
|
|
|
layout(binding = 0, std430) readonly buffer instances
|
|
{
|
|
instance items[];
|
|
} _15;
|
|
|
|
uniform ivec4 ub_draw[1];
|
|
uniform vec4 ub_frame[8];
|
|
layout(location = 0) in vec3 in_pos;
|
|
layout(location = 0) out float v_linear_view_z;
|
|
|
|
void main()
|
|
{
|
|
int _30 = ub_draw[0].x + gl_InstanceID;
|
|
vec4 _68 = vec4(in_pos * _15.items[_30].scale.xyz, 1.0);
|
|
vec4 _95 = vec4(dot(_15.items[_30].xform_row0, _68), dot(_15.items[_30].xform_row1, _68), dot(_15.items[_30].xform_row2, _68), 1.0);
|
|
v_linear_view_z = -(mat4(ub_frame[4], ub_frame[5], ub_frame[6], ub_frame[7]) * _95).z;
|
|
gl_Position = mat4(ub_frame[0], ub_frame[1], ub_frame[2], ub_frame[3]) * _95;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t depth_only_geom_vs_source_glsl430[812] = {
|
|
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x73,0x74,
|
|
0x72,0x75,0x63,0x74,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,
|
|
0x6f,0x77,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x78,0x66,
|
|
0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,
|
|
0x63,0x34,0x20,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x32,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x62,0x61,0x73,0x65,0x5f,0x63,0x6f,0x6c,
|
|
0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x63,0x61,
|
|
0x6c,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x6d,0x61,0x74,
|
|
0x65,0x72,0x69,0x61,0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,
|
|
0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x2c,0x20,0x73,
|
|
0x74,0x64,0x34,0x33,0x30,0x29,0x20,0x72,0x65,0x61,0x64,0x6f,0x6e,0x6c,0x79,0x20,
|
|
0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x73,
|
|
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x20,
|
|
0x69,0x74,0x65,0x6d,0x73,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x31,0x35,0x3b,0x0a,
|
|
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x69,0x76,0x65,0x63,0x34,0x20,0x75,
|
|
0x62,0x5f,0x64,0x72,0x61,0x77,0x5b,0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,
|
|
0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,
|
|
0x5b,0x38,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,
|
|
0x33,0x20,0x69,0x6e,0x5f,0x70,0x6f,0x73,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,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,
|
|
0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,
|
|
0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,
|
|
0x20,0x5f,0x33,0x30,0x20,0x3d,0x20,0x75,0x62,0x5f,0x64,0x72,0x61,0x77,0x5b,0x30,
|
|
0x5d,0x2e,0x78,0x20,0x2b,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
|
0x65,0x49,0x44,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x36,
|
|
0x38,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x69,0x6e,0x5f,0x70,0x6f,0x73,0x20,
|
|
0x2a,0x20,0x5f,0x31,0x35,0x2e,0x69,0x74,0x65,0x6d,0x73,0x5b,0x5f,0x33,0x30,0x5d,
|
|
0x2e,0x73,0x63,0x61,0x6c,0x65,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x39,0x35,0x20,0x3d,
|
|
0x20,0x76,0x65,0x63,0x34,0x28,0x64,0x6f,0x74,0x28,0x5f,0x31,0x35,0x2e,0x69,0x74,
|
|
0x65,0x6d,0x73,0x5b,0x5f,0x33,0x30,0x5d,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,
|
|
0x6f,0x77,0x30,0x2c,0x20,0x5f,0x36,0x38,0x29,0x2c,0x20,0x64,0x6f,0x74,0x28,0x5f,
|
|
0x31,0x35,0x2e,0x69,0x74,0x65,0x6d,0x73,0x5b,0x5f,0x33,0x30,0x5d,0x2e,0x78,0x66,
|
|
0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x31,0x2c,0x20,0x5f,0x36,0x38,0x29,0x2c,0x20,
|
|
0x64,0x6f,0x74,0x28,0x5f,0x31,0x35,0x2e,0x69,0x74,0x65,0x6d,0x73,0x5b,0x5f,0x33,
|
|
0x30,0x5d,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x32,0x2c,0x20,0x5f,
|
|
0x36,0x38,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,
|
|
0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x20,0x3d,
|
|
0x20,0x2d,0x28,0x6d,0x61,0x74,0x34,0x28,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,
|
|
0x5b,0x34,0x5d,0x2c,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x5b,0x35,0x5d,
|
|
0x2c,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x5b,0x36,0x5d,0x2c,0x20,0x75,
|
|
0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x39,
|
|
0x35,0x29,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,
|
|
0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x75,0x62,0x5f,
|
|
0x66,0x72,0x61,0x6d,0x65,0x5b,0x30,0x5d,0x2c,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,
|
|
0x6d,0x65,0x5b,0x31,0x5d,0x2c,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x5b,
|
|
0x32,0x5d,0x2c,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x5b,0x33,0x5d,0x29,
|
|
0x20,0x2a,0x20,0x5f,0x39,0x35,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
};
|
|
/*
|
|
#version 430
|
|
|
|
layout(location = 0) out vec4 out_linear_depth;
|
|
layout(location = 0) in float v_linear_view_z;
|
|
|
|
void main()
|
|
{
|
|
out_linear_depth = vec4(v_linear_view_z, 0.0, 0.0, 0.0);
|
|
}
|
|
|
|
*/
|
|
static const uint8_t depth_only_geom_fs_source_glsl430[189] = {
|
|
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,0x6f,0x75,0x74,0x5f,
|
|
0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,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,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x5f,0x6c,0x69,
|
|
0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x3b,0x0a,0x0a,0x76,0x6f,
|
|
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x6f,0x75,0x74,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,
|
|
0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,
|
|
0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,
|
|
0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
|
};
|
|
/*
|
|
struct instance
|
|
{
|
|
float4 xform_row0;
|
|
float4 xform_row1;
|
|
float4 xform_row2;
|
|
float4 base_color;
|
|
float4 scale;
|
|
float4 material;
|
|
};
|
|
|
|
ByteAddressBuffer _15 : register(t0);
|
|
cbuffer ub_draw : register(b2)
|
|
{
|
|
int4 _21_inst_base : packoffset(c0);
|
|
};
|
|
|
|
cbuffer ub_frame : register(b0)
|
|
{
|
|
row_major float4x4 _87_view_proj : packoffset(c0);
|
|
row_major float4x4 _87_view : packoffset(c4);
|
|
};
|
|
|
|
|
|
static float4 gl_Position;
|
|
static int gl_InstanceIndex;
|
|
static float3 in_pos;
|
|
static float v_linear_view_z;
|
|
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
float3 in_pos : TEXCOORD0;
|
|
uint gl_InstanceIndex : SV_InstanceID;
|
|
};
|
|
|
|
struct SPIRV_Cross_Output
|
|
{
|
|
float v_linear_view_z : TEXCOORD0;
|
|
float4 gl_Position : SV_Position;
|
|
};
|
|
|
|
void vert_main()
|
|
{
|
|
instance _33;
|
|
_33.xform_row0 = asfloat(_15.Load4((_21_inst_base.x + gl_InstanceIndex) * 96 + 0));
|
|
_33.xform_row1 = asfloat(_15.Load4((_21_inst_base.x + gl_InstanceIndex) * 96 + 16));
|
|
_33.xform_row2 = asfloat(_15.Load4((_21_inst_base.x + gl_InstanceIndex) * 96 + 32));
|
|
_33.base_color = asfloat(_15.Load4((_21_inst_base.x + gl_InstanceIndex) * 96 + 48));
|
|
_33.scale = asfloat(_15.Load4((_21_inst_base.x + gl_InstanceIndex) * 96 + 64));
|
|
_33.material = asfloat(_15.Load4((_21_inst_base.x + gl_InstanceIndex) * 96 + 80));
|
|
float4 _68 = float4(in_pos * _33.scale.xyz, 1.0f);
|
|
float4 _95 = float4(dot(_33.xform_row0, _68), dot(_33.xform_row1, _68), dot(_33.xform_row2, _68), 1.0f);
|
|
v_linear_view_z = -mul(_95, _87_view).z;
|
|
gl_Position = mul(_95, _87_view_proj);
|
|
}
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
|
|
in_pos = stage_input.in_pos;
|
|
vert_main();
|
|
SPIRV_Cross_Output stage_output;
|
|
stage_output.gl_Position = gl_Position;
|
|
stage_output.v_linear_view_z = v_linear_view_z;
|
|
return stage_output;
|
|
}
|
|
*/
|
|
static const uint8_t depth_only_geom_vs_source_hlsl5[1880] = {
|
|
0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x0a,
|
|
0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x78,0x66,0x6f,
|
|
0x72,0x6d,0x5f,0x72,0x6f,0x77,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x34,0x20,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x31,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x78,0x66,0x6f,0x72,0x6d,
|
|
0x5f,0x72,0x6f,0x77,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x20,0x62,0x61,0x73,0x65,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,
|
|
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x73,0x63,0x61,0x6c,0x65,0x3b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6d,0x61,0x74,0x65,0x72,
|
|
0x69,0x61,0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x42,0x79,0x74,0x65,0x41,0x64,0x64,
|
|
0x72,0x65,0x73,0x73,0x42,0x75,0x66,0x66,0x65,0x72,0x20,0x5f,0x31,0x35,0x20,0x3a,
|
|
0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x74,0x30,0x29,0x3b,0x0a,0x63,
|
|
0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x75,0x62,0x5f,0x64,0x72,0x61,0x77,0x20,0x3a,
|
|
0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x32,0x29,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x34,0x20,0x5f,0x32,0x31,0x5f,0x69,0x6e,0x73,
|
|
0x74,0x5f,0x62,0x61,0x73,0x65,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,
|
|
0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x63,0x62,0x75,
|
|
0x66,0x66,0x65,0x72,0x20,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x20,0x3a,0x20,
|
|
0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x38,0x37,0x5f,0x76,0x69,0x65,0x77,0x5f,0x70,
|
|
0x72,0x6f,0x6a,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,
|
|
0x28,0x63,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,
|
|
0x6a,0x6f,0x72,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x38,0x37,
|
|
0x5f,0x76,0x69,0x65,0x77,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,
|
|
0x65,0x74,0x28,0x63,0x34,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,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,0x69,
|
|
0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,
|
|
0x64,0x65,0x78,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x33,0x20,0x69,0x6e,0x5f,0x70,0x6f,0x73,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
|
|
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,
|
|
0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,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,0x33,0x20,
|
|
0x69,0x6e,0x5f,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,
|
|
0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,
|
|
0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,
|
|
0x53,0x56,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,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,0x20,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,
|
|
0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,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,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x20,
|
|
0x5f,0x33,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x2e,0x78,0x66,0x6f,
|
|
0x72,0x6d,0x5f,0x72,0x6f,0x77,0x30,0x20,0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x28,0x5f,0x31,0x35,0x2e,0x4c,0x6f,0x61,0x64,0x34,0x28,0x28,0x5f,0x32,0x31,
|
|
0x5f,0x69,0x6e,0x73,0x74,0x5f,0x62,0x61,0x73,0x65,0x2e,0x78,0x20,0x2b,0x20,0x67,
|
|
0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,
|
|
0x20,0x2a,0x20,0x39,0x36,0x20,0x2b,0x20,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x5f,0x33,0x33,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x31,0x20,
|
|
0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,0x35,0x2e,0x4c,0x6f,
|
|
0x61,0x64,0x34,0x28,0x28,0x5f,0x32,0x31,0x5f,0x69,0x6e,0x73,0x74,0x5f,0x62,0x61,
|
|
0x73,0x65,0x2e,0x78,0x20,0x2b,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,
|
|
0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x2a,0x20,0x39,0x36,0x20,0x2b,0x20,
|
|
0x31,0x36,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x2e,0x78,0x66,
|
|
0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x32,0x20,0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x28,0x5f,0x31,0x35,0x2e,0x4c,0x6f,0x61,0x64,0x34,0x28,0x28,0x5f,0x32,
|
|
0x31,0x5f,0x69,0x6e,0x73,0x74,0x5f,0x62,0x61,0x73,0x65,0x2e,0x78,0x20,0x2b,0x20,
|
|
0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,
|
|
0x29,0x20,0x2a,0x20,0x39,0x36,0x20,0x2b,0x20,0x33,0x32,0x29,0x29,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x5f,0x33,0x33,0x2e,0x62,0x61,0x73,0x65,0x5f,0x63,0x6f,0x6c,0x6f,
|
|
0x72,0x20,0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,0x35,0x2e,
|
|
0x4c,0x6f,0x61,0x64,0x34,0x28,0x28,0x5f,0x32,0x31,0x5f,0x69,0x6e,0x73,0x74,0x5f,
|
|
0x62,0x61,0x73,0x65,0x2e,0x78,0x20,0x2b,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,
|
|
0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x2a,0x20,0x39,0x36,0x20,
|
|
0x2b,0x20,0x34,0x38,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x33,0x2e,
|
|
0x73,0x63,0x61,0x6c,0x65,0x20,0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,0x74,0x28,
|
|
0x5f,0x31,0x35,0x2e,0x4c,0x6f,0x61,0x64,0x34,0x28,0x28,0x5f,0x32,0x31,0x5f,0x69,
|
|
0x6e,0x73,0x74,0x5f,0x62,0x61,0x73,0x65,0x2e,0x78,0x20,0x2b,0x20,0x67,0x6c,0x5f,
|
|
0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x2a,
|
|
0x20,0x39,0x36,0x20,0x2b,0x20,0x36,0x34,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
|
0x5f,0x33,0x33,0x2e,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x20,0x3d,0x20,0x61,
|
|
0x73,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,0x35,0x2e,0x4c,0x6f,0x61,0x64,0x34,
|
|
0x28,0x28,0x5f,0x32,0x31,0x5f,0x69,0x6e,0x73,0x74,0x5f,0x62,0x61,0x73,0x65,0x2e,
|
|
0x78,0x20,0x2b,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,
|
|
0x6e,0x64,0x65,0x78,0x29,0x20,0x2a,0x20,0x39,0x36,0x20,0x2b,0x20,0x38,0x30,0x29,
|
|
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x36,
|
|
0x38,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x5f,0x70,0x6f,
|
|
0x73,0x20,0x2a,0x20,0x5f,0x33,0x33,0x2e,0x73,0x63,0x61,0x6c,0x65,0x2e,0x78,0x79,
|
|
0x7a,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x34,0x20,0x5f,0x39,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
|
0x34,0x28,0x64,0x6f,0x74,0x28,0x5f,0x33,0x33,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,
|
|
0x72,0x6f,0x77,0x30,0x2c,0x20,0x5f,0x36,0x38,0x29,0x2c,0x20,0x64,0x6f,0x74,0x28,
|
|
0x5f,0x33,0x33,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x31,0x2c,0x20,
|
|
0x5f,0x36,0x38,0x29,0x2c,0x20,0x64,0x6f,0x74,0x28,0x5f,0x33,0x33,0x2e,0x78,0x66,
|
|
0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x32,0x2c,0x20,0x5f,0x36,0x38,0x29,0x2c,0x20,
|
|
0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x6c,0x69,0x6e,
|
|
0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x20,0x3d,0x20,0x2d,0x6d,0x75,
|
|
0x6c,0x28,0x5f,0x39,0x35,0x2c,0x20,0x5f,0x38,0x37,0x5f,0x76,0x69,0x65,0x77,0x29,
|
|
0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
|
|
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x5f,0x39,0x35,0x2c,0x20,0x5f,
|
|
0x38,0x37,0x5f,0x76,0x69,0x65,0x77,0x5f,0x70,0x72,0x6f,0x6a,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,0x67,
|
|
0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,
|
|
0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,
|
|
0x74,0x2e,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,
|
|
0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x5f,0x70,0x6f,0x73,0x20,
|
|
0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x6e,
|
|
0x5f,0x70,0x6f,0x73,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,0x5f,0x6c,0x69,0x6e,0x65,0x61,
|
|
0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x20,0x3d,0x20,0x76,0x5f,0x6c,0x69,0x6e,
|
|
0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,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 out_linear_depth;
|
|
static float v_linear_view_z;
|
|
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
float v_linear_view_z : TEXCOORD0;
|
|
};
|
|
|
|
struct SPIRV_Cross_Output
|
|
{
|
|
float4 out_linear_depth : SV_Target0;
|
|
};
|
|
|
|
void frag_main()
|
|
{
|
|
out_linear_depth = float4(v_linear_view_z, 0.0f, 0.0f, 0.0f);
|
|
}
|
|
|
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
v_linear_view_z = stage_input.v_linear_view_z;
|
|
frag_main();
|
|
SPIRV_Cross_Output stage_output;
|
|
stage_output.out_linear_depth = out_linear_depth;
|
|
return stage_output;
|
|
}
|
|
*/
|
|
static const uint8_t depth_only_geom_fs_source_hlsl5[539] = {
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6f,0x75,
|
|
0x74,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,0x3b,0x0a,
|
|
0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x76,0x5f,0x6c,
|
|
0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,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,0x20,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,
|
|
0x77,0x5f,0x7a,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,0x6f,0x75,0x74,0x5f,
|
|
0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,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,0x6f,0x75,0x74,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,
|
|
0x5f,0x64,0x65,0x70,0x74,0x68,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,
|
|
0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x2c,
|
|
0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,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,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,
|
|
0x77,0x5f,0x7a,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,
|
|
0x74,0x2e,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,
|
|
0x7a,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,0x6f,0x75,0x74,0x5f,0x6c,0x69,
|
|
0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,0x20,0x3d,0x20,0x6f,0x75,0x74,
|
|
0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,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,
|
|
};
|
|
/*
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct instance
|
|
{
|
|
float4 xform_row0;
|
|
float4 xform_row1;
|
|
float4 xform_row2;
|
|
float4 base_color;
|
|
float4 scale;
|
|
float4 material;
|
|
};
|
|
|
|
struct instances
|
|
{
|
|
instance items[1];
|
|
};
|
|
|
|
struct ub_draw
|
|
{
|
|
int4 inst_base;
|
|
};
|
|
|
|
struct ub_frame
|
|
{
|
|
float4x4 view_proj;
|
|
float4x4 view;
|
|
};
|
|
|
|
struct main0_out
|
|
{
|
|
float v_linear_view_z [[user(locn0)]];
|
|
float4 gl_Position [[position]];
|
|
};
|
|
|
|
struct main0_in
|
|
{
|
|
float3 in_pos [[attribute(0)]];
|
|
};
|
|
|
|
vertex main0_out main0(main0_in in [[stage_in]], constant ub_frame& _87 [[buffer(0)]], constant ub_draw& _21 [[buffer(2)]], const device instances& _15 [[buffer(8)]], uint gl_InstanceIndex [[instance_id]])
|
|
{
|
|
main0_out out = {};
|
|
int _30 = _21.inst_base.x + int(gl_InstanceIndex);
|
|
float4 _68 = float4(in.in_pos * _15.items[_30].scale.xyz, 1.0);
|
|
float4 _95 = float4(dot(_15.items[_30].xform_row0, _68), dot(_15.items[_30].xform_row1, _68), dot(_15.items[_30].xform_row2, _68), 1.0);
|
|
out.v_linear_view_z = -(_87.view * _95).z;
|
|
out.gl_Position = _87.view_proj * _95;
|
|
return out;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t depth_only_geom_vs_source_metal_macos[1144] = {
|
|
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,0x69,
|
|
0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x34,0x20,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x30,0x3b,
|
|
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x78,0x66,0x6f,0x72,
|
|
0x6d,0x5f,0x72,0x6f,0x77,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x34,0x20,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x32,0x3b,0x0a,0x20,
|
|
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x62,0x61,0x73,0x65,0x5f,0x63,
|
|
0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
|
0x20,0x73,0x63,0x61,0x6c,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
|
0x74,0x34,0x20,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,
|
|
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,
|
|
0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,
|
|
0x20,0x69,0x74,0x65,0x6d,0x73,0x5b,0x31,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,
|
|
0x74,0x72,0x75,0x63,0x74,0x20,0x75,0x62,0x5f,0x64,0x72,0x61,0x77,0x0a,0x7b,0x0a,
|
|
0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x34,0x20,0x69,0x6e,0x73,0x74,0x5f,0x62,0x61,
|
|
0x73,0x65,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x75,
|
|
0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x76,0x69,0x65,0x77,0x5f,0x70,0x72,0x6f,0x6a,
|
|
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x76,
|
|
0x69,0x65,0x77,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,0x20,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,
|
|
0x69,0x65,0x77,0x5f,0x7a,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,0x33,0x20,0x69,0x6e,0x5f,
|
|
0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,
|
|
0x30,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,0x75,0x62,0x5f,0x66,0x72,0x61,0x6d,0x65,0x26,0x20,0x5f,0x38,
|
|
0x37,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,
|
|
0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x62,0x5f,0x64,0x72,0x61,
|
|
0x77,0x26,0x20,0x5f,0x32,0x31,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,
|
|
0x32,0x29,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x64,0x65,0x76,0x69,
|
|
0x63,0x65,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x73,0x26,0x20,0x5f,0x31,
|
|
0x35,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x38,0x29,0x5d,0x5d,0x2c,
|
|
0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
|
0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x5b,0x5b,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
|
0x65,0x5f,0x69,0x64,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,0x69,0x6e,0x74,0x20,0x5f,0x33,0x30,0x20,0x3d,0x20,
|
|
0x5f,0x32,0x31,0x2e,0x69,0x6e,0x73,0x74,0x5f,0x62,0x61,0x73,0x65,0x2e,0x78,0x20,
|
|
0x2b,0x20,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
|
0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
|
0x61,0x74,0x34,0x20,0x5f,0x36,0x38,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
|
0x28,0x69,0x6e,0x2e,0x69,0x6e,0x5f,0x70,0x6f,0x73,0x20,0x2a,0x20,0x5f,0x31,0x35,
|
|
0x2e,0x69,0x74,0x65,0x6d,0x73,0x5b,0x5f,0x33,0x30,0x5d,0x2e,0x73,0x63,0x61,0x6c,
|
|
0x65,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x39,0x35,0x20,0x3d,0x20,0x66,0x6c,
|
|
0x6f,0x61,0x74,0x34,0x28,0x64,0x6f,0x74,0x28,0x5f,0x31,0x35,0x2e,0x69,0x74,0x65,
|
|
0x6d,0x73,0x5b,0x5f,0x33,0x30,0x5d,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,
|
|
0x77,0x30,0x2c,0x20,0x5f,0x36,0x38,0x29,0x2c,0x20,0x64,0x6f,0x74,0x28,0x5f,0x31,
|
|
0x35,0x2e,0x69,0x74,0x65,0x6d,0x73,0x5b,0x5f,0x33,0x30,0x5d,0x2e,0x78,0x66,0x6f,
|
|
0x72,0x6d,0x5f,0x72,0x6f,0x77,0x31,0x2c,0x20,0x5f,0x36,0x38,0x29,0x2c,0x20,0x64,
|
|
0x6f,0x74,0x28,0x5f,0x31,0x35,0x2e,0x69,0x74,0x65,0x6d,0x73,0x5b,0x5f,0x33,0x30,
|
|
0x5d,0x2e,0x78,0x66,0x6f,0x72,0x6d,0x5f,0x72,0x6f,0x77,0x32,0x2c,0x20,0x5f,0x36,
|
|
0x38,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
|
|
0x74,0x2e,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,
|
|
0x7a,0x20,0x3d,0x20,0x2d,0x28,0x5f,0x38,0x37,0x2e,0x76,0x69,0x65,0x77,0x20,0x2a,
|
|
0x20,0x5f,0x39,0x35,0x29,0x2e,0x7a,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,
|
|
0x38,0x37,0x2e,0x76,0x69,0x65,0x77,0x5f,0x70,0x72,0x6f,0x6a,0x20,0x2a,0x20,0x5f,
|
|
0x39,0x35,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 out_linear_depth [[color(0)]];
|
|
};
|
|
|
|
struct main0_in
|
|
{
|
|
float v_linear_view_z [[user(locn0)]];
|
|
};
|
|
|
|
fragment main0_out main0(main0_in in [[stage_in]])
|
|
{
|
|
main0_out out = {};
|
|
out.out_linear_depth = float4(in.v_linear_view_z, 0.0, 0.0, 0.0);
|
|
return out;
|
|
}
|
|
|
|
*/
|
|
static const uint8_t depth_only_geom_fs_source_metal_macos[369] = {
|
|
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,0x6f,0x75,0x74,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,
|
|
0x5f,0x64,0x65,0x70,0x74,0x68,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,0x20,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,
|
|
0x65,0x77,0x5f,0x7a,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,0x6f,
|
|
0x75,0x74,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x64,0x65,0x70,0x74,0x68,0x20,
|
|
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x76,0x5f,0x6c,0x69,
|
|
0x6e,0x65,0x61,0x72,0x5f,0x76,0x69,0x65,0x77,0x5f,0x7a,0x2c,0x20,0x30,0x2e,0x30,
|
|
0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
|
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,
|
|
0x00,
|
|
};
|
|
static inline const sg_shader_desc* depth_only_geom_prog_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*)depth_only_geom_vs_source_glsl430;
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = (const char*)depth_only_geom_fs_source_glsl430;
|
|
desc.fragment_func.entry = "main";
|
|
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
|
|
desc.attrs[0].glsl_name = "in_pos";
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 128;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 8;
|
|
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "ub_frame";
|
|
desc.uniform_blocks[2].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[2].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[2].size = 16;
|
|
desc.uniform_blocks[2].glsl_uniforms[0].type = SG_UNIFORMTYPE_INT4;
|
|
desc.uniform_blocks[2].glsl_uniforms[0].array_count = 1;
|
|
desc.uniform_blocks[2].glsl_uniforms[0].glsl_name = "ub_draw";
|
|
desc.views[0].storage_buffer.stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.views[0].storage_buffer.readonly = true;
|
|
desc.views[0].storage_buffer.glsl_binding_n = 0;
|
|
desc.label = "depth_only_geom_prog_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
if (backend == SG_BACKEND_D3D11) {
|
|
static sg_shader_desc desc;
|
|
static bool valid;
|
|
if (!valid) {
|
|
valid = true;
|
|
desc.vertex_func.source = (const char*)depth_only_geom_vs_source_hlsl5;
|
|
desc.vertex_func.d3d11_target = "vs_5_0";
|
|
desc.vertex_func.entry = "main";
|
|
desc.fragment_func.source = (const char*)depth_only_geom_fs_source_hlsl5;
|
|
desc.fragment_func.d3d11_target = "ps_5_0";
|
|
desc.fragment_func.entry = "main";
|
|
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
|
|
desc.attrs[0].hlsl_sem_name = "TEXCOORD";
|
|
desc.attrs[0].hlsl_sem_index = 0;
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 128;
|
|
desc.uniform_blocks[0].hlsl_register_b_n = 0;
|
|
desc.uniform_blocks[2].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[2].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[2].size = 16;
|
|
desc.uniform_blocks[2].hlsl_register_b_n = 2;
|
|
desc.views[0].storage_buffer.stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.views[0].storage_buffer.readonly = true;
|
|
desc.views[0].storage_buffer.hlsl_register_t_n = 0;
|
|
desc.label = "depth_only_geom_prog_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
if (backend == SG_BACKEND_METAL_MACOS) {
|
|
static sg_shader_desc desc;
|
|
static bool valid;
|
|
if (!valid) {
|
|
valid = true;
|
|
desc.vertex_func.source = (const char*)depth_only_geom_vs_source_metal_macos;
|
|
desc.vertex_func.entry = "main0";
|
|
desc.fragment_func.source = (const char*)depth_only_geom_fs_source_metal_macos;
|
|
desc.fragment_func.entry = "main0";
|
|
desc.attrs[0].base_type = SG_SHADERATTRBASETYPE_FLOAT;
|
|
desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[0].size = 128;
|
|
desc.uniform_blocks[0].msl_buffer_n = 0;
|
|
desc.uniform_blocks[2].stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.uniform_blocks[2].layout = SG_UNIFORMLAYOUT_STD140;
|
|
desc.uniform_blocks[2].size = 16;
|
|
desc.uniform_blocks[2].msl_buffer_n = 2;
|
|
desc.views[0].storage_buffer.stage = SG_SHADERSTAGE_VERTEX;
|
|
desc.views[0].storage_buffer.readonly = true;
|
|
desc.views[0].storage_buffer.msl_buffer_n = 8;
|
|
desc.label = "depth_only_geom_prog_shader";
|
|
}
|
|
return &desc;
|
|
}
|
|
return 0;
|
|
}
|