Reland "Add a Vulkan feature to compress float32 vertex formats."

This reverts commit 8ace36f8c1.

Original change's description:
> Revert "Add a Vulkan feature to compress float32 vertex formats."
>
> Bug: b/167404532
> Bug: b/161716126
> Change-Id: I95157a006d5c1fd2d3c0c2c2be37fa0403c07f93
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510011
> Reviewed-by: Tim Van Patten <timvp@google.com>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>
> Commit-Queue: Geoff Lang <geofflang@chromium.org>

Bug: b/167404532
Bug: b/161716126
Change-Id: Ic6811fe3a7124e6eb1efe7c72a1a03a120217753
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815260
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Charlie Lao <cclao@google.com>
This commit is contained in:
Geoff Lang 2021-04-08 12:06:57 -04:00 коммит произвёл Commit Bot
Родитель d630240851
Коммит ccd984ff39
4 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -451,6 +451,14 @@ struct FeaturesVk : FeatureSetBase
FeatureCategory::VulkanWorkarounds,
"Force nearest mip filtering when sampling.", &members};
// Compress float32 vertices in static buffers to float16 at draw time. ANGLE is non-conformant
// if this feature is enabled.
angle::Feature compressVertexData = {"compress_vertex_data",
angle::FeatureCategory::VulkanWorkarounds,
"Compress vertex data to smaller data types when "
"possible. Using this feature makes ANGLE non-conformant.",
&members};
// Qualcomm missynchronizes vkCmdClearAttachments in the middle of render pass.
// https://issuetracker.google.com/166809097
Feature preferDrawClearOverVkCmdClearAttachments = {

Просмотреть файл

@ -2396,6 +2396,8 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
ANGLE_FEATURE_CONDITION(&mFeatures, forceNearestFiltering, false);
ANGLE_FEATURE_CONDITION(&mFeatures, forceNearestMipFiltering, false);
ANGLE_FEATURE_CONDITION(&mFeatures, compressVertexData, false);
ANGLE_FEATURE_CONDITION(
&mFeatures, preferDrawClearOverVkCmdClearAttachments,
IsPixel2(mPhysicalDeviceProperties.vendorID, mPhysicalDeviceProperties.deviceID));

Просмотреть файл

@ -601,6 +601,14 @@ angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
bool bindingIsAligned = BindingIsAligned(
binding, intendedFormat, intendedFormat.channelCount, attrib.relativeOffset);
if (renderer->getFeatures().compressVertexData.enabled &&
gl::IsStaticBufferUsage(bufferGL->getUsage()) &&
vertexFormat.actualCompressedBufferFormatID != angle::FormatID::NONE &&
vertexFormat.actualBufferFormatID != vertexFormat.actualCompressedBufferFormatID)
{
compressed = true;
}
if (vertexFormat.getVertexLoadRequiresConversion(compressed) || !bindingIsAligned)
{
ANGLE_TRY(WarnOnVertexFormatConversion(contextVk, vertexFormat, compressed, true));
@ -610,6 +618,16 @@ angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
binding.getOffset() + attrib.relativeOffset, !bindingIsAligned);
if (conversion->dirty)
{
if (compressed)
{
INFO() << "Compressing vertex data in buffer " << bufferGL->id().value
<< " from "
<< static_cast<unsigned int>(vertexFormat.intendedFormatID) << " to "
<< static_cast<unsigned int>(
vertexFormat.actualCompressedBufferFormatID)
<< ".";
}
if (bindingIsAligned)
{
ANGLE_TRY(convertVertexBufferGPU(contextVk, bufferVk, binding, attribIndex,

Просмотреть файл

@ -178,7 +178,7 @@ void Format::initBufferFallback(RendererVk *renderer,
vertexLoadRequiresConversion = info[i].vertexLoadRequiresConversion;
}
if (compressedStartIndex < numInfo)
if (renderer->getFeatures().compressVertexData.enabled && compressedStartIndex < numInfo)
{
int i = FindSupportedFormat(renderer, info, compressedStartIndex, numInfo,
HasFullBufferFormatSupport);