7

The fixed function pipeline doesn't involve many changes to shaders (there may even be only a single "fixed function" shader in the driver's fixed-function emulation path; up to the driver how it handles legacy APIs) which are one of the more expensive things to change. The driver also could be doing a bazillion different things to optimize or not depending ...


4

Now when using the discard presentation in a Win32 app it passes the render target to DWM which then blits the target to the screen and when in full screen mode (provided you have resized your back buffer and refresh rate correctly) it will disable DWM and perform flips to render the scene. Now with metro apps there's no such thing as full screen exclusive ...


4

For texture spaces, in Direct3D (0, 0) is top-left, in OpenGL (0, 0) is bottom-left. Therefore the v-coordinate will be upside down in one of these APIs. However, I wouldn't recommend negating the v-coordinate as this will only work if you're using a sampler with wrapping. You can fix the v-coordinate as follows: v = 1.0f - v;


3

There is a mesh convert tool in my directory of DXSDK. I can convert .x format from binary to text and text to binary (among other things). C:\Program Files\DXSDK\Utilities\bin\x86>MeshConvert.exe


3

I just stumbled back on this question, so I figure I should supply an answer. :) The shader code I wrote in the question is almost right. I forgot that to convert a point with these transformations, the point needs to be in homogeneous coordinates. See: https://stackoverflow.com/questions/5066532/how-to-multiple-a-2d-point-with-a-4d-matrix So the correct ...


3

A smart bubble/insertion sort is faster than quick sort when the array is already mostly sorted (reused on the next frame). To speed up the copy of data rather than copying entire vertex values use an index buffer to sort the vertices. When you remove quads you can quickly degenerate them (set all vertices to the same value) instead of removing them and ...


3

Sprites in Direct3D are just textured triangles (or rather two triangles forming a quadrilateral). As such, the performance hit is because each time you change the source texture it has to flush the sprite batch and submit it as a Draw. The key to Direct3D performance is to get as much work into each Draw as possible. You are basically drawing two triangles ...


3

You generally want to use the latest version that is compatible with your target platform. For most people that means DirectX11, since DirectX12 is not supported on versions of Windows (i.e. Windows 7) that are still widely used. But, with every version, you need to make sure that you are using it in the most efficient way. Just swapping the calls for the ...


2

A good (also widely used) workaround to this problem is to create multiple render targets of a size that your GPU supports, render your scene in pieces, and assemble on your back buffer(s). The downside to this is, you'll effectively render your scene N times (where N is your # of render targets), but with proper scene preprocessing, this may not be as bad ...


2

See pseudo code First check if the current pixel is in range: if(current.x >= - max_distance + min(x0, x1) && current.x =< max_distance + max(x0, x1)) { if(current.y >= -max_distance + min(y0, y1) && current.y =< max_distance + max(y0, y1)) { result.color = some_color; float distance = ...


2

I can think of two obvious possibilities: You've hit the TDR timeout because the shader is taking ages to run. You can work round this locally by adjusting the timeout in the registry. You probably shouldn't adjust that setting for other people though - the general solution is to break the draw call up into multiple smaller draw calls - resizing is usually ...


2

I believe the answer is no, you cannot use SetLOD. As the documentation says, the texture must be managed which means D3DPOOL_MANAGED and which does not exist in Direct3D 9Ex. I have a sample app which uses Direct3D 9Ex, and tried calling SetLOD, and I got a return of 0 which means it failed according to the documentation which states This method ...


2

What you'll wind up doing David is creating a vertex buffer to hold the different transformation matrices for each instance of grass. You will need a vertex declaration that has your standard 'grass' vertex components( pos, norm, uv...etc ), and in that same declaration 4 additional 4-component floats to hold the 4x4 transformation matrix...the declaration ...


2

The DirectX SDK has samples on how to do this, and there are resources online you can find on how to do this. Look in C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D\Instancing\Instancing.cpp. Here's a Nvidia GPU Gem article on Geometry Instancing. And here's an article on MSDN. This article shows you the two vertex ...


2

Batching will often lead to a performance gain, but this is only if you had a bottleneck being created by the multitude of draw calls being made to begin with. In this particular case you may have simply introduced a new bottleneck. I think it's likely that the CPU is now having to work overtime to transform and batch all that data. Keep in mind that all ...


2

You should do Output.Pos2 = Output.Position in the vertex shader, then in the pixel shader: float2 screenPos; screenPos.x = Input.pos2D.x/Input.pos2D.w/2.0f + 0.5f; screenPos.y = -Input.pos2D.y/Input.pos2D.w/2.0f + 0.5f; To get correct screen space coordinates you have to do your w divide in the pixel shader. After that your return should ...


2

There are two main ways to do this. First way is to do exactly what you're trying to avoid doing, and use a render target. This is the way used by the Shadow Mapping sample for D3D9 in the old DirectX SDK, although it needn't be 32-bit (D3DFMT_R16F may well be sufficient). As a possible optimization you could use a NULL depth/stencil target, enable ...


2

You would have to render the results of the first to a texture, then read the texture in the second shader and output the results to the screen.


2

The problem was inside present parameters - I forgot to set backbuffer's width and height. dx_PresParams.Windowed = TRUE; dx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD; dx_PresParams.BackBufferFormat = D3DFMT_UNKNOWN; dx_PresParams.BackBufferWidth = 1024;//Width dx_PresParams.BackBufferHeight = 1024;//Height dx_PresParams.EnableAutoDepthStencil = TRUE; ...


2

The main thing to remember is that _declspec(align(16)) only affects the struct/class layout, is respected for local or global variables, but has no affect on heap allocated memory. In other words, it doesn't matter if the member variable of a class is marked with alignment if the class is allocated with new. Heap allocations by default with x86 (32-bit) ...


Only top voted, non community-wiki answers of a minimum length are eligible