summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-11 18:11:13 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-11 18:11:13 +0200
commit4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0 (patch)
treef000dd831240707a03b8c806db292c2a15cde3ce /gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp
parent3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff)
downloadUXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.gz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.lz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.xz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.zip
Roll back to ANGLE/2845
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp')
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp105
1 files changed, 7 insertions, 98 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp b/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp
index 504a787f8..87fd24a61 100755
--- a/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp
+++ b/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp
@@ -11,8 +11,6 @@
#include <limits>
-#include "common/mathutil.h"
-#include "libANGLE/Buffer.h"
#include "libANGLE/Caps.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/gl/FunctionsGL.h"
@@ -22,8 +20,6 @@
#include <algorithm>
#include <sstream>
-using angle::CheckedNumeric;
-
namespace rx
{
VendorID GetVendorID(const FunctionsGL *functions)
@@ -871,81 +867,35 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM
functions->isAtLeastGLES(gl::Version(3, 1));
extensions->pathRendering = canEnableGLPathRendering || canEnableESPathRendering;
-
- extensions->textureSRGBDecode = functions->hasGLExtension("GL_EXT_texture_sRGB_decode") ||
- functions->hasGLESExtension("GL_EXT_texture_sRGB_decode");
-
-#if defined(ANGLE_PLATFORM_APPLE)
- VendorID vendor = GetVendorID(functions);
- if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0))
- {
- // Apple Intel/AMD drivers do not correctly use the TEXTURE_SRGB_DECODE property of sampler
- // states. Disable this extension when we would advertise any ES version that has samplers.
- extensions->textureSRGBDecode = false;
- }
-#endif
-
- extensions->sRGBWriteControl = functions->isAtLeastGL(gl::Version(3, 0)) ||
- functions->hasGLExtension("GL_EXT_framebuffer_sRGB") ||
- functions->hasGLExtension("GL_ARB_framebuffer_sRGB") ||
- functions->hasGLESExtension("GL_EXT_sRGB_write_control");
-
-#if defined(ANGLE_PLATFORM_ANDROID)
- // SRGB blending does not appear to work correctly on the Nexus 5. Writing to an SRGB
- // framebuffer with GL_FRAMEBUFFER_SRGB enabled and then reading back returns the same value.
- // Disabling GL_FRAMEBUFFER_SRGB will then convert in the wrong direction.
- extensions->sRGBWriteControl = false;
-#endif
}
void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds)
{
VendorID vendor = GetVendorID(functions);
- workarounds->dontRemoveInvariantForFragmentInput =
- functions->standard == STANDARD_GL_DESKTOP && IsAMD(vendor);
-
// Don't use 1-bit alpha formats on desktop GL with AMD or Intel drivers.
workarounds->avoid1BitAlphaTextureFormats =
- functions->standard == STANDARD_GL_DESKTOP && (IsAMD(vendor) || IsIntel(vendor));
+ functions->standard == STANDARD_GL_DESKTOP &&
+ (vendor == VENDOR_ID_AMD || vendor == VENDOR_ID_INTEL);
workarounds->rgba4IsNotSupportedForColorRendering =
- functions->standard == STANDARD_GL_DESKTOP && IsIntel(vendor);
-
- workarounds->emulateAbsIntFunction = IsIntel(vendor);
-
- workarounds->addAndTrueToLoopCondition = IsIntel(vendor);
-
- workarounds->emulateIsnanFloat = IsIntel(vendor);
+ functions->standard == STANDARD_GL_DESKTOP && vendor == VENDOR_ID_INTEL;
workarounds->doesSRGBClearsOnLinearFramebufferAttachments =
- functions->standard == STANDARD_GL_DESKTOP && (IsIntel(vendor) || IsAMD(vendor));
+ functions->standard == STANDARD_GL_DESKTOP &&
+ (vendor == VENDOR_ID_INTEL || vendor == VENDOR_ID_AMD);
#if defined(ANGLE_PLATFORM_APPLE)
workarounds->doWhileGLSLCausesGPUHang = true;
- workarounds->useUnusedBlocksWithStandardOrSharedLayout = true;
#endif
workarounds->finishDoesNotCauseQueriesToBeAvailable =
- functions->standard == STANDARD_GL_DESKTOP && IsNvidia(vendor);
+ functions->standard == STANDARD_GL_DESKTOP && vendor == VENDOR_ID_NVIDIA;
// TODO(cwallez): Disable this workaround for MacOSX versions 10.9 or later.
workarounds->alwaysCallUseProgramAfterLink = true;
- workarounds->unpackOverlappingRowsSeparatelyUnpackBuffer = IsNvidia(vendor);
- workarounds->packOverlappingRowsSeparatelyPackBuffer = IsNvidia(vendor);
-
- workarounds->initializeCurrentVertexAttributes = IsNvidia(vendor);
-
-#if defined(ANGLE_PLATFORM_APPLE)
- workarounds->unpackLastRowSeparatelyForPaddingInclusion = true;
- workarounds->packLastRowSeparatelyForPaddingInclusion = true;
-#else
- workarounds->unpackLastRowSeparatelyForPaddingInclusion = IsNvidia(vendor);
- workarounds->packLastRowSeparatelyForPaddingInclusion = IsNvidia(vendor);
-#endif
-
- workarounds->removeInvariantAndCentroidForESSL3 = functions->isAtMostGL(gl::Version(4, 1));
+ workarounds->unpackOverlappingRowsSeparatelyUnpackBuffer = vendor == VENDOR_ID_NVIDIA;
}
}
@@ -1001,45 +951,4 @@ uint8_t *MapBufferRangeWithFallback(const FunctionsGL *functions,
return nullptr;
}
}
-
-gl::ErrorOrResult<bool> ShouldApplyLastRowPaddingWorkaround(const gl::Extents &size,
- const gl::PixelStoreStateBase &state,
- GLenum format,
- GLenum type,
- bool is3D,
- const void *pixels)
-{
- if (state.pixelBuffer.get() == nullptr)
- {
- return false;
- }
-
- // We are using an pack or unpack buffer, compute what the driver thinks is going to be the
- // last byte read or written. If it is past the end of the buffer, we will need to use the
- // workaround otherwise the driver will generate INVALID_OPERATION and not do the operation.
- CheckedNumeric<size_t> checkedEndByte;
- CheckedNumeric<size_t> pixelBytes;
- size_t rowPitch;
-
- const gl::InternalFormat &glFormat =
- gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
- ANGLE_TRY_RESULT(glFormat.computePackUnpackEndByte(size, state, is3D), checkedEndByte);
- ANGLE_TRY_RESULT(glFormat.computeRowPitch(size.width, state.alignment, state.rowLength),
- rowPitch);
- pixelBytes = glFormat.pixelBytes;
-
- checkedEndByte += reinterpret_cast<intptr_t>(pixels);
-
- // At this point checkedEndByte is the actual last byte read.
- // The driver adds an extra row padding (if any), mimic it.
- ANGLE_TRY_CHECKED_MATH(pixelBytes);
- if (pixelBytes.ValueOrDie() * size.width < rowPitch)
- {
- checkedEndByte += rowPitch - pixelBytes * size.width;
- }
-
- ANGLE_TRY_CHECKED_MATH(checkedEndByte);
-
- return checkedEndByte.ValueOrDie() > static_cast<size_t>(state.pixelBuffer->getSize());
-}
}