Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualclashie

Posted 29 December 2012 - 11:13 PM

Which is one of the problems, why doesn't MSDN have the complete list of these things? It doesn't even mention that WORLDVIEW exists. :/

Ok, before I just used a single vector for my instance position, but I want to be able to rotate, scale, etc, so I figured I'd just make use a matrix instead.

So before, I just did something like this:
layout[2].SemanticName		= "TEXCOORD";
layout[2].SemanticIndex		= 0;
layout[2].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[2].InputSlot		= 1;
layout[2].AlignedByteOffset	= 0;
layout[2].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[2].InstanceDataStepRate	= 1;

...

VOut vs(float4 pos : POSITION, float4 col : COLOR, float4 ins : TEXCOORD0)
{
	VOut output;
	
	pos.x += ins.x;
	pos.y += ins.y;
...

Ok, bam, works.

But I'm not sure what I'm doing wrong here trying to access my matrix. I changed my input layout to this:
layout[2].SemanticName		= "TEXCOORD";
layout[2].SemanticIndex		= 0;
layout[2].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[2].InputSlot		= 1;
layout[2].AlignedByteOffset	= 0;
layout[2].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[2].InstanceDataStepRate	= 1;

layout[3].SemanticName		= "TEXCOORD";
layout[3].SemanticIndex		= 1;
layout[3].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[3].InputSlot		= 1;
layout[3].AlignedByteOffset	= D3D11_APPEND_ALIGNED_ELEMENT;
layout[3].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[3].InstanceDataStepRate	= 1;

layout[4].SemanticName		= "TEXCOORD";
layout[4].SemanticIndex		= 2;
layout[4].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[4].InputSlot		= 1;
layout[4].AlignedByteOffset	= D3D11_APPEND_ALIGNED_ELEMENT;
layout[4].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[4].InstanceDataStepRate	= 1;

layout[5].SemanticName		= "TEXCOORD";
layout[5].SemanticIndex		= 3;
layout[5].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[5].InputSlot		= 1;
layout[5].AlignedByteOffset	= D3D11_APPEND_ALIGNED_ELEMENT;
layout[5].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[5].InstanceDataStepRate	= 1;

...

The post I linked makes it look like I can just do something like this:
VOut vs(float4 pos : POSITION, float4 col : COLOR, float4x4 ins : TEXCOORD)
{
VOut output;

pos = mul(pos, ins);
...

The shader seems to compile fine, but the runtime immediately complains that:
D3D11: ERROR: ID3D11Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'TEXCOORD'/1, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]

On creation of the input layout.

#1clashie

Posted 29 December 2012 - 11:12 PM

Which is the problem, why doesn't MSDN have the complete list of these things? It doesn't even mention that WORLDVIEW exists. :/

Ok, before I just used a single vector for my instance position, but I want to be able to rotate, scale, etc, so I figured I'd just make use a matrix instead.

So before, I just did something like this:
layout[2].SemanticName		= "TEXCOORD";
layout[2].SemanticIndex		= 0;
layout[2].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[2].InputSlot		= 1;
layout[2].AlignedByteOffset	= 0;
layout[2].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[2].InstanceDataStepRate	= 1;

...

VOut vs(float4 pos : POSITION, float4 col : COLOR, float4 ins : TEXCOORD0)
{
	VOut output;
	
	pos.x += ins.x;
	pos.y += ins.y;
...

Ok, bam, works.

But I'm not sure what I'm doing wrong here trying to access my matrix. I changed my input layout to this:
layout[2].SemanticName		= "TEXCOORD";
layout[2].SemanticIndex		= 0;
layout[2].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[2].InputSlot		= 1;
layout[2].AlignedByteOffset	= 0;
layout[2].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[2].InstanceDataStepRate	= 1;

layout[3].SemanticName		= "TEXCOORD";
layout[3].SemanticIndex		= 1;
layout[3].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[3].InputSlot		= 1;
layout[3].AlignedByteOffset	= D3D11_APPEND_ALIGNED_ELEMENT;
layout[3].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[3].InstanceDataStepRate	= 1;

layout[4].SemanticName		= "TEXCOORD";
layout[4].SemanticIndex		= 2;
layout[4].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[4].InputSlot		= 1;
layout[4].AlignedByteOffset	= D3D11_APPEND_ALIGNED_ELEMENT;
layout[4].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[4].InstanceDataStepRate	= 1;

layout[5].SemanticName		= "TEXCOORD";
layout[5].SemanticIndex		= 3;
layout[5].Format		= DXGI_FORMAT_R32G32B32A32_FLOAT;
layout[5].InputSlot		= 1;
layout[5].AlignedByteOffset	= D3D11_APPEND_ALIGNED_ELEMENT;
layout[5].InputSlotClass	= D3D11_INPUT_PER_INSTANCE_DATA;
layout[5].InstanceDataStepRate	= 1;

...

The post I linked makes it look like I can just do something like this:
VOut vs(float4 pos : POSITION, float4 col : COLOR, float4x4 ins : TEXCOORD)
{
VOut output;

pos = mul(pos, ins);
...

The shader seems to compile fine, but the runtime immediately complains that:
D3D11: ERROR: ID3D11Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'TEXCOORD'/1, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT ]

On creation of the input layout.

PARTNERS