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" |
Geoff Lang | caa55cd | 2018-07-05 13:19:35 -0400 | [diff] [blame^] | 17 | #include "libANGLE/Surface.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 18 | #include "libANGLE/renderer/vulkan/BufferVk.h" |
Jamie Madill | 1f46bc1 | 2018-02-20 16:09:43 -0500 | [diff] [blame] | 19 | #include "libANGLE/renderer/vulkan/CommandGraph.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 20 | #include "libANGLE/renderer/vulkan/CompilerVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 21 | #include "libANGLE/renderer/vulkan/FenceNVVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 22 | #include "libANGLE/renderer/vulkan/FramebufferVk.h" |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 23 | #include "libANGLE/renderer/vulkan/ProgramPipelineVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 24 | #include "libANGLE/renderer/vulkan/ProgramVk.h" |
| 25 | #include "libANGLE/renderer/vulkan/QueryVk.h" |
| 26 | #include "libANGLE/renderer/vulkan/RenderbufferVk.h" |
| 27 | #include "libANGLE/renderer/vulkan/RendererVk.h" |
| 28 | #include "libANGLE/renderer/vulkan/SamplerVk.h" |
| 29 | #include "libANGLE/renderer/vulkan/ShaderVk.h" |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 30 | #include "libANGLE/renderer/vulkan/SyncVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 31 | #include "libANGLE/renderer/vulkan/TextureVk.h" |
| 32 | #include "libANGLE/renderer/vulkan/TransformFeedbackVk.h" |
| 33 | #include "libANGLE/renderer/vulkan/VertexArrayVk.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 34 | |
| 35 | namespace rx |
| 36 | { |
Luc Ferron | 14f4817 | 2018-04-11 08:43:28 -0400 | [diff] [blame] | 37 | |
| 38 | namespace |
| 39 | { |
| 40 | constexpr gl::Rectangle kMaxSizedScissor(0, |
| 41 | 0, |
| 42 | std::numeric_limits<int>::max(), |
| 43 | std::numeric_limits<int>::max()); |
| 44 | |
Jamie Madill | 9aef367 | 2018-04-27 11:45:06 -0400 | [diff] [blame] | 45 | constexpr VkColorComponentFlags kAllColorChannelsMask = |
| 46 | (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | |
| 47 | VK_COLOR_COMPONENT_A_BIT); |
Luc Ferron | 14f4817 | 2018-04-11 08:43:28 -0400 | [diff] [blame] | 48 | } // anonymous namespace |
| 49 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 50 | ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer) |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 51 | : ContextImpl(state), |
| 52 | mRenderer(renderer), |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 53 | mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum), |
Frank Henigman | 1744895 | 2017-01-05 15:48:26 -0500 | [diff] [blame] | 54 | mTexturesDirty(false), |
Jamie Madill | 9aef367 | 2018-04-27 11:45:06 -0400 | [diff] [blame] | 55 | mVertexArrayBindingHasChanged(false), |
Geoff Lang | caa55cd | 2018-07-05 13:19:35 -0400 | [diff] [blame^] | 56 | mClearColorMask(kAllColorChannelsMask), |
| 57 | mFlipYForCurrentSurface(false) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 58 | { |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 59 | memset(&mClearColorValue, 0, sizeof(mClearColorValue)); |
| 60 | memset(&mClearDepthStencilValue, 0, sizeof(mClearDepthStencilValue)); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | ContextVk::~ContextVk() |
| 64 | { |
| 65 | } |
| 66 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 67 | void ContextVk::onDestroy(const gl::Context *context) |
| 68 | { |
Luc Ferron | 9096836 | 2018-05-04 08:47:22 -0400 | [diff] [blame] | 69 | mIncompleteTextures.onDestroy(context); |
Jamie Madill | edeaa83 | 2018-06-22 09:18:41 -0400 | [diff] [blame] | 70 | |
| 71 | for (vk::DynamicDescriptorPool &descriptorPool : mDynamicDescriptorPools) |
| 72 | { |
| 73 | descriptorPool.destroy(getDevice()); |
| 74 | } |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 75 | } |
| 76 | |
Luc Ferron | 9096836 | 2018-05-04 08:47:22 -0400 | [diff] [blame] | 77 | gl::Error ContextVk::getIncompleteTexture(const gl::Context *context, |
| 78 | gl::TextureType type, |
| 79 | gl::Texture **textureOut) |
| 80 | { |
| 81 | // At some point, we'll need to support multisample and we'll pass "this" instead of nullptr |
| 82 | // and implement the necessary interface. |
| 83 | return mIncompleteTextures.getIncompleteTexture(context, type, nullptr, textureOut); |
| 84 | } |
| 85 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 86 | gl::Error ContextVk::initialize() |
| 87 | { |
Jamie Madill | 8a4c49f | 2018-06-21 15:43:06 -0400 | [diff] [blame] | 88 | // Note that this may reserve more sets than strictly necessary for a particular layout. |
Jamie Madill | edeaa83 | 2018-06-22 09:18:41 -0400 | [diff] [blame] | 89 | vk::DescriptorPoolSizes uniformPoolSize; |
| 90 | uniformPoolSize.push_back( |
| 91 | {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, |
| 92 | GetUniformBufferDescriptorCount() * vk::kDefaultDescriptorPoolMaxSets}); |
Jamie Madill | 8a4c49f | 2018-06-21 15:43:06 -0400 | [diff] [blame] | 93 | |
Jamie Madill | edeaa83 | 2018-06-22 09:18:41 -0400 | [diff] [blame] | 94 | vk::DescriptorPoolSizes imageSamplerPoolSize; |
| 95 | imageSamplerPoolSize.push_back( |
| 96 | {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 97 | mRenderer->getMaxActiveTextures() * vk::kDefaultDescriptorPoolMaxSets}); |
| 98 | |
| 99 | ANGLE_TRY( |
| 100 | mDynamicDescriptorPools[kUniformsDescriptorSetIndex].init(getDevice(), uniformPoolSize)); |
| 101 | ANGLE_TRY(mDynamicDescriptorPools[kTextureDescriptorSetIndex].init(getDevice(), |
| 102 | imageSamplerPoolSize)); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 103 | |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 104 | mPipelineDesc.reset(new vk::PipelineDesc()); |
| 105 | mPipelineDesc->initDefaults(); |
| 106 | |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 107 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 108 | } |
| 109 | |
Jamie Madill | afa02a2 | 2017-11-23 12:57:38 -0500 | [diff] [blame] | 110 | gl::Error ContextVk::flush(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 111 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 112 | // 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] | 113 | UNIMPLEMENTED(); |
Luc Ferron | 3314040 | 2018-03-08 13:57:52 -0500 | [diff] [blame] | 114 | |
| 115 | // dEQP tests rely on having no errors thrown at the end of the test and they always call |
| 116 | // flush at the end of the their tests. Just returning NoError until we implement flush |
| 117 | // allow us to work on enabling many tests in the meantime. |
| 118 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 119 | } |
| 120 | |
Jamie Madill | afa02a2 | 2017-11-23 12:57:38 -0500 | [diff] [blame] | 121 | gl::Error ContextVk::finish(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 122 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 123 | return mRenderer->finish(context); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 124 | } |
| 125 | |
Jamie Madill | b90779e | 2018-04-27 11:45:01 -0400 | [diff] [blame] | 126 | gl::Error ContextVk::initPipeline() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 127 | { |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 128 | ASSERT(!mCurrentPipeline); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 129 | |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 130 | const gl::State &state = mState.getState(); |
| 131 | VertexArrayVk *vertexArrayVk = vk::GetImpl(state.getVertexArray()); |
| 132 | FramebufferVk *framebufferVk = vk::GetImpl(state.getDrawFramebuffer()); |
| 133 | ProgramVk *programVk = vk::GetImpl(state.getProgram()); |
Luc Ferron | ceb7190 | 2018-02-05 15:18:47 -0500 | [diff] [blame] | 134 | const gl::AttributesMask activeAttribLocationsMask = |
| 135 | state.getProgram()->getActiveAttribLocationsMask(); |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 136 | |
| 137 | // Ensure the topology of the pipeline description is updated. |
| 138 | mPipelineDesc->updateTopology(mCurrentDrawMode); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 139 | |
Jamie Madill | 112a3a8 | 2018-01-23 13:04:06 -0500 | [diff] [blame] | 140 | // Copy over the latest attrib and binding descriptions. |
Frank Henigman | 2ad498e | 2018-06-20 13:19:01 -0400 | [diff] [blame] | 141 | vertexArrayVk->getPackedInputDescriptions(mRenderer, mPipelineDesc.get()); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 142 | |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 143 | // Ensure that the RenderPass description is updated. |
Jamie Madill | b90779e | 2018-04-27 11:45:01 -0400 | [diff] [blame] | 144 | mPipelineDesc->updateRenderPassDesc(framebufferVk->getRenderPassDesc()); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 145 | |
| 146 | // TODO(jmadill): Validate with ASSERT against physical device limits/caps? |
Jamie Madill | 9aef367 | 2018-04-27 11:45:06 -0400 | [diff] [blame] | 147 | ANGLE_TRY(mRenderer->getAppPipeline(programVk, *mPipelineDesc, activeAttribLocationsMask, |
Jamie Madill | 9b168d0 | 2018-06-13 13:25:32 -0400 | [diff] [blame] | 148 | &mCurrentPipeline)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 149 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 150 | return gl::NoError(); |
| 151 | } |
| 152 | |
Luc Ferron | 9096836 | 2018-05-04 08:47:22 -0400 | [diff] [blame] | 153 | gl::Error ContextVk::setupDraw(const gl::Context *context, |
| 154 | const gl::DrawCallParams &drawCallParams, |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 155 | vk::CommandBuffer **commandBufferOut, |
| 156 | bool *shouldApplyVertexArrayOut) |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 157 | { |
Jamie Madill | 32fd63b | 2018-03-31 11:20:35 -0400 | [diff] [blame] | 158 | if (drawCallParams.mode() != mCurrentDrawMode) |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 159 | { |
| 160 | invalidateCurrentPipeline(); |
Jamie Madill | 32fd63b | 2018-03-31 11:20:35 -0400 | [diff] [blame] | 161 | mCurrentDrawMode = drawCallParams.mode(); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 162 | } |
| 163 | |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 164 | if (!mCurrentPipeline) |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 165 | { |
Jamie Madill | b90779e | 2018-04-27 11:45:01 -0400 | [diff] [blame] | 166 | ANGLE_TRY(initPipeline()); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 167 | } |
| 168 | |
Jamie Madill | 50cf2be | 2018-06-15 09:46:57 -0400 | [diff] [blame] | 169 | const auto &state = mState.getState(); |
| 170 | const gl::Program *programGL = state.getProgram(); |
| 171 | ProgramVk *programVk = vk::GetImpl(programGL); |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 172 | const gl::Framebuffer *framebuffer = state.getDrawFramebuffer(); |
| 173 | FramebufferVk *framebufferVk = vk::GetImpl(framebuffer); |
Jamie Madill | 50cf2be | 2018-06-15 09:46:57 -0400 | [diff] [blame] | 174 | Serial queueSerial = mRenderer->getCurrentQueueSerial(); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 175 | |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 176 | vk::RecordingMode mode = vk::RecordingMode::Start; |
| 177 | ANGLE_TRY(framebufferVk->getCommandBufferForDraw(this, commandBufferOut, &mode)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 178 | |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 179 | if (mode == vk::RecordingMode::Start) |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 180 | { |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 181 | mTexturesDirty = true; |
| 182 | *shouldApplyVertexArrayOut = true; |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 183 | } |
| 184 | else |
| 185 | { |
Luc Ferron | 6ed167a | 2018-06-13 13:45:55 -0400 | [diff] [blame] | 186 | *shouldApplyVertexArrayOut = mVertexArrayBindingHasChanged; |
| 187 | mVertexArrayBindingHasChanged = false; |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | // Ensure any writes to the textures are flushed before we read from them. |
| 191 | if (mTexturesDirty) |
| 192 | { |
| 193 | mTexturesDirty = false; |
| 194 | // TODO(jmadill): Should probably merge this for loop with programVk's descriptor update. |
Luc Ferron | f6e160f | 2018-06-12 10:13:57 -0400 | [diff] [blame] | 195 | ContextVk *contextVk = vk::GetImpl(context); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 196 | const auto &completeTextures = state.getCompleteTextureCache(); |
| 197 | for (const gl::SamplerBinding &samplerBinding : programGL->getSamplerBindings()) |
| 198 | { |
| 199 | ASSERT(!samplerBinding.unreferenced); |
| 200 | |
Jamie Madill | 4cc753e | 2018-06-13 13:25:33 -0400 | [diff] [blame] | 201 | for (GLuint textureUnit : samplerBinding.boundTextureUnits) |
Luc Ferron | 9096836 | 2018-05-04 08:47:22 -0400 | [diff] [blame] | 202 | { |
Jamie Madill | 4cc753e | 2018-06-13 13:25:33 -0400 | [diff] [blame] | 203 | gl::Texture *texture = completeTextures[textureUnit]; |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 204 | |
Jamie Madill | 4cc753e | 2018-06-13 13:25:33 -0400 | [diff] [blame] | 205 | // Null textures represent incomplete textures. |
| 206 | if (texture == nullptr) |
| 207 | { |
| 208 | ANGLE_TRY(getIncompleteTexture(context, samplerBinding.textureType, &texture)); |
| 209 | } |
| 210 | |
| 211 | TextureVk *textureVk = vk::GetImpl(texture); |
Luc Ferron | f6e160f | 2018-06-12 10:13:57 -0400 | [diff] [blame] | 212 | ANGLE_TRY(textureVk->ensureImageInitialized(contextVk)); |
Jamie Madill | 4cc753e | 2018-06-13 13:25:33 -0400 | [diff] [blame] | 213 | textureVk->addReadDependency(framebufferVk); |
| 214 | } |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 215 | } |
| 216 | } |
| 217 | |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 218 | (*commandBufferOut)->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline->get()); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 219 | |
| 220 | // Update the queue serial for the pipeline object. |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 221 | ASSERT(mCurrentPipeline && mCurrentPipeline->valid()); |
| 222 | mCurrentPipeline->updateSerial(queueSerial); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 223 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 224 | // TODO(jmadill): Can probably use more dirty bits here. |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 225 | ANGLE_TRY(programVk->updateUniforms(this)); |
Luc Ferron | 9096836 | 2018-05-04 08:47:22 -0400 | [diff] [blame] | 226 | ANGLE_TRY(programVk->updateTexturesDescriptorSet(context)); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 227 | |
| 228 | // Bind the graphics descriptor sets. |
| 229 | // TODO(jmadill): Handle multiple command buffers. |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 230 | const auto &descriptorSets = programVk->getDescriptorSets(); |
Jamie Madill | 8c3988c | 2017-12-21 14:44:56 -0500 | [diff] [blame] | 231 | const gl::RangeUI &usedRange = programVk->getUsedDescriptorSetRange(); |
| 232 | if (!usedRange.empty()) |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 233 | { |
Jamie Madill | 8c3988c | 2017-12-21 14:44:56 -0500 | [diff] [blame] | 234 | ASSERT(!descriptorSets.empty()); |
Jamie Madill | 9b168d0 | 2018-06-13 13:25:32 -0400 | [diff] [blame] | 235 | const vk::PipelineLayout &pipelineLayout = programVk->getPipelineLayout(); |
Luc Ferron | 7a06ac1 | 2018-03-15 10:17:04 -0400 | [diff] [blame] | 236 | |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 237 | (*commandBufferOut) |
| 238 | ->bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, usedRange.low(), |
| 239 | usedRange.length(), &descriptorSets[usedRange.low()], |
| 240 | programVk->getDynamicOffsetsCount(), |
| 241 | programVk->getDynamicOffsets()); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 242 | } |
| 243 | |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 244 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 245 | } |
| 246 | |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 247 | gl::Error ContextVk::drawArrays(const gl::Context *context, |
| 248 | gl::PrimitiveMode mode, |
| 249 | GLint first, |
| 250 | GLsizei count) |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 251 | { |
Jamie Madill | 32fd63b | 2018-03-31 11:20:35 -0400 | [diff] [blame] | 252 | const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>(); |
| 253 | |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 254 | vk::CommandBuffer *commandBuffer = nullptr; |
| 255 | bool shouldApplyVertexArray = false; |
| 256 | ANGLE_TRY(setupDraw(context, drawCallParams, &commandBuffer, &shouldApplyVertexArray)); |
Luc Ferron | 360098d | 2018-02-21 07:33:50 -0500 | [diff] [blame] | 257 | |
Jamie Madill | c3755fc | 2018-04-05 08:39:13 -0400 | [diff] [blame] | 258 | const gl::VertexArray *vertexArray = context->getGLState().getVertexArray(); |
| 259 | VertexArrayVk *vertexArrayVk = vk::GetImpl(vertexArray); |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 260 | ANGLE_TRY(vertexArrayVk->drawArrays(context, mRenderer, drawCallParams, commandBuffer, |
| 261 | shouldApplyVertexArray)); |
Luc Ferron | 360098d | 2018-02-21 07:33:50 -0500 | [diff] [blame] | 262 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 263 | return gl::NoError(); |
| 264 | } |
| 265 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 266 | gl::Error ContextVk::drawArraysInstanced(const gl::Context *context, |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 267 | gl::PrimitiveMode mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 268 | GLint first, |
| 269 | GLsizei count, |
| 270 | GLsizei instanceCount) |
| 271 | { |
| 272 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 273 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 274 | } |
| 275 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 276 | gl::Error ContextVk::drawElements(const gl::Context *context, |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 277 | gl::PrimitiveMode mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 278 | GLsizei count, |
| 279 | GLenum type, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 280 | const void *indices) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 281 | { |
Jamie Madill | 32fd63b | 2018-03-31 11:20:35 -0400 | [diff] [blame] | 282 | const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>(); |
| 283 | |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 284 | vk::CommandBuffer *commandBuffer = nullptr; |
| 285 | bool shouldApplyVertexArray = false; |
| 286 | ANGLE_TRY(setupDraw(context, drawCallParams, &commandBuffer, &shouldApplyVertexArray)); |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 287 | |
Jamie Madill | c3755fc | 2018-04-05 08:39:13 -0400 | [diff] [blame] | 288 | gl::VertexArray *vao = mState.getState().getVertexArray(); |
| 289 | VertexArrayVk *vertexArrayVk = vk::GetImpl(vao); |
Jamie Madill | 316c606 | 2018-05-29 10:49:45 -0400 | [diff] [blame] | 290 | ANGLE_TRY(vertexArrayVk->drawElements(context, mRenderer, drawCallParams, commandBuffer, |
| 291 | shouldApplyVertexArray)); |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 292 | |
| 293 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 294 | } |
| 295 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 296 | gl::Error ContextVk::drawElementsInstanced(const gl::Context *context, |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 297 | gl::PrimitiveMode mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 298 | GLsizei count, |
| 299 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 300 | const void *indices, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 301 | GLsizei instances) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 302 | { |
| 303 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 304 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 305 | } |
| 306 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 307 | gl::Error ContextVk::drawRangeElements(const gl::Context *context, |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 308 | gl::PrimitiveMode mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 309 | GLuint start, |
| 310 | GLuint end, |
| 311 | GLsizei count, |
| 312 | GLenum type, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 313 | const void *indices) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 314 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 315 | return gl::NoError(); |
| 316 | } |
| 317 | |
| 318 | VkDevice ContextVk::getDevice() const |
| 319 | { |
| 320 | return mRenderer->getDevice(); |
| 321 | } |
| 322 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 323 | gl::Error ContextVk::drawArraysIndirect(const gl::Context *context, |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 324 | gl::PrimitiveMode mode, |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 325 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 326 | { |
| 327 | UNIMPLEMENTED(); |
| 328 | return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend."; |
| 329 | } |
| 330 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 331 | gl::Error ContextVk::drawElementsIndirect(const gl::Context *context, |
Jamie Madill | 493f957 | 2018-05-24 19:52:15 -0400 | [diff] [blame] | 332 | gl::PrimitiveMode mode, |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 333 | GLenum type, |
| 334 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 335 | { |
| 336 | UNIMPLEMENTED(); |
| 337 | return gl::InternalError() |
| 338 | << "DrawElementsIndirect hasn't been implemented for vulkan backend."; |
| 339 | } |
| 340 | |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 341 | GLenum ContextVk::getResetStatus() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 342 | { |
| 343 | UNIMPLEMENTED(); |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 344 | return GL_NO_ERROR; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | std::string ContextVk::getVendorString() const |
| 348 | { |
| 349 | UNIMPLEMENTED(); |
| 350 | return std::string(); |
| 351 | } |
| 352 | |
| 353 | std::string ContextVk::getRendererDescription() const |
| 354 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 355 | return mRenderer->getRendererDescription(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 356 | } |
| 357 | |
| 358 | void ContextVk::insertEventMarker(GLsizei length, const char *marker) |
| 359 | { |
| 360 | UNIMPLEMENTED(); |
| 361 | } |
| 362 | |
| 363 | void ContextVk::pushGroupMarker(GLsizei length, const char *marker) |
| 364 | { |
| 365 | UNIMPLEMENTED(); |
| 366 | } |
| 367 | |
| 368 | void ContextVk::popGroupMarker() |
| 369 | { |
| 370 | UNIMPLEMENTED(); |
| 371 | } |
| 372 | |
Geoff Lang | 5d5253a | 2017-11-22 14:51:12 -0500 | [diff] [blame] | 373 | void ContextVk::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message) |
| 374 | { |
| 375 | UNIMPLEMENTED(); |
| 376 | } |
| 377 | |
| 378 | void ContextVk::popDebugGroup() |
| 379 | { |
| 380 | UNIMPLEMENTED(); |
| 381 | } |
| 382 | |
Geoff Lang | caa55cd | 2018-07-05 13:19:35 -0400 | [diff] [blame^] | 383 | bool ContextVk::isViewportFlipEnabled() const |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 384 | { |
| 385 | gl::Framebuffer *framebuffer = mState.getState().getDrawFramebuffer(); |
Geoff Lang | caa55cd | 2018-07-05 13:19:35 -0400 | [diff] [blame^] | 386 | return framebuffer->isDefault() && mFlipYForCurrentSurface; |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 387 | } |
| 388 | |
Luc Ferron | 0bb940a | 2018-06-22 09:59:34 -0400 | [diff] [blame] | 389 | void ContextVk::updateColorMask(const gl::BlendState &blendState) |
Luc Ferron | 5fd3693 | 2018-06-19 14:55:50 -0400 | [diff] [blame] | 390 | { |
| 391 | mClearColorMask = |
| 392 | gl_vk::GetColorComponentFlags(blendState.colorMaskRed, blendState.colorMaskGreen, |
| 393 | blendState.colorMaskBlue, blendState.colorMaskAlpha); |
| 394 | |
| 395 | FramebufferVk *framebufferVk = vk::GetImpl(mState.getState().getDrawFramebuffer()); |
| 396 | mPipelineDesc->updateColorWriteMask(mClearColorMask, |
| 397 | framebufferVk->getEmulatedAlphaAttachmentMask()); |
| 398 | } |
| 399 | |
Luc Ferron | d17bdfe | 2018-04-05 13:50:10 -0400 | [diff] [blame] | 400 | void ContextVk::updateScissor(const gl::State &glState) |
| 401 | { |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 402 | FramebufferVk *framebufferVk = vk::GetImpl(getGLState().getDrawFramebuffer()); |
| 403 | gl::Box dimensions = framebufferVk->getState().getDimensions(); |
| 404 | gl::Rectangle renderArea(0, 0, dimensions.width, dimensions.height); |
| 405 | |
Luc Ferron | d17bdfe | 2018-04-05 13:50:10 -0400 | [diff] [blame] | 406 | if (glState.isScissorTestEnabled()) |
| 407 | { |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 408 | mPipelineDesc->updateScissor(glState.getScissor(), isViewportFlipEnabled(), renderArea); |
Luc Ferron | d17bdfe | 2018-04-05 13:50:10 -0400 | [diff] [blame] | 409 | } |
| 410 | else |
| 411 | { |
Luc Ferron | 14f4817 | 2018-04-11 08:43:28 -0400 | [diff] [blame] | 412 | // If the scissor test isn't enabled, we can simply use a really big scissor that's |
| 413 | // certainly larger than the current surface using the maximum size of a 2D texture |
| 414 | // for the width and height. |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 415 | mPipelineDesc->updateScissor(kMaxSizedScissor, isViewportFlipEnabled(), renderArea); |
Luc Ferron | d17bdfe | 2018-04-05 13:50:10 -0400 | [diff] [blame] | 416 | } |
| 417 | } |
| 418 | |
Jamie Madill | 189ad87 | 2018-07-09 13:32:37 -0400 | [diff] [blame] | 419 | gl::Error ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 420 | { |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 421 | if (dirtyBits.any()) |
| 422 | { |
| 423 | invalidateCurrentPipeline(); |
| 424 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 425 | |
| 426 | const auto &glState = context->getGLState(); |
| 427 | |
| 428 | // TODO(jmadill): Full dirty bits implementation. |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 429 | bool dirtyTextures = false; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 430 | |
| 431 | for (auto dirtyBit : dirtyBits) |
| 432 | { |
| 433 | switch (dirtyBit) |
| 434 | { |
| 435 | case gl::State::DIRTY_BIT_SCISSOR_TEST_ENABLED: |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 436 | case gl::State::DIRTY_BIT_SCISSOR: |
Luc Ferron | 14f4817 | 2018-04-11 08:43:28 -0400 | [diff] [blame] | 437 | updateScissor(glState); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 438 | break; |
| 439 | case gl::State::DIRTY_BIT_VIEWPORT: |
Luc Ferron | 1a135ad | 2018-07-04 10:35:31 -0400 | [diff] [blame] | 440 | { |
| 441 | FramebufferVk *framebufferVk = vk::GetImpl(glState.getDrawFramebuffer()); |
| 442 | mPipelineDesc->updateViewport(framebufferVk, glState.getViewport(), |
| 443 | glState.getNearPlane(), glState.getFarPlane(), |
| 444 | isViewportFlipEnabled()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 445 | break; |
Luc Ferron | 1a135ad | 2018-07-04 10:35:31 -0400 | [diff] [blame] | 446 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 447 | case gl::State::DIRTY_BIT_DEPTH_RANGE: |
Luc Ferron | 0986f1c | 2018-04-16 13:47:23 -0400 | [diff] [blame] | 448 | mPipelineDesc->updateDepthRange(glState.getNearPlane(), glState.getFarPlane()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 449 | break; |
| 450 | case gl::State::DIRTY_BIT_BLEND_ENABLED: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 451 | mPipelineDesc->updateBlendEnabled(glState.isBlendEnabled()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 452 | break; |
| 453 | case gl::State::DIRTY_BIT_BLEND_COLOR: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 454 | mPipelineDesc->updateBlendColor(glState.getBlendColor()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 455 | break; |
| 456 | case gl::State::DIRTY_BIT_BLEND_FUNCS: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 457 | mPipelineDesc->updateBlendFuncs(glState.getBlendState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 458 | break; |
| 459 | case gl::State::DIRTY_BIT_BLEND_EQUATIONS: |
Luc Ferron | f8be756 | 2018-02-06 15:59:11 -0500 | [diff] [blame] | 460 | mPipelineDesc->updateBlendEquations(glState.getBlendState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 461 | break; |
| 462 | case gl::State::DIRTY_BIT_COLOR_MASK: |
Luc Ferron | 0bb940a | 2018-06-22 09:59:34 -0400 | [diff] [blame] | 463 | updateColorMask(glState.getBlendState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 464 | break; |
| 465 | case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED: |
| 466 | WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED unimplemented"; |
| 467 | break; |
| 468 | case gl::State::DIRTY_BIT_SAMPLE_COVERAGE_ENABLED: |
| 469 | WARN() << "DIRTY_BIT_SAMPLE_COVERAGE_ENABLED unimplemented"; |
| 470 | break; |
| 471 | case gl::State::DIRTY_BIT_SAMPLE_COVERAGE: |
| 472 | WARN() << "DIRTY_BIT_SAMPLE_COVERAGE unimplemented"; |
| 473 | break; |
| 474 | case gl::State::DIRTY_BIT_SAMPLE_MASK_ENABLED: |
| 475 | WARN() << "DIRTY_BIT_SAMPLE_MASK_ENABLED unimplemented"; |
| 476 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 477 | case gl::State::DIRTY_BIT_SAMPLE_MASK: |
| 478 | WARN() << "DIRTY_BIT_SAMPLE_MASK unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 479 | break; |
| 480 | case gl::State::DIRTY_BIT_DEPTH_TEST_ENABLED: |
Jamie Madill | 0cec82a | 2018-03-14 09:21:07 -0400 | [diff] [blame] | 481 | mPipelineDesc->updateDepthTestEnabled(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 482 | break; |
| 483 | case gl::State::DIRTY_BIT_DEPTH_FUNC: |
Jamie Madill | 0cec82a | 2018-03-14 09:21:07 -0400 | [diff] [blame] | 484 | mPipelineDesc->updateDepthFunc(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 485 | break; |
| 486 | case gl::State::DIRTY_BIT_DEPTH_MASK: |
Luc Ferron | dd196e0 | 2018-04-04 11:41:44 -0400 | [diff] [blame] | 487 | mPipelineDesc->updateDepthWriteEnabled(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 488 | break; |
| 489 | case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 490 | mPipelineDesc->updateStencilTestEnabled(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 491 | break; |
| 492 | case gl::State::DIRTY_BIT_STENCIL_FUNCS_FRONT: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 493 | mPipelineDesc->updateStencilFrontFuncs(glState.getStencilRef(), |
| 494 | glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 495 | break; |
| 496 | case gl::State::DIRTY_BIT_STENCIL_FUNCS_BACK: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 497 | mPipelineDesc->updateStencilBackFuncs(glState.getStencilBackRef(), |
| 498 | glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 499 | break; |
| 500 | case gl::State::DIRTY_BIT_STENCIL_OPS_FRONT: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 501 | mPipelineDesc->updateStencilFrontOps(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 502 | break; |
| 503 | case gl::State::DIRTY_BIT_STENCIL_OPS_BACK: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 504 | mPipelineDesc->updateStencilBackOps(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 505 | break; |
| 506 | case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 507 | mPipelineDesc->updateStencilFrontWriteMask(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 508 | break; |
| 509 | case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_BACK: |
Luc Ferron | 364a955 | 2018-03-29 09:44:51 -0400 | [diff] [blame] | 510 | mPipelineDesc->updateStencilBackWriteMask(glState.getDepthStencilState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 511 | break; |
| 512 | case gl::State::DIRTY_BIT_CULL_FACE_ENABLED: |
| 513 | case gl::State::DIRTY_BIT_CULL_FACE: |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 514 | mPipelineDesc->updateCullMode(glState.getRasterizerState(), |
| 515 | isViewportFlipEnabled()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 516 | break; |
| 517 | case gl::State::DIRTY_BIT_FRONT_FACE: |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 518 | mPipelineDesc->updateFrontFace(glState.getRasterizerState()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 519 | break; |
| 520 | case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED: |
| 521 | WARN() << "DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED unimplemented"; |
| 522 | break; |
| 523 | case gl::State::DIRTY_BIT_POLYGON_OFFSET: |
| 524 | WARN() << "DIRTY_BIT_POLYGON_OFFSET unimplemented"; |
| 525 | break; |
| 526 | case gl::State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED: |
| 527 | WARN() << "DIRTY_BIT_RASTERIZER_DISCARD_ENABLED unimplemented"; |
| 528 | break; |
| 529 | case gl::State::DIRTY_BIT_LINE_WIDTH: |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 530 | mPipelineDesc->updateLineWidth(glState.getLineWidth()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 531 | break; |
| 532 | case gl::State::DIRTY_BIT_PRIMITIVE_RESTART_ENABLED: |
| 533 | WARN() << "DIRTY_BIT_PRIMITIVE_RESTART_ENABLED unimplemented"; |
| 534 | break; |
| 535 | case gl::State::DIRTY_BIT_CLEAR_COLOR: |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 536 | mClearColorValue.color.float32[0] = glState.getColorClearValue().red; |
| 537 | mClearColorValue.color.float32[1] = glState.getColorClearValue().green; |
| 538 | mClearColorValue.color.float32[2] = glState.getColorClearValue().blue; |
| 539 | mClearColorValue.color.float32[3] = glState.getColorClearValue().alpha; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 540 | break; |
| 541 | case gl::State::DIRTY_BIT_CLEAR_DEPTH: |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 542 | mClearDepthStencilValue.depthStencil.depth = glState.getDepthClearValue(); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 543 | break; |
| 544 | case gl::State::DIRTY_BIT_CLEAR_STENCIL: |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 545 | mClearDepthStencilValue.depthStencil.stencil = |
| 546 | static_cast<uint32_t>(glState.getStencilClearValue()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 547 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 548 | case gl::State::DIRTY_BIT_UNPACK_STATE: |
Luc Ferron | f9749ea | 2018-04-24 15:34:53 -0400 | [diff] [blame] | 549 | // This is a no-op, its only important to use the right unpack state when we do |
| 550 | // setImage or setSubImage in TextureVk, which is plumbed through the frontend call |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 551 | break; |
Corentin Wallez | 29a2099 | 2017-11-06 18:23:16 -0500 | [diff] [blame] | 552 | case gl::State::DIRTY_BIT_UNPACK_BUFFER_BINDING: |
| 553 | WARN() << "DIRTY_BIT_UNPACK_BUFFER_BINDING unimplemented"; |
| 554 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 555 | case gl::State::DIRTY_BIT_PACK_STATE: |
Luc Ferron | a1c7242 | 2018-05-14 15:58:28 -0400 | [diff] [blame] | 556 | // This is a no-op, its only important to use the right pack state when we do |
| 557 | // call readPixels later on. |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 558 | break; |
Corentin Wallez | 29a2099 | 2017-11-06 18:23:16 -0500 | [diff] [blame] | 559 | case gl::State::DIRTY_BIT_PACK_BUFFER_BINDING: |
| 560 | WARN() << "DIRTY_BIT_PACK_BUFFER_BINDING unimplemented"; |
| 561 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 562 | case gl::State::DIRTY_BIT_DITHER_ENABLED: |
| 563 | WARN() << "DIRTY_BIT_DITHER_ENABLED unimplemented"; |
| 564 | break; |
| 565 | case gl::State::DIRTY_BIT_GENERATE_MIPMAP_HINT: |
| 566 | WARN() << "DIRTY_BIT_GENERATE_MIPMAP_HINT unimplemented"; |
| 567 | break; |
| 568 | case gl::State::DIRTY_BIT_SHADER_DERIVATIVE_HINT: |
| 569 | WARN() << "DIRTY_BIT_SHADER_DERIVATIVE_HINT unimplemented"; |
| 570 | break; |
| 571 | case gl::State::DIRTY_BIT_READ_FRAMEBUFFER_BINDING: |
| 572 | WARN() << "DIRTY_BIT_READ_FRAMEBUFFER_BINDING unimplemented"; |
| 573 | break; |
| 574 | case gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING: |
Luc Ferron | 1a135ad | 2018-07-04 10:35:31 -0400 | [diff] [blame] | 575 | { |
| 576 | FramebufferVk *framebufferVk = vk::GetImpl(glState.getDrawFramebuffer()); |
| 577 | mPipelineDesc->updateViewport(framebufferVk, glState.getViewport(), |
| 578 | glState.getNearPlane(), glState.getFarPlane(), |
| 579 | isViewportFlipEnabled()); |
Luc Ferron | 0bb940a | 2018-06-22 09:59:34 -0400 | [diff] [blame] | 580 | updateColorMask(glState.getBlendState()); |
Luc Ferron | bf6dc37 | 2018-06-28 15:24:19 -0400 | [diff] [blame] | 581 | mPipelineDesc->updateCullMode(glState.getRasterizerState(), |
| 582 | isViewportFlipEnabled()); |
| 583 | updateScissor(glState); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 584 | break; |
Luc Ferron | 1a135ad | 2018-07-04 10:35:31 -0400 | [diff] [blame] | 585 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 586 | case gl::State::DIRTY_BIT_RENDERBUFFER_BINDING: |
| 587 | WARN() << "DIRTY_BIT_RENDERBUFFER_BINDING unimplemented"; |
| 588 | break; |
| 589 | case gl::State::DIRTY_BIT_VERTEX_ARRAY_BINDING: |
Jamie Madill | c3755fc | 2018-04-05 08:39:13 -0400 | [diff] [blame] | 590 | invalidateCurrentPipeline(); |
| 591 | mVertexArrayBindingHasChanged = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 592 | break; |
| 593 | case gl::State::DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING: |
| 594 | WARN() << "DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING unimplemented"; |
| 595 | break; |
Qin Jiajia | a98a281 | 2017-11-30 18:12:06 +0800 | [diff] [blame] | 596 | case gl::State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING: |
| 597 | WARN() << "DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING unimplemented"; |
| 598 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 599 | case gl::State::DIRTY_BIT_PROGRAM_BINDING: |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 600 | break; |
| 601 | case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE: |
| 602 | { |
Jamie Madill | f2f6d37 | 2018-01-10 21:37:23 -0500 | [diff] [blame] | 603 | ProgramVk *programVk = vk::GetImpl(glState.getProgram()); |
Jamie Madill | 78feddc | 2018-04-27 11:45:05 -0400 | [diff] [blame] | 604 | mPipelineDesc->updateShaders(programVk->getVertexModuleSerial(), |
| 605 | programVk->getFragmentModuleSerial()); |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 606 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 607 | break; |
| 608 | } |
| 609 | case gl::State::DIRTY_BIT_TEXTURE_BINDINGS: |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 610 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 611 | break; |
| 612 | case gl::State::DIRTY_BIT_SAMPLER_BINDINGS: |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 613 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 614 | break; |
Geoff Lang | ded7923 | 2017-11-28 15:21:11 -0500 | [diff] [blame] | 615 | case gl::State::DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING: |
| 616 | WARN() << "DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING unimplemented"; |
| 617 | break; |
Xinghua Cao | 10a4d43 | 2017-11-28 14:46:26 +0800 | [diff] [blame] | 618 | case gl::State::DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING: |
| 619 | WARN() << "DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING unimplemented"; |
| 620 | break; |
Jamie Madill | f414121 | 2017-12-12 15:08:07 -0500 | [diff] [blame] | 621 | case gl::State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS: |
| 622 | WARN() << "DIRTY_BIT_UNIFORM_BUFFER_BINDINGS unimplemented"; |
| 623 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 624 | case gl::State::DIRTY_BIT_MULTISAMPLING: |
| 625 | WARN() << "DIRTY_BIT_MULTISAMPLING unimplemented"; |
| 626 | break; |
| 627 | case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_ONE: |
| 628 | WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_ONE unimplemented"; |
| 629 | break; |
| 630 | case gl::State::DIRTY_BIT_COVERAGE_MODULATION: |
| 631 | WARN() << "DIRTY_BIT_COVERAGE_MODULATION unimplemented"; |
| 632 | break; |
| 633 | case gl::State::DIRTY_BIT_PATH_RENDERING_MATRIX_MV: |
| 634 | WARN() << "DIRTY_BIT_PATH_RENDERING_MATRIX_MV unimplemented"; |
| 635 | break; |
| 636 | case gl::State::DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ: |
| 637 | WARN() << "DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ unimplemented"; |
| 638 | break; |
| 639 | case gl::State::DIRTY_BIT_PATH_RENDERING_STENCIL_STATE: |
| 640 | WARN() << "DIRTY_BIT_PATH_RENDERING_STENCIL_STATE unimplemented"; |
| 641 | break; |
| 642 | case gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB: |
| 643 | WARN() << "DIRTY_BIT_FRAMEBUFFER_SRGB unimplemented"; |
| 644 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 645 | case gl::State::DIRTY_BIT_CURRENT_VALUES: |
| 646 | WARN() << "DIRTY_BIT_CURRENT_VALUES unimplemented"; |
| 647 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 648 | default: |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 649 | UNREACHABLE(); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 650 | break; |
| 651 | } |
| 652 | } |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 653 | |
| 654 | if (dirtyTextures) |
| 655 | { |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 656 | ProgramVk *programVk = vk::GetImpl(glState.getProgram()); |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 657 | programVk->invalidateTextures(); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 658 | mTexturesDirty = true; |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 659 | } |
Jamie Madill | 189ad87 | 2018-07-09 13:32:37 -0400 | [diff] [blame] | 660 | |
| 661 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 662 | } |
| 663 | |
| 664 | GLint ContextVk::getGPUDisjoint() |
| 665 | { |
| 666 | UNIMPLEMENTED(); |
| 667 | return GLint(); |
| 668 | } |
| 669 | |
| 670 | GLint64 ContextVk::getTimestamp() |
| 671 | { |
| 672 | UNIMPLEMENTED(); |
| 673 | return GLint64(); |
| 674 | } |
| 675 | |
Geoff Lang | caa55cd | 2018-07-05 13:19:35 -0400 | [diff] [blame^] | 676 | void ContextVk::onMakeCurrent(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 677 | { |
Geoff Lang | caa55cd | 2018-07-05 13:19:35 -0400 | [diff] [blame^] | 678 | // Flip viewports if FeaturesVk::flipViewportY is enabled and the user did not request that the |
| 679 | // surface is flipped. |
| 680 | egl::Surface *drawSurface = context->getCurrentDrawSurface(); |
| 681 | mFlipYForCurrentSurface = |
| 682 | drawSurface != nullptr && mRenderer->getFeatures().flipViewportY && |
| 683 | !IsMaskFlagSet(drawSurface->getOrientation(), EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 684 | } |
| 685 | |
Jiawei Shao | d0a7d10 | 2018-05-07 12:40:20 +0800 | [diff] [blame] | 686 | gl::Caps ContextVk::getNativeCaps() const |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 687 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 688 | return mRenderer->getNativeCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const |
| 692 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 693 | return mRenderer->getNativeTextureCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 694 | } |
| 695 | |
| 696 | const gl::Extensions &ContextVk::getNativeExtensions() const |
| 697 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 698 | return mRenderer->getNativeExtensions(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | const gl::Limitations &ContextVk::getNativeLimitations() const |
| 702 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 703 | return mRenderer->getNativeLimitations(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 704 | } |
| 705 | |
| 706 | CompilerImpl *ContextVk::createCompiler() |
| 707 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 708 | return new CompilerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 709 | } |
| 710 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 711 | ShaderImpl *ContextVk::createShader(const gl::ShaderState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 712 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 713 | return new ShaderVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 714 | } |
| 715 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 716 | ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 717 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 718 | return new ProgramVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 719 | } |
| 720 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 721 | FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 722 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 723 | return FramebufferVk::CreateUserFBO(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 724 | } |
| 725 | |
| 726 | TextureImpl *ContextVk::createTexture(const gl::TextureState &state) |
| 727 | { |
Luc Ferron | a9ab0f3 | 2018-05-17 17:03:55 -0400 | [diff] [blame] | 728 | return new TextureVk(state, mRenderer); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 729 | } |
| 730 | |
Jamie Madill | e703c60 | 2018-02-20 10:21:48 -0500 | [diff] [blame] | 731 | RenderbufferImpl *ContextVk::createRenderbuffer(const gl::RenderbufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 732 | { |
Jamie Madill | e703c60 | 2018-02-20 10:21:48 -0500 | [diff] [blame] | 733 | return new RenderbufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 734 | } |
| 735 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 736 | BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 737 | { |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 738 | return new BufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 739 | } |
| 740 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 741 | VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 742 | { |
Luc Ferron | a9ab0f3 | 2018-05-17 17:03:55 -0400 | [diff] [blame] | 743 | return new VertexArrayVk(state, mRenderer); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 744 | } |
| 745 | |
Corentin Wallez | ad3ae90 | 2018-03-09 13:40:42 -0500 | [diff] [blame] | 746 | QueryImpl *ContextVk::createQuery(gl::QueryType type) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 747 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 748 | return new QueryVk(type); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 749 | } |
| 750 | |
| 751 | FenceNVImpl *ContextVk::createFenceNV() |
| 752 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 753 | return new FenceNVVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 754 | } |
| 755 | |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 756 | SyncImpl *ContextVk::createSync() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 757 | { |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 758 | return new SyncVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 759 | } |
| 760 | |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 761 | TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 762 | { |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 763 | return new TransformFeedbackVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 764 | } |
| 765 | |
Jamie Madill | 06ef36b | 2017-09-09 23:32:46 -0400 | [diff] [blame] | 766 | SamplerImpl *ContextVk::createSampler(const gl::SamplerState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 767 | { |
Jamie Madill | 06ef36b | 2017-09-09 23:32:46 -0400 | [diff] [blame] | 768 | return new SamplerVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 769 | } |
| 770 | |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 771 | ProgramPipelineImpl *ContextVk::createProgramPipeline(const gl::ProgramPipelineState &state) |
| 772 | { |
| 773 | return new ProgramPipelineVk(state); |
| 774 | } |
| 775 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 776 | std::vector<PathImpl *> ContextVk::createPaths(GLsizei) |
| 777 | { |
| 778 | return std::vector<PathImpl *>(); |
| 779 | } |
| 780 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 781 | void ContextVk::invalidateCurrentPipeline() |
| 782 | { |
Jamie Madill | ffa4cbb | 2018-01-23 13:04:07 -0500 | [diff] [blame] | 783 | mCurrentPipeline = nullptr; |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 784 | } |
| 785 | |
Jamie Madill | fe54834 | 2017-06-19 11:13:24 -0400 | [diff] [blame] | 786 | gl::Error ContextVk::dispatchCompute(const gl::Context *context, |
| 787 | GLuint numGroupsX, |
| 788 | GLuint numGroupsY, |
| 789 | GLuint numGroupsZ) |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 790 | { |
| 791 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 792 | return gl::InternalError(); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 793 | } |
| 794 | |
Qin Jiajia | 62fcf62 | 2017-11-30 16:16:12 +0800 | [diff] [blame] | 795 | gl::Error ContextVk::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) |
| 796 | { |
| 797 | UNIMPLEMENTED(); |
| 798 | return gl::InternalError(); |
| 799 | } |
| 800 | |
Xinghua Cao | 89c422a | 2017-11-29 18:24:20 +0800 | [diff] [blame] | 801 | gl::Error ContextVk::memoryBarrier(const gl::Context *context, GLbitfield barriers) |
| 802 | { |
| 803 | UNIMPLEMENTED(); |
| 804 | return gl::InternalError(); |
| 805 | } |
| 806 | |
| 807 | gl::Error ContextVk::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) |
| 808 | { |
| 809 | UNIMPLEMENTED(); |
| 810 | return gl::InternalError(); |
| 811 | } |
| 812 | |
Jamie Madill | edeaa83 | 2018-06-22 09:18:41 -0400 | [diff] [blame] | 813 | vk::DynamicDescriptorPool *ContextVk::getDynamicDescriptorPool(uint32_t descriptorSetIndex) |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 814 | { |
Jamie Madill | edeaa83 | 2018-06-22 09:18:41 -0400 | [diff] [blame] | 815 | return &mDynamicDescriptorPools[descriptorSetIndex]; |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 816 | } |
| 817 | |
Jamie Madill | f4d693c | 2018-02-14 16:38:16 -0500 | [diff] [blame] | 818 | const VkClearValue &ContextVk::getClearColorValue() const |
| 819 | { |
| 820 | return mClearColorValue; |
| 821 | } |
| 822 | |
| 823 | const VkClearValue &ContextVk::getClearDepthStencilValue() const |
| 824 | { |
| 825 | return mClearDepthStencilValue; |
| 826 | } |
| 827 | |
Jamie Madill | 9aef367 | 2018-04-27 11:45:06 -0400 | [diff] [blame] | 828 | VkColorComponentFlags ContextVk::getClearColorMask() const |
| 829 | { |
| 830 | return mClearColorMask; |
| 831 | } |
Jamie Madill | 1266d20 | 2018-06-29 09:11:34 -0400 | [diff] [blame] | 832 | const FeaturesVk &ContextVk::getFeatures() const |
| 833 | { |
| 834 | return mRenderer->getFeatures(); |
| 835 | } |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 836 | } // namespace rx |