-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the code to use the new version of Sokol and the shader
compiler
- Loading branch information
Showing
25 changed files
with
613 additions
and
32 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
assets/shaders/dst/gl33/default.glsl_default_glsl330_fs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#version 330 | ||
|
||
uniform sampler2D tex0_smp; | ||
|
||
in vec2 tcoord; | ||
layout(location = 0) out vec4 fragColor; | ||
in vec4 color; | ||
|
||
void main() | ||
{ | ||
fragColor = color * texture(tex0_smp, tcoord); | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
assets/shaders/dst/gl33/default.glsl_default_glsl330_vs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#version 330 | ||
|
||
uniform vec4 vs_params[12]; | ||
layout(location = 0) in vec3 vertexPosition; | ||
out vec2 tcoord; | ||
layout(location = 1) in vec2 vertexTCoord; | ||
out vec4 color; | ||
layout(location = 2) in vec4 vertexColor; | ||
layout(location = 3) in vec3 vertexNormal; | ||
|
||
void main() | ||
{ | ||
gl_Position = ((mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * mat4(vs_params[8], vs_params[9], vs_params[10], vs_params[11])) * vec4(vertexPosition, 1.0); | ||
tcoord = vertexTCoord; | ||
color = vertexColor; | ||
gl_PointSize = 1.0; | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
assets/shaders/dst/gl33/screen.glsl_default_glsl330_fs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#version 330 | ||
|
||
uniform vec4 fs_params[2]; | ||
uniform sampler2D tex0_smp; | ||
|
||
layout(location = 0) out vec4 fragColor; | ||
|
||
void main() | ||
{ | ||
fragColor = texture(tex0_smp, ((gl_FragCoord.xy - fs_params[1].xy) / fs_params[0].xy) * fs_params[0].zw); | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
assets/shaders/dst/gl33/screen.glsl_default_glsl330_vs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#version 330 | ||
|
||
uniform vec4 vs_params[4]; | ||
layout(location = 0) in vec3 position; | ||
|
||
void main() | ||
{ | ||
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * vec4(position, 1.0); | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
assets/shaders/dst/gles/default.glsl_default_glsl300es_fs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 300 es | ||
precision mediump float; | ||
precision highp int; | ||
|
||
uniform highp sampler2D tex0_smp; | ||
|
||
in highp vec2 tcoord; | ||
layout(location = 0) out highp vec4 fragColor; | ||
in highp vec4 color; | ||
|
||
void main() | ||
{ | ||
fragColor = color * texture(tex0_smp, tcoord); | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
assets/shaders/dst/gles/default.glsl_default_glsl300es_vs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#version 300 es | ||
|
||
uniform vec4 vs_params[12]; | ||
layout(location = 0) in vec3 vertexPosition; | ||
out vec2 tcoord; | ||
layout(location = 1) in vec2 vertexTCoord; | ||
out vec4 color; | ||
layout(location = 2) in vec4 vertexColor; | ||
layout(location = 3) in vec3 vertexNormal; | ||
|
||
void main() | ||
{ | ||
gl_Position = ((mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * mat4(vs_params[4], vs_params[5], vs_params[6], vs_params[7])) * mat4(vs_params[8], vs_params[9], vs_params[10], vs_params[11])) * vec4(vertexPosition, 1.0); | ||
tcoord = vertexTCoord; | ||
color = vertexColor; | ||
gl_PointSize = 1.0; | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
assets/shaders/dst/gles/screen.glsl_default_glsl300es_fs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#version 300 es | ||
precision mediump float; | ||
precision highp int; | ||
|
||
uniform highp vec4 fs_params[2]; | ||
uniform highp sampler2D tex0_smp; | ||
|
||
layout(location = 0) out highp vec4 fragColor; | ||
|
||
void main() | ||
{ | ||
fragColor = texture(tex0_smp, ((gl_FragCoord.xy - fs_params[1].xy) / fs_params[0].xy) * fs_params[0].zw); | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
assets/shaders/dst/gles/screen.glsl_default_glsl300es_vs.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#version 300 es | ||
|
||
uniform vec4 vs_params[4]; | ||
layout(location = 0) in vec3 position; | ||
|
||
void main() | ||
{ | ||
gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * vec4(position, 1.0); | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
assets/shaders/dst/hlsl/default.glsl_default_hlsl4_fs.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Texture2D<float4> tex0 : register(t0); | ||
SamplerState smp : register(s0); | ||
|
||
static float2 tcoord; | ||
static float4 fragColor; | ||
static float4 color; | ||
|
||
struct SPIRV_Cross_Input | ||
{ | ||
float2 tcoord : TEXCOORD0; | ||
float4 color : TEXCOORD1; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
float4 fragColor : SV_Target0; | ||
}; | ||
|
||
void frag_main() | ||
{ | ||
fragColor = color * tex0.Sample(smp, tcoord); | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
tcoord = stage_input.tcoord; | ||
color = stage_input.color; | ||
frag_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.fragColor = fragColor; | ||
return stage_output; | ||
} |
53 changes: 53 additions & 0 deletions
53
assets/shaders/dst/hlsl/default.glsl_default_hlsl4_vs.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
cbuffer vs_params : register(b0) | ||
{ | ||
row_major float4x4 _19_projectionMatrix : packoffset(c0); | ||
row_major float4x4 _19_viewMatrix : packoffset(c4); | ||
row_major float4x4 _19_modelMatrix : packoffset(c8); | ||
}; | ||
|
||
|
||
static float4 gl_Position; | ||
static float gl_PointSize; | ||
static float3 vertexPosition; | ||
static float2 tcoord; | ||
static float2 vertexTCoord; | ||
static float4 color; | ||
static float4 vertexColor; | ||
static float3 vertexNormal; | ||
|
||
struct SPIRV_Cross_Input | ||
{ | ||
float3 vertexPosition : TEXCOORD0; | ||
float2 vertexTCoord : TEXCOORD1; | ||
float4 vertexColor : TEXCOORD2; | ||
float3 vertexNormal : TEXCOORD3; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
float2 tcoord : TEXCOORD0; | ||
float4 color : TEXCOORD1; | ||
float4 gl_Position : SV_Position; | ||
}; | ||
|
||
void vert_main() | ||
{ | ||
gl_Position = mul(float4(vertexPosition, 1.0f), mul(_19_modelMatrix, mul(_19_viewMatrix, _19_projectionMatrix))); | ||
tcoord = vertexTCoord; | ||
color = vertexColor; | ||
gl_PointSize = 1.0f; | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
vertexPosition = stage_input.vertexPosition; | ||
vertexTCoord = stage_input.vertexTCoord; | ||
vertexColor = stage_input.vertexColor; | ||
vertexNormal = stage_input.vertexNormal; | ||
vert_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.gl_Position = gl_Position; | ||
stage_output.tcoord = tcoord; | ||
stage_output.color = color; | ||
return stage_output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
cbuffer fs_params : register(b0) | ||
{ | ||
float2 _17_resolution : packoffset(c0); | ||
float2 _17_scale : packoffset(c0.z); | ||
float2 _17_viewport : packoffset(c1); | ||
}; | ||
|
||
Texture2D<float4> tex0 : register(t0); | ||
SamplerState smp : register(s0); | ||
|
||
static float4 gl_FragCoord; | ||
static float4 fragColor; | ||
|
||
struct SPIRV_Cross_Input | ||
{ | ||
float4 gl_FragCoord : SV_Position; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
float4 fragColor : SV_Target0; | ||
}; | ||
|
||
void frag_main() | ||
{ | ||
fragColor = tex0.Sample(smp, ((gl_FragCoord.xy - _17_viewport) / _17_resolution) * _17_scale); | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
gl_FragCoord = stage_input.gl_FragCoord; | ||
gl_FragCoord.w = 1.0 / gl_FragCoord.w; | ||
frag_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.fragColor = fragColor; | ||
return stage_output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
cbuffer vs_params : register(b0) | ||
{ | ||
row_major float4x4 _19_transform : packoffset(c0); | ||
}; | ||
|
||
|
||
static float4 gl_Position; | ||
static float3 position; | ||
|
||
struct SPIRV_Cross_Input | ||
{ | ||
float3 position : TEXCOORD0; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
float4 gl_Position : SV_Position; | ||
}; | ||
|
||
void vert_main() | ||
{ | ||
gl_Position = mul(float4(position, 1.0f), _19_transform); | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
position = stage_input.position; | ||
vert_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.gl_Position = gl_Position; | ||
return stage_output; | ||
} |
23 changes: 23 additions & 0 deletions
23
assets/shaders/dst/metal-ios/default.glsl_default_metal_ios_fs.metal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_out | ||
{ | ||
float4 fragColor [[color(0)]]; | ||
}; | ||
|
||
struct main0_in | ||
{ | ||
float2 tcoord [[user(locn0)]]; | ||
float4 color [[user(locn1)]]; | ||
}; | ||
|
||
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex0 [[texture(0)]], sampler smp [[sampler(0)]]) | ||
{ | ||
main0_out out = {}; | ||
out.fragColor = in.color * tex0.sample(smp, in.tcoord); | ||
return out; | ||
} | ||
|
37 changes: 37 additions & 0 deletions
37
assets/shaders/dst/metal-ios/default.glsl_default_metal_ios_vs.metal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct vs_params | ||
{ | ||
float4x4 projectionMatrix; | ||
float4x4 viewMatrix; | ||
float4x4 modelMatrix; | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
float2 tcoord [[user(locn0)]]; | ||
float4 color [[user(locn1)]]; | ||
float4 gl_Position [[position]]; | ||
float gl_PointSize [[point_size]]; | ||
}; | ||
|
||
struct main0_in | ||
{ | ||
float3 vertexPosition [[attribute(0)]]; | ||
float2 vertexTCoord [[attribute(1)]]; | ||
float4 vertexColor [[attribute(2)]]; | ||
}; | ||
|
||
vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) | ||
{ | ||
main0_out out = {}; | ||
out.gl_Position = ((_19.projectionMatrix * _19.viewMatrix) * _19.modelMatrix) * float4(in.vertexPosition, 1.0); | ||
out.tcoord = in.vertexTCoord; | ||
out.color = in.vertexColor; | ||
out.gl_PointSize = 1.0; | ||
return out; | ||
} | ||
|
24 changes: 24 additions & 0 deletions
24
assets/shaders/dst/metal-ios/screen.glsl_default_metal_ios_fs.metal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct fs_params | ||
{ | ||
float2 resolution; | ||
float2 scale; | ||
float2 viewport; | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
float4 fragColor [[color(0)]]; | ||
}; | ||
|
||
fragment main0_out main0(constant fs_params& _17 [[buffer(0)]], texture2d<float> tex0 [[texture(0)]], sampler smp [[sampler(0)]], float4 gl_FragCoord [[position]]) | ||
{ | ||
main0_out out = {}; | ||
out.fragColor = tex0.sample(smp, (((gl_FragCoord.xy - _17.viewport) / _17.resolution) * _17.scale)); | ||
return out; | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
assets/shaders/dst/metal-ios/screen.glsl_default_metal_ios_vs.metal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct vs_params | ||
{ | ||
float4x4 transform; | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
float4 gl_Position [[position]]; | ||
}; | ||
|
||
struct main0_in | ||
{ | ||
float3 position [[attribute(0)]]; | ||
}; | ||
|
||
vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) | ||
{ | ||
main0_out out = {}; | ||
out.gl_Position = _19.transform * float4(in.position, 1.0); | ||
return out; | ||
} | ||
|
Oops, something went wrong.