Skip to content

Commit

Permalink
xrRender_R1: use software skinning and details processing when FFP sw…
Browse files Browse the repository at this point in the history
…itch is on
  • Loading branch information
Xottab-DUTY committed Apr 20, 2023
1 parent 493e30e commit 03865cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
5 changes: 5 additions & 0 deletions src/Layers/xrRender/DetailManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ void CDetailManager::UpdateVisibleM()
RImplementation.BasicStats.DetailVisibility.End();
}

bool CDetailManager::UseVS() const
{
return HW.Caps.geometry_major >= 1 && !RImplementation.o.ffp;
}

void CDetailManager::Render()
{
#ifndef _EDITOR
Expand Down
3 changes: 2 additions & 1 deletion src/Layers/xrRender/DetailManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ class ECORE_API CDetailManager
virtual ObjectList* GetSnapList() = 0;
#endif

bool UseVS() { return HW.Caps.geometry_major >= 1; }
bool UseVS() const;

// Software processor
ref_geom soft_Geom;
void soft_Load();
Expand Down
29 changes: 10 additions & 19 deletions src/Layers/xrRender/SkeletonX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#include "stdafx.h"
#pragma hdrstop

#ifdef _EDITOR
#include "Include/xrAPI/xrAPI.h"
#endif
#include "SkeletonX.h"
#include "SkeletonXSkinXW.h"
#include "xrCore/FMesh.hpp"
Expand Down Expand Up @@ -166,14 +163,11 @@ void CSkeletonX::_Load(const char* N, IReader* data, u32& dwVertCount)
u16 hw_bones_cnt = u16((HW.Caps.geometry.dwRegisters - 22 - 3) / 3);

#if RENDER == R_R1
if (ps_r1_SoftwareSkinning == 1)
if (ps_r1_SoftwareSkinning == 1 || RImplementation.o.ffp)
hw_bones_cnt = 0;
#endif // RENDER == R_R1

u16 sw_bones_cnt = 0;
#ifdef _EDITOR
hw_bones_cnt = 0;
#endif

u32 dwVertType, size, it, crc;
dwVertType = data->r_u32();
Expand All @@ -200,12 +194,10 @@ void CSkeletonX::_Load(const char* N, IReader* data, u32& dwVertCount)

sw_bones_cnt = _max(sw_bones_cnt, mid);
}
#ifdef _EDITOR
// software
crc = crc32(data->pointer(), size);
Vertices1W.create(crc, dwVertCount, (vertBoned1W*)data->pointer());
#else
if (1 == bids.size())

// Still allow HW skinning for single bone case
// go full SW skinning only if FFP is forced
if (1 == bids.size() && !RImplementation.o.ffp)
{
// HW- single bone
RenderMode = RImplementation.m_hq_skinning ? RM_SINGLE_HQ : RM_SINGLE;
Expand All @@ -226,7 +218,6 @@ void CSkeletonX::_Load(const char* N, IReader* data, u32& dwVertCount)
Vertices1W.create(crc, dwVertCount, (vertBoned1W*)data->pointer());
GEnv.Render->shader_option_skinning(-1);
}
#endif
}
break;
case OGF_VERTEXFORMAT_FVF_2L: // 2-Link
Expand Down Expand Up @@ -331,11 +322,11 @@ void CSkeletonX::_Load(const char* N, IReader* data, u32& dwVertCount)
break;
default: xrDebug::Fatal(DEBUG_INFO, "Invalid vertex type in skinned model '%s'", N); break;
}
#ifdef _EDITOR
if (bids.size() > 0)
#else
if (bids.size() > 1)
#endif

// Look at single bone case in the switch above
const size_t count = RImplementation.o.ffp ? 0 : 1;

if (bids.size() > count)
{
crc = crc32(&*bids.begin(), bids.size() * sizeof(u16));
BonesUsed.create(crc, bids.size(), &*bids.begin());
Expand Down

1 comment on commit 03865cc

@Xottab-DUTY
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.