Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "config.h"

#include "Headers/PlatformDefines.h"

#include "GUI/Headers/GUI.h"
#include "GUI/Headers/GUIMessageBox.h"

#include "Core/Headers/Console.h"

#if defined(USE_CUSTOM_MEMORY_ALLOCATORS)
#include <Allocator/xallocator.h>
#endif

#if defined(_DEBUG)
#include "Utility/Headers/MemoryTracker.h"
#endif

namespace Divide {
namespace MemoryManager {
void log_new(void* p, size_t size, const char* zFile, size_t nLine) {
#if defined(_DEBUG)
    if (MemoryTracker::Ready) {
         AllocTracer.Add( p, size, zFile, nLine );
    }
#endif
}

void log_delete(void* p) {
#if defined(_DEBUG)
    if (MemoryTracker::Ready) {
        AllocTracer.Remove( p );
    }
#endif
}
};  // namespace MemoryManager

U32 HARDWARE_THREAD_COUNT() {
    return std::max(std::thread::hardware_concurrency(), 2u);
}

bool preAssert(const bool expression, const char* failMessage) {
    if (expression) {
        return false;
    }
    if (Config::Assert::LOG_ASSERTS) {
        Console::errorfn("Assert: %s", failMessage);
    }
    /// Message boxes without continue on assert don't render!
    if (Config::Assert::SHOW_MESSAGE_BOX && Config::Assert::CONTINUE_ON_ASSERT) {
        GUIMessageBox* const msgBox = GUI::instance().getDefaultMessageBox();
        if (msgBox) {
            msgBox->setTitle("Assertion Failed!");
            msgBox->setMessage(stringImpl("Assert: ") + failMessage);
            msgBox->setMessageType(GUIMessageBox::MessageType::MESSAGE_ERROR);
            msgBox->show();
        }
    }

    return !Config::Assert::CONTINUE_ON_ASSERT;
}

};  // namespace Divide

#if defined(_DEBUG)
#if defined(DEBUG_EXTERNAL_ALLOCATIONS)
void* operator new(size_t size) {
    static thread_local bool logged = false;
    void* ptr = malloc(size);
    if (!logged) {
        Divide::MemoryManager::log_new(ptr, size, " allocation outside of macro ", 0);
        if (Divide::MemoryManager::MemoryTracker::Ready) {
            logged = true;
        }
    }
    return ptr;
}

void operator delete(void* ptr) noexcept {
    Divide::MemoryManager::log_delete(ptr);
    free(ptr);
}

void* operator new[](size_t size) {
    static thread_local bool logged = false;
    void* ptr = malloc(size);
    if (!logged) {
        Divide::MemoryManager::log_new(ptr, size, " array allocation outside of macro ", 0);
        if (Divide::MemoryManager::MemoryTracker::Ready) {
            logged = true;
        }
    }
    return ptr;
}

void operator delete[](void* ptr) noexcept {
    Divide::MemoryManager::log_delete(ptr);
    free(ptr);
}
#endif

void* operator new(size_t size, const char* zFile, size_t nLine) {
    void* ptr = malloc(size);
    Divide::MemoryManager::log_new(ptr, size, zFile, nLine);
    return ptr;
}

void operator delete(void* ptr, const char* zFile, size_t nLine) {
    Divide::MemoryManager::log_delete(ptr);
    free(ptr);
}

void* operator new[](size_t size, const char* zFile, size_t nLine) {
    void* ptr = malloc(size);
    Divide::MemoryManager::log_new(ptr, size, zFile, nLine);
    return ptr;
}

void operator delete[](void* ptr, const char* zFile, size_t nLine) {
    Divide::MemoryManager::log_delete(ptr);
    free(ptr);
}
#else
#endif

Commits for Divide-Framework/trunk/Source Code/Platform/PlatformDefines.cpp

Diff revisions: vs.
Revision Author Commited Message
727 Diff Diff IonutCava picture IonutCava Tue 14 Jun, 2016 16:01:38 +0000

[IonutCava]
- Remove node and cmd buffers from GFXDevice and add them as a new BufferData struct to RenderPass class.
— Each render pass holds its own buffers
- Improvements / fixes to the CSM code
- Added a global toggle to enable/disable custom memory allocators

712 Diff Diff IonutCava picture IonutCava Tue 24 May, 2016 16:18:37 +0000

[IonutCava]
- Added the concept of “buffer” to be used by GenericVertexData and ShaderBuffer without caring if it’s persistent or not.
— Persistent buffers handle their own locking instead of relying on the parent class
- HiZ occlusion culling fixes and optimizations

673 Diff Diff IonutCava picture IonutCava Sun 10 Apr, 2016 19:26:18 +0000

[IonutCava]
- Use stl_allocator with hashmap
- Various memory allocation tweaks and bug fixes
- Initial Toksvig specular-AA shader code (from http://www.selfshadow.com/sandbox/gloss.html)

671 Diff Diff IonutCava picture IonutCava Fri 08 Apr, 2016 16:26:49 +0000

[Ionut]
- Custom memory allocation system part 1:
— Add http://www.codeproject.com/Articles/1089905/A-Custom-STL-std-allocator-Replacement-Improves-Pe
— Add custom allocators to strings and vectors
— Add custom allocators to a few test classes
— No support for aligned memory yet, so vec4<F32> and mat4<F32> vectors use the old allocation system
- Replace more std::async call with our custom task system

670 Diff Diff IonutCava picture IonutCava Wed 06 Apr, 2016 16:21:35 +0000

[IonutCava]
- getInstance() renamed to instance() for simplicity (should really go away altogether, but that’s a different issue)
- some particle emitter threading updates

633 Diff Diff IonutCava picture IonutCava Wed 27 Jan, 2016 16:54:12 +0000

[IonutCava]
- Improve load times by using ShaderCache files to avoid re-parsing atoms multiple times
- Z_PRE_PASS and multi-threaded asset loading is disabled automatically for AMD only (until driver issues are resolved)

540 Diff Diff IonutCava picture IonutCava Wed 28 Oct, 2015 19:06:28 +0000

[IonutCava]
- Remove the “Platform” folder from the Platform project as the name is redundant. Move files one level up

526 Diff Diff IonutCava picture IonutCava Thu 15 Oct, 2015 15:07:34 +0000

[IonutCava]
- More work on the OpenCL implementation.
— Based on simpleCL for the backend: https://github.com/morousg/simple-opencl
- Improved formatting options for the Console

494 Diff Diff IonutCava picture IonutCava Sat 15 Aug, 2015 19:09:33 +0000

[Ionut]
- Better transform tracking in PhysicsComponent
- Random code cleanups and fixes

466 IonutCava picture IonutCava Fri 05 Jun, 2015 15:07:17 +0000

[Ionut]
- Moved EASTL, SimpleINI and Threadpool libraries from Dependencies repo to engine repo
- Disabled EASTL string and vector support as they are really out of date and missing required features.
— EASTL hash map is still usable