Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2016 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 | // ContextNULL.cpp: |
| 7 | // Implements the class methods for ContextNULL. |
| 8 | // |
| 9 | |
| 10 | #include "libANGLE/renderer/null/ContextNULL.h" |
| 11 | |
| 12 | #include "common/debug.h" |
| 13 | |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 14 | #include "libANGLE/renderer/null/BufferNULL.h" |
| 15 | #include "libANGLE/renderer/null/CompilerNULL.h" |
| 16 | #include "libANGLE/renderer/null/DisplayNULL.h" |
| 17 | #include "libANGLE/renderer/null/FenceNVNULL.h" |
| 18 | #include "libANGLE/renderer/null/FenceSyncNULL.h" |
| 19 | #include "libANGLE/renderer/null/FramebufferNULL.h" |
| 20 | #include "libANGLE/renderer/null/ImageNULL.h" |
| 21 | #include "libANGLE/renderer/null/PathNULL.h" |
| 22 | #include "libANGLE/renderer/null/ProgramNULL.h" |
| 23 | #include "libANGLE/renderer/null/QueryNULL.h" |
| 24 | #include "libANGLE/renderer/null/RenderbufferNULL.h" |
| 25 | #include "libANGLE/renderer/null/SamplerNULL.h" |
| 26 | #include "libANGLE/renderer/null/ShaderNULL.h" |
| 27 | #include "libANGLE/renderer/null/TextureNULL.h" |
| 28 | #include "libANGLE/renderer/null/TransformFeedbackNULL.h" |
| 29 | #include "libANGLE/renderer/null/VertexArrayNULL.h" |
| 30 | |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 31 | namespace rx |
| 32 | { |
| 33 | |
| 34 | ContextNULL::ContextNULL(const gl::ContextState &state) : ContextImpl(state) |
| 35 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 36 | const gl::Version maxClientVersion(3, 1); |
| 37 | mCaps = GenerateMinimumCaps(maxClientVersion); |
| 38 | mExtensions = gl::Extensions(); |
| 39 | mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | ContextNULL::~ContextNULL() |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | gl::Error ContextNULL::initialize() |
| 47 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 48 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | gl::Error ContextNULL::flush() |
| 52 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 53 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | gl::Error ContextNULL::finish() |
| 57 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 58 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | gl::Error ContextNULL::drawArrays(GLenum mode, GLint first, GLsizei count) |
| 62 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 63 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | gl::Error ContextNULL::drawArraysInstanced(GLenum mode, |
| 67 | GLint first, |
| 68 | GLsizei count, |
| 69 | GLsizei instanceCount) |
| 70 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 71 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | gl::Error ContextNULL::drawElements(GLenum mode, |
| 75 | GLsizei count, |
| 76 | GLenum type, |
| 77 | const GLvoid *indices, |
| 78 | const gl::IndexRange &indexRange) |
| 79 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 80 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | gl::Error ContextNULL::drawElementsInstanced(GLenum mode, |
| 84 | GLsizei count, |
| 85 | GLenum type, |
| 86 | const GLvoid *indices, |
| 87 | GLsizei instances, |
| 88 | const gl::IndexRange &indexRange) |
| 89 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 90 | return gl::NoError(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | gl::Error ContextNULL::drawRangeElements(GLenum mode, |
| 94 | GLuint start, |
| 95 | GLuint end, |
| 96 | GLsizei count, |
| 97 | GLenum type, |
| 98 | const GLvoid *indices, |
| 99 | const gl::IndexRange &indexRange) |
| 100 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 101 | return gl::NoError(); |
| 102 | } |
| 103 | |
| 104 | void ContextNULL::stencilFillPath(const gl::Path *path, GLenum fillMode, GLuint mask) |
| 105 | { |
| 106 | } |
| 107 | |
| 108 | void ContextNULL::stencilStrokePath(const gl::Path *path, GLint reference, GLuint mask) |
| 109 | { |
| 110 | } |
| 111 | |
| 112 | void ContextNULL::coverFillPath(const gl::Path *path, GLenum coverMode) |
| 113 | { |
| 114 | } |
| 115 | |
| 116 | void ContextNULL::coverStrokePath(const gl::Path *path, GLenum coverMode) |
| 117 | { |
| 118 | } |
| 119 | |
| 120 | void ContextNULL::stencilThenCoverFillPath(const gl::Path *path, |
| 121 | GLenum fillMode, |
| 122 | GLuint mask, |
| 123 | GLenum coverMode) |
| 124 | { |
| 125 | } |
| 126 | |
| 127 | void ContextNULL::stencilThenCoverStrokePath(const gl::Path *path, |
| 128 | GLint reference, |
| 129 | GLuint mask, |
| 130 | GLenum coverMode) |
| 131 | { |
| 132 | } |
| 133 | |
| 134 | void ContextNULL::coverFillPathInstanced(const std::vector<gl::Path *> &paths, |
| 135 | GLenum coverMode, |
| 136 | GLenum transformType, |
| 137 | const GLfloat *transformValues) |
| 138 | { |
| 139 | } |
| 140 | |
| 141 | void ContextNULL::coverStrokePathInstanced(const std::vector<gl::Path *> &paths, |
| 142 | GLenum coverMode, |
| 143 | GLenum transformType, |
| 144 | const GLfloat *transformValues) |
| 145 | { |
| 146 | } |
| 147 | |
| 148 | void ContextNULL::stencilFillPathInstanced(const std::vector<gl::Path *> &paths, |
| 149 | GLenum fillMode, |
| 150 | GLuint mask, |
| 151 | GLenum transformType, |
| 152 | const GLfloat *transformValues) |
| 153 | { |
| 154 | } |
| 155 | |
| 156 | void ContextNULL::stencilStrokePathInstanced(const std::vector<gl::Path *> &paths, |
| 157 | GLint reference, |
| 158 | GLuint mask, |
| 159 | GLenum transformType, |
| 160 | const GLfloat *transformValues) |
| 161 | { |
| 162 | } |
| 163 | |
| 164 | void ContextNULL::stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths, |
| 165 | GLenum coverMode, |
| 166 | GLenum fillMode, |
| 167 | GLuint mask, |
| 168 | GLenum transformType, |
| 169 | const GLfloat *transformValues) |
| 170 | { |
| 171 | } |
| 172 | |
| 173 | void ContextNULL::stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths, |
| 174 | GLenum coverMode, |
| 175 | GLint reference, |
| 176 | GLuint mask, |
| 177 | GLenum transformType, |
| 178 | const GLfloat *transformValues) |
| 179 | { |
| 180 | } |
| 181 | |
| 182 | GLenum ContextNULL::getResetStatus() |
| 183 | { |
| 184 | return GL_NO_ERROR; |
| 185 | } |
| 186 | |
| 187 | std::string ContextNULL::getVendorString() const |
| 188 | { |
| 189 | return "NULL"; |
| 190 | } |
| 191 | |
| 192 | std::string ContextNULL::getRendererDescription() const |
| 193 | { |
| 194 | return "NULL"; |
| 195 | } |
| 196 | |
| 197 | void ContextNULL::insertEventMarker(GLsizei length, const char *marker) |
| 198 | { |
| 199 | } |
| 200 | |
| 201 | void ContextNULL::pushGroupMarker(GLsizei length, const char *marker) |
| 202 | { |
| 203 | } |
| 204 | |
| 205 | void ContextNULL::popGroupMarker() |
| 206 | { |
| 207 | } |
| 208 | |
| 209 | void ContextNULL::syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits) |
| 210 | { |
| 211 | } |
| 212 | |
| 213 | GLint ContextNULL::getGPUDisjoint() |
| 214 | { |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | GLint64 ContextNULL::getTimestamp() |
| 219 | { |
| 220 | return 0; |
| 221 | } |
| 222 | |
| 223 | void ContextNULL::onMakeCurrent(const gl::ContextState &data) |
| 224 | { |
| 225 | } |
| 226 | |
| 227 | const gl::Caps &ContextNULL::getNativeCaps() const |
| 228 | { |
| 229 | return mCaps; |
| 230 | } |
| 231 | |
| 232 | const gl::TextureCapsMap &ContextNULL::getNativeTextureCaps() const |
| 233 | { |
| 234 | return mTextureCaps; |
| 235 | } |
| 236 | |
| 237 | const gl::Extensions &ContextNULL::getNativeExtensions() const |
| 238 | { |
| 239 | return mExtensions; |
| 240 | } |
| 241 | |
| 242 | const gl::Limitations &ContextNULL::getNativeLimitations() const |
| 243 | { |
| 244 | return mLimitations; |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | CompilerImpl *ContextNULL::createCompiler() |
| 248 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 249 | return new CompilerNULL(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | ShaderImpl *ContextNULL::createShader(const gl::ShaderState &data) |
| 253 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 254 | return new ShaderNULL(data); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | ProgramImpl *ContextNULL::createProgram(const gl::ProgramState &data) |
| 258 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 259 | return new ProgramNULL(data); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | FramebufferImpl *ContextNULL::createFramebuffer(const gl::FramebufferState &data) |
| 263 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 264 | return new FramebufferNULL(data); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | TextureImpl *ContextNULL::createTexture(const gl::TextureState &state) |
| 268 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 269 | return new TextureNULL(state); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | RenderbufferImpl *ContextNULL::createRenderbuffer() |
| 273 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 274 | return new RenderbufferNULL(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 275 | } |
| 276 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 277 | BufferImpl *ContextNULL::createBuffer(const gl::BufferState &state) |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 278 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 279 | return new BufferNULL(state); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | VertexArrayImpl *ContextNULL::createVertexArray(const gl::VertexArrayState &data) |
| 283 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 284 | return new VertexArrayNULL(data); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | QueryImpl *ContextNULL::createQuery(GLenum type) |
| 288 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 289 | return new QueryNULL(type); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | FenceNVImpl *ContextNULL::createFenceNV() |
| 293 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 294 | return new FenceNVNULL(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | FenceSyncImpl *ContextNULL::createFenceSync() |
| 298 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 299 | return new FenceSyncNULL(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | TransformFeedbackImpl *ContextNULL::createTransformFeedback(const gl::TransformFeedbackState &state) |
| 303 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 304 | return new TransformFeedbackNULL(state); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | SamplerImpl *ContextNULL::createSampler() |
| 308 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 309 | return new SamplerNULL(); |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range) |
| 313 | { |
Geoff Lang | 76cdbd5 | 2016-09-23 16:51:04 -0400 | [diff] [blame] | 314 | std::vector<PathImpl *> result(range); |
| 315 | for (GLsizei idx = 0; idx < range; idx++) |
| 316 | { |
| 317 | result[idx] = new PathNULL(); |
| 318 | } |
| 319 | return result; |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | } // namespace rx |