1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES Utilities
3*35238bceSAndroid Build Coastguard Worker * ------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief OpenGL ES context wrapper that uses FBO as default framebuffer.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "gluFboRenderContext.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "gluContextFactory.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "gluRenderConfig.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "glwFunctions.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "tcuCommandLine.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "gluTextureUtil.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "tcuTextureUtil.hpp"
32*35238bceSAndroid Build Coastguard Worker
33*35238bceSAndroid Build Coastguard Worker #include <sstream>
34*35238bceSAndroid Build Coastguard Worker
35*35238bceSAndroid Build Coastguard Worker namespace glu
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker
getNumDepthBits(const tcu::TextureFormat & format)38*35238bceSAndroid Build Coastguard Worker static int getNumDepthBits(const tcu::TextureFormat &format)
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker if (format.order == tcu::TextureFormat::DS)
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat depthOnlyFormat =
43*35238bceSAndroid Build Coastguard Worker tcu::getEffectiveDepthStencilTextureFormat(format, tcu::Sampler::MODE_DEPTH);
44*35238bceSAndroid Build Coastguard Worker return tcu::getTextureFormatBitDepth(depthOnlyFormat).x();
45*35238bceSAndroid Build Coastguard Worker }
46*35238bceSAndroid Build Coastguard Worker else if (format.order == tcu::TextureFormat::D)
47*35238bceSAndroid Build Coastguard Worker return tcu::getTextureFormatBitDepth(format).x();
48*35238bceSAndroid Build Coastguard Worker else
49*35238bceSAndroid Build Coastguard Worker return 0;
50*35238bceSAndroid Build Coastguard Worker }
51*35238bceSAndroid Build Coastguard Worker
getNumStencilBits(const tcu::TextureFormat & format)52*35238bceSAndroid Build Coastguard Worker static int getNumStencilBits(const tcu::TextureFormat &format)
53*35238bceSAndroid Build Coastguard Worker {
54*35238bceSAndroid Build Coastguard Worker if (format.order == tcu::TextureFormat::DS)
55*35238bceSAndroid Build Coastguard Worker {
56*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat stencilOnlyFormat =
57*35238bceSAndroid Build Coastguard Worker tcu::getEffectiveDepthStencilTextureFormat(format, tcu::Sampler::MODE_STENCIL);
58*35238bceSAndroid Build Coastguard Worker return tcu::getTextureFormatBitDepth(stencilOnlyFormat).x();
59*35238bceSAndroid Build Coastguard Worker }
60*35238bceSAndroid Build Coastguard Worker else if (format.order == tcu::TextureFormat::S)
61*35238bceSAndroid Build Coastguard Worker return tcu::getTextureFormatBitDepth(format).x();
62*35238bceSAndroid Build Coastguard Worker else
63*35238bceSAndroid Build Coastguard Worker return 0;
64*35238bceSAndroid Build Coastguard Worker }
65*35238bceSAndroid Build Coastguard Worker
getPixelFormat(uint32_t colorFormat)66*35238bceSAndroid Build Coastguard Worker static tcu::PixelFormat getPixelFormat(uint32_t colorFormat)
67*35238bceSAndroid Build Coastguard Worker {
68*35238bceSAndroid Build Coastguard Worker const tcu::IVec4 bits = tcu::getTextureFormatBitDepth(glu::mapGLInternalFormat(colorFormat));
69*35238bceSAndroid Build Coastguard Worker return tcu::PixelFormat(bits[0], bits[1], bits[2], bits[3]);
70*35238bceSAndroid Build Coastguard Worker }
71*35238bceSAndroid Build Coastguard Worker
getDepthStencilBits(uint32_t depthStencilFormat,int * depthBits,int * stencilBits)72*35238bceSAndroid Build Coastguard Worker static void getDepthStencilBits(uint32_t depthStencilFormat, int *depthBits, int *stencilBits)
73*35238bceSAndroid Build Coastguard Worker {
74*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat combinedFormat = glu::mapGLInternalFormat(depthStencilFormat);
75*35238bceSAndroid Build Coastguard Worker
76*35238bceSAndroid Build Coastguard Worker *depthBits = getNumDepthBits(combinedFormat);
77*35238bceSAndroid Build Coastguard Worker *stencilBits = getNumStencilBits(combinedFormat);
78*35238bceSAndroid Build Coastguard Worker }
79*35238bceSAndroid Build Coastguard Worker
chooseColorFormat(const glu::RenderConfig & config)80*35238bceSAndroid Build Coastguard Worker uint32_t chooseColorFormat(const glu::RenderConfig &config)
81*35238bceSAndroid Build Coastguard Worker {
82*35238bceSAndroid Build Coastguard Worker static const uint32_t s_formats[] = {GL_RGBA8, GL_RGB8, GL_RG8, GL_R8, GL_RGBA4, GL_RGB5_A1, GL_RGB565, GL_RGB5};
83*35238bceSAndroid Build Coastguard Worker
84*35238bceSAndroid Build Coastguard Worker for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(s_formats); fmtNdx++)
85*35238bceSAndroid Build Coastguard Worker {
86*35238bceSAndroid Build Coastguard Worker const uint32_t format = s_formats[fmtNdx];
87*35238bceSAndroid Build Coastguard Worker const tcu::IVec4 bits = tcu::getTextureFormatBitDepth(glu::mapGLInternalFormat(format));
88*35238bceSAndroid Build Coastguard Worker
89*35238bceSAndroid Build Coastguard Worker if (config.redBits != glu::RenderConfig::DONT_CARE && config.redBits != bits[0])
90*35238bceSAndroid Build Coastguard Worker continue;
91*35238bceSAndroid Build Coastguard Worker
92*35238bceSAndroid Build Coastguard Worker if (config.greenBits != glu::RenderConfig::DONT_CARE && config.greenBits != bits[1])
93*35238bceSAndroid Build Coastguard Worker continue;
94*35238bceSAndroid Build Coastguard Worker
95*35238bceSAndroid Build Coastguard Worker if (config.blueBits != glu::RenderConfig::DONT_CARE && config.blueBits != bits[2])
96*35238bceSAndroid Build Coastguard Worker continue;
97*35238bceSAndroid Build Coastguard Worker
98*35238bceSAndroid Build Coastguard Worker if (config.alphaBits != glu::RenderConfig::DONT_CARE && config.alphaBits != bits[3])
99*35238bceSAndroid Build Coastguard Worker continue;
100*35238bceSAndroid Build Coastguard Worker
101*35238bceSAndroid Build Coastguard Worker return format;
102*35238bceSAndroid Build Coastguard Worker }
103*35238bceSAndroid Build Coastguard Worker
104*35238bceSAndroid Build Coastguard Worker return 0;
105*35238bceSAndroid Build Coastguard Worker }
106*35238bceSAndroid Build Coastguard Worker
chooseDepthStencilFormat(const glu::RenderConfig & config)107*35238bceSAndroid Build Coastguard Worker uint32_t chooseDepthStencilFormat(const glu::RenderConfig &config)
108*35238bceSAndroid Build Coastguard Worker {
109*35238bceSAndroid Build Coastguard Worker static const uint32_t s_formats[] = {GL_DEPTH32F_STENCIL8, GL_DEPTH24_STENCIL8, GL_DEPTH_COMPONENT32F,
110*35238bceSAndroid Build Coastguard Worker GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16, GL_STENCIL_INDEX8};
111*35238bceSAndroid Build Coastguard Worker
112*35238bceSAndroid Build Coastguard Worker for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(s_formats); fmtNdx++)
113*35238bceSAndroid Build Coastguard Worker {
114*35238bceSAndroid Build Coastguard Worker const uint32_t format = s_formats[fmtNdx];
115*35238bceSAndroid Build Coastguard Worker const tcu::TextureFormat combinedFormat = glu::mapGLInternalFormat(format);
116*35238bceSAndroid Build Coastguard Worker const int depthBits = getNumDepthBits(combinedFormat);
117*35238bceSAndroid Build Coastguard Worker const int stencilBits = getNumStencilBits(combinedFormat);
118*35238bceSAndroid Build Coastguard Worker
119*35238bceSAndroid Build Coastguard Worker if (config.depthBits != glu::RenderConfig::DONT_CARE && config.depthBits != depthBits)
120*35238bceSAndroid Build Coastguard Worker continue;
121*35238bceSAndroid Build Coastguard Worker
122*35238bceSAndroid Build Coastguard Worker if (config.stencilBits != glu::RenderConfig::DONT_CARE && config.stencilBits != stencilBits)
123*35238bceSAndroid Build Coastguard Worker continue;
124*35238bceSAndroid Build Coastguard Worker
125*35238bceSAndroid Build Coastguard Worker return format;
126*35238bceSAndroid Build Coastguard Worker }
127*35238bceSAndroid Build Coastguard Worker
128*35238bceSAndroid Build Coastguard Worker return 0;
129*35238bceSAndroid Build Coastguard Worker }
130*35238bceSAndroid Build Coastguard Worker
FboRenderContext(RenderContext * context,const RenderConfig & config)131*35238bceSAndroid Build Coastguard Worker FboRenderContext::FboRenderContext(RenderContext *context, const RenderConfig &config)
132*35238bceSAndroid Build Coastguard Worker : m_context(context)
133*35238bceSAndroid Build Coastguard Worker , m_framebuffer(0)
134*35238bceSAndroid Build Coastguard Worker , m_colorBuffer(0)
135*35238bceSAndroid Build Coastguard Worker , m_depthStencilBuffer(0)
136*35238bceSAndroid Build Coastguard Worker , m_renderTarget()
137*35238bceSAndroid Build Coastguard Worker {
138*35238bceSAndroid Build Coastguard Worker try
139*35238bceSAndroid Build Coastguard Worker {
140*35238bceSAndroid Build Coastguard Worker createFramebuffer(config);
141*35238bceSAndroid Build Coastguard Worker }
142*35238bceSAndroid Build Coastguard Worker catch (...)
143*35238bceSAndroid Build Coastguard Worker {
144*35238bceSAndroid Build Coastguard Worker destroyFramebuffer();
145*35238bceSAndroid Build Coastguard Worker throw;
146*35238bceSAndroid Build Coastguard Worker }
147*35238bceSAndroid Build Coastguard Worker }
148*35238bceSAndroid Build Coastguard Worker
FboRenderContext(const ContextFactory & factory,const RenderConfig & config,const tcu::CommandLine & cmdLine)149*35238bceSAndroid Build Coastguard Worker FboRenderContext::FboRenderContext(const ContextFactory &factory, const RenderConfig &config,
150*35238bceSAndroid Build Coastguard Worker const tcu::CommandLine &cmdLine)
151*35238bceSAndroid Build Coastguard Worker : m_context(DE_NULL)
152*35238bceSAndroid Build Coastguard Worker , m_framebuffer(0)
153*35238bceSAndroid Build Coastguard Worker , m_colorBuffer(0)
154*35238bceSAndroid Build Coastguard Worker , m_depthStencilBuffer(0)
155*35238bceSAndroid Build Coastguard Worker , m_renderTarget()
156*35238bceSAndroid Build Coastguard Worker {
157*35238bceSAndroid Build Coastguard Worker try
158*35238bceSAndroid Build Coastguard Worker {
159*35238bceSAndroid Build Coastguard Worker RenderConfig nativeRenderConfig;
160*35238bceSAndroid Build Coastguard Worker nativeRenderConfig.type = config.type;
161*35238bceSAndroid Build Coastguard Worker nativeRenderConfig.windowVisibility = config.windowVisibility;
162*35238bceSAndroid Build Coastguard Worker // \note All other properties are defaults, mostly DONT_CARE
163*35238bceSAndroid Build Coastguard Worker m_context = factory.createContext(nativeRenderConfig, cmdLine, DE_NULL);
164*35238bceSAndroid Build Coastguard Worker createFramebuffer(config);
165*35238bceSAndroid Build Coastguard Worker }
166*35238bceSAndroid Build Coastguard Worker catch (...)
167*35238bceSAndroid Build Coastguard Worker {
168*35238bceSAndroid Build Coastguard Worker delete m_context;
169*35238bceSAndroid Build Coastguard Worker throw;
170*35238bceSAndroid Build Coastguard Worker }
171*35238bceSAndroid Build Coastguard Worker }
172*35238bceSAndroid Build Coastguard Worker
~FboRenderContext(void)173*35238bceSAndroid Build Coastguard Worker FboRenderContext::~FboRenderContext(void)
174*35238bceSAndroid Build Coastguard Worker {
175*35238bceSAndroid Build Coastguard Worker // \todo [2013-04-08 pyry] Do we want to destry FBO before destroying context?
176*35238bceSAndroid Build Coastguard Worker delete m_context;
177*35238bceSAndroid Build Coastguard Worker }
178*35238bceSAndroid Build Coastguard Worker
postIterate(void)179*35238bceSAndroid Build Coastguard Worker void FboRenderContext::postIterate(void)
180*35238bceSAndroid Build Coastguard Worker {
181*35238bceSAndroid Build Coastguard Worker // \todo [2012-11-27 pyry] Blit to default framebuffer in ES3?
182*35238bceSAndroid Build Coastguard Worker m_context->getFunctions().finish();
183*35238bceSAndroid Build Coastguard Worker }
184*35238bceSAndroid Build Coastguard Worker
makeCurrent(void)185*35238bceSAndroid Build Coastguard Worker void FboRenderContext::makeCurrent(void)
186*35238bceSAndroid Build Coastguard Worker {
187*35238bceSAndroid Build Coastguard Worker m_context->makeCurrent();
188*35238bceSAndroid Build Coastguard Worker }
189*35238bceSAndroid Build Coastguard Worker
createFramebuffer(const RenderConfig & config)190*35238bceSAndroid Build Coastguard Worker void FboRenderContext::createFramebuffer(const RenderConfig &config)
191*35238bceSAndroid Build Coastguard Worker {
192*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_framebuffer == 0 && m_colorBuffer == 0 && m_depthStencilBuffer == 0);
193*35238bceSAndroid Build Coastguard Worker
194*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context->getFunctions();
195*35238bceSAndroid Build Coastguard Worker const uint32_t colorFormat = chooseColorFormat(config);
196*35238bceSAndroid Build Coastguard Worker const uint32_t depthStencilFormat = chooseDepthStencilFormat(config);
197*35238bceSAndroid Build Coastguard Worker int width = config.width;
198*35238bceSAndroid Build Coastguard Worker int height = config.height;
199*35238bceSAndroid Build Coastguard Worker tcu::PixelFormat pixelFormat;
200*35238bceSAndroid Build Coastguard Worker int depthBits = 0;
201*35238bceSAndroid Build Coastguard Worker int stencilBits = 0;
202*35238bceSAndroid Build Coastguard Worker
203*35238bceSAndroid Build Coastguard Worker if (config.numSamples > 0 && !gl.renderbufferStorageMultisample)
204*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Multisample FBO is not supported");
205*35238bceSAndroid Build Coastguard Worker
206*35238bceSAndroid Build Coastguard Worker if (colorFormat == 0)
207*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Unsupported color attachment format");
208*35238bceSAndroid Build Coastguard Worker
209*35238bceSAndroid Build Coastguard Worker if (width == glu::RenderConfig::DONT_CARE || height == glu::RenderConfig::DONT_CARE)
210*35238bceSAndroid Build Coastguard Worker {
211*35238bceSAndroid Build Coastguard Worker int maxSize = 0;
212*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
213*35238bceSAndroid Build Coastguard Worker
214*35238bceSAndroid Build Coastguard Worker width = (width == glu::RenderConfig::DONT_CARE) ? maxSize : width;
215*35238bceSAndroid Build Coastguard Worker height = (height == glu::RenderConfig::DONT_CARE) ? maxSize : height;
216*35238bceSAndroid Build Coastguard Worker }
217*35238bceSAndroid Build Coastguard Worker
218*35238bceSAndroid Build Coastguard Worker {
219*35238bceSAndroid Build Coastguard Worker pixelFormat = getPixelFormat(colorFormat);
220*35238bceSAndroid Build Coastguard Worker
221*35238bceSAndroid Build Coastguard Worker gl.genRenderbuffers(1, &m_colorBuffer);
222*35238bceSAndroid Build Coastguard Worker gl.bindRenderbuffer(GL_RENDERBUFFER, m_colorBuffer);
223*35238bceSAndroid Build Coastguard Worker
224*35238bceSAndroid Build Coastguard Worker if (config.numSamples > 0)
225*35238bceSAndroid Build Coastguard Worker gl.renderbufferStorageMultisample(GL_RENDERBUFFER, config.numSamples, colorFormat, width, height);
226*35238bceSAndroid Build Coastguard Worker else
227*35238bceSAndroid Build Coastguard Worker gl.renderbufferStorage(GL_RENDERBUFFER, colorFormat, width, height);
228*35238bceSAndroid Build Coastguard Worker
229*35238bceSAndroid Build Coastguard Worker gl.bindRenderbuffer(GL_RENDERBUFFER, 0);
230*35238bceSAndroid Build Coastguard Worker GLU_EXPECT_NO_ERROR(gl.getError(), "Creating color renderbuffer");
231*35238bceSAndroid Build Coastguard Worker }
232*35238bceSAndroid Build Coastguard Worker
233*35238bceSAndroid Build Coastguard Worker if (depthStencilFormat != GL_NONE)
234*35238bceSAndroid Build Coastguard Worker {
235*35238bceSAndroid Build Coastguard Worker getDepthStencilBits(depthStencilFormat, &depthBits, &stencilBits);
236*35238bceSAndroid Build Coastguard Worker
237*35238bceSAndroid Build Coastguard Worker gl.genRenderbuffers(1, &m_depthStencilBuffer);
238*35238bceSAndroid Build Coastguard Worker gl.bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
239*35238bceSAndroid Build Coastguard Worker
240*35238bceSAndroid Build Coastguard Worker if (config.numSamples > 0)
241*35238bceSAndroid Build Coastguard Worker gl.renderbufferStorageMultisample(GL_RENDERBUFFER, config.numSamples, depthStencilFormat, width, height);
242*35238bceSAndroid Build Coastguard Worker else
243*35238bceSAndroid Build Coastguard Worker gl.renderbufferStorage(GL_RENDERBUFFER, depthStencilFormat, width, height);
244*35238bceSAndroid Build Coastguard Worker
245*35238bceSAndroid Build Coastguard Worker gl.bindRenderbuffer(GL_RENDERBUFFER, 0);
246*35238bceSAndroid Build Coastguard Worker GLU_EXPECT_NO_ERROR(gl.getError(), "Creating depth / stencil renderbuffer");
247*35238bceSAndroid Build Coastguard Worker }
248*35238bceSAndroid Build Coastguard Worker
249*35238bceSAndroid Build Coastguard Worker gl.genFramebuffers(1, &m_framebuffer);
250*35238bceSAndroid Build Coastguard Worker gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
251*35238bceSAndroid Build Coastguard Worker
252*35238bceSAndroid Build Coastguard Worker if (m_colorBuffer)
253*35238bceSAndroid Build Coastguard Worker gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorBuffer);
254*35238bceSAndroid Build Coastguard Worker
255*35238bceSAndroid Build Coastguard Worker if (m_depthStencilBuffer)
256*35238bceSAndroid Build Coastguard Worker {
257*35238bceSAndroid Build Coastguard Worker if (depthBits > 0)
258*35238bceSAndroid Build Coastguard Worker gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
259*35238bceSAndroid Build Coastguard Worker
260*35238bceSAndroid Build Coastguard Worker if (stencilBits > 0)
261*35238bceSAndroid Build Coastguard Worker gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
262*35238bceSAndroid Build Coastguard Worker }
263*35238bceSAndroid Build Coastguard Worker
264*35238bceSAndroid Build Coastguard Worker GLU_EXPECT_NO_ERROR(gl.getError(), "Creating framebuffer");
265*35238bceSAndroid Build Coastguard Worker
266*35238bceSAndroid Build Coastguard Worker if (gl.checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
267*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("Framebuffer is not complete");
268*35238bceSAndroid Build Coastguard Worker
269*35238bceSAndroid Build Coastguard Worker // Set up correct viewport for first test case.
270*35238bceSAndroid Build Coastguard Worker gl.viewport(0, 0, width, height);
271*35238bceSAndroid Build Coastguard Worker
272*35238bceSAndroid Build Coastguard Worker m_renderTarget = tcu::RenderTarget(width, height, pixelFormat, depthBits, stencilBits, config.numSamples);
273*35238bceSAndroid Build Coastguard Worker }
274*35238bceSAndroid Build Coastguard Worker
destroyFramebuffer(void)275*35238bceSAndroid Build Coastguard Worker void FboRenderContext::destroyFramebuffer(void)
276*35238bceSAndroid Build Coastguard Worker {
277*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context->getFunctions();
278*35238bceSAndroid Build Coastguard Worker
279*35238bceSAndroid Build Coastguard Worker if (m_framebuffer)
280*35238bceSAndroid Build Coastguard Worker {
281*35238bceSAndroid Build Coastguard Worker gl.deleteFramebuffers(1, &m_framebuffer);
282*35238bceSAndroid Build Coastguard Worker m_framebuffer = 0;
283*35238bceSAndroid Build Coastguard Worker }
284*35238bceSAndroid Build Coastguard Worker
285*35238bceSAndroid Build Coastguard Worker if (m_depthStencilBuffer)
286*35238bceSAndroid Build Coastguard Worker {
287*35238bceSAndroid Build Coastguard Worker gl.deleteRenderbuffers(1, &m_depthStencilBuffer);
288*35238bceSAndroid Build Coastguard Worker m_depthStencilBuffer = 0;
289*35238bceSAndroid Build Coastguard Worker }
290*35238bceSAndroid Build Coastguard Worker
291*35238bceSAndroid Build Coastguard Worker if (m_colorBuffer)
292*35238bceSAndroid Build Coastguard Worker {
293*35238bceSAndroid Build Coastguard Worker gl.deleteRenderbuffers(1, &m_colorBuffer);
294*35238bceSAndroid Build Coastguard Worker m_colorBuffer = 0;
295*35238bceSAndroid Build Coastguard Worker }
296*35238bceSAndroid Build Coastguard Worker }
297*35238bceSAndroid Build Coastguard Worker
298*35238bceSAndroid Build Coastguard Worker } // namespace glu
299