From 47c8ed3c064f5176750f370b88119735163c0e8a Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Wed, 15 Nov 2017 18:27:09 -0700 Subject: Reland "Fix precision caps and rrect/ellipse effect precisions" This is a reland of e42180022720f2fcfd3c634cad855506a7940591 Original change's description: > Fix precision caps and rrect/ellipse effect precisions > > Replaces all the complex precision caps with a single flag that says > whether "float" == fp32. Updates the ellipse and rrect effects to > use float coords, and use the scale workaround when float != fp32. > > Bug: skia:7190 > Change-Id: Ieccff9f38acd05e5cec78fe90d01a5da901a9307 > Reviewed-on: https://skia-review.googlesource.com/70961 > Commit-Queue: Chris Dalton > Reviewed-by: Ethan Nicholas > Reviewed-by: Brian Salomon TBR=bsalomon@google.com Bug: skia:7190 Change-Id: I7ced37a64164b83d86f6a957c35e10ce9085aba0 Reviewed-on: https://skia-review.googlesource.com/72760 Reviewed-by: Chris Dalton Commit-Queue: Chris Dalton --- include/private/GrTypesPriv.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/private/GrTypesPriv.h') diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h index a90944064f..cd1c0d4483 100644 --- a/include/private/GrTypesPriv.h +++ b/include/private/GrTypesPriv.h @@ -909,6 +909,33 @@ static inline bool GrPixelConfigIsUnorm(GrPixelConfig config) { return false; } +/** + * Precision qualifier that should be used with a sampler. + */ +static inline GrSLPrecision GrSLSamplerPrecision(GrPixelConfig config) { + switch (config) { + case kUnknown_GrPixelConfig: + case kAlpha_8_GrPixelConfig: + case kGray_8_GrPixelConfig: + case kRGB_565_GrPixelConfig: + case kRGBA_4444_GrPixelConfig: + case kRGBA_8888_GrPixelConfig: + case kBGRA_8888_GrPixelConfig: + case kSRGBA_8888_GrPixelConfig: + case kSBGRA_8888_GrPixelConfig: + case kRGBA_8888_sint_GrPixelConfig: + return kLow_GrSLPrecision; + case kRGBA_float_GrPixelConfig: + case kRG_float_GrPixelConfig: + return kHigh_GrSLPrecision; + case kAlpha_half_GrPixelConfig: + case kRGBA_half_GrPixelConfig: + return kMedium_GrSLPrecision; + } + SK_ABORT("Unexpected type"); + return kHigh_GrSLPrecision; +} + static inline GrPixelConfigIsClamped GrGetPixelConfigIsClamped(GrPixelConfig config) { return GrPixelConfigIsFloatingPoint(config) ? GrPixelConfigIsClamped::kNo : GrPixelConfigIsClamped::kYes; -- cgit v1.2.3