зеркало из https://github.com/mozilla/moz-skia.git
More prep work in Gr for landing AA hairline renderer.
Review URL: http://codereview.appspot.com/4944045 git-svn-id: http://skia.googlecode.com/svn/trunk@2164 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
9a87cee904
Коммит
1f221a7021
|
@ -182,7 +182,9 @@ public:
|
|||
/**
|
||||
* Returns true if the specified use of an indexed texture is supported.
|
||||
*/
|
||||
bool supportsIndex8PixelConfig(const GrSamplerState&, int width, int height);
|
||||
bool supportsIndex8PixelConfig(const GrSamplerState&,
|
||||
int width,
|
||||
int height) const;
|
||||
|
||||
/**
|
||||
* Return the current texture cache limits.
|
||||
|
@ -386,6 +388,11 @@ public:
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Misc.
|
||||
|
||||
/**
|
||||
* Currently needed by SkGpuDevice. Ideally this shouldn't be exposed.
|
||||
*/
|
||||
bool supportsShaders() const;
|
||||
|
||||
/**
|
||||
* Flags that affect flush() behavior.
|
||||
*/
|
||||
|
@ -510,6 +517,7 @@ public:
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Functions intended for internal use only.
|
||||
GrGpu* getGpu() { return fGpu; }
|
||||
const GrGpu* getGpu() const { return fGpu; }
|
||||
GrFontCache* getFontCache() { return fFontCache; }
|
||||
GrDrawTarget* getTextTarget(const GrPaint& paint);
|
||||
void flushText();
|
||||
|
|
|
@ -31,7 +31,8 @@ public:
|
|||
* Average of 4 bilinear filterings spaced +/- 1 texel from sample
|
||||
* position in x and y. Intended for averaging 16 texels in a downsample
|
||||
* pass. (rasterizing such that texture samples fall exactly halfway
|
||||
* between texels in x and y spaced 4 texels apart.)
|
||||
* between texels in x and y spaced 4 texels apart.) Only supported
|
||||
* on shader backends.
|
||||
*/
|
||||
k4x4Downsample_Filter,
|
||||
/**
|
||||
|
|
|
@ -551,7 +551,7 @@ GrResource* GrContext::createPlatformSurface(const GrPlatformSurfaceDesc& desc)
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool GrContext::supportsIndex8PixelConfig(const GrSamplerState& sampler,
|
||||
int width, int height) {
|
||||
int width, int height) const {
|
||||
if (!fGpu->supports8BitPalette()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -639,7 +639,10 @@ bool GrContext::doOffscreenAA(GrDrawTarget* target,
|
|||
if (!paint.fAntiAlias) {
|
||||
return false;
|
||||
}
|
||||
if (isHairLines && target->willUseHWAALines()) {
|
||||
// Line primitves are always rasterized as 1 pixel wide.
|
||||
// Super-sampling would make them too thin but MSAA would be OK.
|
||||
if (isHairLines &&
|
||||
(!PREFER_MSAA_OFFSCREEN_AA || !fGpu->supportsFullsceneAA())) {
|
||||
return false;
|
||||
}
|
||||
if (target->getRenderTarget()->isMultisampled()) {
|
||||
|
@ -693,7 +696,7 @@ bool GrContext::prepareForOffscreenAA(GrDrawTarget* target,
|
|||
record->fScale = 1;
|
||||
desc.fAALevel = kMed_GrAALevel;
|
||||
} else {
|
||||
record->fDownsample = (fGpu->supports4x4DownsampleFilter()) ?
|
||||
record->fDownsample = (fGpu->supportsShaders()) ?
|
||||
OffscreenRecord::k4x4SinglePass_Downsample :
|
||||
OffscreenRecord::k4x4TwoPass_Downsample;
|
||||
record->fScale = OFFSCREEN_SSAA_SCALE;
|
||||
|
@ -1492,6 +1495,10 @@ void GrContext::drawPath(const GrPaint& paint, const GrPath& path,
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool GrContext::supportsShaders() const {
|
||||
return fGpu->supportsShaders();
|
||||
}
|
||||
|
||||
void GrContext::flush(int flagsBitfield) {
|
||||
if (kDiscard_FlushBit & flagsBitfield) {
|
||||
fDrawBuffer->reset();
|
||||
|
|
|
@ -183,6 +183,16 @@ public:
|
|||
*/
|
||||
bool supportsHWAALines() const { return fAALineSupport; }
|
||||
|
||||
/**
|
||||
* Are shaders supported.
|
||||
*/
|
||||
bool supportsShaders() const { return fShaderSupport; }
|
||||
|
||||
/**
|
||||
* Are derivative instructions supported in fragment shaders
|
||||
*/
|
||||
bool supportsShaderDerivatives() const { return fShaderDerivativeSupport; }
|
||||
|
||||
/**
|
||||
* Does the subclass support GrSamplerState::k4x4Downsample_Filter
|
||||
*/
|
||||
|
@ -363,6 +373,8 @@ protected:
|
|||
bool fTwoSidedStencilSupport;
|
||||
bool fStencilWrapOpsSupport;
|
||||
bool fAALineSupport;
|
||||
bool fShaderSupport;
|
||||
bool fShaderDerivativeSupport;
|
||||
bool fFSAASupport;
|
||||
bool f4X4DownsampleFilterSupport; // supports GrSamplerState::k4x4Downsample_Filter
|
||||
bool fDualSourceBlendingSupport;
|
||||
|
|
|
@ -62,7 +62,8 @@ GrGLBinding get_binding_in_use(const GrGLInterface* gl) {
|
|||
|
||||
GrGpuGLFixed::GrGpuGLFixed(const GrGLInterface* gl)
|
||||
: GrGpuGL(gl, get_binding_in_use(gl)) {
|
||||
f4X4DownsampleFilterSupport = false;
|
||||
fShaderSupport = false;
|
||||
fShaderDerivativeSupport = false;
|
||||
fDualSourceBlendingSupport = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,13 +256,16 @@ GrGLBinding get_binding_in_use(const GrGLInterface* gl) {
|
|||
GrGpuGLShaders::GrGpuGLShaders(const GrGLInterface* gl)
|
||||
: GrGpuGL(gl, get_binding_in_use(gl)) {
|
||||
|
||||
f4X4DownsampleFilterSupport = true;
|
||||
fShaderSupport = true;
|
||||
if (kDesktop_GrGLBinding == this->glBinding()) {
|
||||
fDualSourceBlendingSupport =
|
||||
fGLVersion >= 3.3f ||
|
||||
this->hasExtension("GL_ARB_blend_func_extended");
|
||||
fShaderDerivativeSupport = true;
|
||||
} else {
|
||||
fDualSourceBlendingSupport = false;
|
||||
fShaderDerivativeSupport =
|
||||
this->hasExtension("GL_OES_standard_derivatives");
|
||||
}
|
||||
|
||||
fProgramData = NULL;
|
||||
|
|
|
@ -694,7 +694,8 @@ static bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
|
|||
#endif
|
||||
SkMaskFilter::BlurInfo info;
|
||||
SkMaskFilter::BlurType blurType = filter->asABlur(&info);
|
||||
if (SkMaskFilter::kNone_BlurType == blurType) {
|
||||
if (SkMaskFilter::kNone_BlurType == blurType ||
|
||||
!context->supportsShaders()) {
|
||||
return false;
|
||||
}
|
||||
SkScalar radius = info.fIgnoreTransform ? info.fRadius
|
||||
|
|
Загрузка…
Ссылка в новой задаче