Hash :
ad013650
Author :
Date :
2024-03-22T03:42:44
Revert "Rename LinkSubTask -> PostLinkTask" This reverts commit 00eb6edba074a22389b09990ab856adfd417dd64. Reason for revert: Sub tasks are not actually post-link tasks for all the other backends (other than Vulkan), but they are a real part of the link job. Original change's description: > Rename LinkSubTask -> PostLinkTask > > This is a renaming change, no behavior changes are expected. > > Bug: angleproject:8297 > Change-Id: I734c7959f5ed6db2447853cc6f6256e3c8e86213 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5382224 > Commit-Queue: mohan maiya <m.maiya@samsung.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:8297 Change-Id: Iaebf9d165d810344bfc524042206ca427d270034 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5386432 Reviewed-by: Shahbaz Youssefi <syoussefi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shahbaz Youssefi <syoussefi@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
//
// Copyright 2014 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.
//
// ShaderImpl.h: Defines the abstract rx::ShaderImpl class.
#ifndef LIBANGLE_RENDERER_SHADERIMPL_H_
#define LIBANGLE_RENDERER_SHADERIMPL_H_
#include <functional>
#include "common/CompiledShaderState.h"
#include "common/WorkerThread.h"
#include "common/angleutils.h"
#include "libANGLE/Shader.h"
namespace gl
{
class ShCompilerInstance;
} // namespace gl
namespace rx
{
// The compile task is generally just a call to the translator. However, different backends behave
// differently afterwards:
//
// - The Vulkan backend which generates binary (i.e. SPIR-V), does nothing more
// - The backends that generate text (HLSL and MSL), do nothing at this stage, but modify the text
// at link time before invoking the native compiler. These expensive calls are handled in link
// sub-tasks (see LinkSubTask in ProgramImpl.h).
// - The GL backend needs to invoke the native driver, which is problematic when done in another
// thread (and is avoided).
//
// The call to the translator can thus be done in a separate thread or without holding the share
// group lock on all backends except GL. On the GL backend, the translator call is done on the main
// thread followed by a call to the native driver. If the driver supports
// GL_KHR_parallel_shader_compile, ANGLE still delays post-processing of the results to when
// compilation is done (just as if it was ANGLE itself that was doing the compilation in a thread).
class ShaderTranslateTask
{
public:
virtual ~ShaderTranslateTask() = default;
virtual bool translate(ShHandle compiler,
const ShCompileOptions &options,
const std::string &source);
virtual void postTranslate(ShHandle compiler, const gl::CompiledShaderState &compiledState) {}
// Used by the GL backend to query whether the driver is compiling in parallel internally.
virtual bool isCompilingInternally() { return false; }
// Used by the GL backend to finish internal compilation and return results.
virtual angle::Result getResult(std::string &infoLog) { return angle::Result::Continue; }
};
class ShaderImpl : angle::NonCopyable
{
public:
ShaderImpl(const gl::ShaderState &state) : mState(state) {}
virtual ~ShaderImpl() {}
virtual void destroy() {}
virtual std::shared_ptr<ShaderTranslateTask> compile(const gl::Context *context,
ShCompileOptions *options) = 0;
virtual std::string getDebugInfo() const = 0;
const gl::ShaderState &getState() const { return mState; }
virtual angle::Result onLabelUpdate(const gl::Context *context);
protected:
const gl::ShaderState &mState;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_SHADERIMPL_H_