Fix context size for benchmakr.
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1871173002 Review URL: https://codereview.chromium.org/1871173002
This commit is contained in:
parent
ff3681156c
commit
42da45d399
@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
#include "SkColor.h"
|
||||
#include "SkLinearBitmapPipeline.h"
|
||||
#include "SkBitmapProcShader.h"
|
||||
#include "SkPM4f.h"
|
||||
#include "Benchmark.h"
|
||||
#include "SkShader.h"
|
||||
@ -193,7 +194,7 @@ struct SkBitmapFPOrigShader : public CommonBitmapFPBenchmark {
|
||||
|
||||
SkAutoTMalloc<SkPMColor> buffer4b(width*height);
|
||||
|
||||
uint32_t storage[300];
|
||||
uint32_t storage[kSkBlitterContextSize];
|
||||
const SkShader::ContextRec rec(fPaint, fM, nullptr,
|
||||
SkShader::ContextRec::kPMColor_DstType);
|
||||
SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage));
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "SkXfermode.h"
|
||||
#include "SkPM4fPriv.h"
|
||||
#include "SkShader.h"
|
||||
#include "SkBitmapProcShader.h"
|
||||
|
||||
static void fill_in_bits(SkBitmap& bm, SkIRect ir, SkColor c, bool premul) {
|
||||
bm.allocN32Pixels(ir.width(), ir.height());
|
||||
@ -59,7 +60,7 @@ static void draw_rect_orig(SkCanvas* canvas, const SkRect& r, SkColor c, const S
|
||||
|
||||
sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(), pmsrc.rowBytes())));
|
||||
SkPaint paint;
|
||||
int32_t storage[400];
|
||||
int32_t storage[kSkBlitterContextSize];
|
||||
|
||||
sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode,
|
||||
SkShader::kRepeat_TileMode);
|
||||
|
@ -50,12 +50,14 @@ private:
|
||||
typedef SkShader INHERITED;
|
||||
};
|
||||
|
||||
enum {kSkBlitterContextSize = 2400};
|
||||
|
||||
// Commonly used allocator. It currently is only used to allocate up to 3 objects. The total
|
||||
// bytes requested is calculated using one of our large shaders, its context size plus the size of
|
||||
// an Sk3DBlitter in SkDraw.cpp
|
||||
// Note that some contexts may contain other contexts (e.g. for compose shaders), but we've not
|
||||
// yet found a situation where the size below isn't big enough.
|
||||
typedef SkSmallAllocator<3, 2400> SkTBlitterAllocator;
|
||||
typedef SkSmallAllocator<3, kSkBlitterContextSize> SkTBlitterAllocator;
|
||||
|
||||
// If alloc is non-nullptr, it will be used to allocate the returned SkShader, and MUST outlive
|
||||
// the SkShader.
|
||||
|
@ -5,6 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkBitmapProcShader.h"
|
||||
#include "SkColor.h"
|
||||
#include "SkColorMatrixFilter.h"
|
||||
#include "SkGradientShader.h"
|
||||
@ -153,7 +154,7 @@ DEF_TEST(Color4f_shader, reporter) {
|
||||
|
||||
SkPaint paint;
|
||||
for (const auto& rec : recs) {
|
||||
uint32_t storage[400];
|
||||
uint32_t storage[kSkBlitterContextSize];
|
||||
paint.setShader(rec.fFact());
|
||||
// Encourage 4f context selection. At some point we may need
|
||||
// to instantiate two separate contexts for optimal 4b/4f selection.
|
||||
|
Loading…
Reference in New Issue
Block a user