Help with modifying Rastertek tutorials
#1 Members - Reputation: 119
Posted 15 January 2012 - 11:51 PM
#2 GDNet+ - Reputation: 2398
Posted 16 January 2012 - 03:16 PM
Check out our (now available) D3D11 book: Practical Rendering and Computation with Direct3D 11
Check out my Direct3D 11 engine on CodePlex: Hieroglyph 3
Check out our free online D3D10 book: Programming Vertex, Geometry, and Pixel Shaders
Lunar Rift :: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article :: Fast Silhouettes Article
#3 Members - Reputation: 119
Posted 16 January 2012 - 07:43 PM
Error 1 error C2719: 'unnamed-parameter': formal parameter with __declspec(align('16')) won't be aligned c:\users\dwc2987@msn.com\documents\visual studio 2010\projects\2d engine\2d engine\textureshaderclass.h 29 1 2D Engine
which is pointing to this line of code:
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
#4 GDNet+ - Reputation: 2398
Posted 17 January 2012 - 12:55 AM
Check out our (now available) D3D11 book: Practical Rendering and Computation with Direct3D 11
Check out my Direct3D 11 engine on CodePlex: Hieroglyph 3
Check out our free online D3D10 book: Programming Vertex, Geometry, and Pixel Shaders
Lunar Rift :: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article :: Fast Silhouettes Article
#5 Members - Reputation: 308
Posted 17 January 2012 - 06:58 AM
I converted most of the final terrain tutorial to XNAMath some months ago, but hit a snag somewhere. I can't remember where. I gave up and removed it. I'd be interested in whether there's a good reason to convert it to XNAMath as well.
#6 GDNet+ - Reputation: 2398
Posted 17 January 2012 - 02:03 PM
Type Usage Guidelines
The XMVECTOR and XMMATRIX types are the work horses for the XNA Math library. Every operation consumes or produces data of these types. Working with them is key to using the library. However, since XNA Math makes use of the SIMD instruction sets, these data types are subject to a number of restrictions. It is critical that you understand these restrictions if you want to make good use of the XNA Math functions.
You should think of XMVECTOR as a proxy for a SIMD hardware register, and XMMATRIX as a proxy for a logical grouping of four SIMD hardware registers. These types are annotated to indicate they require 16-byte alignment to work correctly. The compiler will automatically place them correctly on the stack when they are used as a local variable, or place them in the data segment when they are used as a global variable. With proper conventions, they can also be passed safely as parameters to a function (see Calling Conventions for details).
Allocations from the heap, however, are more complicated. As such, you need to be careful whenever you use either XMVECTOR or XMMATRIX as a member of a class or structure to be allocated from the heap. On Xbox 360 and Windows x64, all heap allocations are 16-byte aligned, but for Windows x86, they are only 8-byte aligned. There are options for allocating structures from the heap with 16-byte alignment (see Properly Align Allocations). Also, for C++, you can make use of operator new/delete overloads, if you want.
However, often it is easier and more compact to avoid using XMVECTOR or XMMATRIX directly in a class or structure. Instead, make use of the XMFLOAT3, XMFLOAT4, XMFLOAT4X3, XMFLOAT4X4, and so on, as members of your structure. Further, you can use the Vector Loading and Vector Storage functions to move the data efficiently into XMVECTOR or XMMATRIX local variables, perform computations, and store the results. There are also streaming functions (XMVector3TransformStream, XMVector4TransformStream, and so on) that efficiently operate directly on arrays of these data types.
I am fairly certain that the information in here is going to have the answer for your issue... Are you using Windows x86 or x64?
Check out our (now available) D3D11 book: Practical Rendering and Computation with Direct3D 11
Check out my Direct3D 11 engine on CodePlex: Hieroglyph 3
Check out our free online D3D10 book: Programming Vertex, Geometry, and Pixel Shaders
Lunar Rift :: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article :: Fast Silhouettes Article







