performance - C++ & DirectX - setting shader -


Does anyone know a faster way to process shader via directX?

I am currently setting the shaders using the D3DXCreateEffectFromFile call, from * to (once every shader copy) in order Create shaders. Fx files.

Rendering parts for each object ( every patch in my case - look forward ), then it means:

 < Code> // ---- ---------------- // preprocessing effect-> Start (); Impact & gt; BeginPass (0); Effect-> Setmatrix (or vector or whatever - internal shader parameters) (...) effects- & gt; Commute change (); // -------------------- // Geometry Rendering // Pass the Geometry to Render // ... // -------- - ---------- // Postprocessing / End Effect passes through effect - and piece (); Impact & gt; the ending (); It's okay, but the profiler shows weird things -   preprocessing    (see code)  about takes into . 60% of the time  (I'm rendering of 256 patch of terrain where every patch contains about 10k vertices)  

takes actual geometry rendering ~ 35% and postprocessing - 5% of total rendering time

This sounds very strange to me and I think the D3FXFact interface can not be the best solution for this type of thing

I have 2 questions:

Do I need to implement my own shadder controller (cover, lower-level) and where do I Should start?

Would the Shadows compile help improve the performance of a parameter setting?

Perhaps someone knows how to solve this kind of problem / some applied shader's interfaces or can give some advice on how to resolve this kind of problem In the modern game engine.

Thank you. Text after "

Actual geometry rendering ~ 35% and postprocessing - 5% of total rendering time

If you want to create a shady display profile, you have to use NVPerfHud or something similar. Using CPU profiler and not going to help to measure tick - Rendering is often asynchronous

I need to implement my own shader controller / cover (maybe, low level)

Cover your own shader Using is not a bad idea - I do not like ID3DXEffect anytime, with your own cover you will have total control of resources and program behavior. Whether you need it or not, you have to decide that with ID3DXEffect you will not have this warranty that the implementation is as fast as it can be - it can ruin the CPU cycle which you do not really need. There are some classes in the D3XX library that are useful but are not guaranteed to be efficient (ID3DXEffect, ID3DXMesh, all animation-related and skin-related functions etc.).

And where should I start?

D3DXAssembleShader, IDirect3DDevice9 :: CreateVertexShader, IDirect3DDevice9 :: CreatePixelShader on DirectX 9, D3D10CompileShader on DirectX 10 also download DirectX SDK and read Shader documentation / tutorials.

Would the compilation shaders help in any way to improve the parameter performance?

Shaders are automatically compiled when you load them. You can compile efforts with different customization settings, but do not expect miracles


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -