Vertex shader looks like:

// *************************************************************************************

// ShaderTest1_VS.hlsl

//

// Ryan Boghean

// Feb 01, 2013

//

// *************************************************************************************

#include "LinearAlgebra.hlsl"

// ---------------------------------------------------------------------------------------------------------------------------

// constants/types

// ---------------------------------------------------------------------------------------------------------------------------

// ----- constants -----

cbuffer CameraConstants : register(b0) {

// perspective constants

float4 vp_rect; // x0, y0, x1, y1

float4 vp_dim; // width, height, width/height, 0.0f

float4 vp_z_values; // (x,y) = viewport z, (z,w) = perspective z

float4 vp_fov; // (horizontal fov, vertical fov, 0.0f, 0.0f)

// camera constants

float4 cam_origin; // camera origin point

float4 cam_lookat; // camera look-at point

float4 cam_up; // camera up vector

// matrices

float4x4 persp_matrix; // perspective matrix transformation

float4x4 cam_matrix; // camera matrix transformation

float4x4 cam_persp_matrix; // combined perspective/camera transformation matrix

};

// ----- structures -----

struct VIn {

// vertex data

float4 position : POSITION;

float4 tex : NORMAL0; // texture coords in object space

float4 color : NORMAL1;

// instance data

float4 offset : NORMAL2;

float4 dim : NORMAL3;

float4x4 transform_matrix : TEXCOORD0;

float4x4 transform_inverse : TEXCOORD4;

};

struct VOut {

float4 position : SV_POSITION;

float4 tex : TEXCOORD0; // texture coordinates in object space

float4 normal_x : TEXCOORD1; // world x-axis in object space

float4 normal_y : TEXCOORD2; // world y-axis in object space

float4 normal_z : TEXCOORD3; // world z-axis in object space

float4 ray : TEXCOORD4; // ray vector in object space

float4 rayi : TEXCOORD5; // ray inverse vector in object space

float4 color : TEXCOORD6;

};

// ---------------------------------------------------------------------------------------------------------------------------

// VShader

// ---------------------------------------------------------------------------------------------------------------------------

// ----- VShader -----

VOut VShader (VIn input) {

// calculate inverse/transpose of the transformation matrix

float4x4 transform_matrix = input.transform_matrix;

float4x4 transform_inverse = input.transform_inverse; // used to transform ray into object space

float4x4 transform_inverse_transpose = transpose(transform_inverse); // used to transform normals

// calculate position and ray

float4 pos = mul(transform_matrix,input.position); // transform vertex into object space

float4 ray = mul(transform_inverse, pos - cam_origin ); // transform ray into object space

float4 rayi = float4(1,1,1,1) / ray; // ray inverse

pos = mul(cam_persp_matrix,pos); // transform vertex into clip space

// calculate normals

float4 normal_x = mul(transform_inverse_transpose, float4(1,0,0,0) );

float4 normal_y = mul(transform_inverse_transpose, float4(0,1,0,0) );

float4 normal_z = mul(transform_inverse_transpose, float4(0,0,1,0) );

// done

VOut output;

output.position = pos;

output.tex = input.tex;

output.normal_x = normal_x;

output.normal_y = normal_y;

output.normal_z = normal_z;

output.ray = ray;

output.rayi = rayi;

output.color = input.color;

return output;

}

Pixel shader looks like:

// *************************************************************************************

// ShaderTest1_PS.hlsl

//

//

// Ryan Boghean

// Feb 01, 2013

//

// *************************************************************************************

struct PIn {

float4 position : SV_POSITION;

float4 tex : TEXCOORD0; // texture coordinates in object space

float4 normal_x : TEXCOORD1; // world x-axis in object space

float4 normal_y : TEXCOORD2; // world y-axis in object space

float4 normal_z : TEXCOORD3; // world z-axis in object space

float4 ray : TEXCOORD4; // ray vector in object space

float4 rayi : TEXCOORD5; // ray inverse vector in object space

float4 color : TEXCOORD6;

};

// ----- pixel shader -----

float4 PShader (PIn input) : SV_TARGET {

return input.color;

}

//float4 PShader (float4 position : SV_POSITION, float4 color : TEXCOORD6) : SV_TARGET {

// return color;

// }

I get no errors on compile. In the case where SV_POSITION is not used I get a warning:

D3D11 ERROR: ID3D11DeviceContext::DrawInstanced: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'TEXCOORD' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX]