Commit 95584459 by Corentin Wallez Committed by Commit Bot

Revert "Workaround for Mac Intel drawArraysInstanced with first > 0"

This reverts commit 027bc47c. Reason for revert: InstancingTests fail on Mac FYI Release (Intel UHD 630), see https://ci.chromium.org/ui/p/chromium/builders/ci/Mac%20FYI%20Release%20(Intel%20UHD%20630)/1729/overview Original change's description: > Workaround for Mac Intel drawArraysInstanced with first > 0 > > Workaround by forcefully set instanced arrays (divisor > 0) > as streaming attributes and apply extra offset at front. Recover > those attribute bindings when first == 0 and other draw calls > (drawElementsInstanced) > > Bug: chromium:1144207, chromium:1144247, chromium:1144373 > Change-Id: Ie7836cc71b45a290513f34f90d49bd15b14ddba8 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2661095 > Commit-Queue: Shrek Shao <shrekshao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: chromium:1144207 Bug: chromium:1144247 Bug: chromium:1144373 Change-Id: Ia4a6026a8c446490346b373c33fe2b1724c1761f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2704052 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 2d3402eb
......@@ -522,13 +522,6 @@ struct FeaturesGL : FeatureSetBase
Feature initFragmentOutputVariables = {
"init_fragment_output_variables", FeatureCategory::OpenGLWorkarounds,
"No init gl_FragColor causes context lost", &members, "http://crbug.com/1171371"};
// On macOS with Intel GPUs, instanced array with divisor > 0 is buggy when first > 0 in
// drawArraysInstanced. Shift the attributes with extra offset to workaround.
Feature shiftInstancedArrayDataWithExtraOffset = {
"shift_instanced_array_data_with_offset", FeatureCategory::OpenGLWorkarounds,
"glDrawArraysInstanced is buggy on certain new Mac Intel GPUs", &members,
"http://crbug.com/1144207"};
};
inline FeaturesGL::FeaturesGL() = default;
......
......@@ -210,9 +210,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawArraysState(const gl::Context *cont
GLsizei count,
GLsizei instanceCount)
{
const angle::FeaturesGL &features = getFeaturesGL();
if (context->getStateCache().hasAnyActiveClientAttrib() ||
(features.shiftInstancedArrayDataWithExtraOffset.enabled && first > 0))
if (context->getStateCache().hasAnyActiveClientAttrib())
{
const gl::State &glState = context->getState();
const gl::ProgramExecutable *executable = getState().getProgramExecutable();
......@@ -226,16 +224,8 @@ ANGLE_INLINE angle::Result ContextGL::setDrawArraysState(const gl::Context *cont
vaoGL->validateState(context);
#endif // ANGLE_STATE_VALIDATION_ENABLED
}
else if (features.shiftInstancedArrayDataWithExtraOffset.enabled && first == 0)
{
// There could be previous draw call that has modified the attributes
// Instead of forcefully streaming attributes, we just rebind the original ones
const gl::State &glState = context->getState();
const gl::VertexArray *vao = glState.getVertexArray();
const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(vao);
vaoGL->recoverForcedStreamingAttributesForDrawArraysInstanced(context);
}
const angle::FeaturesGL &features = getFeaturesGL();
if (features.setPrimitiveRestartFixedIndexForDrawArrays.enabled)
{
StateManagerGL *stateManager = getStateManager();
......@@ -258,15 +248,6 @@ ANGLE_INLINE angle::Result ContextGL::setDrawElementsState(const gl::Context *co
const gl::VertexArray *vao = glState.getVertexArray();
const gl::StateCache &stateCache = context->getStateCache();
const angle::FeaturesGL &features = getFeaturesGL();
if (features.shiftInstancedArrayDataWithExtraOffset.enabled)
{
// There might be instanced arrays that are forced streaming for drawArraysInstanced
// They cannot be ELEMENT_ARRAY_BUFFER
const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(vao);
vaoGL->recoverForcedStreamingAttributesForDrawArraysInstanced(context);
}
if (stateCache.hasAnyActiveClientAttrib() || vao->getElementArrayBuffer() == nullptr)
{
const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(vao);
......@@ -279,6 +260,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawElementsState(const gl::Context *co
*outIndices = indices;
}
const angle::FeaturesGL &features = getFeaturesGL();
if (glState.isPrimitiveRestartEnabled() && features.emulatePrimitiveRestartFixedIndex.enabled)
{
StateManagerGL *stateManager = getStateManager();
......
......@@ -457,9 +457,4 @@ bool ScopedWorkerContextGL::operator()() const
return mValid;
}
void RendererGL::handleGPUSwitch()
{
nativegl_gl::ReInitializeFeaturesAtGPUSwitch(mFunctions.get(), &mFeatures);
}
} // namespace rx
......@@ -135,8 +135,6 @@ class RendererGL : angle::NonCopyable
void setNeedsFlushBeforeDeleteTextures();
void flushIfNecessaryBeforeDeleteTextures();
void handleGPUSwitch();
protected:
virtual WorkerContext *createWorkerContext(std::string *infoLog) = 0;
......
......@@ -57,8 +57,6 @@ class VertexArrayGL : public VertexArrayImpl
void validateState(const gl::Context *context) const;
void recoverForcedStreamingAttributesForDrawArraysInstanced(const gl::Context *context) const;
private:
angle::Result syncDrawState(const gl::Context *context,
const gl::AttributesMask &activeAttributesMask,
......@@ -118,10 +116,6 @@ class VertexArrayGL : public VertexArrayImpl
GLsizei stride,
GLintptr offset) const;
void recoverForcedStreamingAttributesForDrawArraysInstanced(
const gl::Context *context,
gl::AttributesMask *attributeMask) const;
GLuint mVertexArrayID;
int mAppliedNumViews;
......@@ -139,11 +133,6 @@ class VertexArrayGL : public VertexArrayImpl
mutable size_t mStreamingArrayBufferSize;
mutable GLuint mStreamingArrayBuffer;
// Used for Mac Intel instanced draw workaround
mutable gl::AttributesMask mForcedStreamingAttributesForDrawArraysInstancedMask;
mutable gl::AttributesMask mInstancedAttributesMask;
mutable std::array<GLint, gl::MAX_VERTEX_ATTRIBS> mForcedStreamingAttributesFirstOffsets;
};
ANGLE_INLINE angle::Result VertexArrayGL::syncDrawElementsState(
......
......@@ -658,8 +658,6 @@ egl::Error DisplayCGL::handleGPUSwitch()
CGLSetCurrentContext(mContext);
onStateChange(angle::SubjectMessage::SubjectChanged);
mCurrentGPUID = gpuID;
mRenderer->handleGPUSwitch();
}
}
......
......@@ -1647,33 +1647,23 @@ void GenerateCaps(const FunctionsGL *functions,
extensions->yuvTargetEXT = functions->hasGLESExtension("GL_EXT_YUV_target");
}
bool GetSystemInfoVendorIDAndDeviceID(const FunctionsGL *functions,
angle::SystemInfo *outSystemInfo,
angle::VendorID *outVendor,
angle::DeviceID *outDevice)
void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features)
{
bool isGetSystemInfoSuccess = angle::GetSystemInfo(outSystemInfo);
if (isGetSystemInfoSuccess && !outSystemInfo->gpus.empty())
angle::VendorID vendor;
angle::DeviceID device;
angle::SystemInfo systemInfo;
bool isGetSystemInfoSuccess = angle::GetSystemInfo(&systemInfo);
if (isGetSystemInfoSuccess && !systemInfo.gpus.empty())
{
*outVendor = outSystemInfo->gpus[outSystemInfo->activeGPUIndex].vendorId;
*outDevice = outSystemInfo->gpus[outSystemInfo->activeGPUIndex].deviceId;
vendor = systemInfo.gpus[systemInfo.activeGPUIndex].vendorId;
device = systemInfo.gpus[systemInfo.activeGPUIndex].deviceId;
}
else
{
*outVendor = GetVendorID(functions);
*outDevice = GetDeviceID(functions);
vendor = GetVendorID(functions);
device = GetDeviceID(functions);
}
return isGetSystemInfoSuccess;
}
void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features)
{
angle::VendorID vendor;
angle::DeviceID device;
angle::SystemInfo systemInfo;
bool isGetSystemInfoSuccess =
GetSystemInfoVendorIDAndDeviceID(functions, &systemInfo, &vendor, &device);
bool isAMD = IsAMD(vendor);
bool isIntel = IsIntel(vendor);
......@@ -1941,12 +1931,6 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// If output variable gl_FragColor is written by fragment shader, it may cause context lost with
// Adreno 42x and 3xx.
ANGLE_FEATURE_CONDITION(features, initFragmentOutputVariables, IsAdreno42xOr3xx(functions));
// http://crbug.com/1144207
// The Mac bot with Intel Iris GPU seems unaffected by this bug. Exclude the Haswell family for
// now.
ANGLE_FEATURE_CONDITION(features, shiftInstancedArrayDataWithExtraOffset,
IsApple() && IsIntel(vendor) && !IsHaswell(device));
}
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features)
......@@ -1959,22 +1943,6 @@ void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFea
ANGLE_FEATURE_CONDITION(features, syncFramebufferBindingsOnTexImage, false);
}
void ReInitializeFeaturesAtGPUSwitch(const FunctionsGL *functions, angle::FeaturesGL *features)
{
angle::VendorID vendor;
angle::DeviceID device;
angle::SystemInfo systemInfo;
GetSystemInfoVendorIDAndDeviceID(functions, &systemInfo, &vendor, &device);
// http://crbug.com/1144207
// The Mac bot with Intel Iris GPU seems unaffected by this bug. Exclude the Haswell family for
// now.
// We need to reinitialize this feature when switching between buggy and non-buggy GPUs.
ANGLE_FEATURE_CONDITION(features, shiftInstancedArrayDataWithExtraOffset,
IsApple() && IsIntel(vendor) && !IsHaswell(device));
}
} // namespace nativegl_gl
namespace nativegl
......
......@@ -106,7 +106,6 @@ void GenerateCaps(const FunctionsGL *functions,
void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features);
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features);
void ReInitializeFeaturesAtGPUSwitch(const FunctionsGL *functions, angle::FeaturesGL *features);
} // namespace nativegl_gl
namespace nativegl
......
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