@@ -163,91 +163,65 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic(dxRender_Visual* pVisual, Fvector&
163163
164164 for (u32 iPass = 0 ; iPass < sh->passes .size (); ++iPass)
165165 {
166- // the most common node
167- // SPass& pass = *sh->passes.front ();
168- // mapMatrix_T& map = mapMatrix [sh->flags.iPriority/2];
169- SPass& pass = *sh->passes [iPass];
170- mapMatrix_T& map = mapMatrixPasses[sh->flags .iPriority / 2 ][iPass];
166+ auto &pass = *sh->passes [iPass];
167+ auto &map = mapMatrixPasses[sh->flags .iPriority / 2 ][iPass];
171168
172- #ifdef USE_RESOURCE_DEBUGGER
173169#if defined(USE_DX10) || defined(USE_DX11)
174- mapMatrixVS::TNode* Nvs = map.insert (pass.vs );
175- mapMatrixGS::TNode* Ngs = Nvs->val .insert (pass.gs );
176- mapMatrixPS::TNode* Nps = Ngs->val .insert (pass.ps );
177- #else // USE_DX10
178- mapMatrixVS::TNode* Nvs = map.insert (pass.vs );
179- mapMatrixPS::TNode* Nps = Nvs->val .insert (pass.ps );
180- #endif // USE_DX10
170+ auto &Nvs = map[&*pass.vs ];
171+ auto &Ngs = Nvs[pass.gs ->gs ];
172+ auto &Nps = Ngs[pass.ps ->ps ];
181173#else
182- #if defined(USE_DX10) || defined(USE_DX11)
183- mapMatrixVS::TNode* Nvs = map.insert (&*pass.vs );
184- mapMatrixGS::TNode* Ngs = Nvs->val .insert (pass.gs ->gs );
185- mapMatrixPS::TNode* Nps = Ngs->val .insert (pass.ps ->ps );
186- #else // USE_DX10
187- mapMatrixVS::TNode* Nvs = map.insert (pass.vs ->vs );
188- mapMatrixPS::TNode* Nps = Nvs->val .insert (pass.ps ->ps );
189- #endif // USE_DX10
174+ auto &Nvs = map[pass.vs ->vs ];
175+ auto &Nps = Nvs[pass.ps ->ps ];
190176#endif
191177
192178#ifdef USE_DX11
193- #ifdef USE_RESOURCE_DEBUGGER
194- Nps->val .hs = pass.hs ;
195- Nps->val .ds = pass.ds ;
196- mapMatrixCS::TNode* Ncs = Nps->val .mapCS .insert (pass.constants ._get ());
197- #else
198- Nps->val .hs = pass.hs ->sh ;
199- Nps->val .ds = pass.ds ->sh ;
200- mapMatrixCS::TNode* Ncs = Nps->val .mapCS .insert (pass.constants ._get ());
201- #endif
179+ Nps.hs = pass.hs ->sh ;
180+ Nps.ds = pass.ds ->sh ;
181+
182+ auto &Ncs = Nps.mapCS [pass.constants ._get ()];
202183#else
203- mapMatrixCS::TNode* Ncs = Nps-> val . insert ( pass.constants ._get ()) ;
184+ auto & Ncs = Nps[ pass.constants ._get ()] ;
204185#endif
205- mapMatrixStates::TNode* Nstate = Ncs->val .insert (pass.state ->state );
206- mapMatrixTextures::TNode* Ntex = Nstate->val .insert (pass.T ._get ());
207- mapMatrixItems& items = Ntex->val ;
208- items.push_back (item);
186+ auto &Nstate = Ncs[pass.state ->state ];
187+ auto &Ntex = Nstate[pass.T ._get ()];
188+ Ntex.push_back (item);
209189
210190 // Need to sort for HZB efficient use
211- if (SSA > Ntex-> val .ssa )
191+ if (SSA > Ntex.ssa )
212192 {
213- Ntex-> val .ssa = SSA;
214- if (SSA > Nstate-> val .ssa )
193+ Ntex.ssa = SSA;
194+ if (SSA > Nstate.ssa )
215195 {
216- Nstate-> val .ssa = SSA;
217- if (SSA > Ncs-> val .ssa )
196+ Nstate.ssa = SSA;
197+ if (SSA > Ncs.ssa )
218198 {
219- Ncs-> val .ssa = SSA;
199+ Ncs.ssa = SSA;
220200#ifdef USE_DX11
221- if (SSA > Nps-> val .mapCS .ssa )
201+ if (SSA > Nps.mapCS .ssa )
222202 {
223- Nps-> val .mapCS .ssa = SSA;
203+ Nps.mapCS .ssa = SSA;
224204#else
225- if (SSA > Nps-> val .ssa )
205+ if (SSA > Nps.ssa )
226206 {
227- Nps-> val .ssa = SSA;
207+ Nps.ssa = SSA;
228208#endif
229209#if defined(USE_DX10) || defined(USE_DX11)
230- if (SSA > Ngs-> val .ssa )
210+ if (SSA > Ngs.ssa )
231211 {
232- Ngs-> val .ssa = SSA;
233- #endif // USE_DX10
234- if (SSA > Nvs-> val .ssa )
212+ Ngs.ssa = SSA;
213+ #endif
214+ if (SSA > Nvs.ssa )
235215 {
236- Nvs->val .ssa = SSA;
237- #if defined(USE_DX10) || defined(USE_DX11)
216+ Nvs.ssa = SSA;
238217 }
218+ #if defined(USE_DX10) || defined(USE_DX11)
239219 }
220+ #endif
240221 }
241222 }
242223 }
243224 }
244- #else // USE_DX10
245- }
246- }
247- }
248- }
249- }
250- #endif // USE_DX10
251225 }
252226
253227#if RENDER != R_R1
@@ -345,107 +319,69 @@ void D3DXRenderBase::r_dsgraph_insert_static(dxRender_Visual* pVisual)
345319
346320 counter_S++;
347321
322+ _NormalItem item = {SSA, pVisual};
323+
348324 for (u32 iPass = 0 ; iPass < sh->passes .size (); ++iPass)
349325 {
350- // SPass& pass = *sh->passes.front ();
351- // mapNormal_T& map = mapNormal [sh->flags.iPriority/2];
352- SPass& pass = *sh->passes [iPass];
353- mapNormal_T& map = mapNormalPasses[sh->flags .iPriority / 2 ][iPass];
354-
355- // #ifdef USE_RESOURCE_DEBUGGER
356- // mapNormalVS::TNode* Nvs = map.insert (pass.vs);
357- // mapNormalPS::TNode* Nps = Nvs->val.insert (pass.ps);
358- // #else
359- // #if defined(USE_DX10) || defined(USE_DX11)
360- // mapNormalVS::TNode* Nvs = map.insert (&*pass.vs);
361- // #else // USE_DX10
362- // mapNormalVS::TNode* Nvs = map.insert (pass.vs->vs);
363- // #endif // USE_DX10
364- // mapNormalPS::TNode* Nps = Nvs->val.insert (pass.ps->ps);
365- // #endif
366-
367- #ifdef USE_RESOURCE_DEBUGGER
368- #if defined(USE_DX10) || defined(USE_DX11)
369- mapNormalVS::TNode* Nvs = map.insert (pass.vs );
370- mapNormalGS::TNode* Ngs = Nvs->val .insert (pass.gs );
371- mapNormalPS::TNode* Nps = Ngs->val .insert (pass.ps );
372- #else // USE_DX10
373- mapNormalVS::TNode* Nvs = map.insert (pass.vs );
374- mapNormalPS::TNode* Nps = Nvs->val .insert (pass.ps );
375- #endif // USE_DX10
376- #else // USE_RESOURCE_DEBUGGER
377- #if defined(USE_DX10) || defined(USE_DX11)
378- mapNormalVS::TNode* Nvs = map.insert (&*pass.vs );
379- mapNormalGS::TNode* Ngs = Nvs->val .insert (pass.gs ->gs );
380- mapNormalPS::TNode* Nps = Ngs->val .insert (pass.ps ->ps );
381- #else // USE_DX10
382- mapNormalVS::TNode* Nvs = map.insert (pass.vs ->vs );
383- mapNormalPS::TNode* Nps = Nvs->val .insert (pass.ps ->ps );
384- #endif // USE_DX10
385- #endif // USE_RESOURCE_DEBUGGER
326+ auto &pass = *sh->passes [iPass];
327+ auto &map = mapNormalPasses[sh->flags .iPriority / 2 ][iPass];
386328
387- #ifdef USE_DX11
388- #ifdef USE_RESOURCE_DEBUGGER
389- Nps->val .hs = pass.hs ;
390- Nps->val .ds = pass.ds ;
391- mapNormalCS::TNode* Ncs = Nps->val .mapCS .insert (pass.constants ._get ());
329+ #if defined(USE_DX10) || defined(USE_DX11)
330+ auto &Nvs = map[&*pass.vs ];
331+ auto &Ngs = Nvs[pass.gs ->gs ];
332+ auto &Nps = Ngs[pass.ps ->ps ];
392333#else
393- Nps->val .hs = pass.hs ->sh ;
394- Nps->val .ds = pass.ds ->sh ;
395- mapNormalCS::TNode* Ncs = Nps->val .mapCS .insert (pass.constants ._get ());
334+ auto &Nvs = map[pass.vs ->vs ];
335+ auto &Nps = Nvs[pass.ps ->ps ];
396336#endif
337+
338+ #ifdef USE_DX11
339+ Nps.hs = pass.hs ->sh ;
340+ Nps.ds = pass.ds ->sh ;
341+
342+ auto &Ncs = Nps.mapCS [pass.constants ._get ()];
397343#else
398- mapNormalCS::TNode* Ncs = Nps-> val . insert ( pass.constants ._get ()) ;
344+ auto & Ncs = Nps[ pass.constants ._get ()] ;
399345#endif
400- mapNormalStates::TNode* Nstate = Ncs->val .insert (pass.state ->state );
401- mapNormalTextures::TNode* Ntex = Nstate->val .insert (pass.T ._get ());
402- mapNormalItems& items = Ntex->val ;
403- _NormalItem item = {SSA, pVisual};
404- items.push_back (item);
346+ auto &Nstate = Ncs[pass.state ->state ];
347+ auto &Ntex = Nstate[pass.T ._get ()];
348+ Ntex.push_back (item);
405349
406350 // Need to sort for HZB efficient use
407- if (SSA > Ntex-> val .ssa )
351+ if (SSA > Ntex.ssa )
408352 {
409- Ntex-> val .ssa = SSA;
410- if (SSA > Nstate-> val .ssa )
353+ Ntex.ssa = SSA;
354+ if (SSA > Nstate.ssa )
411355 {
412- Nstate-> val .ssa = SSA;
413- if (SSA > Ncs-> val .ssa )
356+ Nstate.ssa = SSA;
357+ if (SSA > Ncs.ssa )
414358 {
415- Ncs-> val .ssa = SSA;
359+ Ncs.ssa = SSA;
416360#ifdef USE_DX11
417- if (SSA > Nps-> val .mapCS .ssa )
361+ if (SSA > Nps.mapCS .ssa )
418362 {
419- Nps-> val .mapCS .ssa = SSA;
363+ Nps.mapCS .ssa = SSA;
420364#else
421- if (SSA > Nps-> val .ssa )
365+ if (SSA > Nps.ssa )
422366 {
423- Nps-> val .ssa = SSA;
367+ Nps.ssa = SSA;
424368#endif
425- // if (SSA>Nvs->val.ssa) { Nvs->val.ssa = SSA;
426- // } } } } }
427369#if defined(USE_DX10) || defined(USE_DX11)
428- if (SSA > Ngs-> val .ssa )
370+ if (SSA > Ngs.ssa )
429371 {
430- Ngs-> val .ssa = SSA;
431- #endif // USE_DX10
432- if (SSA > Nvs-> val .ssa )
372+ Ngs.ssa = SSA;
373+ #endif
374+ if (SSA > Nvs.ssa )
433375 {
434- Nvs->val .ssa = SSA;
435- #if defined(USE_DX10) || defined(USE_DX11)
376+ Nvs.ssa = SSA;
436377 }
378+ #if defined(USE_DX10) || defined(USE_DX11)
437379 }
380+ #endif
438381 }
439382 }
440383 }
441384 }
442- #else // USE_DX10
443- }
444- }
445- }
446- }
447- }
448- #endif // USE_DX10
449385 }
450386
451387#if RENDER != R_R1
0 commit comments