Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actuallipsryme

Posted 28 March 2013 - 09:30 AM

EDIT: Nevermind got it fixed...my shader wasn't up to date when I ran it smile.png


#4lipsryme

Posted 28 March 2013 - 09:30 AM

EDIT: Nevermind my shader wasn't up to date when I ran it :)


#3lipsryme

Posted 28 March 2013 - 09:27 AM

Hmm I'm having a little problem making it draw the instances...

 

I've not used transformations yet for testing purposes but it should still draw instances.

My draw call looks like this:

	UINT offset = 0;
	context->IASetInputLayout(inputLayout);
	context->IASetVertexBuffers(0, 1, &this->VertexBuffer, &stride, &offset);

	switch(this->type)
	{
	case PrimitiveTypes::Cube:
		{
			context->IASetIndexBuffer(this->CubeIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
			break;
		}
	case PrimitiveTypes::Quad:
		{
			context->IASetIndexBuffer(this->QuadIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
			break;
		}
	}
	
	context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	

	context->DrawIndexedInstanced(this->indexCount, numInstances, 0, 0, 0);	

 

Basically I'm setting the vertex buffer and the index buffer for the unique geometry for the instances, then just tell them to draw X number of them with the DrawIndexedInstanced() call. Is there anything wrong ?

 

In my test shader I just do:


struct VSI
{
	float4 Position : POSITION0;
	uint InstanceID : SV_InstanceID;
};



struct VSO
{
	float4 Position : SV_POSITION;
};




VSO VS(VSI input)
{
	VSO output = (VSO)0;

	input.Position.x += input.InstanceID;
	output.Position = input.Position;

	return output;
}





float4 PS(VSO input) : SV_TARGET0
{
	return 1.0f;
}

 

 

Even PIX tells me it only has data for 1 instance (instance 0).

Any idea what I'm doing wrong or missing ?

 

UPDATE: Wait a minute I think it works now...if I disable wireframe rasterizer state O_o...


#2lipsryme

Posted 28 March 2013 - 08:50 AM

Hmm I'm having a little problem making it draw the instances...

 

I've not used transformations yet for testing purposes but it should still draw instances.

My draw call looks like this:

	UINT offset = 0;
	context->IASetInputLayout(inputLayout);
	context->IASetVertexBuffers(0, 1, &this->VertexBuffer, &stride, &offset);

	switch(this->type)
	{
	case PrimitiveTypes::Cube:
		{
			context->IASetIndexBuffer(this->CubeIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
			break;
		}
	case PrimitiveTypes::Quad:
		{
			context->IASetIndexBuffer(this->QuadIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
			break;
		}
	}
	
	context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	

	context->DrawIndexedInstanced(this->indexCount, numInstances, 0, 0, 0);	

 

Basically I'm setting the vertex buffer and the index buffer for the unique geometry for the instances, then just tell them to draw X number of them with the DrawIndexedInstanced() call. Is there anything wrong ?

 

In my test shader I just do:


struct VSI
{
	float4 Position : POSITION0;
	uint InstanceID : SV_InstanceID;
};



struct VSO
{
	float4 Position : SV_POSITION;
};




VSO VS(VSI input)
{
	VSO output = (VSO)0;

	input.Position.x += input.InstanceID;
	output.Position = input.Position;

	return output;
}





float4 PS(VSO input) : SV_TARGET0
{
	return 1.0f;
}

 

 

Even PIX tells me it only has data for 1 instance (instance 0).

Any idea what I'm doing wrong or missing ?


#1lipsryme

Posted 28 March 2013 - 08:49 AM

Hmm I'm having a little problem making it draw the instances...

 

I've not used transformations yet for testing purposes but it should still draw instances.

My draw call looks like this:

	UINT offset = 0;
	context->IASetInputLayout(inputLayout);
	context->IASetVertexBuffers(0, 1, &this->VertexBuffer, &stride, &offset);

	switch(this->type)
	{
	case PrimitiveTypes::Cube:
		{
			context->IASetIndexBuffer(this->CubeIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
			break;
		}
	case PrimitiveTypes::Quad:
		{
			context->IASetIndexBuffer(this->QuadIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
			break;
		}
	}
	
	context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	

	context->DrawIndexedInstanced(this->indexCount, numInstances, 0, 0, 0);	

 

Basically I'm setting the vertex buffer and the index buffer for the unique geometry for the instances, then just tell them to draw X number of them with the DrawIndexedInstanced() call. Is there anything wrong ?

 

In my test shader I just do:


struct VSI
{
	float4 Position : POSITION0;
	uint InstanceID : SV_InstanceID;
};



struct VSO
{
	float4 Position : SV_POSITION;
};




VSO VS(VSI input)
{
	VSO output = (VSO)0;

	input.Position.x += input.InstanceID;
	output.Position = input.Position;

	return output;
}





float4 PS(VSO input) : SV_TARGET0
{
	return 1.0f;
}

 

 

Even PIX tells me it only has data for 1 instance (instance 0).


PARTNERS