blob: 7c1545cb140a6945c5582aa45c4bee37a222bda8 [file] [log] [blame]
Geoff Langf9a6f082015-01-22 13:32:49 -05001//
2// Copyright 2015 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// RendererGL.cpp: Implements the class methods for RendererGL.
8
9#include "libANGLE/renderer/gl/RendererGL.h"
10
11#include "common/debug.h"
Geoff Langc4152832015-02-20 09:57:29 -050012#include "libANGLE/Data.h"
Geoff Langf9a6f082015-01-22 13:32:49 -050013#include "libANGLE/renderer/gl/BufferGL.h"
14#include "libANGLE/renderer/gl/CompilerGL.h"
15#include "libANGLE/renderer/gl/DefaultAttachmentGL.h"
16#include "libANGLE/renderer/gl/FenceNVGL.h"
17#include "libANGLE/renderer/gl/FenceSyncGL.h"
18#include "libANGLE/renderer/gl/FramebufferGL.h"
Geoff Lang56cf9af2015-02-17 10:16:49 -050019#include "libANGLE/renderer/gl/FunctionsGL.h"
Geoff Langf9a6f082015-01-22 13:32:49 -050020#include "libANGLE/renderer/gl/ProgramGL.h"
21#include "libANGLE/renderer/gl/QueryGL.h"
22#include "libANGLE/renderer/gl/RenderbufferGL.h"
23#include "libANGLE/renderer/gl/ShaderGL.h"
24#include "libANGLE/renderer/gl/TextureGL.h"
25#include "libANGLE/renderer/gl/TransformFeedbackGL.h"
26#include "libANGLE/renderer/gl/VertexArrayGL.h"
27
28namespace rx
29{
30
Geoff Lang56cf9af2015-02-17 10:16:49 -050031RendererGL::RendererGL(const FunctionsGL *functions)
32 : Renderer(),
33 mFunctions(functions)
34{
35 ASSERT(mFunctions);
36}
Geoff Langf9a6f082015-01-22 13:32:49 -050037
38RendererGL::~RendererGL()
39{}
40
41gl::Error RendererGL::flush()
42{
43 UNIMPLEMENTED();
44 return gl::Error(GL_INVALID_OPERATION);
45}
46
47gl::Error RendererGL::finish()
48{
49 UNIMPLEMENTED();
50 return gl::Error(GL_INVALID_OPERATION);
51}
52
53gl::Error RendererGL::drawArrays(const gl::Data &data, GLenum mode,
54 GLint first, GLsizei count, GLsizei instances)
55{
56 UNIMPLEMENTED();
57 return gl::Error(GL_INVALID_OPERATION);
58}
59
60gl::Error RendererGL::drawElements(const gl::Data &data, GLenum mode, GLsizei count, GLenum type,
61 const GLvoid *indices, GLsizei instances,
62 const RangeUI &indexRange)
63{
64 UNIMPLEMENTED();
65 return gl::Error(GL_INVALID_OPERATION);
66}
67
68CompilerImpl *RendererGL::createCompiler(const gl::Data &data)
69{
Geoff Langc4152832015-02-20 09:57:29 -050070 return new CompilerGL(data);
Geoff Langf9a6f082015-01-22 13:32:49 -050071}
72
73ShaderImpl *RendererGL::createShader(GLenum type)
74{
Geoff Lang295ed4c2015-02-20 09:58:25 -050075 return new ShaderGL(type, mFunctions);
Geoff Langf9a6f082015-01-22 13:32:49 -050076}
77
78ProgramImpl *RendererGL::createProgram()
79{
80 return new ProgramGL();
81}
82
83DefaultAttachmentImpl *RendererGL::createDefaultAttachment(GLenum type, egl::Surface *surface)
84{
85 return new DefaultAttachmentGL();
86}
87
88FramebufferImpl *RendererGL::createFramebuffer()
89{
90 return new FramebufferGL();
91}
92
93TextureImpl *RendererGL::createTexture(GLenum target)
94{
95 return new TextureGL();
96}
97
98RenderbufferImpl *RendererGL::createRenderbuffer()
99{
100 return new RenderbufferGL();
101}
102
103BufferImpl *RendererGL::createBuffer()
104{
105 return new BufferGL();
106}
107
108VertexArrayImpl *RendererGL::createVertexArray()
109{
110 return new VertexArrayGL();
111}
112
113QueryImpl *RendererGL::createQuery(GLenum type)
114{
115 return new QueryGL(type);
116}
117
118FenceNVImpl *RendererGL::createFenceNV()
119{
120 return new FenceNVGL();
121}
122
123FenceSyncImpl *RendererGL::createFenceSync()
124{
125 return new FenceSyncGL();
126}
127
128TransformFeedbackImpl *RendererGL::createTransformFeedback()
129{
130 return new TransformFeedbackGL();
131}
132
133void RendererGL::notifyDeviceLost()
134{
135 UNIMPLEMENTED();
136}
137
138bool RendererGL::isDeviceLost() const
139{
140 UNIMPLEMENTED();
141 return bool();
142}
143
144bool RendererGL::testDeviceLost()
145{
146 UNIMPLEMENTED();
147 return bool();
148}
149
150bool RendererGL::testDeviceResettable()
151{
152 UNIMPLEMENTED();
153 return bool();
154}
155
156VendorID RendererGL::getVendorId() const
157{
158 UNIMPLEMENTED();
159 return VendorID();
160}
161
162std::string RendererGL::getVendorString() const
163{
164 UNIMPLEMENTED();
165 return std::string();
166}
167
168std::string RendererGL::getRendererDescription() const
169{
170 UNIMPLEMENTED();
171 return std::string();
172}
173
174void RendererGL::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps, gl::Extensions *outExtensions) const
175{
176 // Set some minimum GLES2 caps, TODO: query for real GL caps
177 outCaps->maxElementIndex = static_cast<GLint64>(std::numeric_limits<unsigned int>::max());
178 outCaps->max3DTextureSize = 0;
179 outCaps->max2DTextureSize = 1024;
180 outCaps->maxCubeMapTextureSize = outCaps->max2DTextureSize;
181 outCaps->maxArrayTextureLayers = 1;
182 outCaps->maxLODBias = 0.0f;
183 outCaps->maxRenderbufferSize = outCaps->max2DTextureSize;
184 outCaps->maxDrawBuffers = 1;
185 outCaps->maxColorAttachments = 1;
186 outCaps->maxViewportWidth = outCaps->max2DTextureSize;
187 outCaps->maxViewportHeight = outCaps->maxViewportWidth;
188 outCaps->minAliasedPointSize = 1.0f;
189 outCaps->maxAliasedPointSize = 1.0f;
190 outCaps->minAliasedLineWidth = 1.0f;
191 outCaps->maxAliasedLineWidth = 1.0f;
192 outCaps->maxElementsIndices = 0;
193 outCaps->maxElementsVertices = 0;
194 outCaps->maxServerWaitTimeout = 0;
195 outCaps->maxVertexAttributes = 16;
196 outCaps->maxVertexUniformVectors = 256;
197 outCaps->maxVertexUniformVectors = outCaps->maxVertexUniformVectors * 4;
198 outCaps->maxVertexUniformBlocks = 0;
199 outCaps->maxVertexOutputComponents = 16;
200 outCaps->maxVertexTextureImageUnits = outCaps->maxTextureImageUnits;
201 outCaps->maxFragmentUniformVectors = 256;
202 outCaps->maxFragmentUniformComponents = outCaps->maxFragmentUniformVectors * 4;
203 outCaps->maxFragmentUniformBlocks = 0;
204 outCaps->maxFragmentInputComponents = outCaps->maxVertexOutputComponents;
205 outCaps->maxTextureImageUnits = 16;
206 outCaps->minProgramTexelOffset = 0;
207 outCaps->maxProgramTexelOffset = 0;
208 outCaps->maxUniformBufferBindings = 0;
209 outCaps->maxUniformBlockSize = 0;
210 outCaps->uniformBufferOffsetAlignment = 0;
211 outCaps->maxCombinedUniformBlocks = 0;
212 outCaps->maxCombinedVertexUniformComponents = 0;
213 outCaps->maxCombinedFragmentUniformComponents = 0;
214 outCaps->maxVaryingComponents = 0;
215 outCaps->maxVaryingVectors = outCaps->maxVertexOutputComponents / 4;
216 outCaps->maxCombinedTextureImageUnits = outCaps->maxVertexTextureImageUnits + outCaps->maxTextureImageUnits;
217 outCaps->maxTransformFeedbackInterleavedComponents = 0;
218 outCaps->maxTransformFeedbackSeparateAttributes = 0;
219 outCaps->maxTransformFeedbackSeparateComponents = 0;
220
221 gl::TextureCaps supportedTextureFormat;
222 supportedTextureFormat.texturable = true;
223 supportedTextureFormat.filterable = true;
224 supportedTextureFormat.renderable = true;
225
226 outTextureCaps->insert(GL_RGB565, supportedTextureFormat);
227 outTextureCaps->insert(GL_RGBA4, supportedTextureFormat);
228 outTextureCaps->insert(GL_RGB5_A1, supportedTextureFormat);
229 outTextureCaps->insert(GL_RGB8_OES, supportedTextureFormat);
230 outTextureCaps->insert(GL_RGBA8_OES, supportedTextureFormat);
231
232 outTextureCaps->insert(GL_DEPTH_COMPONENT16, supportedTextureFormat);
233 outTextureCaps->insert(GL_STENCIL_INDEX8, supportedTextureFormat);
234
235 outExtensions->setTextureExtensionSupport(*outTextureCaps);
236 outExtensions->textureNPOT = true;
237 outExtensions->textureStorage = true;
238}
239
240Workarounds RendererGL::generateWorkarounds() const
241{
242 Workarounds workarounds;
243 return workarounds;
244}
245
246}