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