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 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 104 | return gl::NoError(); |
| 105 | } |
| 106 | |
| 107 | VkDevice ContextVk::getDevice() const |
| 108 | { |
| 109 | return mRenderer->getDevice(); |
| 110 | } |
| 111 | |
| 112 | vk::CommandBuffer *ContextVk::getCommandBuffer() |
| 113 | { |
| 114 | return mRenderer->getCommandBuffer(); |
| 115 | } |
| 116 | |
| 117 | vk::Error ContextVk::submitCommands(const vk::CommandBuffer &commandBuffer) |
| 118 | { |
| 119 | // TODO(jmadill): Command queuing. |
| 120 | ANGLE_TRY(mRenderer->submitAndFinishCommandBuffer(commandBuffer)); |
| 121 | return vk::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 122 | } |
| 123 | |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 124 | gl::Error ContextVk::drawArraysIndirect(GLenum mode, const GLvoid *indirect) |
| 125 | { |
| 126 | UNIMPLEMENTED(); |
| 127 | return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend."; |
| 128 | } |
| 129 | |
| 130 | gl::Error ContextVk::drawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect) |
| 131 | { |
| 132 | UNIMPLEMENTED(); |
| 133 | return gl::InternalError() |
| 134 | << "DrawElementsIndirect hasn't been implemented for vulkan backend."; |
| 135 | } |
| 136 | |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 137 | GLenum ContextVk::getResetStatus() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 138 | { |
| 139 | UNIMPLEMENTED(); |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 140 | return GL_NO_ERROR; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | std::string ContextVk::getVendorString() const |
| 144 | { |
| 145 | UNIMPLEMENTED(); |
| 146 | return std::string(); |
| 147 | } |
| 148 | |
| 149 | std::string ContextVk::getRendererDescription() const |
| 150 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 151 | return mRenderer->getRendererDescription(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | void ContextVk::insertEventMarker(GLsizei length, const char *marker) |
| 155 | { |
| 156 | UNIMPLEMENTED(); |
| 157 | } |
| 158 | |
| 159 | void ContextVk::pushGroupMarker(GLsizei length, const char *marker) |
| 160 | { |
| 161 | UNIMPLEMENTED(); |
| 162 | } |
| 163 | |
| 164 | void ContextVk::popGroupMarker() |
| 165 | { |
| 166 | UNIMPLEMENTED(); |
| 167 | } |
| 168 | |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 169 | void ContextVk::syncState(const gl::State & /*state*/, const gl::State::DirtyBits & /*dirtyBits*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 170 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 171 | // TODO(jmadill): Vulkan dirty bits. |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | GLint ContextVk::getGPUDisjoint() |
| 175 | { |
| 176 | UNIMPLEMENTED(); |
| 177 | return GLint(); |
| 178 | } |
| 179 | |
| 180 | GLint64 ContextVk::getTimestamp() |
| 181 | { |
| 182 | UNIMPLEMENTED(); |
| 183 | return GLint64(); |
| 184 | } |
| 185 | |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 186 | void ContextVk::onMakeCurrent(const gl::ContextState & /*data*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 187 | { |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | const gl::Caps &ContextVk::getNativeCaps() const |
| 191 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 192 | return mRenderer->getNativeCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const |
| 196 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 197 | return mRenderer->getNativeTextureCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | const gl::Extensions &ContextVk::getNativeExtensions() const |
| 201 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 202 | return mRenderer->getNativeExtensions(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | const gl::Limitations &ContextVk::getNativeLimitations() const |
| 206 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 207 | return mRenderer->getNativeLimitations(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | CompilerImpl *ContextVk::createCompiler() |
| 211 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 212 | return new CompilerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 213 | } |
| 214 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 215 | ShaderImpl *ContextVk::createShader(const gl::ShaderState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 216 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 217 | return new ShaderVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 218 | } |
| 219 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 220 | ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 221 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 222 | return new ProgramVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 223 | } |
| 224 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 225 | FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 226 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 227 | return FramebufferVk::CreateUserFBO(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | TextureImpl *ContextVk::createTexture(const gl::TextureState &state) |
| 231 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 232 | return new TextureVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | RenderbufferImpl *ContextVk::createRenderbuffer() |
| 236 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 237 | return new RenderbufferVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 238 | } |
| 239 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 240 | BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 241 | { |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 242 | return new BufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 243 | } |
| 244 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 245 | VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 246 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 247 | return new VertexArrayVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | QueryImpl *ContextVk::createQuery(GLenum type) |
| 251 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 252 | return new QueryVk(type); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | FenceNVImpl *ContextVk::createFenceNV() |
| 256 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 257 | return new FenceNVVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | FenceSyncImpl *ContextVk::createFenceSync() |
| 261 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 262 | return new FenceSyncVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 263 | } |
| 264 | |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 265 | TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 266 | { |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 267 | return new TransformFeedbackVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | SamplerImpl *ContextVk::createSampler() |
| 271 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 272 | return new SamplerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 273 | } |
| 274 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 275 | std::vector<PathImpl *> ContextVk::createPaths(GLsizei) |
| 276 | { |
| 277 | return std::vector<PathImpl *>(); |
| 278 | } |
| 279 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 280 | } // namespace rx |