-
Notifications
You must be signed in to change notification settings - Fork 0
/
Things To Keep in Mind.txt
55 lines (47 loc) · 3.99 KB
/
Things To Keep in Mind.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Deferred Contexts - When Creating the D3DDevice, you create the immediate context that
will run on the main thread. You use D3D11CreateDeferredContext() to
create additional deferred contexts that will be run on separate threads.
There will be one deferred context per separate thread and only one
immediate context on the main thread.
MultiSampling - If you want to change the multisampling settings at runtime, you have
to destroy and recreate the swap chain.
Back Buffer - To obtain a pointer to the backbuffer object, you must call IDXGISwapChain::GetBuffer().
The first parameter being the back buffer index that you want to get, most cases 0,
the second parameter being the interface type, usually ID3D11Texture2D, and the third
parameter being the return pointer to the back buffer.
Deferred Rendering - To Do Deferred Rendering With Multiple RenderTargetViews
--------------------------------------------------------
* Create additional RenderTargetViews to draw to.
-These are texture2D's that you can then send to the shader as
shaderResourceViews.
* Basically deferred rendering is rendering to multiple textures and then rendering
them all to one quad that is the size of the screen. When you render them all you
pass them all as ShaderResourceViews and then "blend" them to get the appropirate image.
* You still need to get the pointer to the back buffer and remember which RenderTargetView is
that back buffer so when you finally output your final Texture you will have to do it to that
RenderTargetView and then present which will swap that with the front buffer and render it to
the screen.
Blend States - Blend states allow you to either have a different blend state for each render target or the same
blend state for every render target. If you want multiple blend states you have to set the
IndependentBlendEnable flag to true. Once this is set, when you set the blend states 0-7, they
will coorespond to the render targets that you currently have bound. If you have all 8 bound,
(Ex: OMSetRenderTargets(8, &renderTargets[0], depthStencilBuffer);) the blend state and render
target will both be the same indices. Ex: renderTarget[0] will be blended using blendState[0].
If you aren't binding all the render targets (Ex: OMSetRenderTargets(7, &renderTargets[1], depthStencilBuffer);)
the blendstate[0] will coorespond to the first renderTarget at the address that you bound from.
Ex: renderTarget[1] will be blended using blendState[0].
Vertex Buffer Array - Make an array of Vertex Buffers. When you set the vertex buffer know that you are using an array
and make sure that the parameter passed to that function matches the number of buffers in the array.
Shader In's - You can pass information to the shaders via a structure or through the paramater list in its main. Know
that if you pass by parameter, the shader will disreguard any information following what it expects
to receive.
Tile Based Lighting - Create an unordered access view and a shader resource view that both point to the same memory.
Send the unordered access view to the compute shader and teh shader resource view to the pixel shader.
Create a structured buffer for all of the lights that you have.
Create a structured buffer for all the tiles that you have with some sort of flag that will be set in the
compute shader for what lights are effecting this tile.
In the compute shader you determine what lights are hitting each tile and adjust the flag for lights accordingly.
In the pixel shader you look at the array of tiles and apply the lights to the tile when you are rendering that tile.
The hardest part will be trying to figure out which tile you are in when you are in the pixel shader, and figuring out
the cheapest way to hold all of the information in the structured buffers... ie. the list of lights and the "flag" for which
lights are affecting this tile.