Hash :
d8f088e0
Author :
Date :
2023-08-14T11:07:24
GL: Remove parallel compile/link without driver support This feature was practically disabled everywhere due to various bugs, and is complicating the code. In effect, the code was always spawning a thread for the compilation and link jobs, immediately fail it (due to a workaround), then do the job when compile/link is resolved (much closer to draw time). This leads to bad user experience, but also is racy because the shaders may get recompiled in the meantime and there is little the GL backend could do to stop that (efficiently). After this change, parallel compile/link is either done by the driver (if supported), or it isn't done. This is a partial revert of a100d8f471f79b9f88d387164992cc5bd9c6ee9f. Bug: angleproject:3031 Bug: chromium:922936 Bug: chromium:1184692 Bug: chromium:1202928 Change-Id: I6348bee3249ccb3828bb98ac2a69dc7d305f821c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4774785 Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
//
// Copyright 2015 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.
//
// RendererGL.h: Defines the class interface for RendererGL.
#ifndef LIBANGLE_RENDERER_GL_RENDERERGL_H_
#define LIBANGLE_RENDERER_GL_RENDERERGL_H_
#include <list>
#include <mutex>
#include "libANGLE/Caps.h"
#include "libANGLE/Error.h"
#include "libANGLE/Version.h"
#include "libANGLE/renderer/gl/renderergl_utils.h"
#include "platform/autogen/FeaturesGL_autogen.h"
namespace angle
{
struct FrontendFeatures;
} // namespace angle
namespace gl
{
struct IndexRange;
class Path;
class State;
} // namespace gl
namespace egl
{
class AttributeMap;
} // namespace egl
namespace sh
{
struct BlockMemberInfo;
} // namespace sh
namespace rx
{
class BlitGL;
class ClearMultiviewGL;
class ContextImpl;
class DisplayGL;
class FunctionsGL;
class PLSProgramCache;
class RendererGL;
class StateManagerGL;
class RendererGL : angle::NonCopyable
{
public:
RendererGL(std::unique_ptr<FunctionsGL> functions,
const egl::AttributeMap &attribMap,
DisplayGL *display);
virtual ~RendererGL();
angle::Result flush();
angle::Result finish();
gl::GraphicsResetStatus getResetStatus();
// EXT_debug_marker
void insertEventMarker(GLsizei length, const char *marker);
void pushGroupMarker(GLsizei length, const char *marker);
void popGroupMarker();
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message);
void popDebugGroup();
GLint getGPUDisjoint();
GLint64 getTimestamp();
const gl::Version &getMaxSupportedESVersion() const;
const FunctionsGL *getFunctions() const { return mFunctions.get(); }
StateManagerGL *getStateManager() const { return mStateManager; }
const angle::FeaturesGL &getFeatures() const { return mFeatures; }
BlitGL *getBlitter() const { return mBlitter; }
ClearMultiviewGL *getMultiviewClearer() const { return mMultiviewClearer; }
PLSProgramCache *getPLSProgramCache();
MultiviewImplementationTypeGL getMultiviewImplementationType() const;
const gl::Caps &getNativeCaps() const;
const gl::TextureCapsMap &getNativeTextureCaps() const;
const gl::Extensions &getNativeExtensions() const;
const gl::Limitations &getNativeLimitations() const;
const ShPixelLocalStorageOptions &getNativePixelLocalStorageOptions() const;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const;
angle::Result dispatchCompute(const gl::Context *context,
GLuint numGroupsX,
GLuint numGroupsY,
GLuint numGroupsZ);
angle::Result dispatchComputeIndirect(const gl::Context *context, GLintptr indirect);
angle::Result memoryBarrier(GLbitfield barriers);
angle::Result memoryBarrierByRegion(GLbitfield barriers);
void framebufferFetchBarrier();
// Checks if the driver has the KHR_parallel_shader_compile or ARB_parallel_shader_compile
// extension.
bool hasNativeParallelCompile();
void setMaxShaderCompilerThreads(GLuint count);
void setNeedsFlushBeforeDeleteTextures();
void flushIfNecessaryBeforeDeleteTextures();
void markWorkSubmitted();
void handleGPUSwitch();
private:
void ensureCapsInitialized() const;
void generateCaps(gl::Caps *outCaps,
gl::TextureCapsMap *outTextureCaps,
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const;
mutable gl::Version mMaxSupportedESVersion;
std::unique_ptr<FunctionsGL> mFunctions;
StateManagerGL *mStateManager;
BlitGL *mBlitter;
ClearMultiviewGL *mMultiviewClearer;
// Load/store programs for EXT_shader_pixel_local_storage.
PLSProgramCache *mPLSProgramCache = nullptr;
bool mUseDebugOutput;
mutable bool mCapsInitialized;
mutable gl::Caps mNativeCaps;
mutable gl::TextureCapsMap mNativeTextureCaps;
mutable gl::Extensions mNativeExtensions;
mutable gl::Limitations mNativeLimitations;
mutable ShPixelLocalStorageOptions mNativePLSOptions;
mutable MultiviewImplementationTypeGL mMultiviewImplementationType;
bool mWorkDoneSinceLastFlush = false;
bool mNativeParallelCompileEnabled;
angle::FeaturesGL mFeatures;
// Workaround for anglebug.com/4267
bool mNeedsFlushBeforeDeleteTextures;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_RENDERERGL_H_