Revert of Add direct getter for GrCaps to GrContext. (patchset #4 id:60001 of https://codereview.chromium.org/1149773005/)
Reason for revert: Breaking Original issue's description: > Add direct getter for GrCaps to GrContext. > > TBR=joshualitt@google.com > > Committed: https://skia.googlesource.com/skia/+/9138c46e572085870638b6f7ad7fcdfcdf3cac99 TBR=joshualitt@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1164443002
This commit is contained in:
parent
9138c46e57
commit
084d1b61bc
@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
#include "gl/GrGLDefines.h"
|
#include "gl/GrGLDefines.h"
|
||||||
#include "GrCaps.h"
|
|
||||||
#include "GrContextFactory.h"
|
#include "GrContextFactory.h"
|
||||||
SkAutoTDelete<GrContextFactory> gGrFactory;
|
SkAutoTDelete<GrContextFactory> gGrFactory;
|
||||||
#endif
|
#endif
|
||||||
@ -373,7 +372,7 @@ static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (const GrContext* ctx = gGrFactory->get(ctxType)) {
|
if (const GrContext* ctx = gGrFactory->get(ctxType)) {
|
||||||
return sampleCnt <= ctx->caps()->maxSampleCount();
|
return sampleCnt <= ctx->getMaxSampleCount();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
class GrAARectRenderer;
|
class GrAARectRenderer;
|
||||||
class GrBatchFontCache;
|
class GrBatchFontCache;
|
||||||
class GrCaps;
|
|
||||||
struct GrContextOptions;
|
struct GrContextOptions;
|
||||||
class GrDrawContext;
|
class GrDrawContext;
|
||||||
class GrDrawTarget;
|
class GrDrawTarget;
|
||||||
@ -156,8 +155,45 @@ public:
|
|||||||
*/
|
*/
|
||||||
void purgeAllUnlockedResources();
|
void purgeAllUnlockedResources();
|
||||||
|
|
||||||
/** Access the context capabilities */
|
//////////////////////////////////////////////////////////////////////////
|
||||||
const GrCaps* caps() const { return fCaps; }
|
/// Texture and Render Target Queries
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are shader derivatives supported?
|
||||||
|
*/
|
||||||
|
bool shaderDerivativeSupport() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the provided configuration act as a texture?
|
||||||
|
*/
|
||||||
|
bool isConfigTexturable(GrPixelConfig) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can non-power-of-two textures be used with tile modes other than clamp?
|
||||||
|
*/
|
||||||
|
bool npotTextureTileSupport() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the max width or height of a texture supported by the current GPU.
|
||||||
|
*/
|
||||||
|
int getMaxTextureSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the provided configuration act as a color render target?
|
||||||
|
*/
|
||||||
|
bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the max width or height of a render target supported by the
|
||||||
|
* current GPU.
|
||||||
|
*/
|
||||||
|
int getMaxRenderTargetSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the max sample count for a render target. It will be 0 if MSAA
|
||||||
|
* is not supported.
|
||||||
|
*/
|
||||||
|
int getMaxSampleCount() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the recommended sample count for a render target when using this
|
* Returns the recommended sample count for a render target when using this
|
||||||
@ -356,7 +392,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
GrGpu* fGpu;
|
GrGpu* fGpu;
|
||||||
const GrCaps* fCaps;
|
|
||||||
GrResourceCache* fResourceCache;
|
GrResourceCache* fResourceCache;
|
||||||
// this union exists because the inheritance of GrTextureProvider->GrResourceProvider
|
// this union exists because the inheritance of GrTextureProvider->GrResourceProvider
|
||||||
// is in a private header.
|
// is in a private header.
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
#include "GrContext.h"
|
#include "GrContext.h"
|
||||||
#include "GrCaps.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -346,7 +345,7 @@ bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai
|
|||||||
GrFragmentProcessor** fp) const {
|
GrFragmentProcessor** fp) const {
|
||||||
int maxTextureSize = 0;
|
int maxTextureSize = 0;
|
||||||
if (context) {
|
if (context) {
|
||||||
maxTextureSize = context->caps()->maxTextureSize();
|
maxTextureSize = context->getMaxTextureSize();
|
||||||
}
|
}
|
||||||
SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix, maxTextureSize));
|
SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix, maxTextureSize));
|
||||||
if (!bitmapShader) {
|
if (!bitmapShader) {
|
||||||
|
@ -271,7 +271,7 @@ bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
|
|||||||
if (fp) {
|
if (fp) {
|
||||||
GrContext* context = texture->getContext();
|
GrContext* context = texture->getContext();
|
||||||
GrSurfaceDesc maskDesc;
|
GrSurfaceDesc maskDesc;
|
||||||
if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
||||||
maskDesc.fConfig = kAlpha_8_GrPixelConfig;
|
maskDesc.fConfig = kAlpha_8_GrPixelConfig;
|
||||||
} else {
|
} else {
|
||||||
maskDesc.fConfig = kRGBA_8888_GrPixelConfig;
|
maskDesc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "effects/GrConvolutionEffect.h"
|
#include "effects/GrConvolutionEffect.h"
|
||||||
#include "effects/GrMatrixConvolutionEffect.h"
|
#include "effects/GrMatrixConvolutionEffect.h"
|
||||||
#include "GrContext.h"
|
#include "GrContext.h"
|
||||||
#include "GrCaps.h"
|
|
||||||
#include "GrDrawContext.h"
|
#include "GrDrawContext.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ GrTexture* GaussianBlur(GrContext* context,
|
|||||||
SkIRect clearRect;
|
SkIRect clearRect;
|
||||||
int scaleFactorX, radiusX;
|
int scaleFactorX, radiusX;
|
||||||
int scaleFactorY, radiusY;
|
int scaleFactorY, radiusY;
|
||||||
int maxTextureSize = context->caps()->maxTextureSize();
|
int maxTextureSize = context->getMaxTextureSize();
|
||||||
sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX);
|
sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX);
|
||||||
sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY);
|
sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GrPathRenderer::AddPathRenderers(GrContext* ctx, GrPathRendererChain* chain) {
|
void GrPathRenderer::AddPathRenderers(GrContext* ctx, GrPathRendererChain* chain) {
|
||||||
chain->addPathRenderer(SkNEW(GrDashLinePathRenderer))->unref();
|
chain->addPathRenderer(SkNEW_ARGS(GrDashLinePathRenderer, (ctx)))->unref();
|
||||||
|
|
||||||
#if GR_STROKE_PATH_RENDERING
|
#if GR_STROKE_PATH_RENDERING
|
||||||
chain->addPathRenderer(SkNEW(GrStrokePathRenderer))->unref();
|
chain->addPathRenderer(SkNEW(GrStrokePathRenderer))->unref();
|
||||||
@ -36,7 +36,7 @@ void GrPathRenderer::AddPathRenderers(GrContext* ctx, GrPathRendererChain* chain
|
|||||||
chain->addPathRenderer(SkNEW(GrAndroidPathRenderer))->unref();
|
chain->addPathRenderer(SkNEW(GrAndroidPathRenderer))->unref();
|
||||||
#endif
|
#endif
|
||||||
if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(ctx->resourceProvider(),
|
if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(ctx->resourceProvider(),
|
||||||
*ctx->caps())) {
|
*ctx->getGpu()->caps())) {
|
||||||
chain->addPathRenderer(pr)->unref();
|
chain->addPathRenderer(pr)->unref();
|
||||||
}
|
}
|
||||||
#if GR_TESSELLATING_PATH_RENDERING
|
#if GR_TESSELLATING_PATH_RENDERING
|
||||||
|
@ -460,7 +460,7 @@ inline bool GrAtlasTextContext::canDrawAsDistanceFields(const SkPaint& skPaint,
|
|||||||
// rasterizers and mask filters modify alpha, which doesn't
|
// rasterizers and mask filters modify alpha, which doesn't
|
||||||
// translate well to distance
|
// translate well to distance
|
||||||
if (skPaint.getRasterizer() || skPaint.getMaskFilter() ||
|
if (skPaint.getRasterizer() || skPaint.getMaskFilter() ||
|
||||||
!fContext->caps()->shaderCaps()->shaderDerivativeSupport()) {
|
!fContext->shaderDerivativeSupport()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "GrBlurUtils.h"
|
#include "GrBlurUtils.h"
|
||||||
#include "GrDrawContext.h"
|
#include "GrDrawContext.h"
|
||||||
#include "GrCaps.h"
|
|
||||||
#include "GrContext.h"
|
#include "GrContext.h"
|
||||||
#include "effects/GrSimpleTextureEffect.h"
|
#include "effects/GrSimpleTextureEffect.h"
|
||||||
#include "GrStrokeInfo.h"
|
#include "GrStrokeInfo.h"
|
||||||
@ -111,7 +110,7 @@ static GrTexture* create_mask_GPU(GrContext* context,
|
|||||||
// render target so default to RGBA_8888
|
// render target so default to RGBA_8888
|
||||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||||
|
|
||||||
if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, desc.fSampleCnt > 0)) {
|
if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, desc.fSampleCnt > 0)) {
|
||||||
desc.fConfig = kAlpha_8_GrPixelConfig;
|
desc.fConfig = kAlpha_8_GrPixelConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ GrTexture* GrClipMaskManager::createTempMask(int width, int height) {
|
|||||||
desc.fFlags = kRenderTarget_GrSurfaceFlag;
|
desc.fFlags = kRenderTarget_GrSurfaceFlag;
|
||||||
desc.fWidth = width;
|
desc.fWidth = width;
|
||||||
desc.fHeight = height;
|
desc.fHeight = height;
|
||||||
if (this->getContext()->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
if (this->getContext()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
||||||
desc.fConfig = kAlpha_8_GrPixelConfig;
|
desc.fConfig = kAlpha_8_GrPixelConfig;
|
||||||
} else {
|
} else {
|
||||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||||
@ -526,8 +526,7 @@ GrTexture* GrClipMaskManager::allocMaskTexture(int32_t elementsGenID,
|
|||||||
desc.fWidth = clipSpaceIBounds.width();
|
desc.fWidth = clipSpaceIBounds.width();
|
||||||
desc.fHeight = clipSpaceIBounds.height();
|
desc.fHeight = clipSpaceIBounds.height();
|
||||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||||
if (willUpload ||
|
if (willUpload || this->getContext()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
||||||
this->getContext()->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
|
||||||
// We would always like A8 but it isn't supported on all platforms
|
// We would always like A8 but it isn't supported on all platforms
|
||||||
desc.fConfig = kAlpha_8_GrPixelConfig;
|
desc.fConfig = kAlpha_8_GrPixelConfig;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,6 @@ static int32_t next_id() {
|
|||||||
|
|
||||||
GrContext::GrContext() : fUniqueID(next_id()) {
|
GrContext::GrContext() : fUniqueID(next_id()) {
|
||||||
fGpu = NULL;
|
fGpu = NULL;
|
||||||
fCaps = NULL;
|
|
||||||
fResourceCache = NULL;
|
fResourceCache = NULL;
|
||||||
fResourceProvider = NULL;
|
fResourceProvider = NULL;
|
||||||
fPathRendererChain = NULL;
|
fPathRendererChain = NULL;
|
||||||
@ -174,13 +173,10 @@ void GrContext::initCommon() {
|
|||||||
fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this));
|
fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this));
|
||||||
|
|
||||||
fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this)));
|
fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this)));
|
||||||
|
|
||||||
fCaps = SkRef(fGpu->caps());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GrContext::~GrContext() {
|
GrContext::~GrContext() {
|
||||||
if (!fGpu) {
|
if (!fGpu) {
|
||||||
SkASSERT(!fCaps);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +191,6 @@ GrContext::~GrContext() {
|
|||||||
SkDELETE(fBatchFontCache);
|
SkDELETE(fBatchFontCache);
|
||||||
|
|
||||||
fGpu->unref();
|
fGpu->unref();
|
||||||
fCaps->unref();
|
|
||||||
SkSafeUnref(fPathRendererChain);
|
SkSafeUnref(fPathRendererChain);
|
||||||
SkSafeUnref(fSoftwarePathRenderer);
|
SkSafeUnref(fSoftwarePathRenderer);
|
||||||
}
|
}
|
||||||
@ -263,6 +258,18 @@ GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget,
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool GrContext::shaderDerivativeSupport() const {
|
||||||
|
return fGpu->caps()->shaderCaps()->shaderDerivativeSupport();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GrContext::isConfigTexturable(GrPixelConfig config) const {
|
||||||
|
return fGpu->caps()->isConfigTexturable(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GrContext::npotTextureTileSupport() const {
|
||||||
|
return fGpu->caps()->npotTextureTileSupport();
|
||||||
|
}
|
||||||
|
|
||||||
void GrContext::OverBudgetCB(void* data) {
|
void GrContext::OverBudgetCB(void* data) {
|
||||||
SkASSERT(data);
|
SkASSERT(data);
|
||||||
|
|
||||||
@ -283,6 +290,18 @@ void GrContext::TextBlobCacheOverBudgetCB(void* data) {
|
|||||||
context->flush();
|
context->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GrContext::getMaxTextureSize() const {
|
||||||
|
return fGpu->caps()->maxTextureSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
int GrContext::getMaxRenderTargetSize() const {
|
||||||
|
return fGpu->caps()->maxRenderTargetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
int GrContext::getMaxSampleCount() const {
|
||||||
|
return fGpu->caps()->maxSampleCount();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void GrContext::flush(int flagsBitfield) {
|
void GrContext::flush(int flagsBitfield) {
|
||||||
@ -668,9 +687,13 @@ GrPathRenderer* GrContext::getPathRenderer(const GrDrawTarget* target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
|
||||||
|
return fGpu->caps()->isConfigRenderable(config, withMSAA);
|
||||||
|
}
|
||||||
|
|
||||||
int GrContext::getRecommendedSampleCount(GrPixelConfig config,
|
int GrContext::getRecommendedSampleCount(GrPixelConfig config,
|
||||||
SkScalar dpi) const {
|
SkScalar dpi) const {
|
||||||
if (!this->caps()->isConfigRenderable(config, true)) {
|
if (!this->isConfigRenderable(config, true)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int chosenSampleCount = 0;
|
int chosenSampleCount = 0;
|
||||||
|
@ -27,7 +27,7 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G
|
|||||||
int subPixelThresh = filter > GrTextureParams::kNone_FilterMode ? 4 : 1;
|
int subPixelThresh = filter > GrTextureParams::kNone_FilterMode ? 4 : 1;
|
||||||
fPrecision = kDefault_GrSLPrecision;
|
fPrecision = kDefault_GrSLPrecision;
|
||||||
if (texture->getContext()) {
|
if (texture->getContext()) {
|
||||||
const GrShaderCaps* caps = texture->getContext()->caps()->shaderCaps();
|
const GrShaderCaps* caps = texture->getContext()->getGpu()->caps()->shaderCaps();
|
||||||
if (caps->floatPrecisionVaries()) {
|
if (caps->floatPrecisionVaries()) {
|
||||||
int maxD = SkTMax(texture->width(), texture->height());
|
int maxD = SkTMax(texture->width(), texture->height());
|
||||||
const GrShaderCaps::PrecisionInfo* info;
|
const GrShaderCaps::PrecisionInfo* info;
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
#include "GrGpu.h"
|
#include "GrGpu.h"
|
||||||
#include "effects/GrDashingEffect.h"
|
#include "effects/GrDashingEffect.h"
|
||||||
|
|
||||||
|
GrDashLinePathRenderer::GrDashLinePathRenderer(GrContext* context)
|
||||||
|
: fGpu(SkRef(context->getGpu())) {
|
||||||
|
}
|
||||||
|
|
||||||
|
GrDashLinePathRenderer::~GrDashLinePathRenderer() {
|
||||||
|
}
|
||||||
|
|
||||||
bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target,
|
bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target,
|
||||||
const GrPipelineBuilder* pipelineBuilder,
|
const GrPipelineBuilder* pipelineBuilder,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
class GrDashLinePathRenderer : public GrPathRenderer {
|
class GrDashLinePathRenderer : public GrPathRenderer {
|
||||||
public:
|
public:
|
||||||
|
GrDashLinePathRenderer(GrContext*);
|
||||||
|
~GrDashLinePathRenderer();
|
||||||
|
|
||||||
bool canDrawPath(const GrDrawTarget*,
|
bool canDrawPath(const GrDrawTarget*,
|
||||||
const GrPipelineBuilder*,
|
const GrPipelineBuilder*,
|
||||||
const SkMatrix& viewMatrix,
|
const SkMatrix& viewMatrix,
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
GrDrawTarget::GrDrawTarget(GrContext* context)
|
GrDrawTarget::GrDrawTarget(GrContext* context)
|
||||||
: fContext(context)
|
: fContext(context)
|
||||||
, fCaps(SkRef(context->caps()))
|
, fCaps(SkRef(context->getGpu()->caps()))
|
||||||
, fGpuTraceMarkerCount(0)
|
, fGpuTraceMarkerCount(0)
|
||||||
, fFlushing(false) {
|
, fFlushing(false) {
|
||||||
SkASSERT(context);
|
SkASSERT(context);
|
||||||
|
@ -9,14 +9,15 @@
|
|||||||
|
|
||||||
// We will use the reordering buffer, unless we have NVPR.
|
// We will use the reordering buffer, unless we have NVPR.
|
||||||
// TODO move NVPR to batch so we can reorder
|
// TODO move NVPR to batch so we can reorder
|
||||||
static inline bool allow_reordering(const GrCaps* caps) {
|
static inline bool allow_reordering(const GrGpu* gpu) {
|
||||||
//return !caps->shaderCaps()->pathRenderingSupport();
|
//const GrCaps* caps = gpu->caps();
|
||||||
|
//return caps && caps->shaderCaps() && !caps->shaderCaps()->pathRenderingSupport();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrContext* context)
|
GrInOrderDrawBuffer::GrInOrderDrawBuffer(GrContext* context)
|
||||||
: INHERITED(context)
|
: INHERITED(context)
|
||||||
, fCommands(GrCommandBuilder::Create(context->getGpu(), allow_reordering(context->caps())))
|
, fCommands(GrCommandBuilder::Create(context->getGpu(), allow_reordering(context->getGpu())))
|
||||||
, fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4)
|
, fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4)
|
||||||
, fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4)
|
, fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4)
|
||||||
, fPipelineBuffer(kPipelineBufferMinReserve)
|
, fPipelineBuffer(kPipelineBufferMinReserve)
|
||||||
|
@ -78,9 +78,9 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
|
|||||||
|
|
||||||
void GrPathRendererChain::init() {
|
void GrPathRendererChain::init() {
|
||||||
SkASSERT(!fInit);
|
SkASSERT(!fInit);
|
||||||
const GrCaps* caps = fOwner->caps();
|
GrGpu* gpu = fOwner->getGpu();
|
||||||
bool twoSided = caps->twoSidedStencilSupport();
|
bool twoSided = gpu->caps()->twoSidedStencilSupport();
|
||||||
bool wrapOp = caps->stencilWrapOpsSupport();
|
bool wrapOp = gpu->caps()->stencilWrapOpsSupport();
|
||||||
GrPathRenderer::AddPathRenderers(fOwner, this);
|
GrPathRenderer::AddPathRenderers(fOwner, this);
|
||||||
this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
|
this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
|
||||||
(twoSided, wrapOp)))->unref();
|
(twoSided, wrapOp)))->unref();
|
||||||
|
@ -174,8 +174,8 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds,
|
|||||||
resultBounds.height());
|
resultBounds.height());
|
||||||
|
|
||||||
if (allowCompression &&
|
if (allowCompression &&
|
||||||
fContext->caps()->drawPathMasksToCompressedTexturesSupport() &&
|
fContext->getGpu()->caps()->drawPathMasksToCompressedTexturesSupport() &&
|
||||||
choose_compressed_fmt(fContext->caps(), &fCompressedFormat)) {
|
choose_compressed_fmt(fContext->getGpu()->caps(), &fCompressedFormat)) {
|
||||||
fCompressionMode = kCompress_CompressionMode;
|
fCompressionMode = kCompress_CompressionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ GrTexture* GrSWMaskHelper::createTexture() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
desc.fConfig = fmt_to_config(fCompressedFormat);
|
desc.fConfig = fmt_to_config(fCompressedFormat);
|
||||||
SkASSERT(fContext->caps()->isConfigTexturable(desc.fConfig));
|
SkASSERT(fContext->getGpu()->caps()->isConfigTexturable(desc.fConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
return fContext->textureProvider()->refScratchTexture(
|
return fContext->textureProvider()->refScratchTexture(
|
||||||
@ -256,7 +256,7 @@ void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& de
|
|||||||
const void *data, size_t rowbytes) {
|
const void *data, size_t rowbytes) {
|
||||||
// If we aren't reusing scratch textures we don't need to flush before
|
// If we aren't reusing scratch textures we don't need to flush before
|
||||||
// writing since no one else will be using 'texture'
|
// writing since no one else will be using 'texture'
|
||||||
bool reuseScratch = fContext->caps()->reuseScratchTextures();
|
bool reuseScratch = fContext->getGpu()->caps()->reuseScratchTextures();
|
||||||
|
|
||||||
// Since we're uploading to it, and it's compressed, 'texture' shouldn't
|
// Since we're uploading to it, and it's compressed, 'texture' shouldn't
|
||||||
// have a render target.
|
// have a render target.
|
||||||
|
@ -910,7 +910,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
|
|||||||
// FIXME: the tiled bitmap code path doesn't currently support
|
// FIXME: the tiled bitmap code path doesn't currently support
|
||||||
// anti-aliased edges, we work around that for now by drawing directly
|
// anti-aliased edges, we work around that for now by drawing directly
|
||||||
// if the image size exceeds maximum texture size.
|
// if the image size exceeds maximum texture size.
|
||||||
int maxTextureSize = fContext->caps()->maxTextureSize();
|
int maxTextureSize = fContext->getMaxTextureSize();
|
||||||
bool directDraw = fRenderTarget->isMultisampled() ||
|
bool directDraw = fRenderTarget->isMultisampled() ||
|
||||||
!paint.isAntiAlias() ||
|
!paint.isAntiAlias() ||
|
||||||
bitmap.width() > maxTextureSize ||
|
bitmap.width() > maxTextureSize ||
|
||||||
@ -1034,7 +1034,7 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw,
|
|||||||
}
|
}
|
||||||
params.setFilterMode(textureFilterMode);
|
params.setFilterMode(textureFilterMode);
|
||||||
|
|
||||||
int maxTileSize = fContext->caps()->maxTextureSize() - 2 * tileFilterPad;
|
int maxTileSize = fContext->getMaxTextureSize() - 2 * tileFilterPad;
|
||||||
int tileSize;
|
int tileSize;
|
||||||
|
|
||||||
SkIRect clippedSrcRect;
|
SkIRect clippedSrcRect;
|
||||||
@ -1163,8 +1163,8 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
|
|||||||
SkCanvas::DrawBitmapRectFlags flags,
|
SkCanvas::DrawBitmapRectFlags flags,
|
||||||
bool bicubic,
|
bool bicubic,
|
||||||
bool needsTextureDomain) {
|
bool needsTextureDomain) {
|
||||||
SkASSERT(bitmap.width() <= fContext->caps()->maxTextureSize() &&
|
SkASSERT(bitmap.width() <= fContext->getMaxTextureSize() &&
|
||||||
bitmap.height() <= fContext->caps()->maxTextureSize());
|
bitmap.height() <= fContext->getMaxTextureSize());
|
||||||
|
|
||||||
GrTexture* texture;
|
GrTexture* texture;
|
||||||
AutoBitmapTexture abt(fContext, bitmap, ¶ms, &texture);
|
AutoBitmapTexture abt(fContext, bitmap, ¶ms, &texture);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "SkGr.h"
|
#include "SkGr.h"
|
||||||
|
|
||||||
#include "GrCaps.h"
|
|
||||||
#include "GrDrawContext.h"
|
#include "GrDrawContext.h"
|
||||||
#include "GrXferProcessor.h"
|
#include "GrXferProcessor.h"
|
||||||
#include "SkColorFilter.h"
|
#include "SkColorFilter.h"
|
||||||
@ -97,7 +96,7 @@ enum Stretch {
|
|||||||
static Stretch get_stretch_type(const GrContext* ctx, int width, int height,
|
static Stretch get_stretch_type(const GrContext* ctx, int width, int height,
|
||||||
const GrTextureParams* params) {
|
const GrTextureParams* params) {
|
||||||
if (params && params->isTiled()) {
|
if (params && params->isTiled()) {
|
||||||
if (!ctx->caps()->npotTextureTileSupport() && (!SkIsPow2(width) || !SkIsPow2(height))) {
|
if (!ctx->npotTextureTileSupport() && (!SkIsPow2(width) || !SkIsPow2(height))) {
|
||||||
switch(params->filterMode()) {
|
switch(params->filterMode()) {
|
||||||
case GrTextureParams::kNone_FilterMode:
|
case GrTextureParams::kNone_FilterMode:
|
||||||
return kNearest_Stretch;
|
return kNearest_Stretch;
|
||||||
@ -199,7 +198,6 @@ GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch,
|
|||||||
|
|
||||||
GrContext* context = inputTexture->getContext();
|
GrContext* context = inputTexture->getContext();
|
||||||
SkASSERT(context);
|
SkASSERT(context);
|
||||||
const GrCaps* caps = context->caps();
|
|
||||||
|
|
||||||
// Either it's a cache miss or the original wasn't cached to begin with.
|
// Either it's a cache miss or the original wasn't cached to begin with.
|
||||||
GrSurfaceDesc rtDesc = inputTexture->desc();
|
GrSurfaceDesc rtDesc = inputTexture->desc();
|
||||||
@ -210,18 +208,18 @@ GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch,
|
|||||||
|
|
||||||
// If the config isn't renderable try converting to either A8 or an 32 bit config. Otherwise,
|
// If the config isn't renderable try converting to either A8 or an 32 bit config. Otherwise,
|
||||||
// fail.
|
// fail.
|
||||||
if (!caps->isConfigRenderable(rtDesc.fConfig, false)) {
|
if (!context->isConfigRenderable(rtDesc.fConfig, false)) {
|
||||||
if (GrPixelConfigIsAlphaOnly(rtDesc.fConfig)) {
|
if (GrPixelConfigIsAlphaOnly(rtDesc.fConfig)) {
|
||||||
if (caps->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
|
||||||
rtDesc.fConfig = kAlpha_8_GrPixelConfig;
|
rtDesc.fConfig = kAlpha_8_GrPixelConfig;
|
||||||
} else if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
|
} else if (context->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
|
||||||
rtDesc.fConfig = kSkia8888_GrPixelConfig;
|
rtDesc.fConfig = kSkia8888_GrPixelConfig;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (kRGB_GrColorComponentFlags ==
|
} else if (kRGB_GrColorComponentFlags ==
|
||||||
(kRGB_GrColorComponentFlags & GrPixelConfigComponentMask(rtDesc.fConfig))) {
|
(kRGB_GrColorComponentFlags & GrPixelConfigComponentMask(rtDesc.fConfig))) {
|
||||||
if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
|
if (context->isConfigRenderable(kSkia8888_GrPixelConfig, false)) {
|
||||||
rtDesc.fConfig = kSkia8888_GrPixelConfig;
|
rtDesc.fConfig = kSkia8888_GrPixelConfig;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -425,10 +423,9 @@ static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx,
|
|||||||
|
|
||||||
GrSurfaceDesc desc;
|
GrSurfaceDesc desc;
|
||||||
generate_bitmap_texture_desc(*bitmap, &desc);
|
generate_bitmap_texture_desc(*bitmap, &desc);
|
||||||
const GrCaps* caps = ctx->caps();
|
|
||||||
|
|
||||||
if (kIndex_8_SkColorType == bitmap->colorType()) {
|
if (kIndex_8_SkColorType == bitmap->colorType()) {
|
||||||
if (caps->isConfigTexturable(kIndex_8_GrPixelConfig)) {
|
if (ctx->isConfigTexturable(kIndex_8_GrPixelConfig)) {
|
||||||
size_t imageSize = GrCompressedFormatDataSize(kIndex_8_GrPixelConfig,
|
size_t imageSize = GrCompressedFormatDataSize(kIndex_8_GrPixelConfig,
|
||||||
bitmap->width(), bitmap->height());
|
bitmap->width(), bitmap->height());
|
||||||
SkAutoMalloc storage(imageSize);
|
SkAutoMalloc storage(imageSize);
|
||||||
@ -450,7 +447,7 @@ static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx,
|
|||||||
#ifndef SK_IGNORE_ETC1_SUPPORT
|
#ifndef SK_IGNORE_ETC1_SUPPORT
|
||||||
// Make sure that the underlying device supports ETC1 textures before we go ahead
|
// Make sure that the underlying device supports ETC1 textures before we go ahead
|
||||||
// and check the data.
|
// and check the data.
|
||||||
else if (caps->isConfigTexturable(kETC1_GrPixelConfig)
|
else if (ctx->isConfigTexturable(kETC1_GrPixelConfig)
|
||||||
// If the bitmap had compressed data and was then uncompressed, it'll still return
|
// If the bitmap had compressed data and was then uncompressed, it'll still return
|
||||||
// compressed data on 'refEncodedData' and upload it. Probably not good, since if
|
// compressed data on 'refEncodedData' and upload it. Probably not good, since if
|
||||||
// the bitmap has available pixels, then they might not be what the decompressed
|
// the bitmap has available pixels, then they might not be what the decompressed
|
||||||
|
@ -29,7 +29,7 @@ DEF_GPUTEST(GrDrawTarget, reporter, factory) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
test_print(reporter, grContext->caps());
|
test_print(reporter, grContext->getGpu()->caps());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ static void test_no_dual_source_blending(skiatest::Reporter* reporter) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GrCaps& caps = *ctx->caps();
|
const GrCaps& caps = *ctx->getGpu()->caps();
|
||||||
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
|
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
|
||||||
SkFAIL("Null context failed to honor request for no ARB_blend_func_extended.");
|
SkFAIL("Null context failed to honor request for no ARB_blend_func_extended.");
|
||||||
return;
|
return;
|
||||||
|
@ -122,7 +122,7 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
|||||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() !=
|
smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() !=
|
||||||
bigRT->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
bigRT->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||||
|
|
||||||
if (context->caps()->maxSampleCount() >= 4) {
|
if (context->getMaxSampleCount() >= 4) {
|
||||||
// An RT with a different sample count should not share.
|
// An RT with a different sample count should not share.
|
||||||
GrSurfaceDesc smallMSAADesc = smallDesc;
|
GrSurfaceDesc smallMSAADesc = smallDesc;
|
||||||
smallMSAADesc.fSampleCnt = 4;
|
smallMSAADesc.fSampleCnt = 4;
|
||||||
@ -154,8 +154,7 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
|||||||
smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||||
// But not one with a larger sample count should not. (Also check that the request for 4
|
// But not one with a larger sample count should not. (Also check that the request for 4
|
||||||
// samples didn't get rounded up to >= 8 or else they could share.).
|
// samples didn't get rounded up to >= 8 or else they could share.).
|
||||||
if (context->caps()->maxSampleCount() >= 8 &&
|
if (context->getMaxSampleCount() >= 8 && smallMSAART0 && smallMSAART0->asRenderTarget() &&
|
||||||
smallMSAART0 && smallMSAART0->asRenderTarget() &&
|
|
||||||
smallMSAART0->asRenderTarget()->numSamples() < 8) {
|
smallMSAART0->asRenderTarget()->numSamples() < 8) {
|
||||||
smallMSAADesc.fSampleCnt = 8;
|
smallMSAADesc.fSampleCnt = 8;
|
||||||
smallMSAART1.reset(cache->createTexture(smallMSAADesc, false));
|
smallMSAART1.reset(cache->createTexture(smallMSAADesc, false));
|
||||||
|
Loading…
Reference in New Issue
Block a user