Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -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 | // ContextVk.cpp: |
| 7 | // Implements the class methods for ContextVk. |
| 8 | // |
| 9 | |
| 10 | #include "libANGLE/renderer/vulkan/ContextVk.h" |
| 11 | |
| 12 | #include "common/debug.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 13 | #include "libANGLE/renderer/vulkan/BufferVk.h" |
| 14 | #include "libANGLE/renderer/vulkan/CompilerVk.h" |
| 15 | #include "libANGLE/renderer/vulkan/ContextVk.h" |
| 16 | #include "libANGLE/renderer/vulkan/DeviceVk.h" |
| 17 | #include "libANGLE/renderer/vulkan/FenceNVVk.h" |
| 18 | #include "libANGLE/renderer/vulkan/FenceSyncVk.h" |
| 19 | #include "libANGLE/renderer/vulkan/FramebufferVk.h" |
| 20 | #include "libANGLE/renderer/vulkan/ImageVk.h" |
| 21 | #include "libANGLE/renderer/vulkan/ProgramVk.h" |
| 22 | #include "libANGLE/renderer/vulkan/QueryVk.h" |
| 23 | #include "libANGLE/renderer/vulkan/RenderbufferVk.h" |
| 24 | #include "libANGLE/renderer/vulkan/RendererVk.h" |
| 25 | #include "libANGLE/renderer/vulkan/SamplerVk.h" |
| 26 | #include "libANGLE/renderer/vulkan/ShaderVk.h" |
| 27 | #include "libANGLE/renderer/vulkan/TextureVk.h" |
| 28 | #include "libANGLE/renderer/vulkan/TransformFeedbackVk.h" |
| 29 | #include "libANGLE/renderer/vulkan/VertexArrayVk.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 30 | |
| 31 | namespace rx |
| 32 | { |
| 33 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 34 | ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer) |
| 35 | : ContextImpl(state), mRenderer(renderer) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 36 | { |
| 37 | } |
| 38 | |
| 39 | ContextVk::~ContextVk() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | gl::Error ContextVk::initialize() |
| 44 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame^] | 45 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | gl::Error ContextVk::flush() |
| 49 | { |
| 50 | UNIMPLEMENTED(); |
| 51 | return gl::Error(GL_INVALID_OPERATION); |
| 52 | } |
| 53 | |
| 54 | gl::Error ContextVk::finish() |
| 55 | { |
| 56 | UNIMPLEMENTED(); |
| 57 | return gl::Error(GL_INVALID_OPERATION); |
| 58 | } |
| 59 | |
| 60 | gl::Error ContextVk::drawArrays(GLenum mode, GLint first, GLsizei count) |
| 61 | { |
| 62 | UNIMPLEMENTED(); |
| 63 | return gl::Error(GL_INVALID_OPERATION); |
| 64 | } |
| 65 | |
| 66 | gl::Error ContextVk::drawArraysInstanced(GLenum mode, |
| 67 | GLint first, |
| 68 | GLsizei count, |
| 69 | GLsizei instanceCount) |
| 70 | { |
| 71 | UNIMPLEMENTED(); |
| 72 | return gl::Error(GL_INVALID_OPERATION); |
| 73 | } |
| 74 | |
| 75 | gl::Error ContextVk::drawElements(GLenum mode, |
| 76 | GLsizei count, |
| 77 | GLenum type, |
| 78 | const GLvoid *indices, |
| 79 | const gl::IndexRange &indexRange) |
| 80 | { |
| 81 | UNIMPLEMENTED(); |
| 82 | return gl::Error(GL_INVALID_OPERATION); |
| 83 | } |
| 84 | |
| 85 | gl::Error ContextVk::drawElementsInstanced(GLenum mode, |
| 86 | GLsizei count, |
| 87 | GLenum type, |
| 88 | const GLvoid *indices, |
| 89 | GLsizei instances, |
| 90 | const gl::IndexRange &indexRange) |
| 91 | { |
| 92 | UNIMPLEMENTED(); |
| 93 | return gl::Error(GL_INVALID_OPERATION); |
| 94 | } |
| 95 | |
| 96 | gl::Error ContextVk::drawRangeElements(GLenum mode, |
| 97 | GLuint start, |
| 98 | GLuint end, |
| 99 | GLsizei count, |
| 100 | GLenum type, |
| 101 | const GLvoid *indices, |
| 102 | const gl::IndexRange &indexRange) |
| 103 | { |
| 104 | UNIMPLEMENTED(); |
| 105 | return gl::Error(GL_INVALID_OPERATION); |
| 106 | } |
| 107 | |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 108 | gl::Error ContextVk::drawArraysIndirect(GLenum mode, const GLvoid *indirect) |
| 109 | { |
| 110 | UNIMPLEMENTED(); |
| 111 | return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend."; |
| 112 | } |
| 113 | |
| 114 | gl::Error ContextVk::drawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect) |
| 115 | { |
| 116 | UNIMPLEMENTED(); |
| 117 | return gl::InternalError() |
| 118 | << "DrawElementsIndirect hasn't been implemented for vulkan backend."; |
| 119 | } |
| 120 | |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 121 | GLenum ContextVk::getResetStatus() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 122 | { |
| 123 | UNIMPLEMENTED(); |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 124 | return GL_NO_ERROR; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | std::string ContextVk::getVendorString() const |
| 128 | { |
| 129 | UNIMPLEMENTED(); |
| 130 | return std::string(); |
| 131 | } |
| 132 | |
| 133 | std::string ContextVk::getRendererDescription() const |
| 134 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame^] | 135 | return mRenderer->getRendererDescription(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | void ContextVk::insertEventMarker(GLsizei length, const char *marker) |
| 139 | { |
| 140 | UNIMPLEMENTED(); |
| 141 | } |
| 142 | |
| 143 | void ContextVk::pushGroupMarker(GLsizei length, const char *marker) |
| 144 | { |
| 145 | UNIMPLEMENTED(); |
| 146 | } |
| 147 | |
| 148 | void ContextVk::popGroupMarker() |
| 149 | { |
| 150 | UNIMPLEMENTED(); |
| 151 | } |
| 152 | |
| 153 | void ContextVk::syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits) |
| 154 | { |
| 155 | UNIMPLEMENTED(); |
| 156 | } |
| 157 | |
| 158 | GLint ContextVk::getGPUDisjoint() |
| 159 | { |
| 160 | UNIMPLEMENTED(); |
| 161 | return GLint(); |
| 162 | } |
| 163 | |
| 164 | GLint64 ContextVk::getTimestamp() |
| 165 | { |
| 166 | UNIMPLEMENTED(); |
| 167 | return GLint64(); |
| 168 | } |
| 169 | |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame^] | 170 | void ContextVk::onMakeCurrent(const gl::ContextState & /*data*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 171 | { |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | const gl::Caps &ContextVk::getNativeCaps() const |
| 175 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 176 | return mRenderer->getNativeCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const |
| 180 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 181 | return mRenderer->getNativeTextureCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | const gl::Extensions &ContextVk::getNativeExtensions() const |
| 185 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 186 | return mRenderer->getNativeExtensions(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | const gl::Limitations &ContextVk::getNativeLimitations() const |
| 190 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 191 | return mRenderer->getNativeLimitations(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | CompilerImpl *ContextVk::createCompiler() |
| 195 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 196 | return new CompilerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 197 | } |
| 198 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 199 | ShaderImpl *ContextVk::createShader(const gl::ShaderState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 200 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 201 | return new ShaderVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 202 | } |
| 203 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 204 | ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 205 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 206 | return new ProgramVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 207 | } |
| 208 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 209 | FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 210 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 211 | return new FramebufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | TextureImpl *ContextVk::createTexture(const gl::TextureState &state) |
| 215 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 216 | return new TextureVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | RenderbufferImpl *ContextVk::createRenderbuffer() |
| 220 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 221 | return new RenderbufferVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 222 | } |
| 223 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 224 | BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 225 | { |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 226 | return new BufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 227 | } |
| 228 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 229 | VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 230 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 231 | return new VertexArrayVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | QueryImpl *ContextVk::createQuery(GLenum type) |
| 235 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 236 | return new QueryVk(type); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | FenceNVImpl *ContextVk::createFenceNV() |
| 240 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 241 | return new FenceNVVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | FenceSyncImpl *ContextVk::createFenceSync() |
| 245 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 246 | return new FenceSyncVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 247 | } |
| 248 | |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 249 | TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 250 | { |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 251 | return new TransformFeedbackVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | SamplerImpl *ContextVk::createSampler() |
| 255 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 256 | return new SamplerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 257 | } |
| 258 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 259 | std::vector<PathImpl *> ContextVk::createPaths(GLsizei) |
| 260 | { |
| 261 | return std::vector<PathImpl *>(); |
| 262 | } |
| 263 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 264 | } // namespace rx |