So the problem is in the last function(the main vertex shader one),it somehow has trouble converting from float3 to float4 I think,I'm actualy new to the .xyz functionality,I think it's called swizzling.Maybe I'm not implementing the swizzling properly?
As a hint, the error is not related to the swizzle itself.
Thanks,I can't believe I missed that one,however I think there is still some problem with the actual vertex declaration,or I'm not doing the C++ side right:
I saw in a tutorial that you define the first 3 ones like this and the ''AlignedByteOffset'' was '0' for the first one, '12' for the second and '24' for the third,even tho the third(texcoord-2 elements) is smaller than the second(position-3 elements) and yet theyre both 12 bytes apart,so I'm confused-should I put the instance ones 12 bytes apart too for it to work with the above shader?
The instance data is (likely) in a separate vertex stream. In the input element descriptions, you still say that they are in the first stream (the InputSlot field of the structure).
I saw in a tutorial that you define the first 3 ones like this and the ''AlignedByteOffset'' was '0' for the first one, '12' for the second and '24' for the third,even tho the third(texcoord-2 elements) is smaller than the second(position-3 elements) and yet theyre both 12 bytes apart,so I'm confused
Offset is calculated from the end of the previous element, it's not related to the current element you're declaring. If I have a 12 byte element, a 12 byte element, and an 8 byte element in that order:
- the first offset is 0 (since it's first in the list),
- the second is (previous offset ((0)) + length of previous element((12))), so 12,
- the third is (previous offset ((12)) + length of previous element ((12))), so 24.
if there had been a fourth element in the same stream, THEN you would have seen the 8-byte alignment make a difference in an offset value, as the next up would be 32.
Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes) DeviantArt :: Because right-brain needs love too (also pretty neglected these days)