From 71b5db579bb6c7bb6e684cb5adf22d086c259532 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Mon, 1 Oct 2018 21:11:30 +0500 Subject: [PATCH] xrRender_RX: removed software processor from details manager It was only used when your GPU doesn't support the vertex shaders.... --- src/Layers/xrRender/DetailManager.cpp | 19 +- src/Layers/xrRender/DetailManager.h | 7 - .../xrRender/DetailManager_Decompress.cpp | 17 +- src/Layers/xrRender/DetailManager_soft.cpp | 174 ------------------ src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj | 1 - .../xrRenderPC_GL/xrRender_GL.vcxproj.filters | 3 - src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj | 1 - .../xrRenderPC_R1/xrRender_R1.vcxproj.filters | 3 - src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj | 1 - .../xrRenderPC_R2/xrRender_R2.vcxproj.filters | 3 - src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj | 1 - .../xrRenderPC_R3/xrRender_R3.vcxproj.filters | 3 - src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj | 1 - .../xrRenderPC_R4/xrRender_R4.vcxproj.filters | 3 - 14 files changed, 10 insertions(+), 227 deletions(-) delete mode 100644 src/Layers/xrRender/DetailManager_soft.cpp diff --git a/src/Layers/xrRender/DetailManager.cpp b/src/Layers/xrRender/DetailManager.cpp index f14ea1f765f..dbc205a8ec7 100644 --- a/src/Layers/xrRender/DetailManager.cpp +++ b/src/Layers/xrRender/DetailManager.cpp @@ -78,7 +78,6 @@ CDetailManager::CDetailManager() : xrc("detail manager") { dtFS = nullptr; dtSlots = nullptr; - soft_Geom = nullptr; hw_Geom = nullptr; hw_BatchSize = 0; hw_VB = 0; @@ -194,11 +193,7 @@ void CDetailManager::Load() // Make dither matrix bwdithermap(2, dither); - // Hardware specific optimizations - if (UseVS()) - hw_Load(); - else - soft_Load(); + hw_Load(); // swing desc // normal @@ -217,10 +212,7 @@ void CDetailManager::Load() #endif void CDetailManager::Unload() { - if (UseVS()) - hw_Unload(); - else - soft_Unload(); + hw_Unload(); for (DetailIt it = objects.begin(); it != objects.end(); it++) { @@ -399,10 +391,9 @@ void CDetailManager::Render() RCache.set_CullMode(CULL_NONE); RCache.set_xform_world(Fidentity); - if (UseVS()) - hw_Render(); - else - soft_Render(); + + hw_Render(); + RCache.set_CullMode(CULL_CCW); g_pGamePersistent->m_pGShaderConstants->m_blender_mode.w = 0.0f; //--#SM+#-- Флаг конца рендера травы [end of grass render] diff --git a/src/Layers/xrRender/DetailManager.h b/src/Layers/xrRender/DetailManager.h index 6730141fa01..ce93368531a 100644 --- a/src/Layers/xrRender/DetailManager.h +++ b/src/Layers/xrRender/DetailManager.h @@ -184,13 +184,6 @@ class ECORE_API CDetailManager virtual ObjectList* GetSnapList() = 0; #endif - bool UseVS() { return HW.Caps.geometry_major >= 1; } - // Software processor - ref_geom soft_Geom; - void soft_Load(); - void soft_Unload(); - void soft_Render(); - // Hardware processor ref_geom hw_Geom; u32 hw_BatchSize; diff --git a/src/Layers/xrRender/DetailManager_Decompress.cpp b/src/Layers/xrRender/DetailManager_Decompress.cpp index e96af1b1a4f..4dfbec1a71d 100644 --- a/src/Layers/xrRender/DetailManager_Decompress.cpp +++ b/src/Layers/xrRender/DetailManager_Decompress.cpp @@ -299,24 +299,17 @@ gray255[3] = 255.f*float(c_pal->a3)/15.f; // Vis-sorting #ifndef DBG_SWITCHOFF_RANDOMIZE - if (!UseVS()) - { - // Always still on CPU pipe + if (Dobj->m_Flags.is(DO_NO_WAVING)) Item.vis_ID = 0; - } else { - if (Dobj->m_Flags.is(DO_NO_WAVING)) - Item.vis_ID = 0; + if (::Random.randI(0, 3) == 0) + Item.vis_ID = 2; // Second wave else - { - if (::Random.randI(0, 3) == 0) - Item.vis_ID = 2; // Second wave - else - Item.vis_ID = 1; // First wave - } + Item.vis_ID = 1; // First wave } #else + // Always still on CPU pipe Item.vis_ID = 0; #endif // Save it diff --git a/src/Layers/xrRender/DetailManager_soft.cpp b/src/Layers/xrRender/DetailManager_soft.cpp deleted file mode 100644 index 28f74fc0fcf..00000000000 --- a/src/Layers/xrRender/DetailManager_soft.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include "detailmanager.h" - -const u32 vs_size = 3000; - -void CDetailManager::soft_Load() -{ - R_ASSERT(RCache.Vertex.Buffer()); - R_ASSERT(RCache.Index.Buffer()); - // Vertex Stream - soft_Geom.create(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1, RCache.Vertex.Buffer(), RCache.Index.Buffer()); -} - -void CDetailManager::soft_Unload() { soft_Geom.destroy(); } -void CDetailManager::soft_Render() -{ - // Render itself - // float fPhaseRange = PI/16; - // float fPhaseX = _sin(RDEVICE.fTimeGlobal*0.1f) *fPhaseRange; - // float fPhaseZ = _sin(RDEVICE.fTimeGlobal*0.11f)*fPhaseRange; - - // Get index-stream - _IndexStream& _IS = RCache.Index; - _VertexStream& _VS = RCache.Vertex; - for (u32 O = 0; O < objects.size(); O++) - { - CDetail& Object = *objects[O]; - u32 vCount_Object = Object.number_vertices; - u32 iCount_Object = Object.number_indices; - - xr_vector& _vis = m_visibles[0][O]; - xr_vector::iterator _vI = _vis.begin(); - xr_vector::iterator _vE = _vis.end(); - for (; _vI != _vE; _vI++) - { - SlotItemVec* items = *_vI; - u32 vCount_Total = items->size() * vCount_Object; - // calculate lock count needed - u32 lock_count = vCount_Total / vs_size; - if (vCount_Total > (lock_count * vs_size)) - lock_count++; - - // calculate objects per lock - u32 o_total = items->size(); - u32 o_per_lock = o_total / lock_count; - if (o_total > (o_per_lock * lock_count)) - o_per_lock++; - - // Fill VB (and flush it as nesessary) - RCache.set_Shader(Object.shader); - - Fmatrix mXform; - for (u32 L_ID = 0; L_ID < lock_count; L_ID++) - { - // Calculate params - u32 item_start = L_ID * o_per_lock; - u32 item_end = item_start + o_per_lock; - if (item_end > o_total) - item_end = o_total; - if (item_end <= item_start) - break; - u32 item_range = item_end - item_start; - - // Calc Lock params - u32 vCount_Lock = item_range * vCount_Object; - u32 iCount_Lock = item_range * iCount_Object; - - // Lock buffers - u32 vBase, iBase, iOffset = 0; - CDetail::fvfVertexOut* vDest = - (CDetail::fvfVertexOut*)_VS.Lock(vCount_Lock, soft_Geom->vb_stride, vBase); - u16* iDest = (u16*)_IS.Lock(iCount_Lock, iBase); - - // Filling itself - for (u32 item_idx = item_start; item_idx < item_end; ++item_idx) - { - SlotItem& Instance = *items->at(item_idx); - float scale = Instance.scale_calculated; - - // Build matrix - Fmatrix& M = Instance.mRotY; - mXform._11 = M._11 * scale; - mXform._12 = M._12 * scale; - mXform._13 = M._13 * scale; - mXform._14 = M._14; - mXform._21 = M._21 * scale; - mXform._22 = M._22 * scale; - mXform._23 = M._23 * scale; - mXform._24 = M._24; - mXform._31 = M._31 * scale; - mXform._32 = M._32 * scale; - mXform._33 = M._33 * scale; - mXform._34 = M._34; - mXform._41 = M._41; - mXform._42 = M._42; - mXform._43 = M._43; - mXform._44 = 1; - - // Transfer vertices - { - u32 C = 0xffffffff; - CDetail::fvfVertexIn *srcIt = Object.vertices, - *srcEnd = Object.vertices + Object.number_vertices; - CDetail::fvfVertexOut* dstIt = vDest; - - for (; srcIt != srcEnd; srcIt++, dstIt++) - { - mXform.transform_tiny(dstIt->P, srcIt->P); - dstIt->C = C; - dstIt->u = srcIt->u; - dstIt->v = srcIt->v; - } - } - - // Transfer indices (in 32bit lines) - VERIFY(iOffset < 65535); - { - u32 item = (iOffset << 16) | iOffset; - u32 count = Object.number_indices / 2; - LPDWORD sit = LPDWORD(Object.indices); - LPDWORD send = sit + count; - LPDWORD dit = LPDWORD(iDest); - for (; sit != send; dit++, sit++) - *dit = *sit + item; - if (Object.number_indices & 1) - { - iDest[Object.number_indices - 1] = - (u16)(Object.indices[Object.number_indices - 1] + u16(iOffset)); - } - } - - // Increment counters - vDest += vCount_Object; - iDest += iCount_Object; - iOffset += vCount_Object; - } - _VS.Unlock(vCount_Lock, soft_Geom->vb_stride); - _IS.Unlock(iCount_Lock); - - // Render - u32 dwNumPrimitives = iCount_Lock / 3; - RCache.set_Geometry(soft_Geom); - RCache.Render(D3DPT_TRIANGLELIST, vBase, 0, vCount_Lock, iBase, dwNumPrimitives); - } - } - // Clean up - _vis.clear(); - } -} - -/* - VERIFY(sizeof(CDetail::fvfVertexOut)==soft_Geom->vb_stride); - CDetail::fvfVertexOut* dstIt = vDest; - VERIFY(items->size()*Object.number_vertices==vCount_Lock); - for (u32 k = 0; kP, srcIt->P); - dstIt->C = C; - dstIt->u = srcIt->u; - dstIt->v = srcIt->v; - } - } - } -*/ diff --git a/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj b/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj index 90f1a316255..47551a30ca1 100644 --- a/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj +++ b/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj @@ -248,7 +248,6 @@ - diff --git a/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters b/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters index 7e4a35f6fdd..047b190e318 100644 --- a/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters +++ b/src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters @@ -336,9 +336,6 @@ Details - - Details - Details diff --git a/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj b/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj index de7b2ee0aad..f991f2e3468 100644 --- a/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj +++ b/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj @@ -329,7 +329,6 @@ - diff --git a/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj.filters b/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj.filters index e3d9dd3f3d4..eb36308ed49 100644 --- a/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj.filters +++ b/src/Layers/xrRenderPC_R1/xrRender_R1.vcxproj.filters @@ -632,9 +632,6 @@ Details - - Details - Details diff --git a/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj b/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj index ecdc314ca54..1576d6bd55a 100644 --- a/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj +++ b/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj @@ -341,7 +341,6 @@ - diff --git a/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj.filters b/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj.filters index d8018a5d75c..4ec7eb8c112 100644 --- a/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj.filters +++ b/src/Layers/xrRenderPC_R2/xrRender_R2.vcxproj.filters @@ -686,9 +686,6 @@ Details - - Details - Details diff --git a/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj b/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj index 68bf8fab6d6..4d16571bc7d 100644 --- a/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj +++ b/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj @@ -391,7 +391,6 @@ - diff --git a/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj.filters b/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj.filters index 3ca8882d585..8da215d5645 100644 --- a/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj.filters +++ b/src/Layers/xrRenderPC_R3/xrRender_R3.vcxproj.filters @@ -773,9 +773,6 @@ Details - - Details - Details diff --git a/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj b/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj index 3b99ed6e41c..f21486eacbe 100644 --- a/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj +++ b/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj @@ -396,7 +396,6 @@ - diff --git a/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj.filters b/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj.filters index 6703c86f2a9..a372d258e85 100644 --- a/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj.filters +++ b/src/Layers/xrRenderPC_R4/xrRender_R4.vcxproj.filters @@ -794,9 +794,6 @@ Details - - Details - Details