aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llagpmempoolapple.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llrender/llagpmempoolapple.cpp')
-rw-r--r--linden/indra/llrender/llagpmempoolapple.cpp314
1 files changed, 0 insertions, 314 deletions
diff --git a/linden/indra/llrender/llagpmempoolapple.cpp b/linden/indra/llrender/llagpmempoolapple.cpp
deleted file mode 100644
index 9aa4993..0000000
--- a/linden/indra/llrender/llagpmempoolapple.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
1/**
2 * @file llagpmempoolapple.cpp
3 * @brief LLAGPMemPoolAPPLE 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#ifdef LL_DARWIN
29
30#include "linden_common.h"
31
32#include "llagpmempoolapple.h"
33#include "llgl.h"
34
35#include "llglheaders.h"
36
37LLAGPMemPoolAPPLE::LLAGPMemPoolAPPLE(S32 request) : LLAGPMemPool()
38{
39 llinfos << "Creating LLAGPMemPoolAPPLE" << llendl;
40 stop_glerror();
41 if (!gGLManager.mHasAPPLEFence || !gGLManager.mHasAPPLEVertexArrayRange)
42 {
43 llerrs << "necessary extensions not present!" << llendl;
44 }
45
46 // No special allocation is necessary for the Apple extensions
47 mBase = (U8*)::malloc(request);
48 mSize = request;
49
50 if (mBase)
51 {
52 mFreeList.append(*(new LLFreeBlock(0,mSize)));
53 }
54 else
55 {
56 mSize = 0;
57 }
58
59 flush_glerror();
60}
61
62LLAGPMemBlockAPPLE::~LLAGPMemBlockAPPLE()
63{
64 mMemPoolp->freeBlock(this);
65}
66
67LLAGPMemBlock *LLAGPMemPoolAPPLE::createBlock(const U32 offset, const U32 size)
68{
69 return new LLAGPMemBlockAPPLE(this, mBase, offset, size);
70}
71
72LLAGPMemPoolAPPLE::~LLAGPMemPoolAPPLE()
73{
74 if (mBase)
75 {
76 // MBW -- This really belongs in a call which is the opposite of bind()...
77 glVertexArrayRangeAPPLE(0, 0);
78 ::free(mBase);
79 }
80}
81
82void LLAGPMemPoolAPPLE::bind()
83{
84 if(mBase)
85 {
86 glVertexArrayRangeAPPLE(mSize, mBase);
87 }
88}
89
90void LLAGPMemPoolAPPLE::enable()
91{
92 glEnableClientState(GL_VERTEX_ARRAY_RANGE_APPLE);
93}
94
95void LLAGPMemPoolAPPLE::disable()
96{
97 glDisableClientState(GL_VERTEX_ARRAY_RANGE_APPLE);
98}
99
100void LLAGPMemPoolAPPLE::flush()
101{
102 if(mBase)
103 {
104 glFlushVertexArrayRangeAPPLE(mSize, mBase);
105 }
106}
107
108void LLAGPMemPoolAPPLE::dump()
109{
110 LLFreeBlock *prev = 0;
111 LLFreeBlock *block = mFreeList.getFirst();
112
113 int d=0;
114
115 int i=0;
116 while (block)
117 {
118 i++;
119 if (prev)
120 {
121 d = (S32)block->mOffset - ((S32)prev->mOffset + prev->mSize);
122 }
123 else d = 0;
124
125 prev = block;
126 block = block->getNext();
127 }
128}
129
130
131U32 LLAGPMemPoolAPPLE::createFence()
132{
133 U32 fence;
134 glGenFencesAPPLE(1, (GLuint*)&fence);
135 glSetFenceAPPLE(fence);
136 glFinishFenceAPPLE(fence);
137 return fence;
138}
139
140
141void LLAGPMemPoolAPPLE::deleteFence(const U32 fence)
142{
143 glDeleteFencesAPPLE(1, (GLuint*)&fence);
144}
145
146
147void LLAGPMemPoolAPPLE::sendFence(U32 fence)
148{
149 glSetFenceAPPLE(fence);
150}
151
152
153void LLAGPMemPoolAPPLE::waitFence(U32 fence)
154{
155 if(!glTestFenceAPPLE(fence))
156 {
157 glFinishFenceAPPLE(fence);
158 }
159}
160
161
162/////////////////////////////
163//
164// LLAGPMemBlockAPPLE
165//
166// APPLE Implementation of an AGP memory block
167//
168
169LLAGPMemBlockAPPLE::LLAGPMemBlockAPPLE(LLAGPMemPool *mem_poolp, U8 *baseptr, S32 offset, const U32 size) : LLAGPMemBlock(mem_poolp)
170{
171 mMemp = baseptr + offset;
172 mOffset = offset;
173 mSize = size;
174}
175
176
177void LLAGPMemBlockAPPLE::bindGLVertexPointer(const U32 stride, const U32 offset)
178{
179 if (!mMemp)
180 {
181 llerrs << "Binding empty vertex array" << llendl;
182 }
183 glVertexPointer(3, GL_FLOAT, stride, mMemp + offset);
184}
185
186void LLAGPMemBlockAPPLE::bindGLNormalPointer(const U32 stride, const U32 offset)
187{
188 if (!mMemp)
189 {
190 llerrs << "Binding empty normal array" << llendl;
191 }
192 glNormalPointer(GL_FLOAT, stride, mMemp + offset);
193}
194
195
196void LLAGPMemBlockAPPLE::bindGLColorPointer(const U32 stride, const U32 offset)
197{
198 if (!mMemp)
199 {
200 llerrs << "Binding empty color array" << llendl;
201 }
202 glColorPointer(4, GL_UNSIGNED_BYTE, stride, mMemp + offset);
203}
204
205
206void LLAGPMemBlockAPPLE::bindGLTexCoordPointer(const U32 stride, const U32 offset)
207{
208 if (!mMemp)
209 {
210 llerrs << "Binding empty texcoord array" << llendl;
211 }
212 glTexCoordPointer(2, GL_FLOAT, stride, mMemp + offset);
213}
214
215
216void LLAGPMemBlockAPPLE::bindGLBinormalPointer(const S32 index, const U32 stride, const U32 offset)
217{
218 if (!mMemp)
219 {
220 llerrs << "Binding empty vertex weight array" << llendl;
221 }
222
223 if (index > 0) glVertexAttribPointerARB(index, 3, GL_FLOAT, FALSE, stride, (F32 *)(mMemp + offset));
224}
225
226void LLAGPMemBlockAPPLE::bindGLVertexWeightPointer(const S32 index, const U32 stride, const U32 offset)
227{
228 if (!mMemp)
229 {
230 llerrs << "Binding empty vertex weight array" << llendl;
231 }
232
233 if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, 0, (F32 *)(mMemp + offset));
234}
235
236void LLAGPMemBlockAPPLE::bindGLVertexClothingWeightPointer(const S32 index, const U32 stride, const U32 offset)
237{
238 if (!mMemp)
239 {
240 llerrs << "Binding empty vertex weight array" << llendl;
241 }
242 set_vertex_clothing_weights(index, stride, (LLVector4 *)(mMemp + offset));
243}
244
245U8* LLAGPMemBlockAPPLE::getMappedMem()
246{
247 return mMemp;
248}
249
250
251void LLAGPMemBlockAPPLE::copy(void *mem, const U32 size)
252{
253 if (!mMemp || !mem)
254 {
255 return;
256 }
257 llassert(size <= mSize);
258
259 memcpy( mMemp, mem, size );
260
261 glFlushVertexArrayRangeAPPLE(size, mMemp);
262}
263
264void LLAGPMemBlockAPPLE::copyColor(void *mem, const U32 size)
265{
266 if (!mMemp || !mem)
267 {
268 return;
269 }
270 llassert(size <= mSize);
271
272 memcpy( mMemp, mem, size );
273
274 glFlushVertexArrayRangeAPPLE(size, mMemp);
275}
276
277
278
279U32 LLAGPMemBlockAPPLE::createFence()
280{
281 U32 fence;
282 glGenFencesAPPLE(1, (GLuint*)&fence);
283 glSetFenceAPPLE(fence);
284 glFinishFenceAPPLE(fence);
285 return fence;
286}
287
288void LLAGPMemBlockAPPLE::deleteFence(const U32 fence)
289{
290 glDeleteFencesAPPLE(1, (GLuint*)&fence);
291}
292
293void LLAGPMemBlockAPPLE::sendFence(U32 fence)
294{
295 glSetFenceAPPLE(fence);
296}
297
298void LLAGPMemBlockAPPLE::waitFence(U32 fence)
299{
300 if(!glTestFenceAPPLE(fence))
301 {
302 glFinishFenceAPPLE(fence);
303 }
304}
305
306// MBW -- May want this at some point...
307#if 0
308void LLAGPMemBlockAPPLE::flush()
309{
310 glFlushVertexArrayRangeAPPLE(mSize, mMemp);
311}
312#endif
313
314#endif // LL_DARWIN