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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#include "Headers/RenderPackage.h"

#include "Headers/GFXDevice.h"
#include "Platform/Video/Buffers/ShaderBuffer/Headers/ShaderBuffer.h"

namespace Divide {

// ToDo: This will return false if the number of shader buffers or number of
// textures does not match between the 2 packages although said buffers/textures
// might be compatible and batchable between the two.
// Obviously, this is not desirable. Fix it! -Ionut
bool RenderPackage::isCompatible(const RenderPackage& other) const {
    vectorAlg::vecSize bufferCount = other._shaderBuffers.size();
    if (_shaderBuffers.size() == bufferCount) {
        for (vectorAlg::vecSize i = 0; i < bufferCount; i++) {
            const ShaderBufferList::value_type& buffer1 = _shaderBuffers[i];
            const ShaderBufferList::value_type& buffer2 = other._shaderBuffers[i];

            I64 guid1 = buffer1._buffer ? buffer1._buffer->getGUID() : -1;
            I64 guid2 = buffer2._buffer ? buffer2._buffer->getGUID() : -1;
            if (buffer1._slot != buffer2._slot ||
                buffer1._range != buffer2._range ||
                guid1 != guid2)
            {
                return false;
            }
        }
    } else {
        return false;
    }

    const vectorImpl<TextureData>& textures = _textureData.textures();
    const vectorImpl<TextureData>& otherTextures = other._textureData.textures();
    vectorAlg::vecSize textureCount = otherTextures.size();
    if (textures.size() == textureCount) {
        U64 handle1 = 0, handle2 = 0;
        for (vectorAlg::vecSize i = 0; i < textureCount; ++i) {
            const TextureData& data1 = textures[i];
            const TextureData& data2 = otherTextures[i];
            data1.getHandle(handle1);
            data2.getHandle(handle2);
            if (handle1 != handle2 ||
                data1._samplerHash != data2._samplerHash ||
                data1._textureType != data2._textureType) {
                return false;
            }
        }
    } else {
        return false;
    }

    return true;
}
void RenderPackage::clear() {
    _shaderBuffers.resize(0);
    _drawCommands.resize(0);
    _textureData.clear(false);
}

void RenderPackage::set(const RenderPackage& other) {
#if 0
    size_t shaderBufferSize = other._shaderBuffers.size();
    size_t textureDataSize = other._textureData.size();
    size_t drawCommandSize = other._drawCommands.size();

    _shaderBuffers.resize(shaderBufferSize);
    _textureData.resize(textureDataSize);
    _drawCommands.resize(drawCommandSize);
    for (size_t i = 0; i < shaderBufferSize; ++i) {
        _shaderBuffers.at(i).set(other._shaderBuffers.at(i));
    }

    for (size_t i = 0; i < textureDataSize; ++i) {
        _textureData.at(i).set(other._textureData.at(i));
    }

    for (size_t i = 0; i < drawCommandSize; ++i) {
        _drawCommands.at(i).set(other._drawCommands.at(i));
    }
#else
    _shaderBuffers = other._shaderBuffers;
    _textureData = other._textureData;
    _drawCommands = other._drawCommands;
#endif
}



void RenderPackageQueue::clear() {
    for (U32 idx = 0; idx < _currentCount; ++idx) {
        //_packages[idx].clear();
    }
    _currentCount = 0;
}

U32 RenderPackageQueue::size() const {
    return _currentCount;
}

bool RenderPackageQueue::locked() const {
    return _locked;
}

bool RenderPackageQueue::empty() const {
    return _currentCount == 0;
}

const RenderPackage& RenderPackageQueue::getPackage(U32 idx) const {
    assert(idx < Config::MAX_VISIBLE_NODES);
    return _packages[idx];
}

RenderPackage& RenderPackageQueue::getPackage(U32 idx) {
    assert(idx < Config::MAX_VISIBLE_NODES);
    return _packages[idx];
}

RenderPackage& RenderPackageQueue::back() {
    return _packages[std::max(to_int(_currentCount) - 1, 0)];
}

bool RenderPackageQueue::push_back(const RenderPackage& package) {
    if (_currentCount <= Config::MAX_VISIBLE_NODES) {
        _packages[_currentCount++].set(package);
        return true;
    }
    return false;
}

void RenderPackageQueue::reserve(U16 size) {
    _packages.resize(size);
}

void RenderPackageQueue::lock() {
    _locked = true;
}

void RenderPackageQueue::unlock() {
    _locked = false;
}

}; //namespace Divide

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

Diff revisions: vs.
Revision Author Commited Message
852 Diff Diff IonutCava picture IonutCava Tue 07 Feb, 2017 17:17:27 +0000

[IonutCava]
- Separate Pass Type from Render Stage:
— Render Stage: Display, Shadow, Reflection, Refraction, etc
— Pass Type: Depth pass, Colour Pass, etc
- ToDo: Bug fixes for issues introduced with this change

818 Diff Diff IonutCava picture IonutCava Mon 16 Jan, 2017 17:23:20 +0000

[IonutCava]
- Units get their bound node setup by the SGN UnitComponent and not during creation
- Profile guided optimizations

778 IonutCava picture IonutCava Mon 10 Oct, 2016 15:18:32 +0000

[IonutCava]
- Rendering abstraction cleanup