I'm trying to compile a simple vs with only the stock shader file from bgfx but failed so far.
$input a_position, a_normal, a_color0
$output v_normal, v_color0
/*
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "common.sh"
void main()
{
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
v_normal = mul(u_model, vec4(a_normal, 0.0) ).xyz;
v_color0 = a_color0;
}
shaderc.exe -f shaders/vs_gwen.sc -o out/shaders/windows/vs_gwen.bin --type v
--platform windows --varyingdef H:/GitHub/bgfx/src/varying.def.sc -p ps_3_0
Code:
---
1: struct Output
2: {
3: float4 gl_Position : SV_POSITION;
4: float4 v_color0 : COLOR0;
5: float3 v_normal : TEXCOORD1;
6: };
7: float3 instMul(float3 _vec, float3x3 _mtx) { return mul(_mtx, _vec); }
8: float3 instMul(float3x3 _mtx, float3 _vec) { return mul(_vec, _mtx); }
9: float4 instMul(float4 _vec, float4x4 _mtx) { return mul(_mtx, _vec); }
10: float4 instMul(float4x4 _mtx, float4 _vec) { return mul(_vec, _mtx); }
11: bool2 lessThan(float2 _a, float2 _b) { return _a < _b; }
12: bool3 lessThan(float3 _a, float3 _b) { return _a < _b; }
13: bool4 lessThan(float4 _a, float4 _b) { return _a < _b; }
14: bool2 lessThanEqual(float2 _a, float2 _b) { return _a <= _b; }
15: bool2 lessThanEqual(float3 _a, float3 _b) { return _a <= _b; }
16: bool2 lessThanEqual(float4 _a, float4 _b) { return _a <= _b; }
17: bool2 greaterThan(float2 _a, float2 _b) { return _a > _b; }
18: bool3 greaterThan(float3 _a, float3 _b) { return _a > _b; }
19: bool4 greaterThan(float4 _a, float4 _b) { return _a > _b; }
20: bool2 greaterThanEqual(float2 _a, float2 _b) { return _a >= _b; }
21: bool3 greaterThanEqual(float3 _a, float3 _b) { return _a >= _b; }
22: bool4 greaterThanEqual(float4 _a, float4 _b) { return _a >= _b; }
23: bool2 notEqual(float2 _a, float2 _b) { return _a != _b; }
24: bool3 notEqual(float3 _a, float3 _b) { return _a != _b; }
25: bool4 notEqual(float4 _a, float4 _b) { return _a != _b; }
26: bool2 equal(float2 _a, float2 _b) { return _a == _b; }
27: bool3 equal(float3 _a, float3 _b) { return _a == _b; }
28: bool4 equal(float4 _a, float4 _b) { return _a == _b; }
29: float2 mix(float2 _a, float2 _b, float2 _t) { return lerp(_a, _b, _t); }
30: float3 mix(float3 _a, float3 _b, float3 _t) { return lerp(_a, _b, _t); }
31: float4 mix(float4 _a, float4 _b, float4 _t) { return lerp(_a, _b, _t); }
32: uniform float4x4 u_view;
33: uniform float4x4 u_viewProj;
34: uniform float4x4 u_model;
35: uniform float4x4 u_modelView;
36: uniform float4x4 u_modelViewProj;
37: uniform float4x4 u_modelViewProjX;
38: uniform float4x4 u_viewProjX;
39: Output main(float4 a_color0 : COLOR0 , float3 a_normal : NORMAL0 , float3 a_position : POSITION) { Output _varying_; _varying_.v_color0 = float4(
1.0, 0.0, 0.0, 1.0); _varying_.v_normal = float3(0.0, 1.0, 0.0);
40: {
41: _varying_.gl_Position = mul(u_modelViewProj, float4(a_position, 1.0) );
42: _varying_.v_normal = mul(u_model, float4(a_normal, 0.0) ).xyz;
43: _varying_.v_color0 = a_color0;
44: } return _varying_;
45: }
---
Error: 0x80004005 H:\GitHub\bgfxGWEN\premake\memory(15,45): warning X3206: implicit truncation of vector type
H:\GitHub\bgfxGWEN\premake\memory(16,45): warning X3206: implicit truncation of vector type
H:\GitHub\bgfxGWEN\premake\memory(39,88): error X4502: invalid input semantic 'POSITION': Legal indices are in [1,15]
H:\GitHub\bgfxGWEN\premake\memory(39,88): error X4502: invalid ps_3_0 input semantic 'POSITION'
H:\GitHub\bgfxGWEN\premake\memory(3,22): error X4502: invalid ps_3_0 output semantic 'SV_POSITION'
H:\GitHub\bgfxGWEN\premake\memory(5,19): error X4502: invalid ps_3_0 output semantic 'TEXCOORD1'
Failed to build shader.
I tried various profile but everything seems to fail so far.
I'm doing something wrong but ran of out idea to try.
Any hint ?