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 | |
Jamie Madill | 20e005b | 2017-04-07 14:19:22 -0400 | [diff] [blame] | 12 | #include "common/bitset_utils.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 13 | #include "common/debug.h" |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 14 | #include "common/utilities.h" |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 15 | #include "libANGLE/Context.h" |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 16 | #include "libANGLE/Program.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 17 | #include "libANGLE/renderer/vulkan/BufferVk.h" |
Jamie Madill | 1f46bc1 | 2018-02-20 16:09:43 -0500 | [diff] [blame] | 18 | #include "libANGLE/renderer/vulkan/CommandGraph.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 19 | #include "libANGLE/renderer/vulkan/CompilerVk.h" |
| 20 | #include "libANGLE/renderer/vulkan/ContextVk.h" |
| 21 | #include "libANGLE/renderer/vulkan/DeviceVk.h" |
| 22 | #include "libANGLE/renderer/vulkan/FenceNVVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 23 | #include "libANGLE/renderer/vulkan/FramebufferVk.h" |
| 24 | #include "libANGLE/renderer/vulkan/ImageVk.h" |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 25 | #include "libANGLE/renderer/vulkan/ProgramPipelineVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 26 | #include "libANGLE/renderer/vulkan/ProgramVk.h" |
| 27 | #include "libANGLE/renderer/vulkan/QueryVk.h" |
| 28 | #include "libANGLE/renderer/vulkan/RenderbufferVk.h" |
| 29 | #include "libANGLE/renderer/vulkan/RendererVk.h" |
| 30 | #include "libANGLE/renderer/vulkan/SamplerVk.h" |
| 31 | #include "libANGLE/renderer/vulkan/ShaderVk.h" |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 32 | #include "libANGLE/renderer/vulkan/SyncVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 33 | #include "libANGLE/renderer/vulkan/TextureVk.h" |
| 34 | #include "libANGLE/renderer/vulkan/TransformFeedbackVk.h" |
| 35 | #include "libANGLE/renderer/vulkan/VertexArrayVk.h" |
Jamie Madill | 3c424b4 | 2018-01-19 12:35:09 -0500 | [diff] [blame] | 36 | #include "libANGLE/renderer/vulkan/vk_format_utils.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 37 | |
| 38 | namespace rx |
| 39 | { |
| 40 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 41 | namespace |
| 42 | { |
| 43 | |
| 44 | VkIndexType GetVkIndexType(GLenum glIndexType) |
| 45 | { |
| 46 | switch (glIndexType) |
| 47 | { |
Luc Ferron | 80964f9 | 2018-03-08 10:31:24 -0500 | [diff] [blame^] | 48 | case GL_UNSIGNED_BYTE: |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 49 | case GL_UNSIGNED_SHORT: |
| 50 | return VK_INDEX_TYPE_UINT16; |
| 51 | case GL_UNSIGNED_INT: |
| 52 | return VK_INDEX_TYPE_UINT32; |
| 53 | default: |
| 54 | UNREACHABLE(); |
| 55 | return VK_INDEX_TYPE_MAX_ENUM; |
| 56 | } |
| 57 | } |
| 58 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 59 | enum DescriptorPoolIndex : uint8_t |
| 60 | { |
| 61 | UniformBufferPool = 0, |
| 62 | TexturePool = 1, |
| 63 | }; |
| 64 | |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 65 | constexpr size_t kStreamingVertexDataSize = 1024 * 1024; |
| 66 | constexpr size_t kStreamingIndexDataSize = 1024 * 8; |
| 67 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 68 | } // anonymous namespace |
| 69 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 70 | ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer) |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 71 | : ContextImpl(state), |
| 72 | mRenderer(renderer), |
| 73 | mCurrentDrawMode(GL_NONE), |
| 74 | mVertexArrayDirty(false), |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 75 | mTexturesDirty(false), |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 76 | mStreamingVertexData(VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, kStreamingVertexDataSize), |
| 77 | mStreamingIndexData(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, kStreamingIndexDataSize) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 78 | { |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 79 | memset(&mClearColorValue, 0, sizeof(mClearColorValue)); |
| 80 | memset(&mClearDepthStencilValue, 0, sizeof(mClearDepthStencilValue)); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | ContextVk::~ContextVk() |
| 84 | { |
| 85 | } |
| 86 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 87 | void ContextVk::onDestroy(const gl::Context *context) |
| 88 | { |
| 89 | VkDevice device = mRenderer->getDevice(); |
| 90 | |
| 91 | mDescriptorPool.destroy(device); |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 92 | mStreamingVertexData.destroy(device); |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 93 | mStreamingIndexData.destroy(device); |
Luc Ferron | 360098d | 2018-02-21 07:33:50 -0500 | [diff] [blame] | 94 | mLineLoopHandler.destroy(device); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 95 | } |
| 96 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 97 | gl::Error ContextVk::initialize() |
| 98 | { |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 99 | VkDevice device = mRenderer->getDevice(); |
| 100 | |
| 101 | VkDescriptorPoolSize poolSizes[2]; |
| 102 | poolSizes[UniformBufferPool].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; |
| 103 | poolSizes[UniformBufferPool].descriptorCount = 1024; |
| 104 | poolSizes[TexturePool].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; |
| 105 | poolSizes[TexturePool].descriptorCount = 1024; |
| 106 | |
| 107 | VkDescriptorPoolCreateInfo descriptorPoolInfo; |
| 108 | descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; |
| 109 | descriptorPoolInfo.pNext = nullptr; |
| 110 | descriptorPoolInfo.flags = 0; |
| 111 | |
| 112 | // TODO(jmadill): Pick non-arbitrary max. |
| 113 | descriptorPoolInfo.maxSets = 2048; |
| 114 | |
| 115 | // Reserve pools for uniform blocks and textures. |
| 116 | descriptorPoolInfo.poolSizeCount = 2; |
| 117 | descriptorPoolInfo.pPoolSizes = poolSizes; |
| 118 | |
| 119 | ANGLE_TRY(mDescriptorPool.init(device, descriptorPoolInfo)); |
| 120 | |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 121 | mPipelineDesc.reset(new vk::PipelineDesc()); |
| 122 | mPipelineDesc->initDefaults(); |
| 123 | |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 124 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 125 | } |
| 126 | |
Jamie Madill | afa02a2 | 2017-11-23 12:57:38 -0500 | [diff] [blame] | 127 | gl::Error ContextVk::flush(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 128 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 129 | // TODO(jmadill): Flush will need to insert a semaphore for the next flush to wait on. |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 130 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 131 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 132 | } |
| 133 | |
Jamie Madill | afa02a2 | 2017-11-23 12:57:38 -0500 | [diff] [blame] | 134 | gl::Error ContextVk::finish(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 135 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 136 | return mRenderer->finish(context); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 137 | } |
| 138 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 139 | gl::Error ContextVk::initPipeline(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 140 | { |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 141 | ASSERT(!mCurrentPipeline); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 142 | |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 143 | const gl::State &state = mState.getState(); |
| 144 | VertexArrayVk *vertexArrayVk = vk::GetImpl(state.getVertexArray()); |
| 145 | FramebufferVk *framebufferVk = vk::GetImpl(state.getDrawFramebuffer()); |
| 146 | ProgramVk *programVk = vk::GetImpl(state.getProgram()); |
Luc Ferron | ceb7190 | 2018-02-05 15:18:47 -0500 | [diff] [blame] | 147 | const gl::AttributesMask activeAttribLocationsMask = |
| 148 | state.getProgram()->getActiveAttribLocationsMask(); |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 149 | |
| 150 | // Ensure the topology of the pipeline description is updated. |
| 151 | mPipelineDesc->updateTopology(mCurrentDrawMode); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 152 | |
Jamie Madill | 112a3a8 | 2018-01-23 13:04:06 -0500 | [diff] [blame] | 153 | // Copy over the latest attrib and binding descriptions. |
| 154 | vertexArrayVk->getPackedInputDescriptions(mPipelineDesc.get()); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 155 | |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 156 | // Ensure that the RenderPass description is updated. |
| 157 | mPipelineDesc->updateRenderPassDesc(framebufferVk->getRenderPassDesc(context)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 158 | |
| 159 | // TODO(jmadill): Validate with ASSERT against physical device limits/caps? |
Luc Ferron | ceb7190 | 2018-02-05 15:18:47 -0500 | [diff] [blame] | 160 | ANGLE_TRY(mRenderer->getPipeline(programVk, *mPipelineDesc, activeAttribLocationsMask, |
| 161 | &mCurrentPipeline)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 162 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 163 | return gl::NoError(); |
| 164 | } |
| 165 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 166 | gl::Error ContextVk::setupDraw(const gl::Context *context, |
| 167 | GLenum mode, |
| 168 | DrawType drawType, |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 169 | size_t firstVertex, |
| 170 | size_t lastVertex, |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 171 | ResourceVk *elementArrayBufferOverride, |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 172 | vk::CommandBuffer **commandBuffer) |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 173 | { |
| 174 | if (mode != mCurrentDrawMode) |
| 175 | { |
| 176 | invalidateCurrentPipeline(); |
| 177 | mCurrentDrawMode = mode; |
| 178 | } |
| 179 | |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 180 | if (!mCurrentPipeline) |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 181 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 182 | ANGLE_TRY(initPipeline(context)); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 183 | } |
| 184 | |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 185 | const auto &state = mState.getState(); |
Jamie Madill | acf2f3a | 2017-11-21 19:22:44 -0500 | [diff] [blame] | 186 | const gl::Program *programGL = state.getProgram(); |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 187 | ProgramVk *programVk = vk::GetImpl(programGL); |
Jamie Madill | acf2f3a | 2017-11-21 19:22:44 -0500 | [diff] [blame] | 188 | const gl::VertexArray *vao = state.getVertexArray(); |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 189 | VertexArrayVk *vkVAO = vk::GetImpl(vao); |
| 190 | const auto *drawFBO = state.getDrawFramebuffer(); |
| 191 | FramebufferVk *vkFBO = vk::GetImpl(drawFBO); |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 192 | Serial queueSerial = mRenderer->getCurrentQueueSerial(); |
| 193 | uint32_t maxAttrib = programGL->getState().getMaxActiveAttribLocation(); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 194 | |
Jamie Madill | e4c5a23 | 2018-03-02 21:00:31 -0500 | [diff] [blame] | 195 | vk::CommandGraphNode *graphNode = nullptr; |
| 196 | ANGLE_TRY(vkFBO->getCommandGraphNodeForDraw(context, &graphNode)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 197 | |
Jamie Madill | e4c5a23 | 2018-03-02 21:00:31 -0500 | [diff] [blame] | 198 | if (!graphNode->getInsideRenderPassCommands()->valid()) |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 199 | { |
| 200 | mVertexArrayDirty = true; |
| 201 | mTexturesDirty = true; |
Jamie Madill | e4c5a23 | 2018-03-02 21:00:31 -0500 | [diff] [blame] | 202 | ANGLE_TRY(graphNode->beginInsideRenderPassRecording(mRenderer, commandBuffer)); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 203 | } |
| 204 | else |
| 205 | { |
Jamie Madill | e4c5a23 | 2018-03-02 21:00:31 -0500 | [diff] [blame] | 206 | *commandBuffer = graphNode->getInsideRenderPassCommands(); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 207 | } |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 208 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 209 | // Ensure any writes to the VAO buffers are flushed before we read from them. |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 210 | if (mVertexArrayDirty || elementArrayBufferOverride != nullptr) |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 211 | { |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 212 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 213 | mVertexArrayDirty = false; |
Jamie Madill | e4c5a23 | 2018-03-02 21:00:31 -0500 | [diff] [blame] | 214 | vkVAO->updateDrawDependencies(graphNode, programGL->getActiveAttribLocationsMask(), |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 215 | elementArrayBufferOverride, queueSerial, drawType); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | // Ensure any writes to the textures are flushed before we read from them. |
| 219 | if (mTexturesDirty) |
| 220 | { |
| 221 | mTexturesDirty = false; |
| 222 | // TODO(jmadill): Should probably merge this for loop with programVk's descriptor update. |
| 223 | const auto &completeTextures = state.getCompleteTextureCache(); |
| 224 | for (const gl::SamplerBinding &samplerBinding : programGL->getSamplerBindings()) |
| 225 | { |
| 226 | ASSERT(!samplerBinding.unreferenced); |
| 227 | |
| 228 | // TODO(jmadill): Sampler arrays |
| 229 | ASSERT(samplerBinding.boundTextureUnits.size() == 1); |
| 230 | |
| 231 | GLuint textureUnit = samplerBinding.boundTextureUnits[0]; |
| 232 | const gl::Texture *texture = completeTextures[textureUnit]; |
| 233 | |
| 234 | // TODO(jmadill): Incomplete textures handling. |
| 235 | ASSERT(texture); |
| 236 | |
| 237 | TextureVk *textureVk = vk::GetImpl(texture); |
Jamie Madill | e4c5a23 | 2018-03-02 21:00:31 -0500 | [diff] [blame] | 238 | textureVk->onReadResource(graphNode, mRenderer->getCurrentQueueSerial()); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 239 | } |
| 240 | } |
| 241 | |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 242 | (*commandBuffer)->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline->get()); |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 243 | ContextVk *contextVk = vk::GetImpl(context); |
| 244 | ANGLE_TRY(vkVAO->streamVertexData(contextVk, &mStreamingVertexData, firstVertex, lastVertex)); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 245 | (*commandBuffer) |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 246 | ->bindVertexBuffers(0, maxAttrib, vkVAO->getCurrentArrayBufferHandles().data(), |
| 247 | vkVAO->getCurrentArrayBufferOffsets().data()); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 248 | |
| 249 | // Update the queue serial for the pipeline object. |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 250 | ASSERT(mCurrentPipeline && mCurrentPipeline->valid()); |
| 251 | mCurrentPipeline->updateSerial(queueSerial); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 252 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 253 | // TODO(jmadill): Can probably use more dirty bits here. |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 254 | ANGLE_TRY(programVk->updateUniforms(this)); |
| 255 | programVk->updateTexturesDescriptorSet(this); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 256 | |
| 257 | // Bind the graphics descriptor sets. |
| 258 | // TODO(jmadill): Handle multiple command buffers. |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 259 | const auto &descriptorSets = programVk->getDescriptorSets(); |
Jamie Madill | 8c3988c | 2017-12-21 14:44:56 -0500 | [diff] [blame] | 260 | const gl::RangeUI &usedRange = programVk->getUsedDescriptorSetRange(); |
| 261 | if (!usedRange.empty()) |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 262 | { |
Jamie Madill | 8c3988c | 2017-12-21 14:44:56 -0500 | [diff] [blame] | 263 | ASSERT(!descriptorSets.empty()); |
| 264 | const vk::PipelineLayout &pipelineLayout = mRenderer->getGraphicsPipelineLayout(); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 265 | (*commandBuffer) |
Jamie Madill | 8c3988c | 2017-12-21 14:44:56 -0500 | [diff] [blame] | 266 | ->bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, usedRange.low(), |
| 267 | usedRange.length(), &descriptorSets[usedRange.low()], 0, nullptr); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 268 | } |
| 269 | |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 270 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 271 | } |
| 272 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 273 | gl::Error ContextVk::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count) |
| 274 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 275 | vk::CommandBuffer *commandBuffer = nullptr; |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 276 | ANGLE_TRY(setupDraw(context, mode, DrawType::Arrays, first, first + count - 1, nullptr, |
| 277 | &commandBuffer)); |
Luc Ferron | 360098d | 2018-02-21 07:33:50 -0500 | [diff] [blame] | 278 | |
| 279 | if (mode == GL_LINE_LOOP) |
| 280 | { |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 281 | ANGLE_TRY(mLineLoopHandler.createIndexBuffer(this, first, count)); |
| 282 | mLineLoopHandler.bindIndexBuffer(VK_INDEX_TYPE_UINT32, &commandBuffer); |
| 283 | ANGLE_TRY(mLineLoopHandler.draw(count, commandBuffer)); |
Luc Ferron | 360098d | 2018-02-21 07:33:50 -0500 | [diff] [blame] | 284 | } |
| 285 | else |
| 286 | { |
| 287 | commandBuffer->draw(count, 1, first, 0); |
| 288 | } |
| 289 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 290 | return gl::NoError(); |
| 291 | } |
| 292 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 293 | gl::Error ContextVk::drawArraysInstanced(const gl::Context *context, |
| 294 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 295 | GLint first, |
| 296 | GLsizei count, |
| 297 | GLsizei instanceCount) |
| 298 | { |
| 299 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 300 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 301 | } |
| 302 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 303 | gl::Error ContextVk::drawElements(const gl::Context *context, |
| 304 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 305 | GLsizei count, |
| 306 | GLenum type, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 307 | const void *indices) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 308 | { |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 309 | gl::VertexArray *vao = mState.getState().getVertexArray(); |
| 310 | const gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 311 | vk::CommandBuffer *commandBuffer = nullptr; |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 312 | |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 313 | if (mode == GL_LINE_LOOP) |
| 314 | { |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 315 | if (!elementArrayBuffer) |
| 316 | { |
| 317 | UNIMPLEMENTED(); |
| 318 | return gl::InternalError() << "Line loop indices in client memory not supported"; |
| 319 | } |
| 320 | |
| 321 | BufferVk *elementArrayBufferVk = vk::GetImpl(elementArrayBuffer); |
| 322 | |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 323 | ANGLE_TRY(mLineLoopHandler.createIndexBufferFromElementArrayBuffer( |
| 324 | this, elementArrayBufferVk, GetVkIndexType(type), count)); |
| 325 | |
| 326 | // TODO(fjhenigman): calculate the index range and pass to setupDraw() |
| 327 | ANGLE_TRY(setupDraw(context, mode, DrawType::Elements, 0, 0, |
| 328 | mLineLoopHandler.getLineLoopBufferResource(), &commandBuffer)); |
| 329 | |
| 330 | mLineLoopHandler.bindIndexBuffer(GetVkIndexType(type), &commandBuffer); |
| 331 | commandBuffer->drawIndexed(count + 1, 1, 0, 0, 0); |
| 332 | } |
| 333 | else |
| 334 | { |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 335 | ContextVk *contextVk = vk::GetImpl(context); |
| 336 | const bool computeIndexRange = vk::GetImpl(vao)->attribsToStream(contextVk).any(); |
| 337 | gl::IndexRange range; |
| 338 | VkBuffer buffer = VK_NULL_HANDLE; |
| 339 | VkDeviceSize offset = 0; |
| 340 | |
| 341 | if (elementArrayBuffer) |
| 342 | { |
Luc Ferron | 80964f9 | 2018-03-08 10:31:24 -0500 | [diff] [blame^] | 343 | if (type == GL_UNSIGNED_BYTE) |
| 344 | { |
| 345 | // TODO(fjhenigman): Index format translation. |
| 346 | UNIMPLEMENTED(); |
| 347 | return gl::InternalError() << "Unsigned byte translation is not implemented for " |
| 348 | << "indices in a buffer object"; |
| 349 | } |
| 350 | |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 351 | BufferVk *elementArrayBufferVk = vk::GetImpl(elementArrayBuffer); |
| 352 | buffer = elementArrayBufferVk->getVkBuffer().getHandle(); |
| 353 | offset = 0; |
| 354 | |
| 355 | if (computeIndexRange) |
| 356 | { |
| 357 | ANGLE_TRY(elementArrayBufferVk->getIndexRange( |
| 358 | context, type, 0, count, false /*primitiveRestartEnabled*/, &range)); |
| 359 | } |
| 360 | } |
| 361 | else |
| 362 | { |
| 363 | const GLsizei amount = sizeof(GLushort) * count; |
Luc Ferron | 80964f9 | 2018-03-08 10:31:24 -0500 | [diff] [blame^] | 364 | GLubyte *dst = nullptr; |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 365 | |
| 366 | ANGLE_TRY(mStreamingIndexData.allocate(contextVk, amount, &dst, &buffer, &offset)); |
Luc Ferron | 80964f9 | 2018-03-08 10:31:24 -0500 | [diff] [blame^] | 367 | if (type == GL_UNSIGNED_BYTE) |
| 368 | { |
| 369 | // Unsigned bytes don't have direct support in Vulkan so we have to expand the |
| 370 | // memory to a GLushort. |
| 371 | const GLubyte *in = static_cast<const GLubyte *>(indices); |
| 372 | GLushort *expandedDst = reinterpret_cast<GLushort *>(dst); |
| 373 | for (GLsizei index = 0; index < count; index++) |
| 374 | { |
| 375 | expandedDst[index] = static_cast<GLushort>(in[index]); |
| 376 | } |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | memcpy(dst, indices, amount); |
| 381 | } |
Frank Henigman | a53d0e1 | 2018-02-13 00:06:06 -0500 | [diff] [blame] | 382 | ANGLE_TRY(mStreamingIndexData.flush(contextVk)); |
| 383 | |
| 384 | if (computeIndexRange) |
| 385 | { |
| 386 | range = |
| 387 | gl::ComputeIndexRange(type, indices, count, false /*primitiveRestartEnabled*/); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | ANGLE_TRY(setupDraw(context, mode, DrawType::Elements, range.start, range.end, nullptr, |
| 392 | &commandBuffer)); |
| 393 | commandBuffer->bindIndexBuffer(buffer, offset, GetVkIndexType(type)); |
Luc Ferron | 78e39b3 | 2018-02-26 07:42:44 -0500 | [diff] [blame] | 394 | commandBuffer->drawIndexed(count, 1, 0, 0, 0); |
| 395 | } |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 396 | |
| 397 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 398 | } |
| 399 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 400 | gl::Error ContextVk::drawElementsInstanced(const gl::Context *context, |
| 401 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 402 | GLsizei count, |
| 403 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 404 | const void *indices, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 405 | GLsizei instances) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 406 | { |
| 407 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 408 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 409 | } |
| 410 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 411 | gl::Error ContextVk::drawRangeElements(const gl::Context *context, |
| 412 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 413 | GLuint start, |
| 414 | GLuint end, |
| 415 | GLsizei count, |
| 416 | GLenum type, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 417 | const void *indices) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 418 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 419 | return gl::NoError(); |
| 420 | } |
| 421 | |
| 422 | VkDevice ContextVk::getDevice() const |
| 423 | { |
| 424 | return mRenderer->getDevice(); |
| 425 | } |
| 426 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 427 | gl::Error ContextVk::drawArraysIndirect(const gl::Context *context, |
| 428 | GLenum mode, |
| 429 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 430 | { |
| 431 | UNIMPLEMENTED(); |
| 432 | return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend."; |
| 433 | } |
| 434 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 435 | gl::Error ContextVk::drawElementsIndirect(const gl::Context *context, |
| 436 | GLenum mode, |
| 437 | GLenum type, |
| 438 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 439 | { |
| 440 | UNIMPLEMENTED(); |
| 441 | return gl::InternalError() |
| 442 | << "DrawElementsIndirect hasn't been implemented for vulkan backend."; |
| 443 | } |
| 444 | |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 445 | GLenum ContextVk::getResetStatus() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 446 | { |
| 447 | UNIMPLEMENTED(); |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 448 | return GL_NO_ERROR; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | std::string ContextVk::getVendorString() const |
| 452 | { |
| 453 | UNIMPLEMENTED(); |
| 454 | return std::string(); |
| 455 | } |
| 456 | |
| 457 | std::string ContextVk::getRendererDescription() const |
| 458 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 459 | return mRenderer->getRendererDescription(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | void ContextVk::insertEventMarker(GLsizei length, const char *marker) |
| 463 | { |
| 464 | UNIMPLEMENTED(); |
| 465 | } |
| 466 | |
| 467 | void ContextVk::pushGroupMarker(GLsizei length, const char *marker) |
| 468 | { |
| 469 | UNIMPLEMENTED(); |
| 470 | } |
| 471 | |
| 472 | void ContextVk::popGroupMarker() |
| 473 | { |
| 474 | UNIMPLEMENTED(); |
| 475 | } |
| 476 | |
Geoff Lang | 5d5253a | 2017-11-22 14:51:12 -0500 | [diff] [blame] | 477 | void ContextVk::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message) |
| 478 | { |
| 479 | UNIMPLEMENTED(); |
| 480 | } |
| 481 | |
| 482 | void ContextVk::popDebugGroup() |
| 483 | { |
| 484 | UNIMPLEMENTED(); |
| 485 | } |
| 486 | |
Jamie Madill | fe54834 | 2017-06-19 11:13:24 -0400 | [diff] [blame] | 487 | void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 488 | { |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 489 | if (dirtyBits.any()) |
| 490 | { |
| 491 | invalidateCurrentPipeline(); |
| 492 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 493 | |
| 494 | const auto &glState = context->getGLState(); |
| 495 | |
| 496 | // TODO(jmadill): Full dirty bits implementation. |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 497 | bool dirtyTextures = false; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 498 | |
| 499 | for (auto dirtyBit : dirtyBits) |
| 500 | { |
| 501 | switch (dirtyBit) |
| 502 | { |
| 503 | case gl::State::DIRTY_BIT_SCISSOR_TEST_ENABLED: |
Luc Ferron | 00155d5 | 2018-02-06 10:48:47 -0500 | [diff] [blame] | 504 | if (glState.isScissorTestEnabled()) |
| 505 | { |
| 506 | mPipelineDesc->updateScissor(glState.getScissor()); |
| 507 | } |
| 508 | else |
| 509 | { |
| 510 | mPipelineDesc->updateScissor(glState.getViewport()); |
| 511 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 512 | break; |
| 513 | case gl::State::DIRTY_BIT_SCISSOR: |
Luc Ferron | 00155d5 | 2018-02-06 10:48:47 -0500 | [diff] [blame] | 514 | // Only modify the scissor region if the test is enabled, otherwise we want to keep |
| 515 | // the viewport size as the scissor region. |
| 516 | if (glState.isScissorTestEnabled()) |
| 517 | { |
| 518 | mPipelineDesc->updateScissor(glState.getScissor()); |
| 519 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 520 | break; |
| 521 | case gl::State::DIRTY_BIT_VIEWPORT: |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 522 | mPipelineDesc->updateViewport(glState.getViewport(), glState.getNearPlane(), |
| 523 | glState.getFarPlane()); |
Luc Ferron | 00155d5 | 2018-02-06 10:48:47 -0500 | [diff] [blame] | 524 | |
| 525 | // If the scissor test isn't enabled, we have to also update the scissor to |
| 526 | // be equal to the viewport to make sure we keep rendering everything in the |
| 527 | // viewport. |
| 528 | if (!glState.isScissorTestEnabled()) |
| 529 | { |
| 530 | mPipelineDesc->updateScissor(glState.getViewport()); |
| 531 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 532 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 533 | case gl::State::DIRTY_BIT_DEPTH_RANGE: |
| 534 | WARN() << "DIRTY_BIT_DEPTH_RANGE unimplemented"; |
| 535 | break; |
| 536 | case gl::State::DIRTY_BIT_BLEND_ENABLED: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 537 | mPipelineDesc->updateBlendEnabled(glState.isBlendEnabled()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 538 | break; |
| 539 | case gl::State::DIRTY_BIT_BLEND_COLOR: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 540 | mPipelineDesc->updateBlendColor(glState.getBlendColor()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 541 | break; |
| 542 | case gl::State::DIRTY_BIT_BLEND_FUNCS: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 543 | mPipelineDesc->updateBlendFuncs(glState.getBlendState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 544 | break; |
| 545 | case gl::State::DIRTY_BIT_BLEND_EQUATIONS: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 546 | mPipelineDesc->updateBlendEquations(glState.getBlendState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 547 | break; |
| 548 | case gl::State::DIRTY_BIT_COLOR_MASK: |
| 549 | WARN() << "DIRTY_BIT_COLOR_MASK unimplemented"; |
| 550 | break; |
| 551 | case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED: |
| 552 | WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED unimplemented"; |
| 553 | break; |
| 554 | case gl::State::DIRTY_BIT_SAMPLE_COVERAGE_ENABLED: |
| 555 | WARN() << "DIRTY_BIT_SAMPLE_COVERAGE_ENABLED unimplemented"; |
| 556 | break; |
| 557 | case gl::State::DIRTY_BIT_SAMPLE_COVERAGE: |
| 558 | WARN() << "DIRTY_BIT_SAMPLE_COVERAGE unimplemented"; |
| 559 | break; |
| 560 | case gl::State::DIRTY_BIT_SAMPLE_MASK_ENABLED: |
| 561 | WARN() << "DIRTY_BIT_SAMPLE_MASK_ENABLED unimplemented"; |
| 562 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 563 | case gl::State::DIRTY_BIT_SAMPLE_MASK: |
| 564 | WARN() << "DIRTY_BIT_SAMPLE_MASK unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 565 | break; |
| 566 | case gl::State::DIRTY_BIT_DEPTH_TEST_ENABLED: |
| 567 | WARN() << "DIRTY_BIT_DEPTH_TEST_ENABLED unimplemented"; |
| 568 | break; |
| 569 | case gl::State::DIRTY_BIT_DEPTH_FUNC: |
| 570 | WARN() << "DIRTY_BIT_DEPTH_FUNC unimplemented"; |
| 571 | break; |
| 572 | case gl::State::DIRTY_BIT_DEPTH_MASK: |
| 573 | WARN() << "DIRTY_BIT_DEPTH_MASK unimplemented"; |
| 574 | break; |
| 575 | case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED: |
| 576 | WARN() << "DIRTY_BIT_STENCIL_TEST_ENABLED unimplemented"; |
| 577 | break; |
| 578 | case gl::State::DIRTY_BIT_STENCIL_FUNCS_FRONT: |
| 579 | WARN() << "DIRTY_BIT_STENCIL_FUNCS_FRONT unimplemented"; |
| 580 | break; |
| 581 | case gl::State::DIRTY_BIT_STENCIL_FUNCS_BACK: |
| 582 | WARN() << "DIRTY_BIT_STENCIL_FUNCS_BACK unimplemented"; |
| 583 | break; |
| 584 | case gl::State::DIRTY_BIT_STENCIL_OPS_FRONT: |
| 585 | WARN() << "DIRTY_BIT_STENCIL_OPS_FRONT unimplemented"; |
| 586 | break; |
| 587 | case gl::State::DIRTY_BIT_STENCIL_OPS_BACK: |
| 588 | WARN() << "DIRTY_BIT_STENCIL_OPS_BACK unimplemented"; |
| 589 | break; |
| 590 | case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT: |
| 591 | WARN() << "DIRTY_BIT_STENCIL_WRITEMASK_FRONT unimplemented"; |
| 592 | break; |
| 593 | case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_BACK: |
| 594 | WARN() << "DIRTY_BIT_STENCIL_WRITEMASK_BACK unimplemented"; |
| 595 | break; |
| 596 | case gl::State::DIRTY_BIT_CULL_FACE_ENABLED: |
| 597 | case gl::State::DIRTY_BIT_CULL_FACE: |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 598 | mPipelineDesc->updateCullMode(glState.getRasterizerState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 599 | break; |
| 600 | case gl::State::DIRTY_BIT_FRONT_FACE: |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 601 | mPipelineDesc->updateFrontFace(glState.getRasterizerState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 602 | break; |
| 603 | case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED: |
| 604 | WARN() << "DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED unimplemented"; |
| 605 | break; |
| 606 | case gl::State::DIRTY_BIT_POLYGON_OFFSET: |
| 607 | WARN() << "DIRTY_BIT_POLYGON_OFFSET unimplemented"; |
| 608 | break; |
| 609 | case gl::State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED: |
| 610 | WARN() << "DIRTY_BIT_RASTERIZER_DISCARD_ENABLED unimplemented"; |
| 611 | break; |
| 612 | case gl::State::DIRTY_BIT_LINE_WIDTH: |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 613 | mPipelineDesc->updateLineWidth(glState.getLineWidth()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 614 | break; |
| 615 | case gl::State::DIRTY_BIT_PRIMITIVE_RESTART_ENABLED: |
| 616 | WARN() << "DIRTY_BIT_PRIMITIVE_RESTART_ENABLED unimplemented"; |
| 617 | break; |
| 618 | case gl::State::DIRTY_BIT_CLEAR_COLOR: |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 619 | mClearColorValue.color.float32[0] = glState.getColorClearValue().red; |
| 620 | mClearColorValue.color.float32[1] = glState.getColorClearValue().green; |
| 621 | mClearColorValue.color.float32[2] = glState.getColorClearValue().blue; |
| 622 | mClearColorValue.color.float32[3] = glState.getColorClearValue().alpha; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 623 | break; |
| 624 | case gl::State::DIRTY_BIT_CLEAR_DEPTH: |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 625 | mClearDepthStencilValue.depthStencil.depth = glState.getDepthClearValue(); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 626 | break; |
| 627 | case gl::State::DIRTY_BIT_CLEAR_STENCIL: |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 628 | mClearDepthStencilValue.depthStencil.stencil = |
| 629 | static_cast<uint32_t>(glState.getStencilClearValue()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 630 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 631 | case gl::State::DIRTY_BIT_UNPACK_STATE: |
| 632 | WARN() << "DIRTY_BIT_UNPACK_STATE unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 633 | break; |
Corentin Wallez | 29a2099 | 2017-11-06 18:23:16 -0500 | [diff] [blame] | 634 | case gl::State::DIRTY_BIT_UNPACK_BUFFER_BINDING: |
| 635 | WARN() << "DIRTY_BIT_UNPACK_BUFFER_BINDING unimplemented"; |
| 636 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 637 | case gl::State::DIRTY_BIT_PACK_STATE: |
| 638 | WARN() << "DIRTY_BIT_PACK_STATE unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 639 | break; |
Corentin Wallez | 29a2099 | 2017-11-06 18:23:16 -0500 | [diff] [blame] | 640 | case gl::State::DIRTY_BIT_PACK_BUFFER_BINDING: |
| 641 | WARN() << "DIRTY_BIT_PACK_BUFFER_BINDING unimplemented"; |
| 642 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 643 | case gl::State::DIRTY_BIT_DITHER_ENABLED: |
| 644 | WARN() << "DIRTY_BIT_DITHER_ENABLED unimplemented"; |
| 645 | break; |
| 646 | case gl::State::DIRTY_BIT_GENERATE_MIPMAP_HINT: |
| 647 | WARN() << "DIRTY_BIT_GENERATE_MIPMAP_HINT unimplemented"; |
| 648 | break; |
| 649 | case gl::State::DIRTY_BIT_SHADER_DERIVATIVE_HINT: |
| 650 | WARN() << "DIRTY_BIT_SHADER_DERIVATIVE_HINT unimplemented"; |
| 651 | break; |
| 652 | case gl::State::DIRTY_BIT_READ_FRAMEBUFFER_BINDING: |
| 653 | WARN() << "DIRTY_BIT_READ_FRAMEBUFFER_BINDING unimplemented"; |
| 654 | break; |
| 655 | case gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING: |
| 656 | WARN() << "DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING unimplemented"; |
| 657 | break; |
| 658 | case gl::State::DIRTY_BIT_RENDERBUFFER_BINDING: |
| 659 | WARN() << "DIRTY_BIT_RENDERBUFFER_BINDING unimplemented"; |
| 660 | break; |
| 661 | case gl::State::DIRTY_BIT_VERTEX_ARRAY_BINDING: |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 662 | mVertexArrayDirty = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 663 | break; |
| 664 | case gl::State::DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING: |
| 665 | WARN() << "DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING unimplemented"; |
| 666 | break; |
Qin Jiajia | a98a281 | 2017-11-30 18:12:06 +0800 | [diff] [blame] | 667 | case gl::State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING: |
| 668 | WARN() << "DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING unimplemented"; |
| 669 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 670 | case gl::State::DIRTY_BIT_PROGRAM_BINDING: |
| 671 | WARN() << "DIRTY_BIT_PROGRAM_BINDING unimplemented"; |
| 672 | break; |
| 673 | case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE: |
| 674 | { |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 675 | ProgramVk *programVk = vk::GetImpl(glState.getProgram()); |
| 676 | mPipelineDesc->updateShaders(programVk); |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 677 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 678 | break; |
| 679 | } |
| 680 | case gl::State::DIRTY_BIT_TEXTURE_BINDINGS: |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 681 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 682 | break; |
| 683 | case gl::State::DIRTY_BIT_SAMPLER_BINDINGS: |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 684 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 685 | break; |
Geoff Lang | ded7923 | 2017-11-28 15:21:11 -0500 | [diff] [blame] | 686 | case gl::State::DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING: |
| 687 | WARN() << "DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING unimplemented"; |
| 688 | break; |
Xinghua Cao | 10a4d43 | 2017-11-28 14:46:26 +0800 | [diff] [blame] | 689 | case gl::State::DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING: |
| 690 | WARN() << "DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING unimplemented"; |
| 691 | break; |
Jamie Madill | f414121 | 2017-12-12 15:08:07 -0500 | [diff] [blame] | 692 | case gl::State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS: |
| 693 | WARN() << "DIRTY_BIT_UNIFORM_BUFFER_BINDINGS unimplemented"; |
| 694 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 695 | case gl::State::DIRTY_BIT_MULTISAMPLING: |
| 696 | WARN() << "DIRTY_BIT_MULTISAMPLING unimplemented"; |
| 697 | break; |
| 698 | case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_ONE: |
| 699 | WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_ONE unimplemented"; |
| 700 | break; |
| 701 | case gl::State::DIRTY_BIT_COVERAGE_MODULATION: |
| 702 | WARN() << "DIRTY_BIT_COVERAGE_MODULATION unimplemented"; |
| 703 | break; |
| 704 | case gl::State::DIRTY_BIT_PATH_RENDERING_MATRIX_MV: |
| 705 | WARN() << "DIRTY_BIT_PATH_RENDERING_MATRIX_MV unimplemented"; |
| 706 | break; |
| 707 | case gl::State::DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ: |
| 708 | WARN() << "DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ unimplemented"; |
| 709 | break; |
| 710 | case gl::State::DIRTY_BIT_PATH_RENDERING_STENCIL_STATE: |
| 711 | WARN() << "DIRTY_BIT_PATH_RENDERING_STENCIL_STATE unimplemented"; |
| 712 | break; |
| 713 | case gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB: |
| 714 | WARN() << "DIRTY_BIT_FRAMEBUFFER_SRGB unimplemented"; |
| 715 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 716 | case gl::State::DIRTY_BIT_CURRENT_VALUES: |
| 717 | WARN() << "DIRTY_BIT_CURRENT_VALUES unimplemented"; |
| 718 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 719 | default: |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 720 | UNREACHABLE(); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 721 | break; |
| 722 | } |
| 723 | } |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 724 | |
| 725 | if (dirtyTextures) |
| 726 | { |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 727 | ProgramVk *programVk = vk::GetImpl(glState.getProgram()); |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 728 | programVk->invalidateTextures(); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 729 | mTexturesDirty = true; |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 730 | } |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | GLint ContextVk::getGPUDisjoint() |
| 734 | { |
| 735 | UNIMPLEMENTED(); |
| 736 | return GLint(); |
| 737 | } |
| 738 | |
| 739 | GLint64 ContextVk::getTimestamp() |
| 740 | { |
| 741 | UNIMPLEMENTED(); |
| 742 | return GLint64(); |
| 743 | } |
| 744 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 745 | void ContextVk::onMakeCurrent(const gl::Context * /*context*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 746 | { |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 747 | } |
| 748 | |
| 749 | const gl::Caps &ContextVk::getNativeCaps() const |
| 750 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 751 | return mRenderer->getNativeCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 752 | } |
| 753 | |
| 754 | const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const |
| 755 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 756 | return mRenderer->getNativeTextureCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 757 | } |
| 758 | |
| 759 | const gl::Extensions &ContextVk::getNativeExtensions() const |
| 760 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 761 | return mRenderer->getNativeExtensions(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | const gl::Limitations &ContextVk::getNativeLimitations() const |
| 765 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 766 | return mRenderer->getNativeLimitations(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 767 | } |
| 768 | |
| 769 | CompilerImpl *ContextVk::createCompiler() |
| 770 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 771 | return new CompilerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 772 | } |
| 773 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 774 | ShaderImpl *ContextVk::createShader(const gl::ShaderState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 775 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 776 | return new ShaderVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 777 | } |
| 778 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 779 | ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 780 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 781 | return new ProgramVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 782 | } |
| 783 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 784 | FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 785 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 786 | return FramebufferVk::CreateUserFBO(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | TextureImpl *ContextVk::createTexture(const gl::TextureState &state) |
| 790 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 791 | return new TextureVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 792 | } |
| 793 | |
Jamie Madill | e703c60 | 2018-02-20 10:21:48 -0500 | [diff] [blame] | 794 | RenderbufferImpl *ContextVk::createRenderbuffer(const gl::RenderbufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 795 | { |
Jamie Madill | e703c60 | 2018-02-20 10:21:48 -0500 | [diff] [blame] | 796 | return new RenderbufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 797 | } |
| 798 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 799 | BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 800 | { |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 801 | return new BufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 802 | } |
| 803 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 804 | VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 805 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 806 | return new VertexArrayVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | QueryImpl *ContextVk::createQuery(GLenum type) |
| 810 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 811 | return new QueryVk(type); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 812 | } |
| 813 | |
| 814 | FenceNVImpl *ContextVk::createFenceNV() |
| 815 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 816 | return new FenceNVVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 817 | } |
| 818 | |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 819 | SyncImpl *ContextVk::createSync() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 820 | { |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 821 | return new SyncVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 822 | } |
| 823 | |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 824 | TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 825 | { |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 826 | return new TransformFeedbackVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 827 | } |
| 828 | |
Jamie Madill | 06ef36b | 2017-09-09 23:32:46 -0400 | [diff] [blame] | 829 | SamplerImpl *ContextVk::createSampler(const gl::SamplerState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 830 | { |
Jamie Madill | 06ef36b | 2017-09-09 23:32:46 -0400 | [diff] [blame] | 831 | return new SamplerVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 832 | } |
| 833 | |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 834 | ProgramPipelineImpl *ContextVk::createProgramPipeline(const gl::ProgramPipelineState &state) |
| 835 | { |
| 836 | return new ProgramPipelineVk(state); |
| 837 | } |
| 838 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 839 | std::vector<PathImpl *> ContextVk::createPaths(GLsizei) |
| 840 | { |
| 841 | return std::vector<PathImpl *>(); |
| 842 | } |
| 843 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 844 | void ContextVk::invalidateCurrentPipeline() |
| 845 | { |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 846 | mCurrentPipeline = nullptr; |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 847 | } |
| 848 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 849 | void ContextVk::onVertexArrayChange() |
| 850 | { |
| 851 | // TODO(jmadill): Does not handle dependent state changes. |
| 852 | mVertexArrayDirty = true; |
| 853 | invalidateCurrentPipeline(); |
| 854 | } |
| 855 | |
Jamie Madill | fe54834 | 2017-06-19 11:13:24 -0400 | [diff] [blame] | 856 | gl::Error ContextVk::dispatchCompute(const gl::Context *context, |
| 857 | GLuint numGroupsX, |
| 858 | GLuint numGroupsY, |
| 859 | GLuint numGroupsZ) |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 860 | { |
| 861 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 862 | return gl::InternalError(); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 863 | } |
| 864 | |
Qin Jiajia | 62fcf62 | 2017-11-30 16:16:12 +0800 | [diff] [blame] | 865 | gl::Error ContextVk::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) |
| 866 | { |
| 867 | UNIMPLEMENTED(); |
| 868 | return gl::InternalError(); |
| 869 | } |
| 870 | |
Xinghua Cao | 89c422a | 2017-11-29 18:24:20 +0800 | [diff] [blame] | 871 | gl::Error ContextVk::memoryBarrier(const gl::Context *context, GLbitfield barriers) |
| 872 | { |
| 873 | UNIMPLEMENTED(); |
| 874 | return gl::InternalError(); |
| 875 | } |
| 876 | |
| 877 | gl::Error ContextVk::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) |
| 878 | { |
| 879 | UNIMPLEMENTED(); |
| 880 | return gl::InternalError(); |
| 881 | } |
| 882 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 883 | vk::DescriptorPool *ContextVk::getDescriptorPool() |
| 884 | { |
| 885 | return &mDescriptorPool; |
| 886 | } |
| 887 | |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 888 | const VkClearValue &ContextVk::getClearColorValue() const |
| 889 | { |
| 890 | return mClearColorValue; |
| 891 | } |
| 892 | |
| 893 | const VkClearValue &ContextVk::getClearDepthStencilValue() const |
| 894 | { |
| 895 | return mClearDepthStencilValue; |
| 896 | } |
| 897 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 898 | } // namespace rx |