#include "libANGLE/renderer/vulkan/VertexArrayVk.h"
#include "common/debug.h"
#include "common/utilities.h"
#include "libANGLE/Context.h"
#include "libANGLE/renderer/vulkan/BufferVk.h"
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "libANGLE/renderer/vulkan/FramebufferVk.h"
#include "libANGLE/renderer/vulkan/vk_format_utils.h"
#include "libANGLE/renderer/vulkan/vk_renderer.h"
#include "libANGLE/renderer/vulkan/vk_resource.h"
namespace rx
{
namespace
{
constexpr int kStreamIndexBufferCachedIndexCount = …;
constexpr int kMaxCachedStreamIndexBuffers = …;
constexpr size_t kDefaultValueSize = …;
ANGLE_INLINE bool BindingIsAligned(const angle::Format &angleFormat,
VkDeviceSize offset,
GLuint stride)
{ … }
ANGLE_INLINE bool ClientBindingAligned(const gl::VertexAttribute &attrib,
GLuint stride,
size_t alignment)
{ … }
bool ShouldCombineAttributes(vk::Renderer *renderer,
const gl::VertexAttribute &attrib,
const gl::VertexBinding &binding)
{ … }
void WarnOnVertexFormatConversion(ContextVk *contextVk,
const vk::Format &vertexFormat,
bool compressed,
bool insertEventMarker)
{ … }
angle::Result StreamVertexData(ContextVk *contextVk,
vk::BufferHelper *dstBufferHelper,
const uint8_t *srcData,
size_t bytesToCopy,
size_t dstOffset,
size_t vertexCount,
size_t srcStride,
VertexCopyFunction vertexLoadFunction)
{ … }
angle::Result StreamVertexDataWithDivisor(ContextVk *contextVk,
vk::BufferHelper *dstBufferHelper,
const uint8_t *srcData,
size_t bytesToAllocate,
size_t srcStride,
size_t dstStride,
VertexCopyFunction vertexLoadFunction,
uint32_t divisor,
size_t numSrcVertices)
{ … }
size_t GetVertexCountForRange(GLint64 srcBufferBytes,
uint32_t srcFormatSize,
uint32_t srcVertexStride)
{ … }
size_t GetVertexCount(BufferVk *srcBuffer, const gl::VertexBinding &binding, uint32_t srcFormatSize)
{ … }
angle::Result CalculateOffsetAndVertexCountForConversion(ContextVk *contextVk,
BufferVk *srcBuffer,
VertexConversionBuffer *conversion,
const angle::Format &srcFormat,
const angle::Format &dstFormat,
size_t *srcOffsetOut,
size_t *dstOffsetOut,
size_t *numVerticesOut)
{ … }
}
VertexArrayVk::VertexArrayVk(ContextVk *contextVk, const gl::VertexArrayState &state)
: … { … }
VertexArrayVk::~VertexArrayVk() { … }
void VertexArrayVk::destroy(const gl::Context *context)
{ … }
angle::Result VertexArrayVk::convertIndexBufferGPU(ContextVk *contextVk,
BufferVk *bufferVk,
const void *indices)
{ … }
angle::Result VertexArrayVk::convertIndexBufferIndirectGPU(ContextVk *contextVk,
vk::BufferHelper *srcIndirectBuf,
VkDeviceSize srcIndirectBufOffset,
vk::BufferHelper **indirectBufferVkOut)
{ … }
angle::Result VertexArrayVk::handleLineLoopIndexIndirect(ContextVk *contextVk,
gl::DrawElementsType glIndexType,
vk::BufferHelper *srcIndirectBuf,
VkDeviceSize indirectBufferOffset,
vk::BufferHelper **indirectBufferOut)
{ … }
angle::Result VertexArrayVk::handleLineLoopIndirectDraw(const gl::Context *context,
vk::BufferHelper *indirectBufferVk,
VkDeviceSize indirectBufferOffset,
vk::BufferHelper **indirectBufferOut)
{ … }
angle::Result VertexArrayVk::convertIndexBufferCPU(ContextVk *contextVk,
gl::DrawElementsType indexType,
size_t indexCount,
const void *sourcePointer,
BufferBindingDirty *bindingDirty)
{ … }
angle::Result VertexArrayVk::convertVertexBufferGPU(ContextVk *contextVk,
BufferVk *srcBuffer,
VertexConversionBuffer *conversion,
const angle::Format &srcFormat,
const angle::Format &dstFormat)
{ … }
angle::Result VertexArrayVk::convertVertexBufferCPU(ContextVk *contextVk,
BufferVk *srcBuffer,
VertexConversionBuffer *conversion,
const angle::Format &srcFormat,
const angle::Format &dstFormat,
const VertexCopyFunction vertexLoadFunction)
{ … }
void VertexArrayVk::updateCurrentElementArrayBuffer()
{ … }
angle::Result VertexArrayVk::syncState(const gl::Context *context,
const gl::VertexArray::DirtyBits &dirtyBits,
gl::VertexArray::DirtyAttribBitsArray *attribBits,
gl::VertexArray::DirtyBindingBitsArray *bindingBits)
{ … }
#undef ANGLE_VERTEX_DIRTY_ATTRIB_FUNC
#undef ANGLE_VERTEX_DIRTY_BINDING_FUNC
#undef ANGLE_VERTEX_DIRTY_BUFFER_DATA_FUNC
ANGLE_INLINE angle::Result VertexArrayVk::setDefaultPackedInput(ContextVk *contextVk,
size_t attribIndex,
angle::FormatID *formatOut)
{ … }
angle::Result VertexArrayVk::updateActiveAttribInfo(ContextVk *contextVk)
{ … }
angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
const gl::VertexAttribute &attrib,
const gl::VertexBinding &binding,
size_t attribIndex,
bool bufferOnly)
{ … }
gl::AttributesMask VertexArrayVk::mergeClientAttribsRange(
vk::Renderer *renderer,
const gl::AttributesMask activeStreamedAttribs,
size_t startVertex,
size_t endVertex,
std::array<AttributeRange, gl::MAX_VERTEX_ATTRIBS> &mergeRangesOut,
std::array<size_t, gl::MAX_VERTEX_ATTRIBS> &mergedIndexesOut) const
{ … }
angle::Result VertexArrayVk::updateStreamedAttribs(const gl::Context *context,
GLint firstVertex,
GLsizei vertexOrIndexCount,
GLsizei instanceCount,
gl::DrawElementsType indexTypeOrInvalid,
const void *indices)
{ … }
angle::Result VertexArrayVk::handleLineLoop(ContextVk *contextVk,
GLint firstVertex,
GLsizei vertexOrIndexCount,
gl::DrawElementsType indexTypeOrInvalid,
const void *indices,
uint32_t *indexCountOut)
{ … }
angle::Result VertexArrayVk::updateDefaultAttrib(ContextVk *contextVk, size_t attribIndex)
{ … }
}