I am trying this approach to querying the ID3DBlob* that is returned from compiling a shader. I have a cbuffer that contains several native-data-type members and a struct definition with various members of type 'matrix', 'float2', and 'float' where the last item (in my special case) is an array of 5 numbers.
I grab an ID3DShaderReflectionBuffer pointer from GetConstantBufferByName(...), iterate over the variables (using GetVariableByIndex and GetType), finding out that the struct information has Class = D3D_SVC_STRUCT. For this item, I iterate over the members (GetMemberTypeName and GetMemberTypeByIndex).
The information I get from this approach appears not to have everything I need to know about the memory layout of the cbuffer. My struct has two 'matrix' elements, two 'float2' elements, and an array 'float'. The 'matrix' elements report correct offsets relative to the parent struct (64 and 128), the two 'float2' elements appear to be packed into a single 4-float register, but each array element from the 'float' is mapped to a single register (.x component, but the .yzw components are ignored). I do not believe the shader reflection interface allows me to deduce the packing of the struct. Is this a known deficiency? Or am I missing something about the query process?
If need be, I can post a link to a simple MSVS project that shows what I am doing, what my experiments are, and what information I get from those experiments.
I have a file ~/.MacOSX/environment.plist that contains an environment variable (named WM5_PATH for what it is worth). Running on Mac OS X Snow Leopard (10.6) and previous with Xcode 3.x, my code makes a call to getenv("WM5_PATH"), and I use the returned string for setting path information in my applications. Worked just fine. I just upgraded to Mac OS X Lion (10.7) and Xcode 4.1. Now the call to getenv("WM5_PATH") returns a null pointer. Anyone else struggling with this problem and might have a solution for me? Thanks.
I had been using the DirectX SDK from March 2009. Using versions of MSVS prior to 2010, I used the "Tools | Options" menu item to set the global paths to various DX directories. In MSVS 2010, this method of setting the paths is deprecated, and the directories are listed on a property page for each project. The March 2009 directories are "inherited", whatever that means. For one project, I modified the paths to use the June 2010 SDK, saved and exited, and then opened another project. This project still has the March 2009 paths. I suspect others have encountered this. What is the magic incantation for setting this once and having all the projects automatically update their paths? Thanks.
I use autoexp.dat to control the summary display of class objects in a debugger watch window. For example, I have in the [AutoExpand] section
where * denotes a template parameter. This works fine, but I do not see in the rules section of autoexp.dat how to write a similar expression for classes with two or more template parameters. For example, I have Wm5::Tuple<int DIM, typename REAL> with data member 'REAL mTuple[DIM]'. I want the debugger to display members for small dimensions, say 2, so I tried
The debugger shows only the default (the pointer value for mTuple), so this must not be the correct syntax.
Anyone know how to make this system work for templates with two or more parameters?
Running on MS Windows 7, NVIDIA Geforce 9800 GT (dual SLI, driver 22.214.171.12445 [4/3/2010]). Nothing complicated about my setup. Double buffered, I clear the backbuffer (to a non-black color), I draw a scene to the front buffer and then call the Windows-provided SwapBuffers with the correct device context. After the swap, I call glReadBuffer(GL_BACK) followed by glReadPixels(...) to obtain the contents of the entire window. The window is fully visible (not partially occluded by other windows). The first time I read the backbuffer, I get all zero values. After another drawing pass, I get what looks correct, but it always appears to be one frame out of sync.
If instead I call glReadBuffer(GL_FRONT) followed by glReadPixels(...), all is as expected. The first read gives me the pixels I expect (of the rendered scene).
Am I missing something obvious here? I thought that glReadPixels stalls until the SwapBuffer finishes. I even put in a "sleep" between SwapBuffers and glReadPixels thinking that the swap needed time. I have vertical sync *enabled*.
Thanks for any insight as to why I cannot get a simple copy of backbuffer to work.