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" |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 14 | #include "libANGLE/Context.h" |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 15 | #include "libANGLE/Program.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 16 | #include "libANGLE/renderer/vulkan/BufferVk.h" |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 17 | #include "libANGLE/renderer/vulkan/CommandBufferNode.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 18 | #include "libANGLE/renderer/vulkan/CompilerVk.h" |
| 19 | #include "libANGLE/renderer/vulkan/ContextVk.h" |
| 20 | #include "libANGLE/renderer/vulkan/DeviceVk.h" |
| 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" |
| 23 | #include "libANGLE/renderer/vulkan/ImageVk.h" |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 24 | #include "libANGLE/renderer/vulkan/ProgramPipelineVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 25 | #include "libANGLE/renderer/vulkan/ProgramVk.h" |
| 26 | #include "libANGLE/renderer/vulkan/QueryVk.h" |
| 27 | #include "libANGLE/renderer/vulkan/RenderbufferVk.h" |
| 28 | #include "libANGLE/renderer/vulkan/RendererVk.h" |
| 29 | #include "libANGLE/renderer/vulkan/SamplerVk.h" |
| 30 | #include "libANGLE/renderer/vulkan/ShaderVk.h" |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 31 | #include "libANGLE/renderer/vulkan/SyncVk.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 32 | #include "libANGLE/renderer/vulkan/TextureVk.h" |
| 33 | #include "libANGLE/renderer/vulkan/TransformFeedbackVk.h" |
| 34 | #include "libANGLE/renderer/vulkan/VertexArrayVk.h" |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 35 | #include "libANGLE/renderer/vulkan/formatutilsvk.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 36 | |
| 37 | namespace rx |
| 38 | { |
| 39 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 40 | namespace |
| 41 | { |
| 42 | |
| 43 | VkIndexType GetVkIndexType(GLenum glIndexType) |
| 44 | { |
| 45 | switch (glIndexType) |
| 46 | { |
| 47 | case GL_UNSIGNED_SHORT: |
| 48 | return VK_INDEX_TYPE_UINT16; |
| 49 | case GL_UNSIGNED_INT: |
| 50 | return VK_INDEX_TYPE_UINT32; |
| 51 | default: |
| 52 | UNREACHABLE(); |
| 53 | return VK_INDEX_TYPE_MAX_ENUM; |
| 54 | } |
| 55 | } |
| 56 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 57 | enum DescriptorPoolIndex : uint8_t |
| 58 | { |
| 59 | UniformBufferPool = 0, |
| 60 | TexturePool = 1, |
| 61 | }; |
| 62 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 63 | } // anonymous namespace |
| 64 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 65 | ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer) |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 66 | : ContextImpl(state), |
| 67 | mRenderer(renderer), |
| 68 | mCurrentDrawMode(GL_NONE), |
| 69 | mVertexArrayDirty(false), |
| 70 | mTexturesDirty(false) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 71 | { |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 72 | // The module handle is filled out at draw time. |
| 73 | mCurrentShaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; |
| 74 | mCurrentShaderStages[0].pNext = nullptr; |
| 75 | mCurrentShaderStages[0].flags = 0; |
| 76 | mCurrentShaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT; |
| 77 | mCurrentShaderStages[0].module = VK_NULL_HANDLE; |
| 78 | mCurrentShaderStages[0].pName = "main"; |
| 79 | mCurrentShaderStages[0].pSpecializationInfo = nullptr; |
| 80 | |
| 81 | mCurrentShaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; |
| 82 | mCurrentShaderStages[1].pNext = nullptr; |
| 83 | mCurrentShaderStages[1].flags = 0; |
| 84 | mCurrentShaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; |
| 85 | mCurrentShaderStages[1].module = VK_NULL_HANDLE; |
| 86 | mCurrentShaderStages[1].pName = "main"; |
| 87 | mCurrentShaderStages[1].pSpecializationInfo = nullptr; |
| 88 | |
| 89 | // The binding descriptions are filled in at draw time. |
| 90 | mCurrentVertexInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; |
| 91 | mCurrentVertexInputState.pNext = nullptr; |
| 92 | mCurrentVertexInputState.flags = 0; |
| 93 | mCurrentVertexInputState.vertexBindingDescriptionCount = 0; |
| 94 | mCurrentVertexInputState.pVertexBindingDescriptions = nullptr; |
| 95 | mCurrentVertexInputState.vertexAttributeDescriptionCount = 0; |
| 96 | mCurrentVertexInputState.pVertexAttributeDescriptions = nullptr; |
| 97 | |
| 98 | // Primitive topology is filled in at draw time. |
| 99 | mCurrentInputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; |
| 100 | mCurrentInputAssemblyState.pNext = nullptr; |
| 101 | mCurrentInputAssemblyState.flags = 0; |
| 102 | mCurrentInputAssemblyState.topology = gl_vk::GetPrimitiveTopology(mCurrentDrawMode); |
| 103 | mCurrentInputAssemblyState.primitiveRestartEnable = VK_FALSE; |
| 104 | |
| 105 | // Set initial viewport and scissor state. |
| 106 | mCurrentViewportVk.x = 0.0f; |
| 107 | mCurrentViewportVk.y = 0.0f; |
| 108 | mCurrentViewportVk.width = 0.0f; |
| 109 | mCurrentViewportVk.height = 0.0f; |
| 110 | mCurrentViewportVk.minDepth = 0.0f; |
| 111 | mCurrentViewportVk.maxDepth = 1.0f; |
| 112 | |
| 113 | mCurrentScissorVk.offset.x = 0; |
| 114 | mCurrentScissorVk.offset.y = 0; |
| 115 | mCurrentScissorVk.extent.width = 0u; |
| 116 | mCurrentScissorVk.extent.height = 0u; |
| 117 | |
| 118 | mCurrentViewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; |
| 119 | mCurrentViewportState.pNext = nullptr; |
| 120 | mCurrentViewportState.flags = 0; |
| 121 | mCurrentViewportState.viewportCount = 1; |
| 122 | mCurrentViewportState.pViewports = &mCurrentViewportVk; |
| 123 | mCurrentViewportState.scissorCount = 1; |
| 124 | mCurrentViewportState.pScissors = &mCurrentScissorVk; |
| 125 | |
| 126 | // Set initial rasterizer state. |
| 127 | // TODO(jmadill): Extra rasterizer state features. |
| 128 | mCurrentRasterState.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; |
| 129 | mCurrentRasterState.pNext = nullptr; |
| 130 | mCurrentRasterState.flags = 0; |
| 131 | mCurrentRasterState.depthClampEnable = VK_FALSE; |
| 132 | mCurrentRasterState.rasterizerDiscardEnable = VK_FALSE; |
| 133 | mCurrentRasterState.polygonMode = VK_POLYGON_MODE_FILL; |
| 134 | mCurrentRasterState.cullMode = VK_CULL_MODE_NONE; |
| 135 | mCurrentRasterState.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; |
| 136 | mCurrentRasterState.depthBiasEnable = VK_FALSE; |
| 137 | mCurrentRasterState.depthBiasConstantFactor = 0.0f; |
| 138 | mCurrentRasterState.depthBiasClamp = 0.0f; |
| 139 | mCurrentRasterState.depthBiasSlopeFactor = 0.0f; |
| 140 | mCurrentRasterState.lineWidth = 1.0f; |
| 141 | |
| 142 | // Initialize a dummy multisample state. |
| 143 | // TODO(jmadill): Multisample state. |
| 144 | mCurrentMultisampleState.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; |
| 145 | mCurrentMultisampleState.pNext = nullptr; |
| 146 | mCurrentMultisampleState.flags = 0; |
| 147 | mCurrentMultisampleState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; |
| 148 | mCurrentMultisampleState.sampleShadingEnable = VK_FALSE; |
| 149 | mCurrentMultisampleState.minSampleShading = 0.0f; |
| 150 | mCurrentMultisampleState.pSampleMask = nullptr; |
| 151 | mCurrentMultisampleState.alphaToCoverageEnable = VK_FALSE; |
| 152 | mCurrentMultisampleState.alphaToOneEnable = VK_FALSE; |
| 153 | |
| 154 | // TODO(jmadill): Depth/stencil state. |
| 155 | |
| 156 | // Initialize a dummy MRT blend state. |
| 157 | // TODO(jmadill): Blend state/MRT. |
| 158 | mCurrentBlendAttachmentState.blendEnable = VK_FALSE; |
| 159 | mCurrentBlendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_ONE; |
| 160 | mCurrentBlendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ONE; |
| 161 | mCurrentBlendAttachmentState.colorBlendOp = VK_BLEND_OP_ADD; |
| 162 | mCurrentBlendAttachmentState.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; |
| 163 | mCurrentBlendAttachmentState.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE; |
| 164 | mCurrentBlendAttachmentState.alphaBlendOp = VK_BLEND_OP_ADD; |
| 165 | mCurrentBlendAttachmentState.colorWriteMask = |
| 166 | (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | |
| 167 | VK_COLOR_COMPONENT_A_BIT); |
| 168 | |
| 169 | mCurrentBlendState.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; |
| 170 | mCurrentBlendState.pNext = 0; |
| 171 | mCurrentBlendState.flags = 0; |
| 172 | mCurrentBlendState.logicOpEnable = VK_FALSE; |
| 173 | mCurrentBlendState.logicOp = VK_LOGIC_OP_CLEAR; |
| 174 | mCurrentBlendState.attachmentCount = 1; |
| 175 | mCurrentBlendState.pAttachments = &mCurrentBlendAttachmentState; |
| 176 | mCurrentBlendState.blendConstants[0] = 0.0f; |
| 177 | mCurrentBlendState.blendConstants[1] = 0.0f; |
| 178 | mCurrentBlendState.blendConstants[2] = 0.0f; |
| 179 | mCurrentBlendState.blendConstants[3] = 0.0f; |
| 180 | |
| 181 | // TODO(jmadill): Dynamic state. |
| 182 | |
| 183 | // The layout and renderpass are filled out at draw time. |
| 184 | mCurrentPipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; |
| 185 | mCurrentPipelineInfo.pNext = nullptr; |
| 186 | mCurrentPipelineInfo.flags = 0; |
| 187 | mCurrentPipelineInfo.stageCount = 2; |
| 188 | mCurrentPipelineInfo.pStages = mCurrentShaderStages; |
| 189 | mCurrentPipelineInfo.pVertexInputState = &mCurrentVertexInputState; |
| 190 | mCurrentPipelineInfo.pInputAssemblyState = &mCurrentInputAssemblyState; |
| 191 | mCurrentPipelineInfo.pTessellationState = nullptr; |
| 192 | mCurrentPipelineInfo.pViewportState = &mCurrentViewportState; |
| 193 | mCurrentPipelineInfo.pRasterizationState = &mCurrentRasterState; |
| 194 | mCurrentPipelineInfo.pMultisampleState = &mCurrentMultisampleState; |
| 195 | mCurrentPipelineInfo.pDepthStencilState = nullptr; |
| 196 | mCurrentPipelineInfo.pColorBlendState = &mCurrentBlendState; |
| 197 | mCurrentPipelineInfo.pDynamicState = nullptr; |
| 198 | mCurrentPipelineInfo.layout = VK_NULL_HANDLE; |
| 199 | mCurrentPipelineInfo.renderPass = VK_NULL_HANDLE; |
| 200 | mCurrentPipelineInfo.subpass = 0; |
| 201 | mCurrentPipelineInfo.basePipelineHandle = VK_NULL_HANDLE; |
| 202 | mCurrentPipelineInfo.basePipelineIndex = 0; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | ContextVk::~ContextVk() |
| 206 | { |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 207 | invalidateCurrentPipeline(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 208 | } |
| 209 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 210 | void ContextVk::onDestroy(const gl::Context *context) |
| 211 | { |
| 212 | VkDevice device = mRenderer->getDevice(); |
| 213 | |
| 214 | mDescriptorPool.destroy(device); |
| 215 | } |
| 216 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 217 | gl::Error ContextVk::initialize() |
| 218 | { |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 219 | VkDevice device = mRenderer->getDevice(); |
| 220 | |
| 221 | VkDescriptorPoolSize poolSizes[2]; |
| 222 | poolSizes[UniformBufferPool].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; |
| 223 | poolSizes[UniformBufferPool].descriptorCount = 1024; |
| 224 | poolSizes[TexturePool].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; |
| 225 | poolSizes[TexturePool].descriptorCount = 1024; |
| 226 | |
| 227 | VkDescriptorPoolCreateInfo descriptorPoolInfo; |
| 228 | descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; |
| 229 | descriptorPoolInfo.pNext = nullptr; |
| 230 | descriptorPoolInfo.flags = 0; |
| 231 | |
| 232 | // TODO(jmadill): Pick non-arbitrary max. |
| 233 | descriptorPoolInfo.maxSets = 2048; |
| 234 | |
| 235 | // Reserve pools for uniform blocks and textures. |
| 236 | descriptorPoolInfo.poolSizeCount = 2; |
| 237 | descriptorPoolInfo.pPoolSizes = poolSizes; |
| 238 | |
| 239 | ANGLE_TRY(mDescriptorPool.init(device, descriptorPoolInfo)); |
| 240 | |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 241 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 242 | } |
| 243 | |
Jamie Madill | afa02a2 | 2017-11-23 12:57:38 -0500 | [diff] [blame] | 244 | gl::Error ContextVk::flush(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 245 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 246 | // 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] | 247 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 248 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 249 | } |
| 250 | |
Jamie Madill | afa02a2 | 2017-11-23 12:57:38 -0500 | [diff] [blame] | 251 | gl::Error ContextVk::finish(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 252 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 253 | return mRenderer->finish(context); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 254 | } |
| 255 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 256 | gl::Error ContextVk::initPipeline(const gl::Context *context) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 257 | { |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 258 | ASSERT(!mCurrentPipeline.valid()); |
| 259 | |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 260 | VkDevice device = mRenderer->getDevice(); |
| 261 | const auto &state = mState.getState(); |
Jamie Madill | acf2f3a | 2017-11-21 19:22:44 -0500 | [diff] [blame] | 262 | const gl::Program *programGL = state.getProgram(); |
| 263 | const gl::VertexArray *vao = state.getVertexArray(); |
| 264 | const gl::Framebuffer *drawFBO = state.getDrawFramebuffer(); |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 265 | ProgramVk *programVk = vk::GetImpl(programGL); |
| 266 | FramebufferVk *vkFBO = vk::GetImpl(drawFBO); |
| 267 | VertexArrayVk *vkVAO = vk::GetImpl(vao); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 268 | |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 269 | // Ensure the attribs and bindings are updated. |
| 270 | vkVAO->updateVertexDescriptions(context); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 271 | |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 272 | const auto &vertexBindings = vkVAO->getVertexBindingDescs(); |
| 273 | const auto &vertexAttribs = vkVAO->getVertexAttribDescs(); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 274 | |
| 275 | // TODO(jmadill): Validate with ASSERT against physical device limits/caps? |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 276 | mCurrentVertexInputState.vertexBindingDescriptionCount = |
| 277 | static_cast<uint32_t>(vertexBindings.size()); |
| 278 | mCurrentVertexInputState.pVertexBindingDescriptions = vertexBindings.data(); |
| 279 | mCurrentVertexInputState.vertexAttributeDescriptionCount = |
| 280 | static_cast<uint32_t>(vertexAttribs.size()); |
| 281 | mCurrentVertexInputState.pVertexAttributeDescriptions = vertexAttribs.data(); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 282 | |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 283 | mCurrentInputAssemblyState.topology = gl_vk::GetPrimitiveTopology(mCurrentDrawMode); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 284 | |
Jamie Madill | 9f2a861 | 2017-11-30 12:43:09 -0500 | [diff] [blame] | 285 | const vk::RenderPassDesc &desc = vkFBO->getRenderPassDesc(context); |
| 286 | |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 287 | vk::RenderPass *renderPass = nullptr; |
Jamie Madill | 9f2a861 | 2017-11-30 12:43:09 -0500 | [diff] [blame] | 288 | ANGLE_TRY(mRenderer->getCompatibleRenderPass(desc, &renderPass)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 289 | ASSERT(renderPass && renderPass->valid()); |
| 290 | |
Jamie Madill | c514348 | 2017-10-15 20:20:06 -0400 | [diff] [blame] | 291 | const vk::PipelineLayout &pipelineLayout = programVk->getPipelineLayout(); |
| 292 | ASSERT(pipelineLayout.valid()); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 293 | |
Jamie Madill | c514348 | 2017-10-15 20:20:06 -0400 | [diff] [blame] | 294 | mCurrentPipelineInfo.layout = pipelineLayout.getHandle(); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 295 | mCurrentPipelineInfo.renderPass = renderPass->getHandle(); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 296 | |
Jamie Madill | 25301b6 | 2017-10-28 20:59:31 -0400 | [diff] [blame] | 297 | ANGLE_TRY(mCurrentPipeline.initGraphics(device, mCurrentPipelineInfo)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 298 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 299 | return gl::NoError(); |
| 300 | } |
| 301 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 302 | gl::Error ContextVk::setupDraw(const gl::Context *context, |
| 303 | GLenum mode, |
| 304 | DrawType drawType, |
| 305 | vk::CommandBuffer **commandBuffer) |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 306 | { |
| 307 | if (mode != mCurrentDrawMode) |
| 308 | { |
| 309 | invalidateCurrentPipeline(); |
| 310 | mCurrentDrawMode = mode; |
| 311 | } |
| 312 | |
| 313 | if (!mCurrentPipeline.valid()) |
| 314 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 315 | ANGLE_TRY(initPipeline(context)); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 316 | ASSERT(mCurrentPipeline.valid()); |
| 317 | } |
| 318 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 319 | const auto &state = mState.getState(); |
Jamie Madill | acf2f3a | 2017-11-21 19:22:44 -0500 | [diff] [blame] | 320 | const gl::Program *programGL = state.getProgram(); |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 321 | ProgramVk *programVk = vk::GetImpl(programGL); |
Jamie Madill | acf2f3a | 2017-11-21 19:22:44 -0500 | [diff] [blame] | 322 | const gl::VertexArray *vao = state.getVertexArray(); |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 323 | VertexArrayVk *vkVAO = vk::GetImpl(vao); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 324 | const auto *drawFBO = state.getDrawFramebuffer(); |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 325 | FramebufferVk *vkFBO = vk::GetImpl(drawFBO); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 326 | Serial queueSerial = mRenderer->getCurrentQueueSerial(); |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 327 | uint32_t maxAttrib = programGL->getState().getMaxActiveAttribLocation(); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 328 | |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 329 | // Process vertex attributes. Assume zero offsets for now. |
| 330 | // TODO(jmadill): Offset handling. |
Jamie Madill | da854a2 | 2017-11-30 17:24:21 -0500 | [diff] [blame] | 331 | const auto &vertexHandles = vkVAO->getCurrentArrayBufferHandles(); |
| 332 | angle::MemoryBuffer *zeroBuf = nullptr; |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 333 | ANGLE_TRY(context->getZeroFilledBuffer(maxAttrib * sizeof(VkDeviceSize), &zeroBuf)); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 334 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 335 | // TODO(jmadill): Need to link up the TextureVk to the Secondary CB. |
| 336 | vk::CommandBufferNode *renderNode = nullptr; |
| 337 | ANGLE_TRY(vkFBO->getRenderNode(context, &renderNode)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 338 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 339 | if (!renderNode->getInsideRenderPassCommands()->valid()) |
| 340 | { |
| 341 | mVertexArrayDirty = true; |
| 342 | mTexturesDirty = true; |
| 343 | ANGLE_TRY(renderNode->startRenderPassRecording(mRenderer, commandBuffer)); |
| 344 | } |
| 345 | else |
| 346 | { |
| 347 | *commandBuffer = renderNode->getInsideRenderPassCommands(); |
| 348 | } |
Jamie Madill | bd159f0 | 2017-10-09 19:39:06 -0400 | [diff] [blame] | 349 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 350 | // Ensure any writes to the VAO buffers are flushed before we read from them. |
| 351 | if (mVertexArrayDirty) |
| 352 | { |
| 353 | mVertexArrayDirty = false; |
| 354 | vkVAO->updateDrawDependencies(renderNode, programGL->getActiveAttribLocationsMask(), |
| 355 | queueSerial, drawType); |
| 356 | } |
| 357 | |
| 358 | // Ensure any writes to the textures are flushed before we read from them. |
| 359 | if (mTexturesDirty) |
| 360 | { |
| 361 | mTexturesDirty = false; |
| 362 | // TODO(jmadill): Should probably merge this for loop with programVk's descriptor update. |
| 363 | const auto &completeTextures = state.getCompleteTextureCache(); |
| 364 | for (const gl::SamplerBinding &samplerBinding : programGL->getSamplerBindings()) |
| 365 | { |
| 366 | ASSERT(!samplerBinding.unreferenced); |
| 367 | |
| 368 | // TODO(jmadill): Sampler arrays |
| 369 | ASSERT(samplerBinding.boundTextureUnits.size() == 1); |
| 370 | |
| 371 | GLuint textureUnit = samplerBinding.boundTextureUnits[0]; |
| 372 | const gl::Texture *texture = completeTextures[textureUnit]; |
| 373 | |
| 374 | // TODO(jmadill): Incomplete textures handling. |
| 375 | ASSERT(texture); |
| 376 | |
| 377 | TextureVk *textureVk = vk::GetImpl(texture); |
| 378 | textureVk->updateDependencies(renderNode, mRenderer->getCurrentQueueSerial()); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | (*commandBuffer)->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline); |
| 383 | (*commandBuffer) |
| 384 | ->bindVertexBuffers(0, maxAttrib, vertexHandles.data(), |
| 385 | reinterpret_cast<const VkDeviceSize *>(zeroBuf->data())); |
| 386 | |
| 387 | // Update the queue serial for the pipeline object. |
Jamie Madill | abd3135 | 2017-09-19 00:24:58 -0400 | [diff] [blame] | 388 | // TODO(jmadill): the queue serial should be bound to the pipeline. |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 389 | updateQueueSerial(queueSerial); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 390 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 391 | // TODO(jmadill): Can probably use more dirty bits here. |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 392 | ANGLE_TRY(programVk->updateUniforms(this)); |
| 393 | programVk->updateTexturesDescriptorSet(this); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 394 | |
| 395 | // Bind the graphics descriptor sets. |
| 396 | // TODO(jmadill): Handle multiple command buffers. |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 397 | const auto &descriptorSets = programVk->getDescriptorSets(); |
| 398 | uint32_t firstSet = programVk->getDescriptorSetOffset(); |
| 399 | uint32_t setCount = static_cast<uint32_t>(descriptorSets.size()); |
| 400 | if (!descriptorSets.empty() && ((setCount - firstSet) > 0)) |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 401 | { |
| 402 | const vk::PipelineLayout &pipelineLayout = programVk->getPipelineLayout(); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 403 | (*commandBuffer) |
| 404 | ->bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, firstSet, |
| 405 | setCount - firstSet, &descriptorSets[firstSet], 0, nullptr); |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 406 | } |
| 407 | |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 408 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 409 | } |
| 410 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 411 | gl::Error ContextVk::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count) |
| 412 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 413 | vk::CommandBuffer *commandBuffer = nullptr; |
| 414 | ANGLE_TRY(setupDraw(context, mode, DrawType::Arrays, &commandBuffer)); |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 415 | commandBuffer->draw(count, 1, first, 0); |
| 416 | return gl::NoError(); |
| 417 | } |
| 418 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 419 | gl::Error ContextVk::drawArraysInstanced(const gl::Context *context, |
| 420 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 421 | GLint first, |
| 422 | GLsizei count, |
| 423 | GLsizei instanceCount) |
| 424 | { |
| 425 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 426 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 427 | } |
| 428 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 429 | gl::Error ContextVk::drawElements(const gl::Context *context, |
| 430 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 431 | GLsizei count, |
| 432 | GLenum type, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 433 | const void *indices) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 434 | { |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 435 | vk::CommandBuffer *commandBuffer; |
| 436 | ANGLE_TRY(setupDraw(context, mode, DrawType::Elements, &commandBuffer)); |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 437 | |
| 438 | if (indices) |
| 439 | { |
| 440 | // TODO(jmadill): Buffer offsets and immediate data. |
| 441 | UNIMPLEMENTED(); |
| 442 | return gl::InternalError() << "Only zero-offset index buffers are currently implemented."; |
| 443 | } |
| 444 | |
| 445 | if (type == GL_UNSIGNED_BYTE) |
| 446 | { |
| 447 | // TODO(jmadill): Index translation. |
| 448 | UNIMPLEMENTED(); |
| 449 | return gl::InternalError() << "Unsigned byte translation is not yet implemented."; |
| 450 | } |
| 451 | |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 452 | const gl::Buffer *elementArrayBuffer = |
| 453 | mState.getState().getVertexArray()->getElementArrayBuffer().get(); |
| 454 | ASSERT(elementArrayBuffer); |
| 455 | |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 456 | BufferVk *elementArrayBufferVk = vk::GetImpl(elementArrayBuffer); |
Jamie Madill | d03a849 | 2017-10-03 15:46:06 -0400 | [diff] [blame] | 457 | |
| 458 | commandBuffer->bindIndexBuffer(elementArrayBufferVk->getVkBuffer(), 0, GetVkIndexType(type)); |
| 459 | commandBuffer->drawIndexed(count, 1, 0, 0, 0); |
| 460 | |
| 461 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 462 | } |
| 463 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 464 | gl::Error ContextVk::drawElementsInstanced(const gl::Context *context, |
| 465 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 466 | GLsizei count, |
| 467 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 468 | const void *indices, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 469 | GLsizei instances) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 470 | { |
| 471 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 472 | return gl::InternalError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 473 | } |
| 474 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 475 | gl::Error ContextVk::drawRangeElements(const gl::Context *context, |
| 476 | GLenum mode, |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 477 | GLuint start, |
| 478 | GLuint end, |
| 479 | GLsizei count, |
| 480 | GLenum type, |
Qin Jiajia | 1da0065 | 2017-06-20 17:16:25 +0800 | [diff] [blame] | 481 | const void *indices) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 482 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 483 | return gl::NoError(); |
| 484 | } |
| 485 | |
| 486 | VkDevice ContextVk::getDevice() const |
| 487 | { |
| 488 | return mRenderer->getDevice(); |
| 489 | } |
| 490 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 491 | gl::Error ContextVk::drawArraysIndirect(const gl::Context *context, |
| 492 | GLenum mode, |
| 493 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 494 | { |
| 495 | UNIMPLEMENTED(); |
| 496 | return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend."; |
| 497 | } |
| 498 | |
Jamie Madill | c564c07 | 2017-06-01 12:45:42 -0400 | [diff] [blame] | 499 | gl::Error ContextVk::drawElementsIndirect(const gl::Context *context, |
| 500 | GLenum mode, |
| 501 | GLenum type, |
| 502 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 503 | { |
| 504 | UNIMPLEMENTED(); |
| 505 | return gl::InternalError() |
| 506 | << "DrawElementsIndirect hasn't been implemented for vulkan backend."; |
| 507 | } |
| 508 | |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 509 | GLenum ContextVk::getResetStatus() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 510 | { |
| 511 | UNIMPLEMENTED(); |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 512 | return GL_NO_ERROR; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 513 | } |
| 514 | |
| 515 | std::string ContextVk::getVendorString() const |
| 516 | { |
| 517 | UNIMPLEMENTED(); |
| 518 | return std::string(); |
| 519 | } |
| 520 | |
| 521 | std::string ContextVk::getRendererDescription() const |
| 522 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 523 | return mRenderer->getRendererDescription(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | void ContextVk::insertEventMarker(GLsizei length, const char *marker) |
| 527 | { |
| 528 | UNIMPLEMENTED(); |
| 529 | } |
| 530 | |
| 531 | void ContextVk::pushGroupMarker(GLsizei length, const char *marker) |
| 532 | { |
| 533 | UNIMPLEMENTED(); |
| 534 | } |
| 535 | |
| 536 | void ContextVk::popGroupMarker() |
| 537 | { |
| 538 | UNIMPLEMENTED(); |
| 539 | } |
| 540 | |
Geoff Lang | 5d5253a | 2017-11-22 14:51:12 -0500 | [diff] [blame] | 541 | void ContextVk::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message) |
| 542 | { |
| 543 | UNIMPLEMENTED(); |
| 544 | } |
| 545 | |
| 546 | void ContextVk::popDebugGroup() |
| 547 | { |
| 548 | UNIMPLEMENTED(); |
| 549 | } |
| 550 | |
Jamie Madill | fe54834 | 2017-06-19 11:13:24 -0400 | [diff] [blame] | 551 | void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 552 | { |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 553 | if (dirtyBits.any()) |
| 554 | { |
| 555 | invalidateCurrentPipeline(); |
| 556 | } |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 557 | |
| 558 | const auto &glState = context->getGLState(); |
| 559 | |
| 560 | // TODO(jmadill): Full dirty bits implementation. |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 561 | bool dirtyTextures = false; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 562 | |
| 563 | for (auto dirtyBit : dirtyBits) |
| 564 | { |
| 565 | switch (dirtyBit) |
| 566 | { |
| 567 | case gl::State::DIRTY_BIT_SCISSOR_TEST_ENABLED: |
| 568 | WARN() << "DIRTY_BIT_SCISSOR_TEST_ENABLED unimplemented"; |
| 569 | break; |
| 570 | case gl::State::DIRTY_BIT_SCISSOR: |
| 571 | WARN() << "DIRTY_BIT_SCISSOR unimplemented"; |
| 572 | break; |
| 573 | case gl::State::DIRTY_BIT_VIEWPORT: |
| 574 | { |
| 575 | const gl::Rectangle &viewportGL = glState.getViewport(); |
| 576 | mCurrentViewportVk.x = static_cast<float>(viewportGL.x); |
| 577 | mCurrentViewportVk.y = static_cast<float>(viewportGL.y); |
| 578 | mCurrentViewportVk.width = static_cast<float>(viewportGL.width); |
| 579 | mCurrentViewportVk.height = static_cast<float>(viewportGL.height); |
| 580 | mCurrentViewportVk.minDepth = glState.getNearPlane(); |
| 581 | mCurrentViewportVk.maxDepth = glState.getFarPlane(); |
| 582 | |
| 583 | // TODO(jmadill): Scissor. |
| 584 | mCurrentScissorVk.offset.x = viewportGL.x; |
| 585 | mCurrentScissorVk.offset.y = viewportGL.y; |
| 586 | mCurrentScissorVk.extent.width = viewportGL.width; |
| 587 | mCurrentScissorVk.extent.height = viewportGL.height; |
| 588 | break; |
| 589 | } |
| 590 | case gl::State::DIRTY_BIT_DEPTH_RANGE: |
| 591 | WARN() << "DIRTY_BIT_DEPTH_RANGE unimplemented"; |
| 592 | break; |
| 593 | case gl::State::DIRTY_BIT_BLEND_ENABLED: |
| 594 | WARN() << "DIRTY_BIT_BLEND_ENABLED unimplemented"; |
| 595 | break; |
| 596 | case gl::State::DIRTY_BIT_BLEND_COLOR: |
| 597 | WARN() << "DIRTY_BIT_BLEND_COLOR unimplemented"; |
| 598 | break; |
| 599 | case gl::State::DIRTY_BIT_BLEND_FUNCS: |
| 600 | WARN() << "DIRTY_BIT_BLEND_FUNCS unimplemented"; |
| 601 | break; |
| 602 | case gl::State::DIRTY_BIT_BLEND_EQUATIONS: |
| 603 | WARN() << "DIRTY_BIT_BLEND_EQUATIONS unimplemented"; |
| 604 | break; |
| 605 | case gl::State::DIRTY_BIT_COLOR_MASK: |
| 606 | WARN() << "DIRTY_BIT_COLOR_MASK unimplemented"; |
| 607 | break; |
| 608 | case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED: |
| 609 | WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED unimplemented"; |
| 610 | break; |
| 611 | case gl::State::DIRTY_BIT_SAMPLE_COVERAGE_ENABLED: |
| 612 | WARN() << "DIRTY_BIT_SAMPLE_COVERAGE_ENABLED unimplemented"; |
| 613 | break; |
| 614 | case gl::State::DIRTY_BIT_SAMPLE_COVERAGE: |
| 615 | WARN() << "DIRTY_BIT_SAMPLE_COVERAGE unimplemented"; |
| 616 | break; |
| 617 | case gl::State::DIRTY_BIT_SAMPLE_MASK_ENABLED: |
| 618 | WARN() << "DIRTY_BIT_SAMPLE_MASK_ENABLED unimplemented"; |
| 619 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 620 | case gl::State::DIRTY_BIT_SAMPLE_MASK: |
| 621 | WARN() << "DIRTY_BIT_SAMPLE_MASK unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 622 | break; |
| 623 | case gl::State::DIRTY_BIT_DEPTH_TEST_ENABLED: |
| 624 | WARN() << "DIRTY_BIT_DEPTH_TEST_ENABLED unimplemented"; |
| 625 | break; |
| 626 | case gl::State::DIRTY_BIT_DEPTH_FUNC: |
| 627 | WARN() << "DIRTY_BIT_DEPTH_FUNC unimplemented"; |
| 628 | break; |
| 629 | case gl::State::DIRTY_BIT_DEPTH_MASK: |
| 630 | WARN() << "DIRTY_BIT_DEPTH_MASK unimplemented"; |
| 631 | break; |
| 632 | case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED: |
| 633 | WARN() << "DIRTY_BIT_STENCIL_TEST_ENABLED unimplemented"; |
| 634 | break; |
| 635 | case gl::State::DIRTY_BIT_STENCIL_FUNCS_FRONT: |
| 636 | WARN() << "DIRTY_BIT_STENCIL_FUNCS_FRONT unimplemented"; |
| 637 | break; |
| 638 | case gl::State::DIRTY_BIT_STENCIL_FUNCS_BACK: |
| 639 | WARN() << "DIRTY_BIT_STENCIL_FUNCS_BACK unimplemented"; |
| 640 | break; |
| 641 | case gl::State::DIRTY_BIT_STENCIL_OPS_FRONT: |
| 642 | WARN() << "DIRTY_BIT_STENCIL_OPS_FRONT unimplemented"; |
| 643 | break; |
| 644 | case gl::State::DIRTY_BIT_STENCIL_OPS_BACK: |
| 645 | WARN() << "DIRTY_BIT_STENCIL_OPS_BACK unimplemented"; |
| 646 | break; |
| 647 | case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT: |
| 648 | WARN() << "DIRTY_BIT_STENCIL_WRITEMASK_FRONT unimplemented"; |
| 649 | break; |
| 650 | case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_BACK: |
| 651 | WARN() << "DIRTY_BIT_STENCIL_WRITEMASK_BACK unimplemented"; |
| 652 | break; |
| 653 | case gl::State::DIRTY_BIT_CULL_FACE_ENABLED: |
| 654 | case gl::State::DIRTY_BIT_CULL_FACE: |
| 655 | mCurrentRasterState.cullMode = gl_vk::GetCullMode(glState.getRasterizerState()); |
| 656 | break; |
| 657 | case gl::State::DIRTY_BIT_FRONT_FACE: |
| 658 | mCurrentRasterState.frontFace = |
| 659 | gl_vk::GetFrontFace(glState.getRasterizerState().frontFace); |
| 660 | break; |
| 661 | case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED: |
| 662 | WARN() << "DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED unimplemented"; |
| 663 | break; |
| 664 | case gl::State::DIRTY_BIT_POLYGON_OFFSET: |
| 665 | WARN() << "DIRTY_BIT_POLYGON_OFFSET unimplemented"; |
| 666 | break; |
| 667 | case gl::State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED: |
| 668 | WARN() << "DIRTY_BIT_RASTERIZER_DISCARD_ENABLED unimplemented"; |
| 669 | break; |
| 670 | case gl::State::DIRTY_BIT_LINE_WIDTH: |
| 671 | mCurrentRasterState.lineWidth = glState.getLineWidth(); |
| 672 | break; |
| 673 | case gl::State::DIRTY_BIT_PRIMITIVE_RESTART_ENABLED: |
| 674 | WARN() << "DIRTY_BIT_PRIMITIVE_RESTART_ENABLED unimplemented"; |
| 675 | break; |
| 676 | case gl::State::DIRTY_BIT_CLEAR_COLOR: |
| 677 | WARN() << "DIRTY_BIT_CLEAR_COLOR unimplemented"; |
| 678 | break; |
| 679 | case gl::State::DIRTY_BIT_CLEAR_DEPTH: |
| 680 | WARN() << "DIRTY_BIT_CLEAR_DEPTH unimplemented"; |
| 681 | break; |
| 682 | case gl::State::DIRTY_BIT_CLEAR_STENCIL: |
| 683 | WARN() << "DIRTY_BIT_CLEAR_STENCIL unimplemented"; |
| 684 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 685 | case gl::State::DIRTY_BIT_UNPACK_STATE: |
| 686 | WARN() << "DIRTY_BIT_UNPACK_STATE unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 687 | break; |
Corentin Wallez | 29a2099 | 2017-11-06 18:23:16 -0500 | [diff] [blame] | 688 | case gl::State::DIRTY_BIT_UNPACK_BUFFER_BINDING: |
| 689 | WARN() << "DIRTY_BIT_UNPACK_BUFFER_BINDING unimplemented"; |
| 690 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 691 | case gl::State::DIRTY_BIT_PACK_STATE: |
| 692 | WARN() << "DIRTY_BIT_PACK_STATE unimplemented"; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 693 | break; |
Corentin Wallez | 29a2099 | 2017-11-06 18:23:16 -0500 | [diff] [blame] | 694 | case gl::State::DIRTY_BIT_PACK_BUFFER_BINDING: |
| 695 | WARN() << "DIRTY_BIT_PACK_BUFFER_BINDING unimplemented"; |
| 696 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 697 | case gl::State::DIRTY_BIT_DITHER_ENABLED: |
| 698 | WARN() << "DIRTY_BIT_DITHER_ENABLED unimplemented"; |
| 699 | break; |
| 700 | case gl::State::DIRTY_BIT_GENERATE_MIPMAP_HINT: |
| 701 | WARN() << "DIRTY_BIT_GENERATE_MIPMAP_HINT unimplemented"; |
| 702 | break; |
| 703 | case gl::State::DIRTY_BIT_SHADER_DERIVATIVE_HINT: |
| 704 | WARN() << "DIRTY_BIT_SHADER_DERIVATIVE_HINT unimplemented"; |
| 705 | break; |
| 706 | case gl::State::DIRTY_BIT_READ_FRAMEBUFFER_BINDING: |
| 707 | WARN() << "DIRTY_BIT_READ_FRAMEBUFFER_BINDING unimplemented"; |
| 708 | break; |
| 709 | case gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING: |
| 710 | WARN() << "DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING unimplemented"; |
| 711 | break; |
| 712 | case gl::State::DIRTY_BIT_RENDERBUFFER_BINDING: |
| 713 | WARN() << "DIRTY_BIT_RENDERBUFFER_BINDING unimplemented"; |
| 714 | break; |
| 715 | case gl::State::DIRTY_BIT_VERTEX_ARRAY_BINDING: |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 716 | mVertexArrayDirty = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 717 | break; |
| 718 | case gl::State::DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING: |
| 719 | WARN() << "DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING unimplemented"; |
| 720 | break; |
Qin Jiajia | a98a281 | 2017-11-30 18:12:06 +0800 | [diff] [blame] | 721 | case gl::State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING: |
| 722 | WARN() << "DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING unimplemented"; |
| 723 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 724 | case gl::State::DIRTY_BIT_PROGRAM_BINDING: |
| 725 | WARN() << "DIRTY_BIT_PROGRAM_BINDING unimplemented"; |
| 726 | break; |
| 727 | case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE: |
| 728 | { |
| 729 | // { vertex, fragment } |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 730 | ProgramVk *programVk = vk::GetImpl(glState.getProgram()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 731 | mCurrentShaderStages[0].module = programVk->getLinkedVertexModule().getHandle(); |
| 732 | mCurrentShaderStages[1].module = programVk->getLinkedFragmentModule().getHandle(); |
| 733 | |
| 734 | // Also invalidate the vertex descriptions cache in the Vertex Array. |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 735 | VertexArrayVk *vaoVk = vk::GetImpl(glState.getVertexArray()); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 736 | vaoVk->invalidateVertexDescriptions(); |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 737 | |
| 738 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 739 | break; |
| 740 | } |
| 741 | case gl::State::DIRTY_BIT_TEXTURE_BINDINGS: |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 742 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 743 | break; |
| 744 | case gl::State::DIRTY_BIT_SAMPLER_BINDINGS: |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 745 | dirtyTextures = true; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 746 | break; |
Geoff Lang | ded7923 | 2017-11-28 15:21:11 -0500 | [diff] [blame] | 747 | case gl::State::DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING: |
| 748 | WARN() << "DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING unimplemented"; |
| 749 | break; |
Xinghua Cao | 10a4d43 | 2017-11-28 14:46:26 +0800 | [diff] [blame] | 750 | case gl::State::DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING: |
| 751 | WARN() << "DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING unimplemented"; |
| 752 | break; |
Jamie Madill | f414121 | 2017-12-12 15:08:07 -0500 | [diff] [blame] | 753 | case gl::State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS: |
| 754 | WARN() << "DIRTY_BIT_UNIFORM_BUFFER_BINDINGS unimplemented"; |
| 755 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 756 | case gl::State::DIRTY_BIT_MULTISAMPLING: |
| 757 | WARN() << "DIRTY_BIT_MULTISAMPLING unimplemented"; |
| 758 | break; |
| 759 | case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_ONE: |
| 760 | WARN() << "DIRTY_BIT_SAMPLE_ALPHA_TO_ONE unimplemented"; |
| 761 | break; |
| 762 | case gl::State::DIRTY_BIT_COVERAGE_MODULATION: |
| 763 | WARN() << "DIRTY_BIT_COVERAGE_MODULATION unimplemented"; |
| 764 | break; |
| 765 | case gl::State::DIRTY_BIT_PATH_RENDERING_MATRIX_MV: |
| 766 | WARN() << "DIRTY_BIT_PATH_RENDERING_MATRIX_MV unimplemented"; |
| 767 | break; |
| 768 | case gl::State::DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ: |
| 769 | WARN() << "DIRTY_BIT_PATH_RENDERING_MATRIX_PROJ unimplemented"; |
| 770 | break; |
| 771 | case gl::State::DIRTY_BIT_PATH_RENDERING_STENCIL_STATE: |
| 772 | WARN() << "DIRTY_BIT_PATH_RENDERING_STENCIL_STATE unimplemented"; |
| 773 | break; |
| 774 | case gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB: |
| 775 | WARN() << "DIRTY_BIT_FRAMEBUFFER_SRGB unimplemented"; |
| 776 | break; |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 777 | case gl::State::DIRTY_BIT_CURRENT_VALUES: |
| 778 | WARN() << "DIRTY_BIT_CURRENT_VALUES unimplemented"; |
| 779 | break; |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 780 | default: |
Jamie Madill | c67323a | 2017-11-02 23:11:41 -0400 | [diff] [blame] | 781 | UNREACHABLE(); |
Jamie Madill | ebf7299 | 2017-10-13 14:09:45 -0400 | [diff] [blame] | 782 | break; |
| 783 | } |
| 784 | } |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 785 | |
| 786 | if (dirtyTextures) |
| 787 | { |
Jamie Madill | e1f3ad4 | 2017-10-28 23:00:42 -0400 | [diff] [blame] | 788 | ProgramVk *programVk = vk::GetImpl(glState.getProgram()); |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 789 | programVk->invalidateTextures(); |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 790 | mTexturesDirty = true; |
Jamie Madill | 5547b38 | 2017-10-23 18:16:01 -0400 | [diff] [blame] | 791 | } |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | GLint ContextVk::getGPUDisjoint() |
| 795 | { |
| 796 | UNIMPLEMENTED(); |
| 797 | return GLint(); |
| 798 | } |
| 799 | |
| 800 | GLint64 ContextVk::getTimestamp() |
| 801 | { |
| 802 | UNIMPLEMENTED(); |
| 803 | return GLint64(); |
| 804 | } |
| 805 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 806 | void ContextVk::onMakeCurrent(const gl::Context * /*context*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 807 | { |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 808 | } |
| 809 | |
| 810 | const gl::Caps &ContextVk::getNativeCaps() const |
| 811 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 812 | return mRenderer->getNativeCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 813 | } |
| 814 | |
| 815 | const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const |
| 816 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 817 | return mRenderer->getNativeTextureCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 818 | } |
| 819 | |
| 820 | const gl::Extensions &ContextVk::getNativeExtensions() const |
| 821 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 822 | return mRenderer->getNativeExtensions(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | const gl::Limitations &ContextVk::getNativeLimitations() const |
| 826 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 827 | return mRenderer->getNativeLimitations(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 828 | } |
| 829 | |
| 830 | CompilerImpl *ContextVk::createCompiler() |
| 831 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 832 | return new CompilerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 833 | } |
| 834 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 835 | ShaderImpl *ContextVk::createShader(const gl::ShaderState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 836 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 837 | return new ShaderVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 838 | } |
| 839 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 840 | ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 841 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 842 | return new ProgramVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 843 | } |
| 844 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 845 | FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 846 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 847 | return FramebufferVk::CreateUserFBO(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 848 | } |
| 849 | |
| 850 | TextureImpl *ContextVk::createTexture(const gl::TextureState &state) |
| 851 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 852 | return new TextureVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 853 | } |
| 854 | |
| 855 | RenderbufferImpl *ContextVk::createRenderbuffer() |
| 856 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 857 | return new RenderbufferVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 858 | } |
| 859 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 860 | BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 861 | { |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 862 | return new BufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 863 | } |
| 864 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 865 | VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 866 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 867 | return new VertexArrayVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | QueryImpl *ContextVk::createQuery(GLenum type) |
| 871 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 872 | return new QueryVk(type); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 873 | } |
| 874 | |
| 875 | FenceNVImpl *ContextVk::createFenceNV() |
| 876 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 877 | return new FenceNVVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 878 | } |
| 879 | |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 880 | SyncImpl *ContextVk::createSync() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 881 | { |
Jamie Madill | 70b5bb0 | 2017-08-28 13:32:37 -0400 | [diff] [blame] | 882 | return new SyncVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 883 | } |
| 884 | |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 885 | TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 886 | { |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 887 | return new TransformFeedbackVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 888 | } |
| 889 | |
Jamie Madill | 06ef36b | 2017-09-09 23:32:46 -0400 | [diff] [blame] | 890 | SamplerImpl *ContextVk::createSampler(const gl::SamplerState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 891 | { |
Jamie Madill | 06ef36b | 2017-09-09 23:32:46 -0400 | [diff] [blame] | 892 | return new SamplerVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 893 | } |
| 894 | |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 895 | ProgramPipelineImpl *ContextVk::createProgramPipeline(const gl::ProgramPipelineState &state) |
| 896 | { |
| 897 | return new ProgramPipelineVk(state); |
| 898 | } |
| 899 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 900 | std::vector<PathImpl *> ContextVk::createPaths(GLsizei) |
| 901 | { |
| 902 | return std::vector<PathImpl *>(); |
| 903 | } |
| 904 | |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 905 | // TODO(jmadill): Use pipeline cache. |
| 906 | void ContextVk::invalidateCurrentPipeline() |
| 907 | { |
Jamie Madill | e88ec8e | 2017-10-31 17:18:14 -0400 | [diff] [blame] | 908 | mRenderer->releaseResource(*this, &mCurrentPipeline); |
Jamie Madill | 7210656 | 2017-03-24 14:18:50 -0400 | [diff] [blame] | 909 | } |
| 910 | |
Jamie Madill | 49ac74b | 2017-12-21 14:42:33 -0500 | [diff] [blame] | 911 | void ContextVk::onVertexArrayChange() |
| 912 | { |
| 913 | // TODO(jmadill): Does not handle dependent state changes. |
| 914 | mVertexArrayDirty = true; |
| 915 | invalidateCurrentPipeline(); |
| 916 | } |
| 917 | |
Jamie Madill | fe54834 | 2017-06-19 11:13:24 -0400 | [diff] [blame] | 918 | gl::Error ContextVk::dispatchCompute(const gl::Context *context, |
| 919 | GLuint numGroupsX, |
| 920 | GLuint numGroupsY, |
| 921 | GLuint numGroupsZ) |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 922 | { |
| 923 | UNIMPLEMENTED(); |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 924 | return gl::InternalError(); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 925 | } |
| 926 | |
Qin Jiajia | 62fcf62 | 2017-11-30 16:16:12 +0800 | [diff] [blame] | 927 | gl::Error ContextVk::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) |
| 928 | { |
| 929 | UNIMPLEMENTED(); |
| 930 | return gl::InternalError(); |
| 931 | } |
| 932 | |
Xinghua Cao | 89c422a | 2017-11-29 18:24:20 +0800 | [diff] [blame] | 933 | gl::Error ContextVk::memoryBarrier(const gl::Context *context, GLbitfield barriers) |
| 934 | { |
| 935 | UNIMPLEMENTED(); |
| 936 | return gl::InternalError(); |
| 937 | } |
| 938 | |
| 939 | gl::Error ContextVk::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) |
| 940 | { |
| 941 | UNIMPLEMENTED(); |
| 942 | return gl::InternalError(); |
| 943 | } |
| 944 | |
Jamie Madill | 76e471e | 2017-10-21 09:56:01 -0400 | [diff] [blame] | 945 | vk::DescriptorPool *ContextVk::getDescriptorPool() |
| 946 | { |
| 947 | return &mDescriptorPool; |
| 948 | } |
| 949 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 950 | } // namespace rx |