2015-12-10 15:52:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
#ifndef fiddle_main_DEFINED
|
|
|
|
#define fiddle_main_DEFINED
|
|
|
|
|
2016-04-18 18:50:07 +00:00
|
|
|
#ifdef FIDDLE_BUILD_TEST
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkDocument.h"
|
|
|
|
#include "include/core/SkPictureRecorder.h"
|
|
|
|
#include "include/core/SkStream.h"
|
|
|
|
#include "include/core/SkSurface.h"
|
Reland "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
This reverts commit cf43fc676856c4db0122ff3bcb49d90b0e7b1115.
Reason for revert: Fixed g3
Original change's description:
> Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
>
> This reverts commit ff13ffbeacec5335cfdb84c8a9d20bb78e10da58.
>
> Reason for revert: Blink in g3
>
> Original change's description:
> > Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit 89bdc90ac877dc8cd49c86c35a20d9df0d3b9016.
> >
> > Reason for revert: Fix metal
> >
> > Original change's description:
> > > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> > >
> > > This reverts commit d2daa94edeca88281796524fae45f38f11a7bef2.
> > >
> > > Reason for revert: Metaru
> > >
> > > Original change's description:
> > > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > > >
> > > > Woo!
> > > >
> > > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > > Docs-Preview: https://skia.org/?cl=317436
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Adlai Holler <adlai@google.com>
> > >
> > > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> > >
> > > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > > Reviewed-by: Adlai Holler <adlai@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> >
> > Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> > Docs-Preview: https://skia.org/?cl=318759
> > Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
Change-Id: I4f01291f4b3bfbb8fd7dd8cf2bf8415430c3392e
Docs-Preview: https://skia.org/?cl=322437
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322437
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-06 18:04:35 +00:00
|
|
|
#include "include/gpu/GrDirectContext.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/gpu/gl/GrGLAssembleInterface.h"
|
|
|
|
#include "include/gpu/gl/GrGLInterface.h"
|
2016-04-18 18:50:07 +00:00
|
|
|
#else
|
|
|
|
#include "skia.h"
|
|
|
|
#endif
|
2015-12-10 15:52:45 +00:00
|
|
|
|
2018-05-29 17:56:27 +00:00
|
|
|
#include <memory>
|
2017-06-01 17:24:11 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
2017-11-16 19:59:48 +00:00
|
|
|
extern GrBackendTexture backEndTexture;
|
|
|
|
extern GrBackendRenderTarget backEndRenderTarget;
|
|
|
|
extern GrBackendTexture backEndTextureRenderTarget;
|
2015-12-10 15:52:45 +00:00
|
|
|
extern SkBitmap source;
|
2016-04-18 15:17:56 +00:00
|
|
|
extern sk_sp<SkImage> image;
|
2017-04-19 18:05:14 +00:00
|
|
|
extern double duration; // The total duration of the animation in seconds.
|
|
|
|
extern double frame; // A value in [0, 1] of where we are in the animation.
|
2015-12-10 15:52:45 +00:00
|
|
|
|
2018-05-29 17:56:27 +00:00
|
|
|
namespace sk_gpu_test {
|
|
|
|
class GLTestContext;
|
2020-08-06 18:11:56 +00:00
|
|
|
} // namespace sk_gpu_test
|
2018-05-29 17:56:27 +00:00
|
|
|
|
2015-12-10 15:52:45 +00:00
|
|
|
struct DrawOptions {
|
2017-11-17 19:59:43 +00:00
|
|
|
DrawOptions(int w, int h, bool r, bool g, bool p, bool k, bool srgb, bool f16,
|
|
|
|
bool textOnly, const char* s,
|
2020-07-21 13:27:25 +00:00
|
|
|
GrMipmapped mipMapping,
|
2017-11-17 19:59:43 +00:00
|
|
|
int offScreenWidth,
|
|
|
|
int offScreenHeight,
|
|
|
|
int offScreenSampleCount,
|
2020-07-21 13:27:25 +00:00
|
|
|
GrMipmapped offScreenMipMapping)
|
2015-12-10 15:52:45 +00:00
|
|
|
: size(SkISize::Make(w, h))
|
|
|
|
, raster(r)
|
|
|
|
, gpu(g)
|
|
|
|
, pdf(p)
|
|
|
|
, skp(k)
|
2016-11-29 22:14:58 +00:00
|
|
|
, srgb(srgb)
|
|
|
|
, f16(f16)
|
2017-02-13 16:39:43 +00:00
|
|
|
, textOnly(textOnly)
|
2016-11-29 22:14:58 +00:00
|
|
|
, source(s)
|
2017-11-17 19:59:43 +00:00
|
|
|
, fMipMapping(mipMapping)
|
|
|
|
, fOffScreenWidth(offScreenWidth)
|
|
|
|
, fOffScreenHeight(offScreenHeight)
|
|
|
|
, fOffScreenSampleCount(offScreenSampleCount)
|
|
|
|
, fOffScreenMipMapping(offScreenMipMapping) {
|
2016-11-29 22:14:58 +00:00
|
|
|
// F16 mode is only valid for color correct backends.
|
|
|
|
SkASSERT(srgb || !f16);
|
|
|
|
}
|
2015-12-10 15:52:45 +00:00
|
|
|
SkISize size;
|
|
|
|
bool raster;
|
|
|
|
bool gpu;
|
|
|
|
bool pdf;
|
|
|
|
bool skp;
|
2016-11-29 22:14:58 +00:00
|
|
|
bool srgb;
|
|
|
|
bool f16;
|
2017-02-13 16:39:43 +00:00
|
|
|
bool textOnly;
|
2015-12-10 15:52:45 +00:00
|
|
|
const char* source;
|
2017-11-17 19:59:43 +00:00
|
|
|
|
|
|
|
// This flag is used when a GPU texture resource is created and exposed as a GrBackendTexture.
|
|
|
|
// In this case the resource is created with extra room to accomodate mipmaps.
|
|
|
|
// TODO: The SkImage::makeTextureImage API would need to be widened to allow this to be true
|
|
|
|
// for the non-backend gpu SkImages.
|
2020-07-21 13:27:25 +00:00
|
|
|
GrMipmapped fMipMapping;
|
2017-11-17 19:59:43 +00:00
|
|
|
|
|
|
|
// Parameters for an GPU offscreen resource exposed as a GrBackendRenderTarget
|
|
|
|
int fOffScreenWidth;
|
|
|
|
int fOffScreenHeight;
|
|
|
|
int fOffScreenSampleCount;
|
|
|
|
// TODO: should we also expose stencilBits here? How about the config?
|
|
|
|
|
2020-07-21 13:27:25 +00:00
|
|
|
GrMipmapped fOffScreenMipMapping; // only applicable if the offscreen is also textureable
|
2015-12-10 15:52:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern DrawOptions GetDrawOptions();
|
2017-02-13 16:39:43 +00:00
|
|
|
extern void SkDebugf(const char * format, ...);
|
2015-12-10 15:52:45 +00:00
|
|
|
extern void draw(SkCanvas*);
|
|
|
|
|
2020-07-13 20:13:31 +00:00
|
|
|
// There are different implementations of create_direct_context() for EGL, Mesa,
|
2017-05-31 13:45:19 +00:00
|
|
|
// and a fallback to a null context.
|
2020-07-13 20:13:31 +00:00
|
|
|
extern sk_sp<GrDirectContext> create_direct_context(std::ostringstream& driverinfo,
|
|
|
|
std::unique_ptr<sk_gpu_test::GLTestContext>*);
|
2017-05-31 13:45:19 +00:00
|
|
|
|
2015-12-10 15:52:45 +00:00
|
|
|
#endif // fiddle_main_DEFINED
|