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 | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 12 | #include "common/BitSetIterator.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 13 | #include "common/debug.h" |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 14 | #include "libANGLE/Program.h" |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 15 | #include "libANGLE/renderer/vulkan/BufferVk.h" |
| 16 | #include "libANGLE/renderer/vulkan/CompilerVk.h" |
| 17 | #include "libANGLE/renderer/vulkan/ContextVk.h" |
| 18 | #include "libANGLE/renderer/vulkan/DeviceVk.h" |
| 19 | #include "libANGLE/renderer/vulkan/FenceNVVk.h" |
| 20 | #include "libANGLE/renderer/vulkan/FenceSyncVk.h" |
| 21 | #include "libANGLE/renderer/vulkan/FramebufferVk.h" |
| 22 | #include "libANGLE/renderer/vulkan/ImageVk.h" |
| 23 | #include "libANGLE/renderer/vulkan/ProgramVk.h" |
| 24 | #include "libANGLE/renderer/vulkan/QueryVk.h" |
| 25 | #include "libANGLE/renderer/vulkan/RenderbufferVk.h" |
| 26 | #include "libANGLE/renderer/vulkan/RendererVk.h" |
| 27 | #include "libANGLE/renderer/vulkan/SamplerVk.h" |
| 28 | #include "libANGLE/renderer/vulkan/ShaderVk.h" |
| 29 | #include "libANGLE/renderer/vulkan/TextureVk.h" |
| 30 | #include "libANGLE/renderer/vulkan/TransformFeedbackVk.h" |
| 31 | #include "libANGLE/renderer/vulkan/VertexArrayVk.h" |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 32 | #include "libANGLE/renderer/vulkan/formatutilsvk.h" |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 33 | |
| 34 | namespace rx |
| 35 | { |
| 36 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 37 | ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer) |
| 38 | : ContextImpl(state), mRenderer(renderer) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 39 | { |
| 40 | } |
| 41 | |
| 42 | ContextVk::~ContextVk() |
| 43 | { |
Jamie Madill | 5deea72 | 2017-02-16 10:44:46 -0500 | [diff] [blame] | 44 | mCurrentPipeline.destroy(getDevice()); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | gl::Error ContextVk::initialize() |
| 48 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 49 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | gl::Error ContextVk::flush() |
| 53 | { |
| 54 | UNIMPLEMENTED(); |
| 55 | return gl::Error(GL_INVALID_OPERATION); |
| 56 | } |
| 57 | |
| 58 | gl::Error ContextVk::finish() |
| 59 | { |
| 60 | UNIMPLEMENTED(); |
| 61 | return gl::Error(GL_INVALID_OPERATION); |
| 62 | } |
| 63 | |
| 64 | gl::Error ContextVk::drawArrays(GLenum mode, GLint first, GLsizei count) |
| 65 | { |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 66 | VkDevice device = mRenderer->getDevice(); |
| 67 | const auto &state = mState.getState(); |
| 68 | const auto &programGL = state.getProgram(); |
| 69 | const auto &vao = state.getVertexArray(); |
| 70 | const auto &attribs = vao->getVertexAttributes(); |
Jiawei-Shao | 2597fb6 | 2016-12-09 16:38:02 +0800 | [diff] [blame] | 71 | const auto &bindings = vao->getVertexBindings(); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 72 | const auto &programVk = GetImplAs<ProgramVk>(programGL); |
| 73 | const auto *drawFBO = state.getDrawFramebuffer(); |
| 74 | FramebufferVk *vkFBO = GetImplAs<FramebufferVk>(drawFBO); |
Jamie Madill | 4c26fc2 | 2017-02-24 11:04:10 -0500 | [diff] [blame^] | 75 | Serial queueSerial = mRenderer->getCurrentQueueSerial(); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 76 | |
| 77 | // { vertex, fragment } |
| 78 | VkPipelineShaderStageCreateInfo shaderStages[2]; |
| 79 | |
| 80 | shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; |
| 81 | shaderStages[0].pNext = nullptr; |
| 82 | shaderStages[0].flags = 0; |
| 83 | shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT; |
| 84 | shaderStages[0].module = programVk->getLinkedVertexModule().getHandle(); |
| 85 | shaderStages[0].pName = "main"; |
| 86 | shaderStages[0].pSpecializationInfo = nullptr; |
| 87 | |
| 88 | shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; |
| 89 | shaderStages[1].pNext = nullptr; |
| 90 | shaderStages[1].flags = 0; |
| 91 | shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; |
| 92 | shaderStages[1].module = programVk->getLinkedFragmentModule().getHandle(); |
| 93 | shaderStages[1].pName = "main"; |
| 94 | shaderStages[1].pSpecializationInfo = nullptr; |
| 95 | |
| 96 | // Process vertex attributes |
| 97 | // TODO(jmadill): Caching with dirty bits. |
| 98 | std::vector<VkVertexInputBindingDescription> vertexBindings; |
| 99 | std::vector<VkVertexInputAttributeDescription> vertexAttribs; |
| 100 | std::vector<VkBuffer> vertexHandles; |
| 101 | std::vector<VkDeviceSize> vertexOffsets; |
| 102 | |
| 103 | for (auto attribIndex : angle::IterateBitSet(programGL->getActiveAttribLocationsMask())) |
| 104 | { |
| 105 | const auto &attrib = attribs[attribIndex]; |
Jiawei-Shao | 2597fb6 | 2016-12-09 16:38:02 +0800 | [diff] [blame] | 106 | const auto &binding = bindings[attrib.bindingIndex]; |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 107 | if (attrib.enabled) |
| 108 | { |
| 109 | VkVertexInputBindingDescription bindingDesc; |
| 110 | bindingDesc.binding = static_cast<uint32_t>(vertexBindings.size()); |
| 111 | bindingDesc.stride = static_cast<uint32_t>(gl::ComputeVertexAttributeTypeSize(attrib)); |
| 112 | bindingDesc.inputRate = |
Jiawei-Shao | 2597fb6 | 2016-12-09 16:38:02 +0800 | [diff] [blame] | 113 | (binding.divisor > 0 ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 114 | |
| 115 | gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib); |
| 116 | |
| 117 | VkVertexInputAttributeDescription attribDesc; |
| 118 | attribDesc.binding = bindingDesc.binding; |
| 119 | attribDesc.format = vk::GetNativeVertexFormat(vertexFormatType); |
| 120 | attribDesc.location = static_cast<uint32_t>(attribIndex); |
Jiawei-Shao | 2597fb6 | 2016-12-09 16:38:02 +0800 | [diff] [blame] | 121 | attribDesc.offset = |
| 122 | static_cast<uint32_t>(ComputeVertexAttributeOffset(attrib, binding)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 123 | |
| 124 | vertexBindings.push_back(bindingDesc); |
| 125 | vertexAttribs.push_back(attribDesc); |
| 126 | |
| 127 | // TODO(jmadill): Offset handling. |
Jiawei-Shao | 2597fb6 | 2016-12-09 16:38:02 +0800 | [diff] [blame] | 128 | gl::Buffer *bufferGL = binding.buffer.get(); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 129 | ASSERT(bufferGL); |
| 130 | BufferVk *bufferVk = GetImplAs<BufferVk>(bufferGL); |
| 131 | vertexHandles.push_back(bufferVk->getVkBuffer().getHandle()); |
| 132 | vertexOffsets.push_back(0); |
Jamie Madill | 4c26fc2 | 2017-02-24 11:04:10 -0500 | [diff] [blame^] | 133 | |
| 134 | bufferVk->setQueueSerial(queueSerial); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 135 | } |
| 136 | else |
| 137 | { |
| 138 | UNIMPLEMENTED(); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | // TODO(jmadill): Validate with ASSERT against physical device limits/caps? |
| 143 | VkPipelineVertexInputStateCreateInfo vertexInputState; |
| 144 | vertexInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; |
| 145 | vertexInputState.pNext = nullptr; |
| 146 | vertexInputState.flags = 0; |
| 147 | vertexInputState.vertexBindingDescriptionCount = static_cast<uint32_t>(vertexBindings.size()); |
| 148 | vertexInputState.pVertexBindingDescriptions = vertexBindings.data(); |
| 149 | vertexInputState.vertexAttributeDescriptionCount = static_cast<uint32_t>(vertexAttribs.size()); |
| 150 | vertexInputState.pVertexAttributeDescriptions = vertexAttribs.data(); |
| 151 | |
| 152 | VkPipelineInputAssemblyStateCreateInfo inputAssemblyState; |
| 153 | inputAssemblyState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; |
| 154 | inputAssemblyState.pNext = nullptr; |
| 155 | inputAssemblyState.flags = 0; |
| 156 | inputAssemblyState.topology = gl_vk::GetPrimitiveTopology(mode); |
| 157 | inputAssemblyState.primitiveRestartEnable = VK_FALSE; |
| 158 | |
| 159 | const gl::Rectangle &viewportGL = state.getViewport(); |
| 160 | VkViewport viewportVk; |
| 161 | viewportVk.x = static_cast<float>(viewportGL.x); |
| 162 | viewportVk.y = static_cast<float>(viewportGL.y); |
| 163 | viewportVk.width = static_cast<float>(viewportGL.width); |
| 164 | viewportVk.height = static_cast<float>(viewportGL.height); |
| 165 | viewportVk.minDepth = state.getNearPlane(); |
| 166 | viewportVk.maxDepth = state.getFarPlane(); |
| 167 | |
| 168 | // TODO(jmadill): Scissor. |
| 169 | VkRect2D scissorVk; |
| 170 | scissorVk.offset.x = viewportGL.x; |
| 171 | scissorVk.offset.y = viewportGL.y; |
| 172 | scissorVk.extent.width = viewportGL.width; |
| 173 | scissorVk.extent.height = viewportGL.height; |
| 174 | |
| 175 | VkPipelineViewportStateCreateInfo viewportState; |
| 176 | viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; |
| 177 | viewportState.pNext = nullptr; |
| 178 | viewportState.flags = 0; |
| 179 | viewportState.viewportCount = 1; |
| 180 | viewportState.pViewports = &viewportVk; |
| 181 | viewportState.scissorCount = 1; |
| 182 | viewportState.pScissors = &scissorVk; |
| 183 | |
| 184 | // TODO(jmadill): Extra rasterizer state features. |
| 185 | VkPipelineRasterizationStateCreateInfo rasterState; |
| 186 | rasterState.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; |
| 187 | rasterState.pNext = nullptr; |
| 188 | rasterState.flags = 0; |
| 189 | rasterState.depthClampEnable = VK_FALSE; |
| 190 | rasterState.rasterizerDiscardEnable = VK_FALSE; |
| 191 | rasterState.polygonMode = VK_POLYGON_MODE_FILL; |
| 192 | rasterState.cullMode = gl_vk::GetCullMode(state.getRasterizerState()); |
| 193 | rasterState.frontFace = gl_vk::GetFrontFace(state.getRasterizerState().frontFace); |
| 194 | rasterState.depthBiasEnable = VK_FALSE; |
| 195 | rasterState.depthBiasConstantFactor = 0.0f; |
| 196 | rasterState.depthBiasClamp = 0.0f; |
| 197 | rasterState.depthBiasSlopeFactor = 0.0f; |
| 198 | rasterState.lineWidth = state.getLineWidth(); |
| 199 | |
| 200 | // TODO(jmadill): Multisample state. |
| 201 | VkPipelineMultisampleStateCreateInfo multisampleState; |
| 202 | multisampleState.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; |
| 203 | multisampleState.pNext = nullptr; |
| 204 | multisampleState.flags = 0; |
| 205 | multisampleState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; |
| 206 | multisampleState.sampleShadingEnable = VK_FALSE; |
| 207 | multisampleState.minSampleShading = 0.0f; |
| 208 | multisampleState.pSampleMask = nullptr; |
| 209 | multisampleState.alphaToCoverageEnable = VK_FALSE; |
| 210 | multisampleState.alphaToOneEnable = VK_FALSE; |
| 211 | |
| 212 | // TODO(jmadill): Depth/stencil state. |
| 213 | |
| 214 | // TODO(jmadill): Blend state/MRT. |
| 215 | VkPipelineColorBlendAttachmentState blendAttachmentState; |
| 216 | blendAttachmentState.blendEnable = VK_FALSE; |
| 217 | blendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_ONE; |
| 218 | blendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ONE; |
| 219 | blendAttachmentState.colorBlendOp = VK_BLEND_OP_ADD; |
| 220 | blendAttachmentState.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; |
| 221 | blendAttachmentState.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE; |
| 222 | blendAttachmentState.alphaBlendOp = VK_BLEND_OP_ADD; |
| 223 | blendAttachmentState.colorWriteMask = (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | |
| 224 | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT); |
| 225 | |
| 226 | VkPipelineColorBlendStateCreateInfo blendState; |
| 227 | blendState.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; |
| 228 | blendState.pNext = 0; |
| 229 | blendState.flags = 0; |
| 230 | blendState.logicOpEnable = VK_FALSE; |
| 231 | blendState.logicOp = VK_LOGIC_OP_CLEAR; |
| 232 | blendState.attachmentCount = 1; |
| 233 | blendState.pAttachments = &blendAttachmentState; |
| 234 | blendState.blendConstants[0] = 0.0f; |
| 235 | blendState.blendConstants[1] = 0.0f; |
| 236 | blendState.blendConstants[2] = 0.0f; |
| 237 | blendState.blendConstants[3] = 0.0f; |
| 238 | |
| 239 | // TODO(jmadill): Dynamic state. |
| 240 | vk::RenderPass *renderPass = nullptr; |
| 241 | ANGLE_TRY_RESULT(vkFBO->getRenderPass(device), renderPass); |
| 242 | ASSERT(renderPass && renderPass->valid()); |
| 243 | |
| 244 | vk::PipelineLayout *pipelineLayout = nullptr; |
| 245 | ANGLE_TRY_RESULT(programVk->getPipelineLayout(device), pipelineLayout); |
| 246 | ASSERT(pipelineLayout && pipelineLayout->valid()); |
| 247 | |
| 248 | VkGraphicsPipelineCreateInfo pipelineInfo; |
| 249 | pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; |
| 250 | pipelineInfo.pNext = nullptr; |
| 251 | pipelineInfo.flags = 0; |
| 252 | pipelineInfo.stageCount = 2; |
| 253 | pipelineInfo.pStages = shaderStages; |
| 254 | pipelineInfo.pVertexInputState = &vertexInputState; |
| 255 | pipelineInfo.pInputAssemblyState = &inputAssemblyState; |
| 256 | pipelineInfo.pTessellationState = nullptr; |
| 257 | pipelineInfo.pViewportState = &viewportState; |
| 258 | pipelineInfo.pRasterizationState = &rasterState; |
| 259 | pipelineInfo.pMultisampleState = &multisampleState; |
| 260 | pipelineInfo.pDepthStencilState = nullptr; |
| 261 | pipelineInfo.pColorBlendState = &blendState; |
| 262 | pipelineInfo.pDynamicState = nullptr; |
| 263 | pipelineInfo.layout = pipelineLayout->getHandle(); |
| 264 | pipelineInfo.renderPass = renderPass->getHandle(); |
| 265 | pipelineInfo.subpass = 0; |
| 266 | pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; |
| 267 | pipelineInfo.basePipelineIndex = 0; |
| 268 | |
Jamie Madill | 5deea72 | 2017-02-16 10:44:46 -0500 | [diff] [blame] | 269 | vk::Pipeline newPipeline; |
| 270 | ANGLE_TRY(newPipeline.initGraphics(device, pipelineInfo)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 271 | |
Jamie Madill | 5deea72 | 2017-02-16 10:44:46 -0500 | [diff] [blame] | 272 | mCurrentPipeline.retain(device, std::move(newPipeline)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 273 | |
| 274 | vk::CommandBuffer *commandBuffer = mRenderer->getCommandBuffer(); |
Jamie Madill | 4c26fc2 | 2017-02-24 11:04:10 -0500 | [diff] [blame^] | 275 | ANGLE_TRY(vkFBO->beginRenderPass(device, commandBuffer, queueSerial, state)); |
Jamie Madill | df68a6f | 2017-01-13 17:29:53 -0500 | [diff] [blame] | 276 | |
| 277 | commandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline); |
| 278 | commandBuffer->bindVertexBuffers(0, vertexHandles, vertexOffsets); |
| 279 | commandBuffer->draw(count, 1, first, 0); |
| 280 | commandBuffer->endRenderPass(); |
| 281 | ANGLE_TRY(commandBuffer->end()); |
| 282 | |
| 283 | ANGLE_TRY(mRenderer->submitAndFinishCommandBuffer(*commandBuffer)); |
| 284 | |
| 285 | return gl::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | gl::Error ContextVk::drawArraysInstanced(GLenum mode, |
| 289 | GLint first, |
| 290 | GLsizei count, |
| 291 | GLsizei instanceCount) |
| 292 | { |
| 293 | UNIMPLEMENTED(); |
| 294 | return gl::Error(GL_INVALID_OPERATION); |
| 295 | } |
| 296 | |
| 297 | gl::Error ContextVk::drawElements(GLenum mode, |
| 298 | GLsizei count, |
| 299 | GLenum type, |
| 300 | const GLvoid *indices, |
| 301 | const gl::IndexRange &indexRange) |
| 302 | { |
| 303 | UNIMPLEMENTED(); |
| 304 | return gl::Error(GL_INVALID_OPERATION); |
| 305 | } |
| 306 | |
| 307 | gl::Error ContextVk::drawElementsInstanced(GLenum mode, |
| 308 | GLsizei count, |
| 309 | GLenum type, |
| 310 | const GLvoid *indices, |
| 311 | GLsizei instances, |
| 312 | const gl::IndexRange &indexRange) |
| 313 | { |
| 314 | UNIMPLEMENTED(); |
| 315 | return gl::Error(GL_INVALID_OPERATION); |
| 316 | } |
| 317 | |
| 318 | gl::Error ContextVk::drawRangeElements(GLenum mode, |
| 319 | GLuint start, |
| 320 | GLuint end, |
| 321 | GLsizei count, |
| 322 | GLenum type, |
| 323 | const GLvoid *indices, |
| 324 | const gl::IndexRange &indexRange) |
| 325 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 326 | return gl::NoError(); |
| 327 | } |
| 328 | |
| 329 | VkDevice ContextVk::getDevice() const |
| 330 | { |
| 331 | return mRenderer->getDevice(); |
| 332 | } |
| 333 | |
| 334 | vk::CommandBuffer *ContextVk::getCommandBuffer() |
| 335 | { |
| 336 | return mRenderer->getCommandBuffer(); |
| 337 | } |
| 338 | |
| 339 | vk::Error ContextVk::submitCommands(const vk::CommandBuffer &commandBuffer) |
| 340 | { |
| 341 | // TODO(jmadill): Command queuing. |
| 342 | ANGLE_TRY(mRenderer->submitAndFinishCommandBuffer(commandBuffer)); |
| 343 | return vk::NoError(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 344 | } |
| 345 | |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 346 | gl::Error ContextVk::drawArraysIndirect(GLenum mode, const GLvoid *indirect) |
| 347 | { |
| 348 | UNIMPLEMENTED(); |
| 349 | return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend."; |
| 350 | } |
| 351 | |
| 352 | gl::Error ContextVk::drawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect) |
| 353 | { |
| 354 | UNIMPLEMENTED(); |
| 355 | return gl::InternalError() |
| 356 | << "DrawElementsIndirect hasn't been implemented for vulkan backend."; |
| 357 | } |
| 358 | |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 359 | GLenum ContextVk::getResetStatus() |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 360 | { |
| 361 | UNIMPLEMENTED(); |
Corentin Wallez | 87fbe1c | 2016-08-03 14:41:42 -0400 | [diff] [blame] | 362 | return GL_NO_ERROR; |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | std::string ContextVk::getVendorString() const |
| 366 | { |
| 367 | UNIMPLEMENTED(); |
| 368 | return std::string(); |
| 369 | } |
| 370 | |
| 371 | std::string ContextVk::getRendererDescription() const |
| 372 | { |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 373 | return mRenderer->getRendererDescription(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | void ContextVk::insertEventMarker(GLsizei length, const char *marker) |
| 377 | { |
| 378 | UNIMPLEMENTED(); |
| 379 | } |
| 380 | |
| 381 | void ContextVk::pushGroupMarker(GLsizei length, const char *marker) |
| 382 | { |
| 383 | UNIMPLEMENTED(); |
| 384 | } |
| 385 | |
| 386 | void ContextVk::popGroupMarker() |
| 387 | { |
| 388 | UNIMPLEMENTED(); |
| 389 | } |
| 390 | |
Frank Henigman | 5a53d54 | 2017-02-16 21:24:10 -0500 | [diff] [blame] | 391 | void ContextVk::syncState(const gl::State::DirtyBits & /*dirtyBits*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 392 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 393 | // TODO(jmadill): Vulkan dirty bits. |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | GLint ContextVk::getGPUDisjoint() |
| 397 | { |
| 398 | UNIMPLEMENTED(); |
| 399 | return GLint(); |
| 400 | } |
| 401 | |
| 402 | GLint64 ContextVk::getTimestamp() |
| 403 | { |
| 404 | UNIMPLEMENTED(); |
| 405 | return GLint64(); |
| 406 | } |
| 407 | |
Jamie Madill | e09bd5d | 2016-11-29 16:20:35 -0500 | [diff] [blame] | 408 | void ContextVk::onMakeCurrent(const gl::ContextState & /*data*/) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 409 | { |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | const gl::Caps &ContextVk::getNativeCaps() const |
| 413 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 414 | return mRenderer->getNativeCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const |
| 418 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 419 | return mRenderer->getNativeTextureCaps(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | const gl::Extensions &ContextVk::getNativeExtensions() const |
| 423 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 424 | return mRenderer->getNativeExtensions(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 425 | } |
| 426 | |
| 427 | const gl::Limitations &ContextVk::getNativeLimitations() const |
| 428 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 429 | return mRenderer->getNativeLimitations(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 430 | } |
| 431 | |
| 432 | CompilerImpl *ContextVk::createCompiler() |
| 433 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 434 | return new CompilerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 435 | } |
| 436 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 437 | ShaderImpl *ContextVk::createShader(const gl::ShaderState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 438 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 439 | return new ShaderVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 440 | } |
| 441 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 442 | ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 443 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 444 | return new ProgramVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 445 | } |
| 446 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 447 | FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 448 | { |
Jamie Madill | 7b57b9d | 2017-01-13 09:33:38 -0500 | [diff] [blame] | 449 | return FramebufferVk::CreateUserFBO(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | TextureImpl *ContextVk::createTexture(const gl::TextureState &state) |
| 453 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 454 | return new TextureVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | RenderbufferImpl *ContextVk::createRenderbuffer() |
| 458 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 459 | return new RenderbufferVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 460 | } |
| 461 | |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 462 | BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 463 | { |
Jamie Madill | 8f77560 | 2016-11-03 16:45:34 -0400 | [diff] [blame] | 464 | return new BufferVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 465 | } |
| 466 | |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 467 | VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 468 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 469 | return new VertexArrayVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | QueryImpl *ContextVk::createQuery(GLenum type) |
| 473 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 474 | return new QueryVk(type); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 475 | } |
| 476 | |
| 477 | FenceNVImpl *ContextVk::createFenceNV() |
| 478 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 479 | return new FenceNVVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | FenceSyncImpl *ContextVk::createFenceSync() |
| 483 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 484 | return new FenceSyncVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 485 | } |
| 486 | |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 487 | TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state) |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 488 | { |
Geoff Lang | 73bd218 | 2016-07-15 13:01:24 -0400 | [diff] [blame] | 489 | return new TransformFeedbackVk(state); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | SamplerImpl *ContextVk::createSampler() |
| 493 | { |
Jamie Madill | acccc6c | 2016-05-03 17:22:10 -0400 | [diff] [blame] | 494 | return new SamplerVk(); |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 495 | } |
| 496 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 497 | std::vector<PathImpl *> ContextVk::createPaths(GLsizei) |
| 498 | { |
| 499 | return std::vector<PathImpl *>(); |
| 500 | } |
| 501 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 502 | } // namespace rx |