Hash :
5b7c5b34
Author :
Date :
2020-10-18T17:19:51
Metal: don't precompile default shaders. Default shaders will be compiled from source at runtime, this is because they depend on ANGLE format table and there is currently no way to pre-compile metal shaders in a cross-platform manner. Using default shaders' source instead of pre-compiled form seems to reduce the libGLESv2's binary size. However, the startup time will be increased due to runtime cost of compilation, thus the compilation now will be done asynchronously. Bug: angleproject:5186 Change-Id: I0e1987d6c76692d5169255736fbb8e215185c33b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2482405 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
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
//
// Copyright 2019 The ANGLE Project. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "common.h"
constant bool kCombineWithExistingResult [[function_constant(1000)]];
// Combine the visibility result of current render pass with previous value from previous render
// pass
struct CombineVisibilityResultOptions
{
// Start offset in the render pass's visibility buffer allocated for the query.
uint startOffset;
// How many offsets in the render pass's visibility buffer is used for the query?
uint numOffsets;
};
kernel void combineVisibilityResult(uint idx [[thread_position_in_grid]],
constant CombineVisibilityResultOptions &options [[buffer(0)]],
constant ushort4 *renderpassVisibilityResult [[buffer(1)]],
device ushort4 *finalResults [[buffer(2)]])
{
if (idx > 0)
{
// NOTE(hqle):
// This is a bit wasteful to use a WARP of multiple threads just for combining one integer.
// Consider a better approach.
return;
}
ushort4 finalResult16x4;
if (kCombineWithExistingResult)
{
finalResult16x4 = finalResults[0];
}
else
{
finalResult16x4 = ushort4(0, 0, 0, 0);
}
for (uint i = 0; i < options.numOffsets; ++i)
{
uint offset = options.startOffset + i;
ushort4 renderpassResult = renderpassVisibilityResult[offset];
// Only boolean result is required, so bitwise OR is enough
finalResult16x4 = finalResult16x4 | renderpassResult;
}
finalResults[0] = finalResult16x4;
}