Hash :
7b57b9d7
Author :
Date :
2017-01-13T09:33:38
Vulkan: Implement basic Clear and ReadPixels. This enables the simple operations clear test on Vulkan. The current implementation is very synchronous - it will block and finish the current command buffer if there is any possibility of a race. BUG=angleproject:1319 Change-Id: If01fe9a19ed6f539639a38786193d3626164cada Reviewed-on: https://chromium-review.googlesource.com/367754 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ContextVk.cpp:
// Implements the class methods for ContextVk.
//
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "common/debug.h"
#include "libANGLE/renderer/vulkan/BufferVk.h"
#include "libANGLE/renderer/vulkan/CompilerVk.h"
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "libANGLE/renderer/vulkan/DeviceVk.h"
#include "libANGLE/renderer/vulkan/FenceNVVk.h"
#include "libANGLE/renderer/vulkan/FenceSyncVk.h"
#include "libANGLE/renderer/vulkan/FramebufferVk.h"
#include "libANGLE/renderer/vulkan/ImageVk.h"
#include "libANGLE/renderer/vulkan/ProgramVk.h"
#include "libANGLE/renderer/vulkan/QueryVk.h"
#include "libANGLE/renderer/vulkan/RenderbufferVk.h"
#include "libANGLE/renderer/vulkan/RendererVk.h"
#include "libANGLE/renderer/vulkan/SamplerVk.h"
#include "libANGLE/renderer/vulkan/ShaderVk.h"
#include "libANGLE/renderer/vulkan/TextureVk.h"
#include "libANGLE/renderer/vulkan/TransformFeedbackVk.h"
#include "libANGLE/renderer/vulkan/VertexArrayVk.h"
namespace rx
{
ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer)
: ContextImpl(state), mRenderer(renderer)
{
}
ContextVk::~ContextVk()
{
}
gl::Error ContextVk::initialize()
{
return gl::NoError();
}
gl::Error ContextVk::flush()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
gl::Error ContextVk::finish()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
gl::Error ContextVk::drawArrays(GLenum mode, GLint first, GLsizei count)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
gl::Error ContextVk::drawArraysInstanced(GLenum mode,
GLint first,
GLsizei count,
GLsizei instanceCount)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
gl::Error ContextVk::drawElements(GLenum mode,
GLsizei count,
GLenum type,
const GLvoid *indices,
const gl::IndexRange &indexRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
gl::Error ContextVk::drawElementsInstanced(GLenum mode,
GLsizei count,
GLenum type,
const GLvoid *indices,
GLsizei instances,
const gl::IndexRange &indexRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
gl::Error ContextVk::drawRangeElements(GLenum mode,
GLuint start,
GLuint end,
GLsizei count,
GLenum type,
const GLvoid *indices,
const gl::IndexRange &indexRange)
{
return gl::NoError();
}
VkDevice ContextVk::getDevice() const
{
return mRenderer->getDevice();
}
vk::CommandBuffer *ContextVk::getCommandBuffer()
{
return mRenderer->getCommandBuffer();
}
vk::Error ContextVk::submitCommands(const vk::CommandBuffer &commandBuffer)
{
// TODO(jmadill): Command queuing.
ANGLE_TRY(mRenderer->submitAndFinishCommandBuffer(commandBuffer));
return vk::NoError();
}
gl::Error ContextVk::drawArraysIndirect(GLenum mode, const GLvoid *indirect)
{
UNIMPLEMENTED();
return gl::InternalError() << "DrawArraysIndirect hasn't been implemented for vulkan backend.";
}
gl::Error ContextVk::drawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
{
UNIMPLEMENTED();
return gl::InternalError()
<< "DrawElementsIndirect hasn't been implemented for vulkan backend.";
}
GLenum ContextVk::getResetStatus()
{
UNIMPLEMENTED();
return GL_NO_ERROR;
}
std::string ContextVk::getVendorString() const
{
UNIMPLEMENTED();
return std::string();
}
std::string ContextVk::getRendererDescription() const
{
return mRenderer->getRendererDescription();
}
void ContextVk::insertEventMarker(GLsizei length, const char *marker)
{
UNIMPLEMENTED();
}
void ContextVk::pushGroupMarker(GLsizei length, const char *marker)
{
UNIMPLEMENTED();
}
void ContextVk::popGroupMarker()
{
UNIMPLEMENTED();
}
void ContextVk::syncState(const gl::State & /*state*/, const gl::State::DirtyBits & /*dirtyBits*/)
{
// TODO(jmadill): Vulkan dirty bits.
}
GLint ContextVk::getGPUDisjoint()
{
UNIMPLEMENTED();
return GLint();
}
GLint64 ContextVk::getTimestamp()
{
UNIMPLEMENTED();
return GLint64();
}
void ContextVk::onMakeCurrent(const gl::ContextState & /*data*/)
{
}
const gl::Caps &ContextVk::getNativeCaps() const
{
return mRenderer->getNativeCaps();
}
const gl::TextureCapsMap &ContextVk::getNativeTextureCaps() const
{
return mRenderer->getNativeTextureCaps();
}
const gl::Extensions &ContextVk::getNativeExtensions() const
{
return mRenderer->getNativeExtensions();
}
const gl::Limitations &ContextVk::getNativeLimitations() const
{
return mRenderer->getNativeLimitations();
}
CompilerImpl *ContextVk::createCompiler()
{
return new CompilerVk();
}
ShaderImpl *ContextVk::createShader(const gl::ShaderState &state)
{
return new ShaderVk(state);
}
ProgramImpl *ContextVk::createProgram(const gl::ProgramState &state)
{
return new ProgramVk(state);
}
FramebufferImpl *ContextVk::createFramebuffer(const gl::FramebufferState &state)
{
return FramebufferVk::CreateUserFBO(state);
}
TextureImpl *ContextVk::createTexture(const gl::TextureState &state)
{
return new TextureVk(state);
}
RenderbufferImpl *ContextVk::createRenderbuffer()
{
return new RenderbufferVk();
}
BufferImpl *ContextVk::createBuffer(const gl::BufferState &state)
{
return new BufferVk(state);
}
VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state)
{
return new VertexArrayVk(state);
}
QueryImpl *ContextVk::createQuery(GLenum type)
{
return new QueryVk(type);
}
FenceNVImpl *ContextVk::createFenceNV()
{
return new FenceNVVk();
}
FenceSyncImpl *ContextVk::createFenceSync()
{
return new FenceSyncVk();
}
TransformFeedbackImpl *ContextVk::createTransformFeedback(const gl::TransformFeedbackState &state)
{
return new TransformFeedbackVk(state);
}
SamplerImpl *ContextVk::createSampler()
{
return new SamplerVk();
}
std::vector<PathImpl *> ContextVk::createPaths(GLsizei)
{
return std::vector<PathImpl *>();
}
} // namespace rx