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