#include "SkTypes.h"
class SkMatrix;
-class GrDrawTargetCaps;
+class GrCaps;
namespace GrProcessorUnitTest {
// Used to access the dummy textures in TestCreate procs.
typedef Processor* (*CreateProc)(SkRandom*,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture* dummyTextures[]);
GrProcessorTestFactory(CreateProc createProc) {
static Processor* CreateStage(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture* dummyTextures[]) {
VerifyFactoryCount();
SkASSERT(GetFactories()->count());
static GrProcessorTestFactory<GrGeometryProcessor> gTestFactory SK_UNUSED; \
static GrGeometryProcessor* TestCreate(SkRandom*, \
GrContext*, \
- const GrDrawTargetCaps&, \
+ const GrCaps&, \
GrTexture* dummyTextures[2])
#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \
static GrProcessorTestFactory<GrFragmentProcessor> gTestFactory SK_UNUSED; \
static GrFragmentProcessor* TestCreate(SkRandom*, \
GrContext*, \
- const GrDrawTargetCaps&, \
+ const GrCaps&, \
GrTexture* dummyTextures[2])
#define GR_DECLARE_XP_FACTORY_TEST \
static GrProcessorTestFactory<GrXPFactory> gTestFactory SK_UNUSED; \
static GrXPFactory* TestCreate(SkRandom*, \
GrContext*, \
- const GrDrawTargetCaps&, \
+ const GrCaps&, \
GrTexture* dummyTextures[2])
* also implement this static function:
* GrProcessor* TestCreate(SkRandom*,
* GrContext*,
- * const GrDrawTargetCaps&,
+ * const GrCaps&,
* GrTexture* dummyTextures[2]);
* dummyTextures[] are valid textures that can optionally be used to construct GrTextureAccesses.
* The first texture has config kSkia8888_GrPixelConfig and the second has
#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \
static GrFragmentProcessor* TestCreate(SkRandom*, \
GrContext*, \
- const GrDrawTargetCaps&, \
+ const GrCaps&, \
GrTexture* dummyTextures[2])
#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(X)
#define GR_DECLARE_XP_FACTORY_TEST \
static GrXPFactory* TestCreate(SkRandom*, \
GrContext*, \
- const GrDrawTargetCaps&, \
+ const GrCaps&, \
GrTexture* dummyTextures[2])
#define GR_DEFINE_XP_FACTORY_TEST(X)
#define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \
static GrGeometryProcessor* TestCreate(SkRandom*, \
GrContext*, \
- const GrDrawTargetCaps&, \
+ const GrCaps&, \
GrTexture* dummyTextures[2])
#define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X)
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps);
+ const GrCaps& caps);
/**
* Returns whether this XP will require an Xfer barrier on the given rt. If true, outBarrierType
* is updated to contain the type of barrier needed.
*/
bool willNeedXferBarrier(const GrRenderTarget* rt,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrXferBarrierType* outBarrierType) const;
struct BlendInfo {
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) = 0;
+ const GrCaps& caps) = 0;
/**
* Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer
* of barrier.
*/
virtual bool onWillNeedXferBarrier(const GrRenderTarget*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrXferBarrierType* outBarrierType SK_UNUSED) const {
return false;
}
GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy,
- const GrDrawTargetCaps& caps) const;
+ const GrCaps& caps) const;
/**
* This function returns true if the GrXferProcessor generated from this factory will be able to
virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
InvariantOutput*) const = 0;
- bool willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& colorPOI,
+ bool willNeedDstCopy(const GrCaps& caps, const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const;
bool isEqual(const GrXPFactory& that) const {
uint32_t fClassID;
private:
- virtual GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
+ virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const = 0;
* Returns true if the XP generated by this factory will explicitly read dst in the fragment
* shader.
*/
- virtual bool willReadDstColor(const GrDrawTargetCaps& caps,
+ virtual bool willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const = 0;
private:
GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage);
- GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
+ GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const override;
- bool willReadDstColor(const GrDrawTargetCaps& /*caps*/,
+ bool willReadDstColor(const GrCaps& /*caps*/,
const GrProcOptInfo& /*colorPOI*/,
const GrProcOptInfo& /*coveragePOI*/) const override {
return false;
private:
GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst);
- GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
+ GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const override;
- bool willReadDstColor(const GrDrawTargetCaps& caps,
+ bool willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const override;
GrFragmentProcessor* AlphaThresholdEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture** textures) {
GrTexture* bmpTex = textures[GrProcessorUnitTest::kSkiaPMTextureIdx];
GrTexture* maskTex = textures[GrProcessorUnitTest::kAlphaTextureIdx];
GrFragmentProcessor* GrArithmeticFP::TestCreate(SkRandom* rand,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
float k1 = rand->nextF();
float k2 = rand->nextF();
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) override;
+ const GrCaps& caps) override;
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
return GrXferProcessor::kNone_Opt;
}
}
GrXferProcessor*
-GrArithmeticXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps,
+GrArithmeticXPFactory::onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const {
GrXPFactory* GrArithmeticXPFactory::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
float k1 = random->nextF();
float k2 = random->nextF();
private:
GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePMColor);
- GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
+ GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const override;
- bool willReadDstColor(const GrDrawTargetCaps& caps,
+ bool willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const override {
return true;
GrFragmentProcessor* GrRectBlurEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
float sigma = random->nextRangeF(3,8);
float width = random->nextRangeF(200,300);
GrFragmentProcessor* GrRRectBlurEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
SkScalar w = random->nextRangeScalar(100.f, 1000.f);
SkScalar h = random->nextRangeScalar(100.f, 1000.f);
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect);
GrFragmentProcessor* ModeColorFilterEffect::TestCreate(SkRandom* rand,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
SkXfermode::Mode mode = SkXfermode::kDst_Mode;
while (SkXfermode::kDst_Mode == mode) {
GrFragmentProcessor* ColorMatrixEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* dummyTextures[2]) {
SkColorMatrix colorMatrix;
for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) {
GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdxDispl = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
SkScalar surfaceScale = random->nextSScalar1();
SkScalar kd = random->nextUScalar1();
GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
SkScalar surfaceScale = random->nextSScalar1();
SkScalar ks = random->nextUScalar1();
GrFragmentProcessor* GrMagnifierEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture** textures) {
GrTexture* texture = textures[0];
const int kMaxWidth = 200;
GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
int numOctaves = random->nextRangeU(2, 10);
bool stitchTiles = random->nextBool();
GrFragmentProcessor* ColorTableEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int flags = 0;
uint8_t luts[256][4];
GrFragmentProcessor* GrLinearGradient::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint points[] = {{random->nextUScalar1(), random->nextUScalar1()},
{random->nextUScalar1(), random->nextUScalar1()}};
GrFragmentProcessor* GrRadialGradient::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius = random->nextUScalar1();
GrFragmentProcessor* GrSweepGradient::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
*/
GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius1 = random->nextUScalar1();
*/
GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius1 = 0.f;
*/
GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius1 = 0.f;
*/
GrFragmentProcessor* CircleInside2PtConicalEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius1 = random->nextUScalar1() + 0.0001f; // make sure radius1 != 0
*/
GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
SkScalar radius1 = random->nextUScalar1() + 0.0001f; // make sure radius1 != 0
GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
// Doesn't work without derivative instructions.
return caps.shaderCaps()->shaderDerivativeSupport() ?
fInlineUploads.reset();
}
- const GrDrawTargetCaps& caps() const { return *fGpu->caps(); }
+ const GrCaps& caps() const { return *fGpu->caps(); }
GrResourceProvider* resourceProvider() const { return fGpu->getContext()->resourceProvider(); }
// Otherwise when buffer mapping is supported we map if the buffer size is greater than the
// threshold.
bool attemptMap = block.fBuffer->isCPUBacked();
- if (!attemptMap && GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags()) {
+ if (!attemptMap && GrCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags()) {
attemptMap = size > GR_GEOM_BUFFER_MAP_THRESHOLD;
}
SkASSERT(flushSize <= buffer->gpuMemorySize());
VALIDATE(true);
- if (GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() &&
+ if (GrCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() &&
flushSize > GR_GEOM_BUFFER_MAP_THRESHOLD) {
void* data = buffer->map();
if (data) {
GrTargetCommands::Cmd*
GrCommandBuilder::recordXferBarrierIfNecessary(const GrPipeline& pipeline,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
const GrXferProcessor& xp = *pipeline.getXferProcessor();
GrRenderTarget* rt = pipeline.getRenderTarget();
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
- virtual Cmd* recordXferBarrierIfNecessary(const GrPipeline&, const GrDrawTargetCaps&);
+ virtual Cmd* recordXferBarrierIfNecessary(const GrPipeline&, const GrCaps&);
protected:
typedef GrTargetCommands::DrawBatch DrawBatch;
GrGeometryProcessor* DefaultGeoProc::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
uint32_t flags = 0;
if (random->nextBool()) {
///////////////////////////////////////////////////////////////////////////////
-void GrDrawTargetCaps::reset() {
+void GrCaps::reset() {
fMipMapSupport = false;
fNPOTTextureTileSupport = false;
fTwoSidedStencilSupport = false;
memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport));
}
-GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
+GrCaps& GrCaps::operator=(const GrCaps& other) {
fMipMapSupport = other.fMipMapSupport;
fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
static SkString map_flags_to_string(uint32_t flags) {
SkString str;
- if (GrDrawTargetCaps::kNone_MapFlags == flags) {
+ if (GrCaps::kNone_MapFlags == flags) {
str = "none";
} else {
- SkASSERT(GrDrawTargetCaps::kCanMap_MapFlag & flags);
- SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kCanMap_MapFlag);
+ SkASSERT(GrCaps::kCanMap_MapFlag & flags);
+ SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag);
str = "can_map";
- if (GrDrawTargetCaps::kSubset_MapFlag & flags) {
+ if (GrCaps::kSubset_MapFlag & flags) {
str.append(" partial");
} else {
str.append(" full");
}
- SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag);
+ SkDEBUGCODE(flags &= ~GrCaps::kSubset_MapFlag);
}
SkASSERT(0 == flags); // Make sure we handled all the flags.
return str;
}
-SkString GrDrawTargetCaps::dump() const {
+SkString GrCaps::dump() const {
SkString r;
static const char* gNY[] = {"NO", "YES"};
r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
#include "SkXfermode.h"
class GrClip;
-class GrDrawTargetCaps;
+class GrCaps;
class GrPath;
class GrPathRange;
class GrPipeline;
/**
* Gets the capabilities of the draw target.
*/
- const GrDrawTargetCaps* caps() const { return fCaps.get(); }
+ const GrCaps* caps() const { return fCaps.get(); }
void drawBatch(GrPipelineBuilder*, GrBatch*);
// The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTarget.
GrContext* fContext;
- SkAutoTUnref<const GrDrawTargetCaps> fCaps;
+ SkAutoTUnref<const GrCaps> fCaps;
// To keep track that we always have at least as many debug marker adds as removes
int fGpuTraceMarkerCount;
GrTraceMarkerSet fActiveTraceMarkers;
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef GrDrawTargetCaps_DEFINED
-#define GrDrawTargetCaps_DEFINED
+#ifndef GrCaps_DEFINED
+#define GrCaps_DEFINED
#include "GrTypes.h"
#include "GrTypesPriv.h"
};
/**
- * Represents the draw target capabilities.
+ * Represents the capabilities of a GrContext.
*/
-class GrDrawTargetCaps : public SkRefCnt {
+class GrCaps : public SkRefCnt {
public:
- SK_DECLARE_INST_COUNT(GrDrawTargetCaps)
+ SK_DECLARE_INST_COUNT(GrCaps)
- GrDrawTargetCaps() {
+ GrCaps() {
fShaderCaps.reset(NULL);
this->reset();
}
- GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() {
+ GrCaps(const GrCaps& other) : INHERITED() {
*this = other;
}
- virtual ~GrDrawTargetCaps() {}
- GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
+ virtual ~GrCaps() {}
+ GrCaps& operator= (const GrCaps&);
virtual void reset();
virtual SkString dump() const;
/**
* Gets the capabilities of the draw target.
*/
- const GrDrawTargetCaps* caps() const { return fCaps.get(); }
+ const GrCaps* caps() const { return fCaps.get(); }
GrPathRendering* pathRendering() { return fPathRendering.get(); }
* Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can
* be used as a render target by calling GrTexture::asRenderTarget(). Not all
* pixel configs can be used as render targets. Support for configs as textures
- * or render targets can be checked using GrDrawTargetCaps.
+ * or render targets can be checked using GrCaps.
*
* @param desc describes the texture to be created.
* @param budgeted does this texture count against the resource cache budget?
Stats fStats;
SkAutoTDelete<GrPathRendering> fPathRendering;
// Subclass must initialize this in its constructor.
- SkAutoTUnref<const GrDrawTargetCaps> fCaps;
+ SkAutoTUnref<const GrCaps> fCaps;
private:
// called when the 3D context state is unknown. Subclass should emit any
GrGeometryProcessor* CircleEdgeEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
return CircleEdgeEffect::Create(GrRandomColor(random),
random->nextBool(),
GrGeometryProcessor* EllipseEdgeEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
return EllipseEdgeEffect::Create(GrRandomColor(random),
random->nextBool(),
GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
return DIEllipseEdgeEffect::Create(GrRandomColor(random),
GrTest::TestMatrix(random),
GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
const GrScissorState& scissorState,
const GrDeviceCoordTexture* dstCopy) {
// Create XferProcessor from DS's XPFactory
GrPipeline(const GrPipelineBuilder&,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
- const GrDrawTargetCaps&,
+ const GrCaps&,
const GrScissorState&,
const GrDeviceCoordTexture* dstCopy);
* blend coeffs will represent those used by backend API.
*/
void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFlags,
- const GrDrawTargetCaps&);
+ const GrCaps&);
enum Flags {
kDither_Flag = 0x1,
//////////////////////////////////////////////////////////////////////////////s
-bool GrPipelineBuilder::willXPNeedDstCopy(const GrDrawTargetCaps& caps,
+bool GrPipelineBuilder::willXPNeedDstCopy(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const {
return this->getXPFactory()->willNeedDstCopy(caps, colorPOI, coveragePOI);
#include "effects/GrSimpleTextureEffect.h"
class GrBatch;
-class GrDrawTargetCaps;
+class GrCaps;
class GrPaint;
class GrTexture;
/**
* Checks whether the xp will need a copy of the destination to correctly blend.
*/
- bool willXPNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& colorPOI,
+ bool willXPNeedDstCopy(const GrCaps& caps, const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const;
/// @}
return config;
}
-static bool choose_compressed_fmt(const GrDrawTargetCaps* caps,
+static bool choose_compressed_fmt(const GrCaps* caps,
SkTextureCompressor::Format *fmt) {
if (NULL == fmt) {
return false;
class MockGpu : public GrGpu {
public:
- MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrDrawTargetCaps)); }
+ MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrCaps)); }
~MockGpu() override {}
bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override {
return true;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
GrXferProcessor::OptFlags flags = this->onGetOptimizations(colorPOI,
coveragePOI,
doesStencilWrite,
}
bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrXferBarrierType* outBarrierType) const {
if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) {
// Texture barriers are required when a shader reads and renders to the same texture.
GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy,
- const GrDrawTargetCaps& caps) const {
+ const GrCaps& caps) const {
#ifdef SK_DEBUG
if (this->willReadDstColor(caps, colorPOI, coveragePOI)) {
if (!caps.shaderCaps()->dstReadInShaderSupport()) {
return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy);
}
-bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& colorPOI,
+bool GrXPFactory::willNeedDstCopy(const GrCaps& caps, const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const {
return (this->willReadDstColor(caps, colorPOI, coveragePOI)
&& !caps.shaderCaps()->dstReadInShaderSupport());
GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
GrGeometryProcessor* gp;
do {
GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
GrGeometryProcessor* gp;
do {
GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
GrGeometryProcessor* gp;
do {
static GrGeometryProcessor* Create(GrColor color,
const SkMatrix& viewMatrix,
const GrPrimitiveEdgeType edgeType,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
const SkMatrix& localMatrix,
bool usesLocalCoords,
uint8_t coverage = 0xff) {
static GrGeometryProcessor* Create(GrColor color,
const SkMatrix& viewMatrix,
const GrPrimitiveEdgeType edgeType,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
const SkMatrix& localMatrix,
bool usesLocalCoords,
uint8_t coverage = 0xff) {
static GrGeometryProcessor* Create(GrColor color,
const SkMatrix& viewMatrix,
const GrPrimitiveEdgeType edgeType,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
GrFragmentProcessor* GrBicubicEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMConversionCnt));
bool swapRB;
GrFragmentProcessor* GrConstColorProcessor::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
GrColor color;
int colorPicker = random->nextULessThan(3);
GrFragmentProcessor* AARectEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
SkRect rect = SkRect::MakeLTRB(random->nextSScalar1(),
random->nextSScalar1(),
GrFragmentProcessor* GrConvexPolyEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
int count = random->nextULessThan(kMaxEdges) + 1;
SkScalar edges[kMaxEdges * 3];
GrFragmentProcessor* GrConvolutionEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* color,
- const GrDrawTargetCaps& caps) override;
+ const GrCaps& caps) override;
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* color,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
// We never look at the color input
return GrXferProcessor::kIgnoreColor_OptFlag;
}
}
GrXferProcessor*
-GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps,
+GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& covPOI,
const GrDeviceCoordTexture* dstCopy) const {
GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
SkRegion::Op regionOp = SkRegion::Op(random->nextULessThan(SkRegion::kLastOp + 1));
bool invertCoverage = random->nextBool();
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP);
GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode);
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) override;
+ const GrCaps& caps) override;
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
bool onWillNeedXferBarrier(const GrRenderTarget* rt,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrXferBarrierType* outBarrierType) const override;
void onGetBlendInfo(BlendInfo*) const override;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
/*
Most the optimizations we do here are based on tweaking alpha for coverage.
}
bool CustomXP::onWillNeedXferBarrier(const GrRenderTarget* rt,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrXferBarrierType* outBarrierType) const {
if (this->hasHWBlendEquation() && !caps.advancedCoherentBlendEquationSupport()) {
*outBarrierType = kBlend_GrXferBarrierType;
}
GrXferProcessor*
-GrCustomXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps,
+GrCustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const {
return CustomXP::Create(fMode, dstCopy, this->willReadDstColor(caps, colorPOI, coveragePOI));
}
-bool GrCustomXPFactory::willReadDstColor(const GrDrawTargetCaps& caps,
+bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const {
if (!caps.advancedBlendEquationSupport()) {
GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode);
GrXPFactory::InvariantOutput*) const override;
private:
- GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
+ GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const override;
- bool willReadDstColor(const GrDrawTargetCaps& caps,
+ bool willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const override;
GrGeometryProcessor* DashingCircleEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAModeCount));
return DashingCircleEffect::Create(GrRandomColor(random),
GrGeometryProcessor* DashingLineEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAModeCount));
return DashingLineEffect::Create(GrRandomColor(random),
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* color,
- const GrDrawTargetCaps& caps) override {
+ const GrCaps& caps) override {
return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreCoverage_OptFlag;
}
}
GrXferProcessor*
-GrDisableColorXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps,
+GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& covPOI,
const GrDeviceCoordTexture* dstCopy) const {
GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
return GrDisableColorXPFactory::Create();
}
private:
GrDisableColorXPFactory();
- GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
+ GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
const GrDeviceCoordTexture* dstCopy) const override;
- bool willReadDstColor(const GrDrawTargetCaps& caps,
+ bool willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const override {
return false;
GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: GrProcessorUnitTest::kAlphaTextureIdx;
GrGeometryProcessor* GrDistanceFieldLCDTextGeoProc::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrFragmentProcessor* DitherEffect::TestCreate(SkRandom*,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
return DitherEffect::Create();
}
GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(SkRandom* random,
GrContext* context,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
SkPoint center;
center.fX = random->nextRangeScalar(0.f, 1000.f);
GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
SkPoint center;
center.fX = random->nextRangeScalar(0.f, 1000.f);
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) override;
+ const GrCaps& caps) override;
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite);
- void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrDrawTargetCaps& caps,
+ void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrCaps& caps,
bool hasSolidCoverage);
GrBlendCoeff fSrcBlend;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
GrXferProcessor::OptFlags optFlags = this->internalGetOptimizations(colorPOI,
coveragePOI,
doesStencilWrite);
}
void PorterDuffXferProcessor::calcOutputTypes(GrXferProcessor::OptFlags optFlags,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
bool hasSolidCoverage) {
if (this->willReadDstColor()) {
fPrimaryOutputType = kCustom_PrimaryOutputType;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) override;
+ const GrCaps& caps) override;
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
- const GrDrawTargetCaps& caps) {
+ const GrCaps& caps) {
// We want to force our primary output to be alpha * Coverage, where alpha is the alpha
// value of the blend the constant. We should already have valid blend coeff's if we are at
// a point where we have RGB coverage. We don't need any color stages since the known color
}
GrXferProcessor*
-GrPorterDuffXPFactory::onCreateXferProcessor(const GrDrawTargetCaps& caps,
+GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& covPOI,
const GrDeviceCoordTexture* dstCopy) const {
output->fWillBlendWithDst = false;
}
-bool GrPorterDuffXPFactory::willReadDstColor(const GrDrawTargetCaps& caps,
+bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI) const {
// We can always blend correctly if we have dual source blending.
GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::kLastCoeffMode));
return GrPorterDuffXPFactory::Create(mode);
GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
SkScalar w = random->nextRangeScalar(20.f, 1000.f);
SkScalar h = random->nextRangeScalar(20.f, 1000.f);
GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps& caps,
+ const GrCaps& caps,
GrTexture*[]) {
SkScalar w = random->nextRangeScalar(20.f, 1000.f);
SkScalar h = random->nextRangeScalar(20.f, 1000.f);
GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
}
-GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
+GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrCaps() {
*this = caps;
}
this->initStencilFormats(ctxInfo);
/**************************************************************************
- * GrDrawTargetCaps fields
+ * GrCaps fields
**************************************************************************/
if (kGL_GrGLStandard == standard) {
// we could also look for GL_ATI_separate_stencil extension or
* version and the extensions string. It also tracks formats that have passed
* the FBO completeness test.
*/
-class GrGLCaps : public GrDrawTargetCaps {
+class GrGLCaps : public GrCaps {
public:
SK_DECLARE_INST_COUNT(GrGLCaps)
};
mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCache;
- typedef GrDrawTargetCaps INHERITED;
+ typedef GrCaps INHERITED;
};
return;
}
case kBlend_GrXferBarrierType:
- SkASSERT(GrDrawTargetCaps::kAdvanced_BlendEquationSupport ==
+ SkASSERT(GrCaps::kAdvanced_BlendEquationSupport ==
this->caps()->blendEquationSupport());
GL_CALL(BlendBarrier());
return;
GrFragmentProcessor* BigKeyProcessor::TestCreate(SkRandom*,
GrContext*,
- const GrDrawTargetCaps&,
+ const GrCaps&,
GrTexture*[]) {
return BigKeyProcessor::Create();
}
static const int kRenderTargetWidth = 1;
static GrRenderTarget* random_render_target(GrContext* context, SkRandom* random,
- const GrDrawTargetCaps* caps) {
+ const GrCaps* caps) {
// setup render target
GrTextureParams params;
GrSurfaceDesc texDesc;
return texture ? texture->asRenderTarget() : NULL;
}
-static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps,
+static void set_random_xpf(GrContext* context, const GrCaps& caps,
GrPipelineBuilder* pipelineBuilder, SkRandom* random,
GrTexture* dummyTextures[]) {
SkAutoTUnref<const GrXPFactory> xpf(
* found in the LICENSE file.
*/
+#include "Test.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrDrawTargetCaps.h"
#include "GrGpu.h"
-#include "Test.h"
-static void test_print(skiatest::Reporter*, const GrDrawTargetCaps* caps) {
+static void test_print(skiatest::Reporter*, const GrCaps* caps) {
// This used to assert.
SkString result = caps->dump();
SkASSERT(!result.isEmpty());