Commit 5993d899 by Jamie Madill Committed by Commit Bot

Vulkan: Use storage buffers for index conversion shader.

This allows us to use the shader regardless of driver support for texel buffer views. It also allows us to convert indices on the GPU unconditionally. We add a new internal compute shader that converts pairs of indices into a packed single uint value that stores two 16-bit values. In the future we could add support for converting primitive restart indices. Should speed up benchmarks on systems which didn't have R8_UINT support for compute shader buffers. Bug: angleproject:3490 Change-Id: I56ca0cabb094e97f36ab4edc779e6c8ad2d2601e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1639058 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 4a757416
......@@ -217,6 +217,8 @@
"41a4c1f28284dd9396bca79d9967704d",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.0000000B.inc":
"065aaa20cdad29b5f5d2916eb3d096fc",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000000.inc":
"449ed947f0a7923a26b9fe1fa9c02a47",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000000.inc":
"d4e48d64aa66fcf3c09330c4234ba349",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000001.inc":
......@@ -365,6 +367,8 @@
"5f9bbc046387b04be58dbd71988abfc2",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/src/BufferUtils.comp":
"0c8c050841543da0d7faca2559212aa8",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/src/ConvertIndex.comp":
"f7675f4b3c966022e5bd222823b5a094",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/src/ConvertVertex.comp":
"93649f61036c2fa4739988ad71f413df",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/src/FullScreenQuad.vert":
......@@ -378,9 +382,9 @@
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/src/ResolveStencilNoExport.comp":
"645d157257fd8b5315ed56cc12bc94b9",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.cpp":
"f41ce1c729f1fb8adc179d7767cda072",
"bb91c9011878e1603c26e4e915cabcd0",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.h":
"d903e4852d80ccb8b7f817728f8fb887",
"1e4e242530c906e74a6f288d98298780",
"Vulkan internal shader programs:tools/glslang/glslang_validator.exe.sha1":
"9f1f0fc61116a657e065c40f9296e5ab",
"Vulkan internal shader programs:tools/glslang/glslang_validator.sha1":
......
......@@ -1244,7 +1244,7 @@ angle::CheckedNumeric<T> CheckedRoundUp(const T value, const T alignment)
return roundUp(checkedValue, checkedAlignment);
}
inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
inline constexpr unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
{
unsigned int divided = value / divisor;
return (divided + ((value % divisor == 0) ? 0 : 1));
......
......@@ -30,8 +30,7 @@ namespace
constexpr uint32_t kSetIndex = 0;
constexpr uint32_t kBufferClearOutputBinding = 0;
constexpr uint32_t kBufferCopyDestinationBinding = 0;
constexpr uint32_t kBufferCopySourceBinding = 1;
constexpr uint32_t kConvertIndexDestinationBinding = 0;
constexpr uint32_t kConvertVertexDestinationBinding = 0;
constexpr uint32_t kConvertVertexSourceBinding = 1;
constexpr uint32_t kImageCopySourceBinding = 0;
......@@ -248,6 +247,7 @@ void UtilsVk::destroy(VkDevice device)
{
program.destroy(device);
}
mConvertIndexProgram.destroy(device);
for (vk::ShaderProgramHelper &program : mConvertVertexPrograms)
{
program.destroy(device);
......@@ -338,12 +338,12 @@ angle::Result UtilsVk::ensureConvertIndexResourcesInitialized(ContextVk *context
}
VkDescriptorPoolSize setSizes[2] = {
{VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1},
{VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1},
{VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1},
{VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1},
};
return ensureResourcesInitialized(context, Function::ConvertIndexBuffer, setSizes,
ArraySize(setSizes), sizeof(BufferUtilsShaderParams));
ArraySize(setSizes), sizeof(ConvertIndexShaderParams));
}
angle::Result UtilsVk::ensureConvertVertexResourcesInitialized(ContextVk *context)
......@@ -557,19 +557,6 @@ angle::Result UtilsVk::convertIndexBuffer(ContextVk *context,
// Tell dest it's being written to.
dest->onWrite(VK_ACCESS_SHADER_WRITE_BIT);
const vk::Format &destFormat = dest->getViewFormat();
const vk::Format &srcFormat = src->getViewFormat();
ASSERT(destFormat.vkFormatIsInt == srcFormat.vkFormatIsInt);
ASSERT(destFormat.vkFormatIsUnsigned == srcFormat.vkFormatIsUnsigned);
uint32_t flags = BufferUtils_comp::kIsCopy | GetBufferUtilsFlags(params.size, destFormat);
BufferUtilsShaderParams shaderParams;
shaderParams.destOffset = params.destOffset;
shaderParams.size = params.size;
shaderParams.srcOffset = params.srcOffset;
VkDescriptorSet descriptorSet;
vk::RefCountedDescriptorPoolBinding descriptorPoolBinding;
ANGLE_TRY(mDescriptorPools[Function::ConvertIndexBuffer].allocateSets(
......@@ -577,32 +564,37 @@ angle::Result UtilsVk::convertIndexBuffer(ContextVk *context,
&descriptorPoolBinding, &descriptorSet));
descriptorPoolBinding.get().updateSerial(context->getCurrentQueueSerial());
VkWriteDescriptorSet writeInfo[2] = {};
std::array<VkDescriptorBufferInfo, 2> buffers = {{
{dest->getBuffer().getHandle(), 0, VK_WHOLE_SIZE},
{src->getBuffer().getHandle(), 0, VK_WHOLE_SIZE},
}};
writeInfo[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeInfo[0].dstSet = descriptorSet;
writeInfo[0].dstBinding = kBufferCopyDestinationBinding;
writeInfo[0].descriptorCount = 1;
writeInfo[0].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
writeInfo[0].pTexelBufferView = dest->getBufferView().ptr();
VkWriteDescriptorSet writeInfo = {};
writeInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeInfo.dstSet = descriptorSet;
writeInfo.dstBinding = kConvertIndexDestinationBinding;
writeInfo.descriptorCount = 2;
writeInfo.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
writeInfo.pBufferInfo = buffers.data();
writeInfo[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeInfo[1].dstSet = descriptorSet;
writeInfo[1].dstBinding = kBufferCopySourceBinding;
writeInfo[1].descriptorCount = 1;
writeInfo[1].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
writeInfo[1].pTexelBufferView = src->getBufferView().ptr();
vkUpdateDescriptorSets(context->getDevice(), 1, &writeInfo, 0, nullptr);
vkUpdateDescriptorSets(context->getDevice(), 2, writeInfo, 0, nullptr);
ConvertIndexShaderParams shaderParams = {params.srcOffset, params.dstOffset >> 2,
params.maxIndex, 0};
vk::RefCounted<vk::ShaderAndSerial> *shader = nullptr;
ANGLE_TRY(context->getShaderLibrary().getBufferUtils_comp(context, flags, &shader));
ANGLE_TRY(context->getShaderLibrary().getConvertIndex_comp(context, 0, &shader));
ANGLE_TRY(setupProgram(context, Function::ConvertIndexBuffer, shader, nullptr,
&mBufferUtilsPrograms[flags], nullptr, descriptorSet, &shaderParams,
sizeof(shaderParams), commandBuffer));
commandBuffer->dispatch(UnsignedCeilDivide(params.size, 64), 1, 1);
&mConvertIndexProgram, nullptr, descriptorSet, &shaderParams,
sizeof(ConvertIndexShaderParams), commandBuffer));
constexpr uint32_t kInvocationsPerGroup = 64;
constexpr uint32_t kInvocationsPerIndex = 2;
const uint32_t kIndexCount = params.maxIndex - params.srcOffset;
const uint32_t kGroupCount =
UnsignedCeilDivide(kIndexCount * kInvocationsPerIndex, kInvocationsPerGroup);
commandBuffer->dispatch(kGroupCount, 1, 1);
descriptorPoolBinding.reset();
......
......@@ -48,9 +48,9 @@ class UtilsVk : angle::NonCopyable
struct ConvertIndexParameters
{
size_t destOffset;
size_t srcOffset;
size_t size;
uint32_t srcOffset = 0;
uint32_t dstOffset = 0;
uint32_t maxIndex = 0;
};
struct ConvertVertexParameters
......@@ -162,6 +162,14 @@ class UtilsVk : angle::NonCopyable
VkClearColorValue clearValue = {};
};
struct ConvertIndexShaderParams
{
uint32_t srcOffset = 0;
uint32_t dstOffsetDiv4 = 0;
uint32_t maxIndex = 0;
uint32_t _padding = 0;
};
struct ConvertVertexShaderParams
{
ConvertVertexShaderParams();
......@@ -310,6 +318,10 @@ class UtilsVk : angle::NonCopyable
mBufferUtilsPrograms[vk::InternalShader::BufferUtils_comp::kFlagsMask |
vk::InternalShader::BufferUtils_comp::kFunctionMask |
vk::InternalShader::BufferUtils_comp::kFormatMask];
// Currently does not use parameters.
vk::ShaderProgramHelper mConvertIndexProgram;
vk::ShaderProgramHelper
mConvertVertexPrograms[vk::InternalShader::ConvertVertex_comp::kFlagsMask |
vk::InternalShader::ConvertVertex_comp::kConversionMask];
......
......@@ -29,9 +29,8 @@ constexpr size_t kDynamicIndexDataSize = 1024 * 8;
constexpr size_t kMaxVertexFormatAlignment = 4;
constexpr VkBufferUsageFlags kVertexBufferUsageFlags =
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
constexpr VkBufferUsageFlags kIndexBufferUsageFlags = VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT |
VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
constexpr VkBufferUsageFlags kIndexBufferUsageFlags =
VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
ANGLE_INLINE bool BindingIsAligned(const gl::VertexBinding &binding,
const angle::Format &angleFormat,
......@@ -145,8 +144,11 @@ VertexArrayVk::VertexArrayVk(ContextVk *contextVk, const gl::VertexArrayState &s
buffer.init(kMaxVertexFormatAlignment, renderer);
}
mDynamicVertexData.init(kMaxVertexFormatAlignment, renderer);
mDynamicIndexData.init(1, renderer);
mTranslatedByteIndexData.init(1, renderer);
// We use an alignment of four for index data. This ensures that compute shaders can read index
// elements from "uint" aligned addresses.
mDynamicIndexData.init(4, renderer);
mTranslatedByteIndexData.init(4, renderer);
}
VertexArrayVk::~VertexArrayVk() {}
......@@ -171,8 +173,6 @@ angle::Result VertexArrayVk::convertIndexBufferGPU(ContextVk *contextVk,
BufferVk *bufferVk,
const void *indices)
{
RendererVk *renderer = contextVk->getRenderer();
intptr_t offsetIntoSrcData = reinterpret_cast<intptr_t>(indices);
size_t srcDataSize = static_cast<size_t>(bufferVk->getSize()) - offsetIntoSrcData;
......@@ -186,19 +186,13 @@ angle::Result VertexArrayVk::convertIndexBufferGPU(ContextVk *contextVk,
vk::BufferHelper *dest = mTranslatedByteIndexData.getCurrentBuffer();
vk::BufferHelper *src = &bufferVk->getBuffer();
ANGLE_TRY(src->initBufferView(contextVk, renderer->getFormat(angle::FormatID::R8_UINT)));
ANGLE_TRY(dest->initBufferView(contextVk, renderer->getFormat(angle::FormatID::R16_UINT)));
// Copy relevant section of the source into destination at allocated offset. Note that the
// offset returned by allocate() above is in bytes, while our allocated array is of
// GLushorts.
// offset returned by allocate() above is in bytes. As is the indices offset pointer.
UtilsVk::ConvertIndexParameters params = {};
params.destOffset = static_cast<size_t>(mCurrentElementArrayBufferOffset) / sizeof(GLushort);
params.srcOffset = offsetIntoSrcData;
params.size = srcDataSize;
params.srcOffset = static_cast<uint32_t>(offsetIntoSrcData);
params.dstOffset = static_cast<uint32_t>(mCurrentElementArrayBufferOffset);
params.maxIndex = static_cast<uint32_t>(bufferVk->getSize());
// Note: Once support for primitive restart is added, a specialized shader is needed to
// convert 0xFF -> 0xFFFF. http://anglebug.com/3215
return contextVk->getUtils().convertIndexBuffer(contextVk, dest, src, params);
}
......@@ -678,7 +672,6 @@ angle::Result VertexArrayVk::updateIndexTranslation(ContextVk *contextVk,
{
ASSERT(type != gl::DrawElementsType::InvalidEnum);
RendererVk *renderer = contextVk->getRenderer();
gl::Buffer *glBuffer = mState.getElementArrayBuffer();
if (!glBuffer)
......@@ -686,44 +679,10 @@ angle::Result VertexArrayVk::updateIndexTranslation(ContextVk *contextVk,
return convertIndexBufferCPU(contextVk, type, indexCount, indices, &mDynamicIndexData);
}
BufferVk *bufferVk = vk::GetImpl(glBuffer);
if (renderer->getFormat(angle::FormatID::R16_UINT).vkSupportsStorageBuffer)
{
ASSERT(type == gl::DrawElementsType::UnsignedByte);
ANGLE_TRY(convertIndexBufferGPU(contextVk, bufferVk, indices));
}
else
{
// If it's not possible to convert the buffer with compute, opt for a CPU read back for now.
// TODO(syoussefi): R8G8B8A8_UINT is required to have storage texel buffer support, so a
// specialized shader code can be made to read two ubyte indices and output them in R and B
// (or A and G based on endianness?) with 0 on the other channels. If specialized, we might
// as well support the ubyte to ushort case with correct handling of primitive restart.
// http://anglebug.com/3003
TRACE_EVENT0("gpu.angle", "VertexArrayVk::updateIndexTranslation");
// Needed before reading buffer or we could get stale data.
ANGLE_TRY(contextVk->finishImpl());
ASSERT(type == gl::DrawElementsType::UnsignedByte);
// Unsigned bytes don't have direct support in Vulkan so we have to expand the
// memory to a GLushort.
void *srcDataMapping = nullptr;
ASSERT(!glBuffer->isMapped());
ANGLE_TRY(bufferVk->mapImpl(contextVk, &srcDataMapping));
uint8_t *srcData = static_cast<uint8_t *>(srcDataMapping);
intptr_t offsetIntoSrcData = reinterpret_cast<intptr_t>(indices);
srcData += offsetIntoSrcData;
ANGLE_TRY(convertIndexBufferCPU(
contextVk, type, static_cast<size_t>(bufferVk->getSize()) - offsetIntoSrcData, srcData,
&mTranslatedByteIndexData));
ANGLE_TRY(bufferVk->unmapImpl(contextVk));
}
ASSERT(type == gl::DrawElementsType::UnsignedByte);
return angle::Result::Continue;
BufferVk *bufferVk = vk::GetImpl(glBuffer);
return convertIndexBufferGPU(contextVk, bufferVk, indices);
}
void VertexArrayVk::updateDefaultAttrib(ContextVk *contextVk,
......
//
// Copyright 2019 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.
//
// ConvertIndex.comp: Convert UINT_8 indices into UINT_16 using a compute shader.
//
// The following defines tweak the functionality, and a different shader is built based on these.
//
// (Currently no parameters)
//
#version 450 core
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout (set = 0, binding = 0) buffer dst
{
// Shader invocations output one packed 32-bit value with up to two 16-bit indices.
uint dstData[];
};
layout (set = 0, binding = 1) readonly buffer src
{
// Shader invocations read at most 16 bits of one packed 32-bit value. (Two 8-bit indices.)
uint srcData[];
};
layout (push_constant) uniform PushConstants
{
// Read offset in bytes into the srcData array.
uint srcOffset;
// Write offset in bytes into the dstData array, divided by four.
uint dstOffsetDiv4;
// Maximum size of the read buffer. The highest index value we will convert.
uint maxIndex;
// Not used in the shader. Kept to pad "PushContants" to the size of a vec4.
uint _padding;
};
uint PullIndex(uint index)
{
uint srcIndex = index + srcOffset;
uint srcBlock = srcData[srcIndex >> 2];
uint srcComponent = (srcIndex & 3);
return (srcBlock >> (srcComponent << 3)) & 0xFF;
}
void PackIndexValue(uint srcValue, uint indexIndex, inout uint dstValue)
{
// Pack 16-byte index into the 32-byte destination.
dstValue |= srcValue << (indexIndex << 4);
}
// Note: Once support for primitive restart is added, the shader needs to
// convert 0xFF -> 0xFFFF. http://anglebug.com/3215
void main()
{
// The element index is simply the invocation ID times two.
uint index = (gl_GlobalInvocationID.x << 1);
// Don't write anything to dest if we're entirely past the end of the buffer.
// We assume buffer size is uint-aligned.
if (index >= maxIndex)
return;
uint dstValue = 0;
uint srcValue = PullIndex(index);
PackIndexValue(srcValue, 0, dstValue);
// Skip packing the second index if we're after the last element.
if (index + 1 < maxIndex)
{
uint srcValue = PullIndex(index + 1);
PackIndexValue(srcValue, 1, dstValue);
}
dstData[dstOffsetDiv4 + gl_GlobalInvocationID.x] = dstValue;
}
{
"Description": [
"Copyright 2019 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.",
"",
"ConvertIndex.comp.json: Build parameters for ConvertIndex.comp."
]
}
......@@ -98,7 +98,6 @@ Format::Format()
textureLoadFunctions(),
vertexLoadRequiresConversion(false),
vkBufferFormatIsPacked(false),
vkSupportsStorageBuffer(false),
vkFormatIsInt(false),
vkFormatIsUnsigned(false)
{}
......@@ -209,9 +208,6 @@ void FormatTable::initialize(RendererVk *renderer,
continue;
}
format.vkSupportsStorageBuffer = renderer->hasBufferFormatFeatureBits(
format.vkBufferFormat, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT);
gl::TextureCaps textureCaps;
FillTextureFormatCaps(renderer, format.vkImageFormat, &textureCaps);
outTextureCapsMap->set(formatID, textureCaps);
......
......@@ -97,7 +97,6 @@ struct Format final : private angle::NonCopyable
bool vertexLoadRequiresConversion;
bool vkBufferFormatIsPacked;
bool vkSupportsStorageBuffer;
bool vkFormatIsInt;
bool vkFormatIsUnsigned;
};
......
......@@ -28,6 +28,7 @@ namespace
#include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000009.inc"
#include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.0000000A.inc"
#include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.0000000B.inc"
#include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000000.inc"
#include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000000.inc"
#include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000001.inc"
#include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000002.inc"
......@@ -123,6 +124,9 @@ constexpr ShaderBlob kBufferUtils_comp_shaders[] = {
{kBufferUtils_comp_0000000A, sizeof(kBufferUtils_comp_0000000A)},
{kBufferUtils_comp_0000000B, sizeof(kBufferUtils_comp_0000000B)},
};
constexpr ShaderBlob kConvertIndex_comp_shaders[] = {
{kConvertIndex_comp_00000000, sizeof(kConvertIndex_comp_00000000)},
};
constexpr ShaderBlob kConvertVertex_comp_shaders[] = {
{kConvertVertex_comp_00000000, sizeof(kConvertVertex_comp_00000000)},
{kConvertVertex_comp_00000001, sizeof(kConvertVertex_comp_00000001)},
......@@ -247,6 +251,10 @@ void ShaderLibrary::destroy(VkDevice device)
{
shader.get().destroy(device);
}
for (RefCounted<ShaderAndSerial> &shader : mConvertIndex_comp_shaders)
{
shader.get().destroy(device);
}
for (RefCounted<ShaderAndSerial> &shader : mConvertVertex_comp_shaders)
{
shader.get().destroy(device);
......@@ -281,6 +289,14 @@ angle::Result ShaderLibrary::getBufferUtils_comp(Context *context,
ArraySize(kBufferUtils_comp_shaders), shaderFlags, shaderOut);
}
angle::Result ShaderLibrary::getConvertIndex_comp(Context *context,
uint32_t shaderFlags,
RefCounted<ShaderAndSerial> **shaderOut)
{
return GetShader(context, mConvertIndex_comp_shaders, kConvertIndex_comp_shaders,
ArraySize(kConvertIndex_comp_shaders), shaderFlags, shaderOut);
}
angle::Result ShaderLibrary::getConvertVertex_comp(Context *context,
uint32_t shaderFlags,
RefCounted<ShaderAndSerial> **shaderOut)
......
......@@ -21,6 +21,7 @@ angle_vulkan_internal_shaders = [
"shaders/gen/BufferUtils.comp.00000009.inc",
"shaders/gen/BufferUtils.comp.0000000A.inc",
"shaders/gen/BufferUtils.comp.0000000B.inc",
"shaders/gen/ConvertIndex.comp.00000000.inc",
"shaders/gen/ConvertVertex.comp.00000000.inc",
"shaders/gen/ConvertVertex.comp.00000001.inc",
"shaders/gen/ConvertVertex.comp.00000002.inc",
......
......@@ -41,6 +41,9 @@ enum Format
};
} // namespace BufferUtils_comp
namespace ConvertIndex_comp
{} // namespace ConvertIndex_comp
namespace ConvertVertex_comp
{
enum flags
......@@ -152,6 +155,9 @@ class ShaderLibrary final : angle::NonCopyable
angle::Result getBufferUtils_comp(Context *context,
uint32_t shaderFlags,
RefCounted<ShaderAndSerial> **shaderOut);
angle::Result getConvertIndex_comp(Context *context,
uint32_t shaderFlags,
RefCounted<ShaderAndSerial> **shaderOut);
angle::Result getConvertVertex_comp(Context *context,
uint32_t shaderFlags,
RefCounted<ShaderAndSerial> **shaderOut);
......@@ -176,6 +182,7 @@ class ShaderLibrary final : angle::NonCopyable
mBufferUtils_comp_shaders[InternalShader::BufferUtils_comp::kFlagsMask |
InternalShader::BufferUtils_comp::kFunctionMask |
InternalShader::BufferUtils_comp::kFormatMask];
RefCounted<ShaderAndSerial> mConvertIndex_comp_shaders[1];
RefCounted<ShaderAndSerial>
mConvertVertex_comp_shaders[InternalShader::ConvertVertex_comp::kFlagsMask |
InternalShader::ConvertVertex_comp::kConversionMask];
......
......@@ -312,5 +312,5 @@ TEST_P(WebGLDrawElementsTest, DrawElementsTypeAlignment)
}
ANGLE_INSTANTIATE_TEST(DrawElementsTest, ES3_OPENGL(), ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(WebGLDrawElementsTest, ES2_OPENGL(), ES2_OPENGLES());
ANGLE_INSTANTIATE_TEST(WebGLDrawElementsTest, ES2_OPENGL(), ES2_OPENGLES(), ES2_VULKAN());
} // namespace
......@@ -91,7 +91,7 @@ class IndexBufferOffsetTest : public ANGLETest
for (int i = 0; i < 16; i++)
{
glDrawElements(GL_TRIANGLES, 6, type, reinterpret_cast<void *>(indexDataWidth));
EXPECT_PIXEL_EQ(64, 64, 255, 0, 0, 255);
EXPECT_PIXEL_COLOR_EQ(64, 64, GLColor::red);
}
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, indexDataWidth, indexDataWidth, nullIndexData);
......@@ -99,7 +99,7 @@ class IndexBufferOffsetTest : public ANGLETest
glUniform4f(mColorUniformLocation, 0.0f, 1.0f, 0.0f, 1.0f);
glDrawElements(GL_TRIANGLES, 6, type, reinterpret_cast<void *>(indexDataWidth * 2));
EXPECT_PIXEL_EQ(64, 64, 0, 255, 0, 255);
EXPECT_PIXEL_COLOR_EQ(64, 64, GLColor::green);
EXPECT_GL_NO_ERROR();
swapBuffers();
......
......@@ -158,19 +158,17 @@ void main()
if (i < firstIndex)
{
EXPECT_PIXEL_EQ(x, y, 0, 0, 0, 255);
EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::black);
}
else
{
if (useVertexBufferWithColor)
{
// Pixel data is assumed to be GREEN
EXPECT_PIXEL_EQ(x, y, 0, 255, 0, 255);
EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::green);
}
else
{
// Pixel data is assumed to be RED
EXPECT_PIXEL_EQ(x, y, 255, 0, 0, 255);
EXPECT_PIXEL_COLOR_EQ(x, y, GLColor::red);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment