DirectX 8 Graphics Common Error

zhaozj2021-02-11  199

DirectX Graphics Common Errors (Selected)

Richard Huddy, NVIDIA CORP.

Translation of Nightmare (QinGru Li)

** They should appear in the initialization section

Be careful not to make time-consuming expensive API calls in efficiency sensitive part

- ValidateDevice ()

- cretevb ()

- Destroyvb ()

- Optimize ()

- CreateStateBlock ()

- AssemblevertexShader ()

** template buffer, when you don't need ...

- If you only clear the Z buffer, the system has to retain the template buffer

So if you use the template buffer, clear the Z buffer time together

- This means that if you have different clashes, Clear () will slow

Read and write every pixel

- Do not use painting rectangles to clear buffer

** Remove redundant state changes, who is responsible?

- Driver has to do this on Pure Hal

Such drivers should be quite radical

- Renar in non-Pure Hal works this

But only remove simple repeat

- Your program is the best place

** Excessive change Vertex Shader or Pixel Shader

- will force the system to refresh the state

- This is actually expensive, even more expensive than material changes

- So make sure you have not repeatedly set the same shader

** DrawPrimitiveup

- want me how many times, use VertexBuffer

(Translator Note: DrawPrimitiveup will lead to additional data replication, but simple programs can make the program simply, trade-off.)

** Use GDI to draw word

- will block the operation of the CPU until the completed rendering

- Words should be drawn using 3D function, like D3DX

- If your text is not dynamic

Use a texture containing text

** Use n-patches

- I don't recommend this

- just NVIDIA's opinions

But we insist on this position

This technology has too many details

We think it is just the appealing on the surface.

** Use W-buffer instead of Z-Buffer?

- Perspective projection material will not work (on GeForce 1, 2)

- And you will not be able to close the perspective correction

- Cubemap will fail (in Geforce 1, 2)

- If you are using VertexShader, you still have to set the projection matrix

** Color Key

- Test using Alpha because it is better

Color Key does not exist in DX8

- There is no pair, because for multiple materials and double linear filtration colorKey is a metamorphosis

** No object

- usually leads to the next time to create a broken device object

- Use the test library

- Remember to release the selected material before clearing

转载请注明原文地址:https://www.9cbs.com/read-5123.html

New Post(0)