aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-12-05 16:27:11 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-07 20:52:40 +0000
commit7af060a8bcc250af00b0dadaf10d414765dc94f9 (patch)
tree282a8c41b0a49b70640ce280d89142dc668d18df /src
parent4e5029744d5adc542857ca506607e2135d288e57 (diff)
Add gray_8_as_lum and _as_red private grpixelconfigs
Bug: skia: Change-Id: I70cbd0bc9f7a7a16fb9f0688d272d7afa607700a Reviewed-on: https://skia-review.googlesource.com/80622 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrCaps.cpp2
-rw-r--r--src/gpu/SkGr.cpp4
-rw-r--r--src/gpu/effects/GrDitherEffect.fp2
-rw-r--r--src/gpu/effects/GrDitherEffect.h2
-rw-r--r--src/gpu/gl/GrGLCaps.cpp58
-rw-r--r--src/gpu/gl/GrGLGpu.cpp2
-rw-r--r--src/gpu/mtl/GrMtlUtil.mm5
-rw-r--r--src/gpu/vk/GrVkCaps.cpp3
-rw-r--r--src/gpu/vk/GrVkUtil.cpp3
9 files changed, 57 insertions, 24 deletions
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 589c387001..67f67def70 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -17,6 +17,8 @@ static const char* pixel_config_name(GrPixelConfig config) {
case kAlpha_8_as_Alpha_GrPixelConfig: return "Alpha8_asAlpha";
case kAlpha_8_as_Red_GrPixelConfig: return "Alpha8_asRed";
case kGray_8_GrPixelConfig: return "Gray8";
+ case kGray_8_as_Lum_GrPixelConfig: return "Gray8_asLum";
+ case kGray_8_as_Red_GrPixelConfig: return "Gray8_asRed";
case kRGB_565_GrPixelConfig: return "RGB565";
case kRGBA_4444_GrPixelConfig: return "RGBA444";
case kRGBA_8888_GrPixelConfig: return "RGBA8888";
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index def99c33ba..e95bf341b4 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -373,7 +373,9 @@ bool GrPixelConfigToColorType(GrPixelConfig config, SkColorType* ctOut) {
case kAlpha_8_as_Red_GrPixelConfig:
ct = kAlpha_8_SkColorType;
break;
- case kGray_8_GrPixelConfig:
+ case kGray_8_GrPixelConfig: // fall through
+ case kGray_8_as_Lum_GrPixelConfig: // fall through
+ case kGray_8_as_Red_GrPixelConfig:
ct = kGray_8_SkColorType;
break;
case kRGB_565_GrPixelConfig:
diff --git a/src/gpu/effects/GrDitherEffect.fp b/src/gpu/effects/GrDitherEffect.fp
index 1f4f3039b1..c47898e6ed 100644
--- a/src/gpu/effects/GrDitherEffect.fp
+++ b/src/gpu/effects/GrDitherEffect.fp
@@ -6,6 +6,8 @@ layout(key) in int rangeType;
int rangeType;
switch (dstConfig) {
case kGray_8_GrPixelConfig:
+ case kGray_8_as_Lum_GrPixelConfig:
+ case kGray_8_as_Red_GrPixelConfig:
case kRGBA_8888_GrPixelConfig:
case kBGRA_8888_GrPixelConfig:
case kSRGBA_8888_GrPixelConfig:
diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h
index a11ea666a1..1b944a852d 100644
--- a/src/gpu/effects/GrDitherEffect.h
+++ b/src/gpu/effects/GrDitherEffect.h
@@ -22,6 +22,8 @@ public:
int rangeType;
switch (dstConfig) {
case kGray_8_GrPixelConfig:
+ case kGray_8_as_Lum_GrPixelConfig:
+ case kGray_8_as_Red_GrPixelConfig:
case kRGBA_8888_GrPixelConfig:
case kBGRA_8888_GrPixelConfig:
case kSRGBA_8888_GrPixelConfig:
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index e40b56ff2e..4daabda0c0 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1940,26 +1940,29 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
fConfigTable[kAlpha_8_GrPixelConfig] = alphaInfo;
}
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
- fConfigTable[kGray_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
- fConfigTable[kGray_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
- if (this->textureRedSupport()) {
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RED;
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_R8;
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] =
- GR_GL_RED;
- fConfigTable[kGray_8_GrPixelConfig].fSwizzle = GrSwizzle::RRRA();
- if (texelBufferSupport) {
- fConfigTable[kGray_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag;
- }
- } else {
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_LUMINANCE;
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_LUMINANCE8;
- fConfigTable[kGray_8_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] =
- GR_GL_LUMINANCE;
- fConfigTable[kGray_8_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
- }
-#if 0 // Leaving Gray8 as non-renderable, to keep things simple and match raster
+ ConfigInfo& grayLumInfo = fConfigTable[kGray_8_as_Lum_GrPixelConfig];
+ grayLumInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
+ grayLumInfo.fFormatType = kNormalizedFixedPoint_FormatType;
+ grayLumInfo.fFormats.fBaseInternalFormat = GR_GL_LUMINANCE;
+ grayLumInfo.fFormats.fSizedInternalFormat = GR_GL_LUMINANCE8;
+ grayLumInfo.fFormats.fExternalFormat[kOther_ExternalFormatUsage] = GR_GL_LUMINANCE;
+ grayLumInfo.fSwizzle = GrSwizzle::RGBA();
+ if ((standard == kGL_GrGLStandard && version <= GR_GL_VER(3, 0)) ||
+ (standard == kGLES_GrGLStandard && version < GR_GL_VER(3, 0))) {
+ grayLumInfo.fFlags = ConfigInfo::kTextureable_Flag;
+ }
+
+ ConfigInfo& grayRedInfo = fConfigTable[kGray_8_as_Red_GrPixelConfig];
+ grayRedInfo.fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
+ grayRedInfo.fFormatType = kNormalizedFixedPoint_FormatType;
+ grayRedInfo.fFormats.fBaseInternalFormat = GR_GL_RED;
+ grayRedInfo.fFormats.fSizedInternalFormat = GR_GL_R8;
+ grayRedInfo.fFormats.fExternalFormat[kOther_ExternalFormatUsage] = GR_GL_RED;
+ grayRedInfo.fSwizzle = GrSwizzle::RRRA();
+ grayRedInfo.fFlags = ConfigInfo::kTextureable_Flag;
+
+#if 0 // Leaving Gray8 as non-renderable, to keep things simple and match raster. Needs to be
+ // updated to support Gray8_as_Lum and Gray8_as_red if this is ever enabled.
if (this->textureRedSupport() ||
(kDesktop_ARB_MSFBOType == this->msFBOType() &&
ctxInfo.renderer() != kOSMesa_GrGLRenderer)) {
@@ -1970,7 +1973,20 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
}
#endif
if (texStorageSupported && !isCommandBufferES2) {
- fConfigTable[kGray_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ if (GrGLANGLEBackend::kOpenGL != ctxInfo.angleBackend()) {
+ grayLumInfo.fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
+ grayRedInfo.fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
+
+ if (this->textureRedSupport()) {
+ if (texelBufferSupport) {
+ grayRedInfo.fFlags |= ConfigInfo::kCanUseWithTexelBuffer_Flag;
+ }
+ fConfigTable[kGray_8_GrPixelConfig] = grayRedInfo;
+ } else {
+ grayRedInfo.fFlags = 0;
+ fConfigTable[kGray_8_GrPixelConfig] = grayLumInfo;
}
// Check for [half] floating point texture support
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index ba3f1c2e11..fe860c4610 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -786,6 +786,8 @@ static inline GrGLint config_alignment(GrPixelConfig config) {
case kAlpha_8_as_Alpha_GrPixelConfig:
case kAlpha_8_as_Red_GrPixelConfig:
case kGray_8_GrPixelConfig:
+ case kGray_8_as_Lum_GrPixelConfig:
+ case kGray_8_as_Red_GrPixelConfig:
return 1;
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
diff --git a/src/gpu/mtl/GrMtlUtil.mm b/src/gpu/mtl/GrMtlUtil.mm
index cc40e47c0b..d05b9988e9 100644
--- a/src/gpu/mtl/GrMtlUtil.mm
+++ b/src/gpu/mtl/GrMtlUtil.mm
@@ -53,9 +53,12 @@ bool GrPixelConfigToMTLFormat(GrPixelConfig config, MTLPixelFormat* format) {
return true;
case kAlpha_8_as_Alpha_GrPixelConfig:
return false;
- case kGray_8_GrPixelConfig:
+ case kGray_8_GrPixelConfig: // fall through
+ case kGray_8_as_Red_GrPixelConfig:
*format = MTLPixelFormatR8Unorm;
return true;
+ case kGray_8_as_Lum_GrPixelConfig:
+ return false;
case kRGBA_float_GrPixelConfig:
*format = MTLPixelFormatRGBA32Float;
return true;
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 889093f68b..9e48983884 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -214,7 +214,8 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint
shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR();
shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA();
} else {
- if (kGray_8_GrPixelConfig == config) {
+ if (kGray_8_GrPixelConfig == config ||
+ kGray_8_as_Red_GrPixelConfig == config) {
shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRA();
} else if (kRGBA_4444_GrPixelConfig == config) {
// The vulkan spec does not require R4G4B4A4 to be supported for texturing so we
diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp
index 2f4e9b1d1d..1b206050c7 100644
--- a/src/gpu/vk/GrVkUtil.cpp
+++ b/src/gpu/vk/GrVkUtil.cpp
@@ -49,8 +49,11 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) {
case kAlpha_8_as_Alpha_GrPixelConfig:
return false;
case kGray_8_GrPixelConfig:
+ case kGray_8_as_Red_GrPixelConfig:
*format = VK_FORMAT_R8_UNORM;
return true;
+ case kGray_8_as_Lum_GrPixelConfig:
+ return false;
case kRGBA_float_GrPixelConfig:
*format = VK_FORMAT_R32G32B32A32_SFLOAT;
return true;