Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ vars = {
'googlefonts_testdata_version': 'version:20230913',

# Pre-built task drivers from this repo, used for CI.
'task_drivers_revision': 'git_revision:b5d31abb7bc772a69f800de45783768768437675',
'task_drivers_revision': 'git_revision:5e4f3217c17a8d88195d4c2924613420a256457b',
}

# If you modify this file, you will need to regenerate the Bazel version of this file (bazel/deps.bzl).
Expand Down
76 changes: 39 additions & 37 deletions include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,44 @@
// DO NOT EDIT!

#ifndef GPU_DRIVER_BUG_WORKAROUNDS
#define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) \
GPU_OP(ADD_AND_TRUE_TO_LOOP_CONDITION, \
add_and_true_to_loop_condition) \
GPU_OP(DISABLE_BLEND_EQUATION_ADVANCED, \
disable_blend_equation_advanced) \
GPU_OP(DISABLE_DISCARD_FRAMEBUFFER, \
disable_discard_framebuffer) \
GPU_OP(DISABLE_DUAL_SOURCE_BLENDING_SUPPORT, \
disable_dual_source_blending_support) \
GPU_OP(DISABLE_TEXTURE_STORAGE, \
disable_texture_storage) \
GPU_OP(DISALLOW_LARGE_INSTANCED_DRAW, \
disallow_large_instanced_draw) \
GPU_OP(EMULATE_ABS_INT_FUNCTION, \
emulate_abs_int_function) \
GPU_OP(ENSURE_PREVIOUS_FRAMEBUFFER_NOT_DELETED, \
ensure_previous_framebuffer_not_deleted) \
GPU_OP(FLUSH_ON_FRAMEBUFFER_CHANGE, \
flush_on_framebuffer_change) \
GPU_OP(FORCE_UPDATE_SCISSOR_STATE_WHEN_BINDING_FBO0, \
force_update_scissor_state_when_binding_fbo0) \
GPU_OP(GL_CLEAR_BROKEN, \
gl_clear_broken) \
GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32, \
max_fragment_uniform_vectors_32) \
GPU_OP(MAX_MSAA_SAMPLE_COUNT_4, \
max_msaa_sample_count_4) \
GPU_OP(PACK_PARAMETERS_WORKAROUND_WITH_PACK_BUFFER, \
pack_parameters_workaround_with_pack_buffer) \
GPU_OP(REMOVE_POW_WITH_CONSTANT_EXPONENT, \
remove_pow_with_constant_exponent) \
GPU_OP(REWRITE_DO_WHILE_LOOPS, \
rewrite_do_while_loops) \
GPU_OP(UNBIND_ATTACHMENTS_ON_BOUND_RENDER_FBO_DELETE, \
unbind_attachments_on_bound_render_fbo_delete) \
GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \
unfold_short_circuit_as_ternary_operation) \
#define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) \
GPU_OP(ADD_AND_TRUE_TO_LOOP_CONDITION, \
add_and_true_to_loop_condition) \
GPU_OP(DISABLE_BLEND_EQUATION_ADVANCED, \
disable_blend_equation_advanced) \
GPU_OP(DISABLE_DISCARD_FRAMEBUFFER, \
disable_discard_framebuffer) \
GPU_OP(DISABLE_DUAL_SOURCE_BLENDING_SUPPORT, \
disable_dual_source_blending_support) \
GPU_OP(DISABLE_TEXTURE_STORAGE, \
disable_texture_storage) \
GPU_OP(DISALLOW_LARGE_INSTANCED_DRAW, \
disallow_large_instanced_draw) \
GPU_OP(EMULATE_ABS_INT_FUNCTION, \
emulate_abs_int_function) \
GPU_OP(ENSURE_PREVIOUS_FRAMEBUFFER_NOT_DELETED, \
ensure_previous_framebuffer_not_deleted) \
GPU_OP(FLUSH_ON_FRAMEBUFFER_CHANGE, \
flush_on_framebuffer_change) \
GPU_OP(FLUSH_QUERIES_BEFORE_DELETING_OR_UNBINDING_FBO, \
flush_queries_before_deleting_or_unbinding_fbo) \
GPU_OP(FORCE_UPDATE_SCISSOR_STATE_WHEN_BINDING_FBO0, \
force_update_scissor_state_when_binding_fbo0) \
GPU_OP(GL_CLEAR_BROKEN, \
gl_clear_broken) \
GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32, \
max_fragment_uniform_vectors_32) \
GPU_OP(MAX_MSAA_SAMPLE_COUNT_4, \
max_msaa_sample_count_4) \
GPU_OP(PACK_PARAMETERS_WORKAROUND_WITH_PACK_BUFFER, \
pack_parameters_workaround_with_pack_buffer) \
GPU_OP(REMOVE_POW_WITH_CONSTANT_EXPONENT, \
remove_pow_with_constant_exponent) \
GPU_OP(REWRITE_DO_WHILE_LOOPS, \
rewrite_do_while_loops) \
GPU_OP(UNBIND_ATTACHMENTS_ON_BOUND_RENDER_FBO_DELETE, \
unbind_attachments_on_bound_render_fbo_delete) \
GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \
unfold_short_circuit_as_ternary_operation) \

#endif // GPU_DRIVER_BUG_WORKAROUNDS
2 changes: 1 addition & 1 deletion infra/bots/deps/deps_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions infra/bots/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3961,7 +3961,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4041,7 +4041,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4197,7 +4197,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4277,7 +4277,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4357,7 +4357,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4513,7 +4513,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4593,7 +4593,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down Expand Up @@ -4682,7 +4682,7 @@
{
"name": "skia/tools/bazel_build/${platform}",
"path": "task_drivers",
"version": "git_revision:b5d31abb7bc772a69f800de45783768768437675"
"version": "git_revision:5e4f3217c17a8d88195d4c2924613420a256457b"
}
],
"command": [
Expand Down
14 changes: 8 additions & 6 deletions src/gpu/ganesh/GrResourceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,11 +922,13 @@ sk_sp<GrTexture> GrResourceProvider::writePixels(sk_sp<GrTexture> texture,
if (tempColorType == GrColorType::kUnknown) {
return nullptr;
}
SkAssertResult(fGpu->writePixels(texture.get(),
SkIRect::MakeSize(baseSize),
colorType,
tempColorType,
tmpTexels.get(),
mipLevelCount));
if (!fGpu->writePixels(texture.get(),
SkIRect::MakeSize(baseSize),
colorType,
tempColorType,
tmpTexels.get(),
mipLevelCount)) {
return nullptr;
}
return texture;
}
1 change: 1 addition & 0 deletions src/gpu/ganesh/gl/GrGLCaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
if (ctxInfo.vendor() == GrGLVendor::kARM) {
// On Mali G71, RT's above 4k have been observed to incur a performance cost.
fMaxPreferredRenderTargetSize = std::min(4096, fMaxPreferredRenderTargetSize);
fDriverBugWorkarounds.flush_queries_before_deleting_or_unbinding_fbo = true;
}

fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker");
Expand Down
33 changes: 33 additions & 0 deletions src/gpu/ganesh/gl/GrGLGpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3214,6 +3214,10 @@ void GrGLGpu::onFBOChanged() {
if (this->caps()->workarounds().flush_on_framebuffer_change) {
this->flush(FlushType::kForce);
}
if (fHasUnflushedQueries &&
this->caps()->workarounds().flush_queries_before_deleting_or_unbinding_fbo) {
this->forcefullyFlushQueries();
}
#ifdef SK_DEBUG
if (fIsExecutingCommandBuffer_DebugOnly) {
SkDebugf("WARNING: GL FBO binding changed while executing a command buffer. "
Expand All @@ -3234,6 +3238,10 @@ void GrGLGpu::deleteFramebuffer(GrGLuint fboid) {
// We're relying on the GL state shadowing being correct in the workaround code below so we
// need to handle a dirty context.
this->handleDirtyContext();
if (fHasUnflushedQueries &&
this->caps()->workarounds().flush_queries_before_deleting_or_unbinding_fbo) {
this->forcefullyFlushQueries();
}
if (fboid == fBoundDrawFramebuffer) {
if (this->caps()->workarounds().unbind_attachments_on_bound_render_fbo_delete) {
// This workaround only applies to deleting currently bound framebuffers
Expand Down Expand Up @@ -4469,6 +4477,29 @@ void GrGLGpu::waitSemaphore(GrSemaphore* semaphore) {
#endif
}

void GrGLGpu::forcefullyFlushQueries() {
if (!fHasUnflushedQueries) {
return;
}
if (this->glCaps().fenceType() == GrGLCaps::FenceType::kSyncObject) {
GrGLsync sync;
GL_CALL_RET(sync, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
if (sync) {
#if defined(__EMSCRIPTEN__) && __EMSCRIPTEN_major__ < 5
GL_CALL(ClientWaitSync(sync, GR_GL_SYNC_FLUSH_COMMANDS_BIT, 0, 0));
#else
GL_CALL(ClientWaitSync(sync, GR_GL_SYNC_FLUSH_COMMANDS_BIT, 0));
#endif
GL_CALL(DeleteSync(sync));
fHasUnflushedQueries = false;
return;
}
}

GL_CALL(Finish());
fHasUnflushedQueries = false;
}

std::optional<GrTimerQuery> GrGLGpu::startTimerQuery() {
if (glCaps().timerQueryType() == GrGLCaps::TimerQueryType::kNone) {
return {};
Expand All @@ -4484,6 +4515,7 @@ std::optional<GrTimerQuery> GrGLGpu::startTimerQuery() {
GR_GL_GetIntegerv(this->glInterface(), GR_GL_GPU_DISJOINT, &_);
}
GL_CALL(BeginQuery(GR_GL_TIME_ELAPSED, glQuery));
fHasUnflushedQueries = true;
return GrTimerQuery{glQuery};
}

Expand All @@ -4493,6 +4525,7 @@ void GrGLGpu::endTimerQuery(const GrTimerQuery& timerQuery) {
// Since only one query of a particular type can be active at once, glEndQuery doesn't take a
// query parameter.
GL_CALL(EndQuery(GR_GL_TIME_ELAPSED));
fHasUnflushedQueries = true;
}

uint64_t GrGLGpu::getTimerQueryResult(GrGLuint query) {
Expand Down
3 changes: 3 additions & 0 deletions src/gpu/ganesh/gl/GrGLGpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,9 @@ class GrGLGpu final : public GrGpu {
// we call glFlush and reset this to false.
bool fNeedsGLFlush = false;

bool fHasUnflushedQueries = false;
void forcefullyFlushQueries();

SkDEBUGCODE(bool fIsExecutingCommandBuffer_DebugOnly = false;)

friend class GrGLPathRendering; // For accessing setTextureUnit.
Expand Down
1 change: 1 addition & 0 deletions src/gpu/gpu_workaround_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ disallow_large_instanced_draw
emulate_abs_int_function
ensure_previous_framebuffer_not_deleted
flush_on_framebuffer_change
flush_queries_before_deleting_or_unbinding_fbo
force_update_scissor_state_when_binding_fbo0
gl_clear_broken
max_fragment_uniform_vectors_32
Expand Down
Loading