mirror of
https://github.com/izzy2lost/Super3.git
synced 2026-07-05 15:18:38 -07:00
fix daytona crash
This commit is contained in:
@@ -18,7 +18,7 @@ bool NodeAttributes::Push()
|
||||
//=============
|
||||
|
||||
// check for overflow
|
||||
if (m_vecAttribs.size() >= 128) {
|
||||
if (m_vecAttribs.size() >= kMaxAttribStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ bool NodeAttributes::Pop()
|
||||
|
||||
bool NodeAttributes::StackLimit()
|
||||
{
|
||||
return m_vecAttribs.size() >= 1024;
|
||||
return m_vecAttribs.size() >= kMaxAttribStack;
|
||||
}
|
||||
|
||||
void NodeAttributes::Reset()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
#include "Texture.h"
|
||||
#include "Mat4.h"
|
||||
|
||||
@@ -223,6 +224,7 @@ enum class Clip { INSIDE, OUTSIDE, INTERCEPT, NOT_SET };
|
||||
class NodeAttributes
|
||||
{
|
||||
public:
|
||||
static constexpr size_t kMaxAttribStack = 128;
|
||||
|
||||
NodeAttributes();
|
||||
|
||||
|
||||
@@ -684,7 +684,30 @@ void CNew3D::DescendCullingNode(UINT32 addr)
|
||||
return;
|
||||
}
|
||||
|
||||
node = TranslateCullingAddress(addr);
|
||||
const UINT32 nodeAddr = addr & 0x00FFFFFF;
|
||||
|
||||
struct CullingStackGuard
|
||||
{
|
||||
CNew3D &owner;
|
||||
UINT32 addr;
|
||||
bool active;
|
||||
CullingStackGuard(CNew3D &owner, UINT32 addr)
|
||||
: owner(owner), addr(addr), active(owner.m_cullingStack.insert(addr).second)
|
||||
{
|
||||
}
|
||||
~CullingStackGuard()
|
||||
{
|
||||
if (active) {
|
||||
owner.m_cullingStack.erase(addr);
|
||||
}
|
||||
}
|
||||
} guard(*this, nodeAddr);
|
||||
|
||||
if (!guard.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
node = TranslateCullingAddress(nodeAddr);
|
||||
|
||||
if (NULL == node) {
|
||||
return;
|
||||
@@ -714,7 +737,9 @@ void CNew3D::DescendCullingNode(UINT32 addr)
|
||||
m_colorTableAddr &= 0x000FFFFF; // clamp to 4MB (in words) range
|
||||
}
|
||||
|
||||
m_nodeAttribs.Push(); // save current attribs
|
||||
if (!m_nodeAttribs.Push()) { // save current attribs
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_offset) { // Step 1.5+
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "R3DScrollFog.h"
|
||||
#include "PolyHeader.h"
|
||||
#include "R3DFrameBuffers.h"
|
||||
#include <unordered_set>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
|
||||
@@ -270,6 +271,7 @@ private:
|
||||
TextureSheet m_texSheet;
|
||||
NodeAttributes m_nodeAttribs;
|
||||
Mat4 m_modelMat; // current modelview matrix
|
||||
std::unordered_set<UINT32> m_cullingStack; // recursion guard for culling nodes
|
||||
|
||||
struct LOS
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user