Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


jdub

Member Since 01 Aug 2007
Offline Last Active Feb 22 2014 09:35 PM

#5089085 Using padding to make vertex structures align?

Posted by jdub on 25 August 2013 - 11:29 PM

Forgive me if I have things totally wrong here as I'm not too informed on this subject.  I was wondering if it makes a performance difference to add extra padding to my vertex structures to make them align along 32bit boundaries?

 

I'm running a 64bit system so I'm not sure if it would matter (adding enough padding to make my vertex structures align along a 64bit boundary seems like an absurd waste of memory to me).




#5087145 [Visual Studio 2012]What does this error mean?

Posted by jdub on 18 August 2013 - 04:46 PM

After running my application I get the following output:

D3D11 WARNING: Live Producer at 0x0061B800, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x0061CB68, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x0058D000, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x0062F85C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x0062FE0C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x00592F2C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x00593A5C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x00593BCC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x00593D18, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x0059427C, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: 	Live Object at 0x005945CC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]

Not sure what's going on here because I encapsulate all my d3d interfaces in CComPtr<T> which as I understand manages calling Release() on COM pointers when they go out of scope.  Is there something I am missing here?




#4971696 [SlimDX] Triangle not Drawing Correctly

Posted by jdub on 20 August 2012 - 09:09 PM

Trying to render a triangle on the screen. Here's the code which sets up the transform:

Triangle Vertices:
Vector3[] vertices =
			{
				  new Vector3(1.0f, 1.0f, 1.0f),
				  new Vector3(1.0f, 0.0f, 1.0f),
				  new Vector3(0.0f, 0.0f, 1.0f),
			};

private void setShaderParams(Matrix view, Matrix world, Matrix projection)
		{
			BufferDescription bufferDescr = new BufferDescription(
				Marshal.SizeOf(typeof(ConstantBuffer)),
				ResourceUsage.Default,
				BindFlags.ConstantBuffer,
				CpuAccessFlags.None,
				ResourceOptionFlags.None,
				0);
			DXBuffer buffer = new DXBuffer(this.device, bufferDescr);
			DataStream stream = new DataStream(Marshal.SizeOf(typeof(ConstantBuffer)), true, true);
			stream.Write<ConstantBuffer>(new ConstantBuffer() {View = Matrix.Transpose(view), World = Matrix.Transpose(world), Projection = Matrix.Transpose(projection)});
			stream.Position = 0;
			this.context.UpdateSubresource(new DataBox(0, 0, stream), buffer, 0);
		}

this is called at the end of my init function:
Matrix view = Matrix.LookAtLH(Vector3.Zero, -Vector3.UnitZ, Vector3.UnitY);
			Matrix world = Matrix.AffineTransformation(1f, Vector3.Zero, Quaternion.RotationAxis(Vector3.UnitY, 0f), Vector3.Zero);
			Matrix projection = Matrix.PerspectiveFovLH(0.523598776f, 480 / 640, 1.0f, 100.0f);
			this.setShaderParams(view, world, projection);

here's my shader code:
cbuffer ConstantBuffer : register( b0 )
{
	matrix World;
	matrix View;
	matrix Projection;
}


float4 VShader(float4 position : POSITION) : SV_Position
{
float4 output = position;
mul( output, World );
mul( output, View );
mul( output, Projection );
return output;
}

float4 PShader(float4 position : SV_POSITION) : SV_Target
{
	return float4(1.0f, 1.0f, 0.0f, 1.0f);
}

Note that the camera is facing down the negative Z-Axis so the triangle would be out of view right? Wrong. triangle is in view which makes me think that none of the transformations are being applied and DirectX is treating the vertices of the triangle as if they were already transformed. Anybody have any clue where I'm going wrong?


PARTNERS