Setting DX Surface Memory Alignment?

esotic

Newcomer
I'm coding an open source realtime video editing program called OpenTZT which built heavily on DirectX. The program keeps most surfaces in system memory and is currently optimized for MMX. I would like to work on integrating SSE optimizations but am having a hard time figuring out how to align DX surfaces. From what I've been able to gather thus far it doesn't look possible, so I've considered making my surfaces 15 pixels wider than they need to be and then just start the actual data at the start pointer + (pointer MOD 16).

s_ptr=(LPWORD)lpddsoSource->GetPointer();
s_start=s_ptr + (s_ptr % 16);

I suppose that's a possible solution, but it doesn't seem very elegant. Is there some way to force DX to put system memory surfaces on a 16 byte boundary?

Thanks,

-Esotic
 
Hmmm... I may have just found the answer to my own question

From http://www.charlesriver.com/resrcs/chapters/1584502045_1stChap.pdf

There is one caveat when using compilers other than Microsoft Vi-
sual Studio.Net. The Direct3D Extension Library (D3DX) contains sup-
port for Intel Streaming SIMD Extensions (SSE) instructions, but only
when compiled with Microsoft Visual Studio.Net (Microsoft Visual C++
®
7.0 or greater, to be specific).
This is because support for 16-byte aligned
memory allocations was not supported under earlier versions of Visual
C++ without the installation of an additional patch, known as the proces-
sor pack. Because the 16-byte alignment is a critical requirement of many
SSE memory-access instructions, these instructions are not enabled
within D3DX unless compiler support for aligned memory allocations can
be guaranteed. Since the presence of the processor pack cannot be de-
tected, the Intel SSE-aware code within the D3DX library is not enabled
unless the preprocessor definition identifying Microsoft Visual C++ com-
pilers is set to denote version 7.0 or higher.

?-\
 
Back
Top