Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 911 vs 912 for /trunk/Source Code/Platform/Video/Buffers/RenderTarget/RTAttachmentPool.cpp

Diff revisions: vs.
  @@ -15,11 +15,11 @@
15 15 namespace Divide {
16 16
17 17 namespace {
18 - const char* getAttachmentName(RTAttachment::Type type) {
18 + const char* getAttachmentName(RTAttachmentType type) {
19 19 switch (type) {
20 - case RTAttachment::Type::Colour: return "Colour";
21 - case RTAttachment::Type::Depth: return "Depth";
22 - case RTAttachment::Type::Stencil: return "Stencil";
20 + case RTAttachmentType::Colour: return "Colour";
21 + case RTAttachmentType::Depth: return "Depth";
22 + case RTAttachmentType::Stencil: return "Stencil";
23 23 };
24 24
25 25 return "ERROR";
  @@ -30,9 +30,9 @@
30 30 : _parent(parent)
31 31 {
32 32 _attachmentCount.fill(0);
33 - _attachment[to_base(RTAttachment::Type::Colour)].resize(colourAttCount, nullptr);
34 - _attachment[to_base(RTAttachment::Type::Depth)].resize(1, nullptr);
35 - _attachment[to_base(RTAttachment::Type::Stencil)].resize(1, nullptr);
33 + _attachment[to_base(RTAttachmentType::Colour)].resize(colourAttCount, nullptr);
34 + _attachment[to_base(RTAttachmentType::Depth)].resize(1, nullptr);
35 + _attachment[to_base(RTAttachmentType::Stencil)].resize(1, nullptr);
36 36 }
37 37
38 38 RTAttachmentPool::~RTAttachmentPool()
  @@ -40,14 +40,14 @@
40 40 }
41 41
42 42 void RTAttachmentPool::copy(const RTAttachmentPool& other) {
43 - for (U8 i = 0; i < to_base(RTAttachment::Type::COUNT); ++i) {
43 + for (U8 i = 0; i < to_base(RTAttachmentType::COUNT); ++i) {
44 44 for (U8 j = 0; j < other._attachment[i].size(); ++j) {
45 45 const RTAttachment_ptr& att = other._attachment[i][j];
46 46 if (att != nullptr) {
47 47 RTAttachmentDescriptor descriptor = {};
48 48 descriptor._clearColour = att->clearColour();
49 49 descriptor._index = j;
50 - descriptor._type = static_cast<RTAttachment::Type>(i);
50 + descriptor._type = static_cast<RTAttachmentType>(i);
51 51 descriptor._texDescriptor = att->texture()->getDescriptor();
52 52
53 53 update(descriptor);
  @@ -58,7 +58,7 @@
58 58
59 59 RTAttachment_ptr& RTAttachmentPool::update(const RTAttachmentDescriptor& descriptor) {
60 60 U8 index = descriptor._index;
61 - RTAttachment::Type type = descriptor._type;
61 + RTAttachmentType type = descriptor._type;
62 62 assert(index < to_U8(_attachment[to_U32(type)].size()));
63 63
64 64 RTAttachment_ptr& ptr = getInternal(_attachment, type, index);
  @@ -71,7 +71,7 @@
71 71 // Just to be clear about our intentions
72 72 ptr.reset();
73 73 }
74 - ptr = std::make_shared<RTAttachment>();
74 + ptr = std::make_shared<RTAttachment>(descriptor);
75 75
76 76 ResourceDescriptor textureAttachment(Util::StringFormat("FBO_%s_Att_%s_%d_%d",
77 77 _parent.getName().c_str(),
  @@ -90,14 +90,13 @@
90 90 tex->loadData(info, NULL, vec2<U16>(_parent.getWidth(), _parent.getHeight()));
91 91
92 92 ptr->texture(tex);
93 - ptr->clearColour(descriptor._clearColour);
94 93
95 94 _attachmentCount[to_U32(type)]++;
96 95
97 96 return ptr;
98 97 }
99 98
100 - bool RTAttachmentPool::clear(RTAttachment::Type type, U8 index) {
99 + bool RTAttachmentPool::clear(RTAttachmentType type, U8 index) {
101 100 RTAttachment_ptr& ptr = getInternal(_attachment, type, index);
102 101 if (ptr != nullptr) {
103 102 ptr.reset();
  @@ -107,22 +106,22 @@
107 106 return false;
108 107 }
109 108
110 - RTAttachment_ptr& RTAttachmentPool::getInternal(AttachmentPool& pool, RTAttachment::Type type, U8 index) {
109 + RTAttachment_ptr& RTAttachmentPool::getInternal(AttachmentPool& pool, RTAttachmentType type, U8 index) {
111 110 switch (type) {
112 - case RTAttachment::Type::Colour:
111 + case RTAttachmentType::Colour:
113 112 {
114 113 assert(index < to_U8(_attachment[to_U32(type)].size()));
115 - return pool[to_base(RTAttachment::Type::Colour)][index];
114 + return pool[to_base(RTAttachmentType::Colour)][index];
116 115 }
117 - case RTAttachment::Type::Depth:
116 + case RTAttachmentType::Depth:
118 117 {
119 118 assert(index == 0);
120 - return pool[to_base(RTAttachment::Type::Depth)].front();
119 + return pool[to_base(RTAttachmentType::Depth)].front();
121 120 }
122 - case RTAttachment::Type::Stencil:
121 + case RTAttachmentType::Stencil:
123 122 {
124 123 assert(index == 0);
125 - return pool[to_base(RTAttachment::Type::Stencil)].front();
124 + return pool[to_base(RTAttachmentType::Stencil)].front();
126 125 }
127 126 }
128 127
  @@ -130,22 +129,22 @@
130 129 return pool[0][0];
131 130 }
132 131
133 - const RTAttachment_ptr& RTAttachmentPool::getInternal(const AttachmentPool& pool, RTAttachment::Type type, U8 index) const {
132 + const RTAttachment_ptr& RTAttachmentPool::getInternal(const AttachmentPool& pool, RTAttachmentType type, U8 index) const {
134 133 switch (type) {
135 - case RTAttachment::Type::Colour:
134 + case RTAttachmentType::Colour:
136 135 {
137 136 assert(index < to_U8(_attachment[to_U32(type)].size()));
138 - return pool[to_base(RTAttachment::Type::Colour)][index];
137 + return pool[to_base(RTAttachmentType::Colour)][index];
139 138 }
140 - case RTAttachment::Type::Depth:
139 + case RTAttachmentType::Depth:
141 140 {
142 141 assert(index == 0);
143 - return pool[to_base(RTAttachment::Type::Depth)].front();
142 + return pool[to_base(RTAttachmentType::Depth)].front();
144 143 }
145 - case RTAttachment::Type::Stencil:
144 + case RTAttachmentType::Stencil:
146 145 {
147 146 assert(index == 0);
148 - return pool[to_base(RTAttachment::Type::Stencil)].front();
147 + return pool[to_base(RTAttachmentType::Stencil)].front();
149 148 }
150 149 }
151 150
  @@ -153,15 +152,15 @@
153 152 return pool[0][0];
154 153 }
155 154
156 - RTAttachment_ptr& RTAttachmentPool::get(RTAttachment::Type type, U8 index) {
155 + RTAttachment_ptr& RTAttachmentPool::get(RTAttachmentType type, U8 index) {
157 156 return getInternal(_attachment, type, index);
158 157 }
159 158
160 - const RTAttachment_ptr& RTAttachmentPool::get(RTAttachment::Type type, U8 index) const {
159 + const RTAttachment_ptr& RTAttachmentPool::get(RTAttachmentType type, U8 index) const {
161 160 return getInternal(_attachment, type, index);
162 161 }
163 162
164 - void RTAttachmentPool::get(RTAttachment::Type type, vectorImpl<RTAttachment_ptr>& attachments) const {
163 + void RTAttachmentPool::get(RTAttachmentType type, vectorImpl<RTAttachment_ptr>& attachments) const {
165 164 if (!attachments.empty()) {
166 165 attachments.resize(0);
167 166 }
  @@ -171,7 +170,7 @@
171 170 std::copy_if(std::begin(_attachment[to_U32(type)]), std::end(_attachment[to_U32(type)]), back_it, usedPredicate);
172 171 }
173 172
174 - U8 RTAttachmentPool::attachmentCount(RTAttachment::Type type) const {
173 + U8 RTAttachmentPool::attachmentCount(RTAttachmentType type) const {
175 174 return _attachmentCount[to_U32(type)];
176 175 }
177 176