InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));
Show differencesHistory of post edits
#ActualGavin Williams
Posted 08 December 2012 - 05:15 AM
I found the problem, you need to set the input layout...
#5Gavin Williams
Posted 08 December 2012 - 05:13 AM
I found the problem, you need to set the input layout...
Also, I've adjusted your shader code to make things match up ...
InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));
Also, I've adjusted your shader code to make things match up ...
struct VS_INPUT
{
float4 Pos : POSITION;
float2 TexCoord : TEXCOORD0;
};
...
VS_OUTPUT Text_VS(VS_INPUT input)
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos = input.Pos;
...
#4Gavin Williams
Posted 08 December 2012 - 04:57 AM
I found the problem, you need to set the input layout...
Also, I've adjusted your shader code to make things match up ...
So here, it's ok to have a float3 for your position in the vertex shader input, as long as it's converted to float4 for the pixel shader.
InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));
Also, I've adjusted your shader code to make things match up ...
struct VS_INPUT
{
float3 Pos : POSITION;
float2 TexCoord : TEXCOORD0;
};
...
VS_OUTPUT Text_VS(VS_INPUT input)
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos = float4(input.Pos, 1);
...
So here, it's ok to have a float3 for your position in the vertex shader input, as long as it's converted to float4 for the pixel shader.
#3Gavin Williams
Posted 08 December 2012 - 04:54 AM
I found the problem, you need to set the input layout...
Also, I've adjusted your shader code to make things match up ...
InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));
Also, I've adjusted your shader code to make things match up ...
struct VS_INPUT
{
float3 Pos : POSITION;
float2 TexCoord : TEXCOORD0;
};
...
VS_OUTPUT Text_VS(VS_INPUT input)
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos = float4(input.Pos, 1);
...
#2Gavin Williams
Posted 08 December 2012 - 04:49 AM
I found the problem, you need to set the input layout...
InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));
#1Gavin Williams
Posted 08 December 2012 - 04:48 AM
I found the problem, you need to set the input layout...
InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));