diff --git a/examples/05-instancing/varying.def.sc b/examples/05-instancing/varying.def.sc index d8e2ca91..2ac2984d 100644 --- a/examples/05-instancing/varying.def.sc +++ b/examples/05-instancing/varying.def.sc @@ -2,8 +2,8 @@ vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); vec3 a_position : POSITION; vec4 a_color0 : COLOR0; -vec4 i_data0 : TEXCOORD3; -vec4 i_data1 : TEXCOORD4; +vec4 i_data0 : TEXCOORD7; +vec4 i_data1 : TEXCOORD6; vec4 i_data2 : TEXCOORD5; -vec4 i_data3 : TEXCOORD6; -vec4 i_data4 : TEXCOORD7; +vec4 i_data3 : TEXCOORD4; +vec4 i_data4 : TEXCOORD3; diff --git a/examples/06-bump/varying.def.sc b/examples/06-bump/varying.def.sc index 716bbca5..34417e78 100644 --- a/examples/06-bump/varying.def.sc +++ b/examples/06-bump/varying.def.sc @@ -9,7 +9,7 @@ vec3 a_position : POSITION; vec4 a_normal : NORMAL; vec4 a_tangent : TANGENT; vec2 a_texcoord0 : TEXCOORD0; -vec4 i_data0 : TEXCOORD4; -vec4 i_data1 : TEXCOORD5; -vec4 i_data2 : TEXCOORD6; -vec4 i_data3 : TEXCOORD7; +vec4 i_data0 : TEXCOORD7; +vec4 i_data1 : TEXCOORD6; +vec4 i_data2 : TEXCOORD5; +vec4 i_data3 : TEXCOORD4; diff --git a/examples/14-shadowvolumes/varying.def.sc b/examples/14-shadowvolumes/varying.def.sc index 4adeb88b..f5bf981d 100644 --- a/examples/14-shadowvolumes/varying.def.sc +++ b/examples/14-shadowvolumes/varying.def.sc @@ -8,8 +8,3 @@ vec3 a_position : POSITION; vec4 a_normal : NORMAL; vec4 a_color0 : COLOR0; vec2 a_texcoord0 : TEXCOORD0; -vec4 i_data0 : TEXCOORD3; -vec4 i_data1 : TEXCOORD4; -vec4 i_data2 : TEXCOORD5; -vec4 i_data3 : TEXCOORD6; -vec4 i_data4 : TEXCOORD7; diff --git a/examples/21-deferred/varying.def.sc b/examples/21-deferred/varying.def.sc index 82e40e14..4fb6fcf9 100644 --- a/examples/21-deferred/varying.def.sc +++ b/examples/21-deferred/varying.def.sc @@ -11,7 +11,3 @@ vec4 a_normal : NORMAL; vec4 a_tangent : TANGENT; vec2 a_texcoord0 : TEXCOORD0; vec4 a_color0 : COLOR0; -vec4 i_data0 : TEXCOORD4; -vec4 i_data1 : TEXCOORD5; -vec4 i_data2 : TEXCOORD6; -vec4 i_data3 : TEXCOORD7; diff --git a/examples/24-nbody/varying.def.sc b/examples/24-nbody/varying.def.sc index c2bead99..16023cea 100644 --- a/examples/24-nbody/varying.def.sc +++ b/examples/24-nbody/varying.def.sc @@ -1,4 +1,4 @@ vec2 a_position : POSITION; -vec4 i_data3 : TEXCOORD7; +vec4 i_data0 : TEXCOORD7; vec3 v_texCoord : TEXCOORD0 = vec3(0.0, 0.0, 0.0); diff --git a/examples/24-nbody/vs_particle.sc b/examples/24-nbody/vs_particle.sc index 329bcc49..870c27ce 100644 --- a/examples/24-nbody/vs_particle.sc +++ b/examples/24-nbody/vs_particle.sc @@ -1,4 +1,4 @@ -$input a_position, i_data3 +$input a_position, i_data0 $output v_texCoord /* @@ -11,13 +11,13 @@ $output v_texCoord void main() { - vec3 eye = mul(u_view, vec4(i_data3.xyz, 1.0) ).xyz; + vec3 eye = mul(u_view, vec4(i_data0.xyz, 1.0) ).xyz; vec3 up = normalize(cross(eye, vec3(1.0, 0.0, 0.0) ) ); vec3 right = normalize(cross(up, eye)); float size = u_particleSize; vec3 position = eye + size * right * a_position.x + size * up * a_position.y; v_texCoord.xy = a_position; - v_texCoord.z = i_data3.w; + v_texCoord.z = i_data0.w; gl_Position = mul(u_proj, vec4(position, 1.0) ); } diff --git a/examples/runtime/shaders/dx11/vs_bump_instanced.bin b/examples/runtime/shaders/dx11/vs_bump_instanced.bin index 497c92e5..976e45ca 100644 Binary files a/examples/runtime/shaders/dx11/vs_bump_instanced.bin and b/examples/runtime/shaders/dx11/vs_bump_instanced.bin differ diff --git a/examples/runtime/shaders/dx11/vs_instancing.bin b/examples/runtime/shaders/dx11/vs_instancing.bin index 416166a7..242829ad 100644 Binary files a/examples/runtime/shaders/dx11/vs_instancing.bin and b/examples/runtime/shaders/dx11/vs_instancing.bin differ diff --git a/examples/runtime/shaders/dx9/vs_bump_instanced.bin b/examples/runtime/shaders/dx9/vs_bump_instanced.bin index 7a962587..7e3fa3cb 100644 Binary files a/examples/runtime/shaders/dx9/vs_bump_instanced.bin and b/examples/runtime/shaders/dx9/vs_bump_instanced.bin differ diff --git a/examples/runtime/shaders/dx9/vs_instancing.bin b/examples/runtime/shaders/dx9/vs_instancing.bin index fc70843a..d99a7116 100644 Binary files a/examples/runtime/shaders/dx9/vs_instancing.bin and b/examples/runtime/shaders/dx9/vs_instancing.bin differ diff --git a/examples/runtime/shaders/gles/vs_particle.bin b/examples/runtime/shaders/gles/vs_particle.bin index 586ce977..935b3b3b 100644 Binary files a/examples/runtime/shaders/gles/vs_particle.bin and b/examples/runtime/shaders/gles/vs_particle.bin differ diff --git a/examples/runtime/shaders/glsl/vs_particle.bin b/examples/runtime/shaders/glsl/vs_particle.bin index 39f9df50..652ebb75 100644 Binary files a/examples/runtime/shaders/glsl/vs_particle.bin and b/examples/runtime/shaders/glsl/vs_particle.bin differ diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index f0428069..a63c2759 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -1600,7 +1600,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); for (uint32_t ii = 0; ii < _numInstanceData; ++ii) { - uint32_t index = 8-_numInstanceData+ii; + uint32_t index = 7-ii; // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc. uint32_t jj; D3D11_INPUT_ELEMENT_DESC* curr = vertexElements; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 9bce8f52..70cbf7fd 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -1970,7 +1970,7 @@ namespace bgfx { namespace d3d9 for (uint8_t ii = 0; ii < _numInstanceData; ++ii) { memcpy(elem, &inst, sizeof(D3DVERTEXELEMENT9) ); - elem->UsageIndex = uint8_t(8-_numInstanceData+ii); + elem->UsageIndex = uint8_t(7-ii); // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc. elem->Offset = ii*16; ++elem; }