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