Skip to content

Commit ae9c193

Browse files
committed
hlsl51: unify shader input semantics and update docs
1 parent 1807908 commit ae9c193

145 files changed

Lines changed: 465 additions & 445 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1k/build.profiles

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# --- region platfom:common
77

88
# The Axmol HLSL-first cross-platform shader compiler
9-
axslcc=3.99.2
9+
axslcc=3.99.0
1010

1111
# The cmake, @gradle @axmol-cmdline
1212
# as latest as possible

axmol/renderer/shaders/base.hlsli

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,38 @@
4545
//------------------------------------------------------------------------------
4646

4747
// --- Linear sampling ---
48-
SamplerState LinearClamp : register(s0, space1);
49-
SamplerState LinearWrap : register(s1, space1);
50-
SamplerState LinearMirror : register(s2, space1);
51-
SamplerState LinearBorder : register(s3, space1);
48+
SamplerState LinearClamp;
49+
SamplerState LinearWrap;
50+
SamplerState LinearMirror;
51+
SamplerState LinearBorder;
5252

5353
// --- Point sampling ---
54-
SamplerState PointClamp : register(s4, space1);
55-
SamplerState PointWrap : register(s5, space1);
56-
SamplerState PointMirror : register(s6, space1);
57-
SamplerState PointBorder : register(s7, space1);
54+
SamplerState PointClamp;
55+
SamplerState PointWrap;
56+
SamplerState PointMirror;
57+
SamplerState PointBorder;
5858

5959
// --- Linear + Mipmap ---
60-
SamplerState LinearMipClamp : register(s8, space1);
61-
SamplerState LinearMipWrap : register(s9, space1);
62-
SamplerState LinearMipMirror : register(s10, space1);
63-
SamplerState LinearMipBorder : register(s11, space1);
60+
SamplerState LinearMipClamp;
61+
SamplerState LinearMipWrap;
62+
SamplerState LinearMipMirror;
63+
SamplerState LinearMipBorder;
6464

6565
// --- Anisotropic filtering ---
66-
SamplerState AnisoClamp : register(s12, space1);
67-
SamplerState AnisoWrap : register(s13, space1);
68-
SamplerState AnisoMirror : register(s14, space1);
69-
SamplerState AnisoBorder : register(s15, space1);
66+
SamplerState AnisoClamp;
67+
SamplerState AnisoWrap;
68+
SamplerState AnisoMirror;
69+
SamplerState AnisoBorder;
7070

7171
// --- Depth comparison samplers ---
72-
SamplerComparisonState ShadowCmpClamp : register(s16, space1);
73-
SamplerComparisonState ShadowCmpWrap : register(s17, space1);
74-
SamplerComparisonState ShadowCmpMirror : register(s18, space1);
75-
SamplerComparisonState ShadowCmpBorder : register(s19, space1);
72+
SamplerComparisonState ShadowCmpClamp;
73+
SamplerComparisonState ShadowCmpWrap;
74+
SamplerComparisonState ShadowCmpMirror;
75+
SamplerComparisonState ShadowCmpBorder;
7676

7777
// --- Special cases ---
78-
SamplerState LinearNoMipClamp : register(s20, space1);
79-
SamplerState PointNoMipClamp : register(s21, space1);
80-
81-
// s0-s21: predefined shader samplers
82-
// s22-s31: reserved
83-
// s32+: texture-owned samplers
84-
#define AX_TEXTURE_SAMPLER_BASE 32
78+
SamplerState LinearNoMipClamp;
79+
SamplerState PointNoMipClamp;
8580

8681
//------------------------------------------------------------------------------
8782
// GPU Instancing

axmol/renderer/shaders/cameraClear_vs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct VS_OUT {
1212
float4 position : SV_Position;
1313
};
1414

15-
cbuffer vs_ub : register(b0, space0) {
15+
cbuffer vs_ub {
1616
float depth;
1717
};
1818

axmol/renderer/shaders/colorNormalTexture_fs.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ struct PS_IN {
1515
#endif
1616
};
1717

18-
Texture2D u_tex0 : register(t0, space1);
18+
Texture2D u_tex0;
1919

2020
#ifdef USE_NORMAL_MAPPING
21-
Texture2D u_normalTex : register(t1, space1);
21+
Texture2D u_normalTex;
2222
#endif
2323

24-
cbuffer fs_ub : register(b1, space0) {
24+
cbuffer fs_ub {
2525
vvec3_def(u_DirLightSourceColor, MAX_DIRECTIONAL_LIGHT_NUM);
2626
vvec3_def(u_DirLightSourceDirection, MAX_DIRECTIONAL_LIGHT_NUM);
2727
vvec3_def(u_PointLightSourceColor, MAX_POINT_LIGHT_NUM);

axmol/renderer/shaders/colorNormal_fs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct PS_IN {
77
float3 v_normal : NORMAL;
88
};
99

10-
cbuffer fs_ub : register(b1, space0) {
10+
cbuffer fs_ub {
1111
vvec3_def(u_DirLightSourceColor, MAX_DIRECTIONAL_LIGHT_NUM);
1212
vvec3_def(u_DirLightSourceDirection, MAX_DIRECTIONAL_LIGHT_NUM);
1313
vvec3_def(u_PointLightSourceColor, MAX_POINT_LIGHT_NUM);

axmol/renderer/shaders/colorTexture_fs.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ struct PS_IN {
44
float2 v_texCoord : TEXCOORD0;
55
};
66

7-
cbuffer fs_ub : register(b1, space0) {
7+
cbuffer fs_ub {
88
float4 u_color;
99
};
1010

11-
Texture2D u_tex0 : register(t0, space1);
11+
Texture2D u_tex0;
1212

1313
float4 main(PS_IN input) : SV_Target0
1414
{

axmol/renderer/shaders/color_fs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cbuffer fs_ub : register(b1, space0) {
1+
cbuffer fs_ub {
22
float4 u_color;
33
};
44

axmol/renderer/shaders/dualSampler_fs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct PS_IN {
55
float2 v_texCoord : TEXCOORD0;
66
};
77

8-
Texture2DArray u_tex0 : register(t0, space1);
8+
Texture2DArray u_tex0;
99

1010
float4 main(PS_IN input) : SV_Target0
1111
{

axmol/renderer/shaders/dualSampler_gray_fs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct PS_IN {
55
float2 v_texCoord : TEXCOORD0;
66
};
77

8-
Texture2DArray u_tex0 : register(t0, space1);
8+
Texture2DArray u_tex0;
99

1010
float4 main(PS_IN input) : SV_Target0
1111
{

axmol/renderer/shaders/dualSampler_hsv_fs.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ struct PS_IN {
77
float2 v_texCoord : TEXCOORD0;
88
};
99

10-
Texture2DArray u_tex0 : register(t0, space1);
10+
Texture2DArray u_tex0;
1111

12-
cbuffer fs_ub : register(b1, space0) {
12+
cbuffer fs_ub {
1313
float3 u_hsv;
1414
};
1515

0 commit comments

Comments
 (0)