blob: 828affbfae9784838bb42eccff9c339e977758dd [file] [log] [blame]
Jamie Madill9e54b5a2016-05-25 12:57:39 -04001//
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 Madilldf68a6f2017-01-13 17:29:53 -050012#include "common/BitSetIterator.h"
Jamie Madill9e54b5a2016-05-25 12:57:39 -040013#include "common/debug.h"
Jamie Madilldf68a6f2017-01-13 17:29:53 -050014#include "libANGLE/Program.h"
Jamie Madillacccc6c2016-05-03 17:22:10 -040015#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 Madilldf68a6f2017-01-13 17:29:53 -050032#include "libANGLE/renderer/vulkan/formatutilsvk.h"
Jamie Madill9e54b5a2016-05-25 12:57:39 -040033
34namespace rx
35{
36
Jamie Madillacccc6c2016-05-03 17:22:10 -040037ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer)
38 : ContextImpl(state), mRenderer(renderer)
Jamie Madill9e54b5a2016-05-25 12:57:39 -040039{
40}
41
42ContextVk::~ContextVk()
43{
Jamie Madill5deea722017-02-16 10:44:46 -050044 mCurrentPipeline.destroy(getDevice());
Jamie Madill9e54b5a2016-05-25 12:57:39 -040045}
46
47gl::Error ContextVk::initialize()
48{
Jamie Madille09bd5d2016-11-29 16:20:35 -050049 return gl::NoError();
Jamie Madill9e54b5a2016-05-25 12:57:39 -040050}
51
52gl::Error ContextVk::flush()
53{
54 UNIMPLEMENTED();
55 return gl::Error(GL_INVALID_OPERATION);
56}
57
58gl::Error ContextVk::finish()
59{
60 UNIMPLEMENTED();
61 return gl::Error(GL_INVALID_OPERATION);
62}
63
64gl::Error ContextVk::drawArrays(GLenum mode, GLint first, GLsizei count)
65{
Jamie Madilldf68a6f2017-01-13 17:29:53 -050066 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-Shao2597fb62016-12-09 16:38:02 +080071 const auto &bindings = vao->getVertexBindings();
Jamie Madilldf68a6f2017-01-13 17:29:53 -050072 const auto &programVk = GetImplAs<ProgramVk>(programGL);
73 const auto *drawFBO = state.getDrawFramebuffer();
74 FramebufferVk *vkFBO = GetImplAs<FramebufferVk>(drawFBO);
Jamie Madill4c26fc22017-02-24 11:04:10 -050075 Serial queueSerial = mRenderer->getCurrentQueueSerial();
Jamie Madilldf68a6f2017-01-13 17:29:53 -050076
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-Shao2597fb62016-12-09 16:38:02 +0800106 const auto &binding = bindings[attrib.bindingIndex];
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500107 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-Shao2597fb62016-12-09 16:38:02 +0800113 (binding.divisor > 0 ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX);
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500114
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-Shao2597fb62016-12-09 16:38:02 +0800121 attribDesc.offset =
122 static_cast<uint32_t>(ComputeVertexAttributeOffset(attrib, binding));
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500123
124 vertexBindings.push_back(bindingDesc);
125 vertexAttribs.push_back(attribDesc);
126
127 // TODO(jmadill): Offset handling.
Jiawei-Shao2597fb62016-12-09 16:38:02 +0800128 gl::Buffer *bufferGL = binding.buffer.get();
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500129 ASSERT(bufferGL);
130 BufferVk *bufferVk = GetImplAs<BufferVk>(bufferGL);
131 vertexHandles.push_back(bufferVk->getVkBuffer().getHandle());
132 vertexOffsets.push_back(0);
Jamie Madill4c26fc22017-02-24 11:04:10 -0500133
134 bufferVk->setQueueSerial(queueSerial);
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500135 }
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 Madill5deea722017-02-16 10:44:46 -0500269 vk::Pipeline newPipeline;
270 ANGLE_TRY(newPipeline.initGraphics(device, pipelineInfo));
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500271
Jamie Madill5deea722017-02-16 10:44:46 -0500272 mCurrentPipeline.retain(device, std::move(newPipeline));
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500273
274 vk::CommandBuffer *commandBuffer = mRenderer->getCommandBuffer();
Jamie Madill4c26fc22017-02-24 11:04:10 -0500275 ANGLE_TRY(vkFBO->beginRenderPass(device, commandBuffer, queueSerial, state));
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500276
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 Madill9e54b5a2016-05-25 12:57:39 -0400286}
287
288gl::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
297gl::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
307gl::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
318gl::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 Madill7b57b9d2017-01-13 09:33:38 -0500326 return gl::NoError();
327}
328
329VkDevice ContextVk::getDevice() const
330{
331 return mRenderer->getDevice();
332}
333
334vk::CommandBuffer *ContextVk::getCommandBuffer()
335{
336 return mRenderer->getCommandBuffer();
337}
338
339vk::Error ContextVk::submitCommands(const vk::CommandBuffer &commandBuffer)
340{
341 // TODO(jmadill): Command queuing.
342 ANGLE_TRY(mRenderer->submitAndFinishCommandBuffer(commandBuffer));
343 return vk::NoError();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400344}
345
Jiajia Qind9671222016-11-29 16:30:31 +0800346gl::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
352gl::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 Wallez87fbe1c2016-08-03 14:41:42 -0400359GLenum ContextVk::getResetStatus()
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400360{
361 UNIMPLEMENTED();
Corentin Wallez87fbe1c2016-08-03 14:41:42 -0400362 return GL_NO_ERROR;
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400363}
364
365std::string ContextVk::getVendorString() const
366{
367 UNIMPLEMENTED();
368 return std::string();
369}
370
371std::string ContextVk::getRendererDescription() const
372{
Jamie Madille09bd5d2016-11-29 16:20:35 -0500373 return mRenderer->getRendererDescription();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400374}
375
376void ContextVk::insertEventMarker(GLsizei length, const char *marker)
377{
378 UNIMPLEMENTED();
379}
380
381void ContextVk::pushGroupMarker(GLsizei length, const char *marker)
382{
383 UNIMPLEMENTED();
384}
385
386void ContextVk::popGroupMarker()
387{
388 UNIMPLEMENTED();
389}
390
Frank Henigman5a53d542017-02-16 21:24:10 -0500391void ContextVk::syncState(const gl::State::DirtyBits & /*dirtyBits*/)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400392{
Jamie Madill7b57b9d2017-01-13 09:33:38 -0500393 // TODO(jmadill): Vulkan dirty bits.
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400394}
395
396GLint ContextVk::getGPUDisjoint()
397{
398 UNIMPLEMENTED();
399 return GLint();
400}
401
402GLint64 ContextVk::getTimestamp()
403{
404 UNIMPLEMENTED();
405 return GLint64();
406}
407
Jamie Madille09bd5d2016-11-29 16:20:35 -0500408void ContextVk::onMakeCurrent(const gl::ContextState & /*data*/)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400409{
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400410}
411
412const gl::Caps &ContextVk::getNativeCaps() const
413{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400414 return mRenderer->getNativeCaps();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400415}
416
417const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const
418{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400419 return mRenderer->getNativeTextureCaps();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400420}
421
422const gl::Extensions &ContextVk::getNativeExtensions() const
423{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400424 return mRenderer->getNativeExtensions();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400425}
426
427const gl::Limitations &ContextVk::getNativeLimitations() const
428{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400429 return mRenderer->getNativeLimitations();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400430}
431
432CompilerImpl *ContextVk::createCompiler()
433{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400434 return new CompilerVk();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400435}
436
Jamie Madillacccc6c2016-05-03 17:22:10 -0400437ShaderImpl *ContextVk::createShader(const gl::ShaderState &state)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400438{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400439 return new ShaderVk(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400440}
441
Jamie Madillacccc6c2016-05-03 17:22:10 -0400442ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400443{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400444 return new ProgramVk(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400445}
446
Jamie Madillacccc6c2016-05-03 17:22:10 -0400447FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400448{
Jamie Madill7b57b9d2017-01-13 09:33:38 -0500449 return FramebufferVk::CreateUserFBO(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400450}
451
452TextureImpl *ContextVk::createTexture(const gl::TextureState &state)
453{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400454 return new TextureVk(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400455}
456
457RenderbufferImpl *ContextVk::createRenderbuffer()
458{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400459 return new RenderbufferVk();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400460}
461
Jamie Madill8f775602016-11-03 16:45:34 -0400462BufferImpl *ContextVk::createBuffer(const gl::BufferState &state)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400463{
Jamie Madill8f775602016-11-03 16:45:34 -0400464 return new BufferVk(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400465}
466
Jamie Madillacccc6c2016-05-03 17:22:10 -0400467VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400468{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400469 return new VertexArrayVk(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400470}
471
472QueryImpl *ContextVk::createQuery(GLenum type)
473{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400474 return new QueryVk(type);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400475}
476
477FenceNVImpl *ContextVk::createFenceNV()
478{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400479 return new FenceNVVk();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400480}
481
482FenceSyncImpl *ContextVk::createFenceSync()
483{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400484 return new FenceSyncVk();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400485}
486
Geoff Lang73bd2182016-07-15 13:01:24 -0400487TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state)
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400488{
Geoff Lang73bd2182016-07-15 13:01:24 -0400489 return new TransformFeedbackVk(state);
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400490}
491
492SamplerImpl *ContextVk::createSampler()
493{
Jamie Madillacccc6c2016-05-03 17:22:10 -0400494 return new SamplerVk();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400495}
496
Sami Väisänene45e53b2016-05-25 10:36:04 +0300497std::vector<PathImpl *> ContextVk::createPaths(GLsizei)
498{
499 return std::vector<PathImpl *>();
500}
501
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400502} // namespace rx