diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llagpmempoolarb.cpp | 230 |
1 files changed, 0 insertions, 230 deletions
diff --git a/linden/indra/llrender/llagpmempoolarb.cpp b/linden/indra/llrender/llagpmempoolarb.cpp deleted file mode 100644 index ab97c97..0000000 --- a/linden/indra/llrender/llagpmempoolarb.cpp +++ /dev/null | |||
@@ -1,230 +0,0 @@ | |||
1 | /** | ||
2 | * @file llagpmempoolarb.cpp | ||
3 | * @brief LLAGPMemPoolARB base class | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "linden_common.h" | ||
29 | #include "llagpmempoolarb.h" | ||
30 | #include "llgl.h" | ||
31 | |||
32 | #include "llglheaders.h" | ||
33 | |||
34 | LLAGPMemPoolARB::LLAGPMemPoolARB(S32 request) : LLAGPMemPool() | ||
35 | { | ||
36 | llinfos << "Creating LLAGPMemPoolARB" << llendl; | ||
37 | stop_glerror(); | ||
38 | if (!gGLManager.mHasVertexBufferObject) | ||
39 | { | ||
40 | llerrs << "No ARB vertex buffer object extension!" << llendl; | ||
41 | } | ||
42 | |||
43 | mName = 0; | ||
44 | |||
45 | mSize = request; | ||
46 | flush_glerror(); | ||
47 | } | ||
48 | |||
49 | |||
50 | LLAGPMemPoolARB::~LLAGPMemPoolARB() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | |||
55 | LLAGPMemBlock* LLAGPMemPoolARB::allocBlock(const S32 size) | ||
56 | { | ||
57 | return allocBlock(size, GL_ARRAY_BUFFER_ARB); | ||
58 | } | ||
59 | |||
60 | LLAGPMemBlock *LLAGPMemPoolARB::allocBlock(const S32 size, U32 target) | ||
61 | { | ||
62 | S32 aligned_size = size; | ||
63 | if (size & 0x0f) | ||
64 | { | ||
65 | aligned_size += 16 - (size & 0x0f); | ||
66 | } | ||
67 | |||
68 | if (aligned_size > (mSize - mTotalAllocated)) | ||
69 | { | ||
70 | // We're totally out of AGP memory, bail. | ||
71 | return (LLAGPMemBlock *)0; | ||
72 | } | ||
73 | |||
74 | mTotalAllocated += aligned_size; | ||
75 | return createBlock(0, aligned_size, target); | ||
76 | } | ||
77 | |||
78 | |||
79 | void LLAGPMemPoolARB::freeBlock(LLAGPMemBlock *blockp) | ||
80 | { | ||
81 | if (!blockp->getSize()) | ||
82 | { | ||
83 | return; | ||
84 | } | ||
85 | LLAGPMemBlockARB *arb_blockp = (LLAGPMemBlockARB*)blockp; | ||
86 | U32 name[1]; | ||
87 | name[0] = arb_blockp->getName(); | ||
88 | stop_glerror(); | ||
89 | glDeleteBuffersARB(1, (GLuint*)name); | ||
90 | stop_glerror(); | ||
91 | mTotalAllocated -= blockp->getSize(); | ||
92 | } | ||
93 | |||
94 | LLAGPMemBlock *LLAGPMemPoolARB::createBlock(const U32 offset, const U32 size) | ||
95 | { | ||
96 | return createBlock(offset, size, GL_ARRAY_BUFFER_ARB); | ||
97 | } | ||
98 | |||
99 | LLAGPMemBlock *LLAGPMemPoolARB::createBlock(const U32 offset, const U32 size, const U32 target) | ||
100 | { | ||
101 | U32 name[1]; | ||
102 | stop_glerror(); | ||
103 | glGenBuffersARB(1, (GLuint*)name); | ||
104 | stop_glerror(); | ||
105 | return new LLAGPMemBlockARB(this, name[0], offset, size, target); | ||
106 | } | ||
107 | |||
108 | void LLAGPMemPoolARB::disable() | ||
109 | { | ||
110 | } | ||
111 | |||
112 | void LLAGPMemPoolARB::dump() | ||
113 | { | ||
114 | } | ||
115 | |||
116 | |||
117 | ///////////////////////////// | ||
118 | // | ||
119 | // LLAGPMemBlockARB | ||
120 | // | ||
121 | // ARB ImplementARBon of an AGP memory block | ||
122 | // | ||
123 | |||
124 | LLAGPMemBlockARB::LLAGPMemBlockARB(LLAGPMemPool *mem_poolp, const U32 name, const U32 offset, const U32 size, U32 target) : | ||
125 | LLAGPMemBlock(mem_poolp), mTarget(target) | ||
126 | { | ||
127 | llassert(name > 0); | ||
128 | mName = name; | ||
129 | stop_glerror(); | ||
130 | glBindBufferARB(mTarget, mName); | ||
131 | stop_glerror(); | ||
132 | |||
133 | glBufferDataARB(mTarget, size, NULL, GL_DYNAMIC_DRAW_ARB); | ||
134 | |||
135 | stop_glerror(); | ||
136 | glBindBufferARB(mTarget, 0); | ||
137 | stop_glerror(); | ||
138 | mSize = size; | ||
139 | } | ||
140 | |||
141 | |||
142 | void LLAGPMemBlockARB::bindGLVertexPointer(const U32 stride, const U32 offset) | ||
143 | { | ||
144 | stop_glerror(); | ||
145 | glBindBufferARB(mTarget, mName); | ||
146 | glVertexPointer(3, GL_FLOAT, stride, (GLvoid*)((intptr_t)offset)); | ||
147 | glBindBufferARB(mTarget, 0); | ||
148 | } | ||
149 | |||
150 | |||
151 | void LLAGPMemBlockARB::bindGLNormalPointer(const U32 stride, const U32 offset) | ||
152 | { | ||
153 | stop_glerror(); | ||
154 | glBindBufferARB(mTarget, mName); | ||
155 | glNormalPointer(GL_FLOAT, stride, (GLvoid*)((intptr_t)offset)); | ||
156 | glBindBufferARB(mTarget, 0); | ||
157 | stop_glerror(); | ||
158 | } | ||
159 | |||
160 | |||
161 | void LLAGPMemBlockARB::bindGLColorPointer(const U32 stride, const U32 offset) | ||
162 | { | ||
163 | stop_glerror(); | ||
164 | glBindBufferARB(mTarget, mName); | ||
165 | glColorPointer(4, GL_UNSIGNED_BYTE, stride, (GLvoid*)((intptr_t)offset)); | ||
166 | glBindBufferARB(mTarget, 0); | ||
167 | stop_glerror(); | ||
168 | } | ||
169 | |||
170 | |||
171 | void LLAGPMemBlockARB::bindGLTexCoordPointer(const U32 stride, const U32 offset) | ||
172 | { | ||
173 | stop_glerror(); | ||
174 | glBindBufferARB(mTarget, mName); | ||
175 | glTexCoordPointer(2, GL_FLOAT, stride, (GLvoid*)((intptr_t)offset)); | ||
176 | glBindBufferARB(mTarget, 0); | ||
177 | stop_glerror(); | ||
178 | } | ||
179 | |||
180 | |||
181 | void LLAGPMemBlockARB::bindGLVertexWeightPointer(const S32 index, const U32 stride, const U32 offset) | ||
182 | { | ||
183 | stop_glerror(); | ||
184 | glBindBufferARB(mTarget, mName); | ||
185 | set_vertex_weights(index, (F32*)(intptr_t)offset); | ||
186 | glBindBufferARB(mTarget, 0); | ||
187 | stop_glerror(); | ||
188 | } | ||
189 | |||
190 | void LLAGPMemBlockARB::bindGLBinormalPointer(const S32 index, const U32 stride, const U32 offset) | ||
191 | { | ||
192 | stop_glerror(); | ||
193 | glBindBufferARB(mTarget, mName); | ||
194 | set_binormals(index, stride, (LLVector3*)(intptr_t)offset); | ||
195 | glBindBufferARB(mTarget, 0); | ||
196 | stop_glerror(); | ||
197 | } | ||
198 | |||
199 | |||
200 | void LLAGPMemBlockARB::bindGLVertexClothingWeightPointer(const S32 index, const U32 stride, const U32 offset) | ||
201 | { | ||
202 | return; | ||
203 | } | ||
204 | |||
205 | |||
206 | void LLAGPMemBlockARB::copy(void *mem, const U32 size) | ||
207 | { | ||
208 | stop_glerror(); | ||
209 | llassert(size <= mSize); | ||
210 | glBindBufferARB(mTarget, mName); | ||
211 | glBufferSubDataARB(mTarget, 0, size, mem); | ||
212 | glBindBufferARB(mTarget, 0); | ||
213 | stop_glerror(); | ||
214 | } | ||
215 | |||
216 | void LLAGPMemBlockARB::copyColor(void *mem, const U32 size) | ||
217 | { | ||
218 | stop_glerror(); | ||
219 | llassert(size <= mSize); | ||
220 | glBindBufferARB(mTarget, mName); | ||
221 | glBufferSubDataARB(mTarget, 0, size, mem); | ||
222 | glBindBufferARB(mTarget, 0); | ||
223 | stop_glerror(); | ||
224 | } | ||
225 | |||
226 | |||
227 | U8* LLAGPMemBlockARB::getMappedMem() | ||
228 | { | ||
229 | return NULL; | ||
230 | } | ||