aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-25 09:52:04 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-27 14:04:17 +0000
commitfa7ee2447e6227e7f441d32e570489130c0932bb (patch)
tree16bba14539e43cf1b729a2d5a575f34c9c1d1dfc /src
parenta78f1bc1d4055b82c8d31861f80cafdcc17f3d1f (diff)
changed vertex attribute precisions to be actual types
Bug: skia: Change-Id: Ic5555d9f1be7f24655bdea9f2a3677bfb128ef70 Reviewed-on: https://skia-review.googlesource.com/50221 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrDefaultGeoProcFactory.cpp10
-rw-r--r--src/gpu/GrPrimitiveProcessor.h15
-rw-r--r--src/gpu/ccpr/GrCCPRCoverageProcessor.cpp3
-rw-r--r--src/gpu/ccpr/GrCCPRCoverageProcessor.h4
-rw-r--r--src/gpu/ccpr/GrCCPRPathProcessor.cpp16
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp13
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.cpp8
-rw-r--r--src/gpu/effects/GrDistanceFieldGeoProc.cpp24
-rw-r--r--src/gpu/effects/GrShadowGeoProc.cpp7
-rw-r--r--src/gpu/gl/GrGLGpu.cpp6
-rw-r--r--src/gpu/gl/GrGLVertexArray.cpp56
-rw-r--r--src/gpu/glsl/GrGLSLVarying.cpp3
-rw-r--r--src/gpu/instanced/InstanceProcessor.cpp10
-rw-r--r--src/gpu/ops/GrAAConvexPathRenderer.cpp6
-rw-r--r--src/gpu/ops/GrDashOp.cpp12
-rw-r--r--src/gpu/ops/GrMSAAPathRenderer.cpp7
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp31
-rw-r--r--src/gpu/ops/GrTextureOp.cpp8
-rw-r--r--src/gpu/vk/GrVkPipeline.cpp24
19 files changed, 127 insertions, 136 deletions
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 58ae2a90ec..32d16ffa75 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -256,18 +256,16 @@ private:
, fLocalCoordsWillBeRead(localCoordsWillBeRead)
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->initClassID<DefaultGeoProc>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
if (fFlags & kColorAttribute_GPFlag) {
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
}
if (fFlags & kLocalCoordAttribute_GPFlag) {
- fInLocalCoords = &this->addVertexAttrib("inLocalCoord", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInLocalCoords = &this->addVertexAttrib("inLocalCoord", kFloat2_GrVertexAttribType);
this->setHasExplicitLocalCoords();
}
if (fFlags & kCoverageAttribute_GPFlag) {
- fInCoverage = &this->addVertexAttrib("inCoverage", kFloat_GrVertexAttribType);
+ fInCoverage = &this->addVertexAttrib("inCoverage", kHalf_GrVertexAttribType);
}
}
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index 3b90689aca..eb59d98b15 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -49,7 +49,6 @@ public:
const char* fName;
GrVertexAttribType fType;
int fOffsetInRecord;
- GrSLPrecision fPrecision;
InputRate fInputRate;
};
@@ -118,19 +117,13 @@ protected:
/**
* Subclasses call these from their constructor to register vertex and instance attributes.
*/
- const Attribute& addVertexAttrib(const char* name, GrVertexAttribType type,
- GrSLPrecision precision = kDefault_GrSLPrecision) {
- precision = (kDefault_GrSLPrecision == precision) ? kMedium_GrSLPrecision : precision;
- fAttribs.push_back() = {name, type, fVertexStride, precision,
- Attribute::InputRate::kPerVertex};
+ const Attribute& addVertexAttrib(const char* name, GrVertexAttribType type) {
+ fAttribs.push_back() = {name, type, fVertexStride, Attribute::InputRate::kPerVertex};
fVertexStride += static_cast<int>(SkAlign4(GrVertexAttribTypeSize(type)));
return fAttribs.back();
}
- const Attribute& addInstanceAttrib(const char* name, GrVertexAttribType type,
- GrSLPrecision precision = kDefault_GrSLPrecision) {
- precision = (kDefault_GrSLPrecision == precision) ? kMedium_GrSLPrecision : precision;
- fAttribs.push_back() = {name, type, fInstanceStride, precision,
- Attribute::InputRate::kPerInstance};
+ const Attribute& addInstanceAttrib(const char* name, GrVertexAttribType type) {
+ fAttribs.push_back() = {name, type, fInstanceStride, Attribute::InputRate::kPerInstance};
fInstanceStride += static_cast<int>(SkAlign4(GrVertexAttribTypeSize(type)));
return fAttribs.back();
}
diff --git a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
index 4a0dd2666a..7354c03592 100644
--- a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
@@ -43,8 +43,7 @@ const char* GrCCPRCoverageProcessor::GetProcessorName(Mode mode) {
GrCCPRCoverageProcessor::GrCCPRCoverageProcessor(Mode mode, GrBuffer* pointsBuffer)
: fMode(mode)
- , fInstanceAttrib(this->addInstanceAttrib("instance", InstanceArrayFormat(mode),
- kHigh_GrSLPrecision)) {
+ , fInstanceAttrib(this->addInstanceAttrib("instance", InstanceArrayFormat(mode))) {
fPointsBufferAccess.reset(kRG_float_GrPixelConfig, pointsBuffer, kVertex_GrShaderFlag);
this->addBufferAccess(&fPointsBufferAccess);
diff --git a/src/gpu/ccpr/GrCCPRCoverageProcessor.h b/src/gpu/ccpr/GrCCPRCoverageProcessor.h
index 879f724f4f..f02b7422c8 100644
--- a/src/gpu/ccpr/GrCCPRCoverageProcessor.h
+++ b/src/gpu/ccpr/GrCCPRCoverageProcessor.h
@@ -73,7 +73,7 @@ public:
kLoopCorners
};
static constexpr GrVertexAttribType InstanceArrayFormat(Mode mode) {
- return mode < Mode::kQuadraticHulls ? kVec4i_GrVertexAttribType : kVec2i_GrVertexAttribType;
+ return mode < Mode::kQuadraticHulls ? kInt4_GrVertexAttribType : kInt2_GrVertexAttribType;
}
static const char* GetProcessorName(Mode);
@@ -81,7 +81,7 @@ public:
const char* instanceAttrib() const { return fInstanceAttrib.fName; }
int atlasOffsetIdx() const {
- return kVec4i_GrVertexAttribType == InstanceArrayFormat(fMode) ? 3 : 1;
+ return kInt4_GrVertexAttribType == InstanceArrayFormat(fMode) ? 3 : 1;
}
const char* name() const override { return GetProcessorName(fMode); }
SkString dumpInfo() const override {
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index 78baa368da..bac52ce447 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -51,14 +51,14 @@ GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTextureProxy> atlas,
SkPath::FillType fillType, const GrShaderCaps& shaderCaps)
: fFillType(fillType) {
- this->addInstanceAttrib("devbounds", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision);
- this->addInstanceAttrib("devbounds45", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision);
- this->addInstanceAttrib("view_matrix", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision);
- this->addInstanceAttrib("view_translate", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+ this->addInstanceAttrib("devbounds", kFloat4_GrVertexAttribType);
+ this->addInstanceAttrib("devbounds45", kFloat4_GrVertexAttribType);
+ this->addInstanceAttrib("view_matrix", kFloat4_GrVertexAttribType);
+ this->addInstanceAttrib("view_translate", kFloat2_GrVertexAttribType);
// FIXME: this could be a vector of two shorts if it were supported by Ganesh.
- // Note: this should be doable now with kVec2us_uint_GrVertexAttribType
- this->addInstanceAttrib("atlas_offset", kVec2i_GrVertexAttribType, kHigh_GrSLPrecision);
- this->addInstanceAttrib("color", kVec4ub_GrVertexAttribType, kLow_GrSLPrecision);
+ // Note: this should be doable now with kUShort2_GrVertexAttribType
+ this->addInstanceAttrib("atlas_offset", kInt2_GrVertexAttribType);
+ this->addInstanceAttrib("color", kUByte4_norm_GrVertexAttribType);
SkASSERT(offsetof(Instance, fDevBounds) ==
this->getInstanceAttrib(InstanceAttribs::kDevBounds).fOffsetInRecord);
@@ -76,7 +76,7 @@ GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTexture
GR_STATIC_ASSERT(6 == kNumInstanceAttribs);
- this->addVertexAttrib("edge_norms", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision);
+ this->addVertexAttrib("edge_norms", kFloat4_GrVertexAttribType);
fAtlasAccess.reset(std::move(atlas), GrSamplerState::Filter::kNearest,
GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag);
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 9f5c8ca0e7..354bc67bda 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -241,9 +241,8 @@ GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
, fCoverageScale(coverage)
, fEdgeType(edgeType) {
this->initClassID<GrConicEffect>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInConicCoeffs = &this->addVertexAttrib("inConicCoeffs", kVec4f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInConicCoeffs = &this->addVertexAttrib("inConicCoeffs", kHalf4_GrVertexAttribType);
}
//////////////////////////////////////////////////////////////////////////////
@@ -444,9 +443,8 @@ GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
, fCoverageScale(coverage)
, fEdgeType(edgeType) {
this->initClassID<GrQuadEffect>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInHairQuadEdge = &this->addVertexAttrib("inHairQuadEdge", kVec4f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInHairQuadEdge = &this->addVertexAttrib("inHairQuadEdge", kHalf4_GrVertexAttribType);
}
//////////////////////////////////////////////////////////////////////////////
@@ -670,8 +668,7 @@ GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, const Sk
, fDevKLMMatrix(devKLMMatrix)
, fEdgeType(edgeType) {
this->initClassID<GrCubicEffect>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 0997b9ed7d..4370219f67 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -130,17 +130,15 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color,
, fInColor(nullptr)
, fMaskFormat(format) {
this->initClassID<GrBitmapTextGeoProc>();
- fInPosition =
- &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
kA565_GrMaskFormat == fMaskFormat;
if (hasVertexColor) {
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
}
- fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_uint_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
for (int i = 0; i < kMaxTextures; ++i) {
if (proxies[i]) {
fTextureSamplers[i].reset(std::move(proxies[i]), params);
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 44e52735bd..dcbb5d5df9 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -247,11 +247,9 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
this->initClassID<GrDistanceFieldA8TextGeoProc>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_uint_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
for (int i = 0; i < kMaxTextures; ++i) {
if (proxies[i]) {
fTextureSamplers[i].reset(std::move(proxies[i]), params);
@@ -507,11 +505,9 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
this->initClassID<GrDistanceFieldPathGeoProc>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_uint_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
for (int i = 0; i < kMaxTextures; ++i) {
if (proxies[i]) {
fTextureSamplers[i].reset(std::move(proxies[i]), params);
@@ -828,11 +824,9 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_DistanceFieldEffectFlag));
this->initClassID<GrDistanceFieldLCDTextGeoProc>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_uint_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
for (int i = 0; i < kMaxTextures; ++i) {
if (proxies[i]) {
fTextureSamplers[i].reset(std::move(proxies[i]), params);
diff --git a/src/gpu/effects/GrShadowGeoProc.cpp b/src/gpu/effects/GrShadowGeoProc.cpp
index ca4c5dba75..3217f46303 100644
--- a/src/gpu/effects/GrShadowGeoProc.cpp
+++ b/src/gpu/effects/GrShadowGeoProc.cpp
@@ -65,10 +65,9 @@ private:
GrRRectShadowGeoProc::GrRRectShadowGeoProc() {
this->initClassID<GrRRectShadowGeoProc>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInShadowParams = &this->addVertexAttrib("inShadowParams", kVec4f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInShadowParams = &this->addVertexAttrib("inShadowParams", kHalf4_GrVertexAttribType);
}
GrGLSLPrimitiveProcessor* GrRRectShadowGeoProc::createGLSLInstance(const GrShaderCaps&) const {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 92eb86d707..ff19bb6fc3 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3811,7 +3811,7 @@ void GrGLGpu::clearStencilClipAsDraw(const GrFixedClip& clip, bool insideStencil
GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
attribs->enableVertexArrays(this, 1);
- attribs->set(this, 0, fStencilClipClearArrayBuffer.get(), kVec2f_GrVertexAttribType,
+ attribs->set(this, 0, fStencilClipClearArrayBuffer.get(), kHalf2_GrVertexAttribType,
2 * sizeof(GrGLfloat), 0);
GrXferProcessor::BlendInfo blendInfo;
@@ -3864,7 +3864,7 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
attribs->enableVertexArrays(this, 1);
- attribs->set(this, 0, fCopyProgramArrayBuffer.get(), kVec2f_GrVertexAttribType,
+ attribs->set(this, 0, fCopyProgramArrayBuffer.get(), kHalf2_GrVertexAttribType,
2 * sizeof(GrGLfloat), 0);
// dst rect edges in NDC (-1 to 1)
@@ -4095,7 +4095,7 @@ bool GrGLGpu::generateMipmap(GrGLTexture* texture, GrSurfaceOrigin textureOrigin
GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
attribs->enableVertexArrays(this, 1);
- attribs->set(this, 0, fMipmapProgramArrayBuffer.get(), kVec2f_GrVertexAttribType,
+ attribs->set(this, 0, fMipmapProgramArrayBuffer.get(), kHalf2_GrVertexAttribType,
2 * sizeof(GrGLfloat), 0);
// Set "simple" state once:
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index 991de96325..a903e7d2f1 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -21,25 +21,33 @@ static AttribLayout attrib_layout(GrVertexAttribType type) {
switch (type) {
case kFloat_GrVertexAttribType:
return {false, 1, GR_GL_FLOAT};
- case kVec2f_GrVertexAttribType:
+ case kFloat2_GrVertexAttribType:
return {false, 2, GR_GL_FLOAT};
- case kVec3f_GrVertexAttribType:
+ case kFloat3_GrVertexAttribType:
return {false, 3, GR_GL_FLOAT};
- case kVec4f_GrVertexAttribType:
+ case kFloat4_GrVertexAttribType:
return {false, 4, GR_GL_FLOAT};
- case kVec2i_GrVertexAttribType:
+ case kHalf_GrVertexAttribType:
+ return {false, 1, GR_GL_FLOAT};
+ case kHalf2_GrVertexAttribType:
+ return {false, 2, GR_GL_FLOAT};
+ case kHalf3_GrVertexAttribType:
+ return {false, 3, GR_GL_FLOAT};
+ case kHalf4_GrVertexAttribType:
+ return {false, 4, GR_GL_FLOAT};
+ case kInt2_GrVertexAttribType:
return {false, 2, GR_GL_INT};
- case kVec3i_GrVertexAttribType:
+ case kInt3_GrVertexAttribType:
return {false, 3, GR_GL_INT};
- case kVec4i_GrVertexAttribType:
+ case kInt4_GrVertexAttribType:
return {false, 4, GR_GL_INT};
- case kUByte_GrVertexAttribType:
+ case kUByte_norm_GrVertexAttribType:
return {true, 1, GR_GL_UNSIGNED_BYTE};
- case kVec4ub_GrVertexAttribType:
+ case kUByte4_norm_GrVertexAttribType:
return {true, 4, GR_GL_UNSIGNED_BYTE};
- case kVec2us_norm_GrVertexAttribType:
+ case kUShort2_norm_GrVertexAttribType:
return {true, 2, GR_GL_UNSIGNED_SHORT};
- case kVec2us_uint_GrVertexAttribType:
+ case kUShort2_GrVertexAttribType:
return {false, 2, GR_GL_UNSIGNED_SHORT};
case kInt_GrVertexAttribType:
return {false, 1, GR_GL_INT};
@@ -55,25 +63,33 @@ static bool GrVertexAttribTypeIsIntType(const GrShaderCaps* shaderCaps,
switch (type) {
case kFloat_GrVertexAttribType:
return false;
- case kVec2f_GrVertexAttribType:
+ case kFloat2_GrVertexAttribType:
+ return false;
+ case kFloat3_GrVertexAttribType:
+ return false;
+ case kFloat4_GrVertexAttribType:
+ return false;
+ case kHalf_GrVertexAttribType:
+ return false;
+ case kHalf2_GrVertexAttribType:
return false;
- case kVec3f_GrVertexAttribType:
+ case kHalf3_GrVertexAttribType:
return false;
- case kVec4f_GrVertexAttribType:
+ case kHalf4_GrVertexAttribType:
return false;
- case kVec2i_GrVertexAttribType:
+ case kInt2_GrVertexAttribType:
return true;
- case kVec3i_GrVertexAttribType:
+ case kInt3_GrVertexAttribType:
return true;
- case kVec4i_GrVertexAttribType:
+ case kInt4_GrVertexAttribType:
return true;
- case kUByte_GrVertexAttribType:
+ case kUByte_norm_GrVertexAttribType:
return false;
- case kVec4ub_GrVertexAttribType:
+ case kUByte4_norm_GrVertexAttribType:
return false;
- case kVec2us_norm_GrVertexAttribType:
+ case kUShort2_norm_GrVertexAttribType:
return false;
- case kVec2us_uint_GrVertexAttribType:
+ case kUShort2_GrVertexAttribType:
return shaderCaps->integerSupport();
case kInt_GrVertexAttribType:
return true;
diff --git a/src/gpu/glsl/GrGLSLVarying.cpp b/src/gpu/glsl/GrGLSLVarying.cpp
index ef3fe8af23..1f8ddbd8dd 100644
--- a/src/gpu/glsl/GrGLSLVarying.cpp
+++ b/src/gpu/glsl/GrGLSLVarying.cpp
@@ -69,8 +69,7 @@ void GrGLSLVaryingHandler::emitAttributes(const GrGeometryProcessor& gp) {
this->addAttribute(GrShaderVar(attr.fName,
GrVertexAttribTypeToSLType(attr.fType),
GrShaderVar::kIn_TypeModifier,
- GrShaderVar::kNonArray,
- attr.fPrecision));
+ GrShaderVar::kNonArray));
}
}
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index 3dcc3caf21..5890028b6a 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -43,13 +43,13 @@ GrCaps::InstancedSupport InstanceProcessor::CheckSupport(const GrShaderCaps& sha
InstanceProcessor::InstanceProcessor(OpInfo opInfo, GrBuffer* paramsBuffer) : fOpInfo(opInfo) {
this->initClassID<InstanceProcessor>();
- this->addVertexAttrib("shapeCoords", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+ this->addVertexAttrib("shapeCoords", kFloat2_GrVertexAttribType);
this->addVertexAttrib("vertexAttrs", kInt_GrVertexAttribType);
this->addVertexAttrib("instanceInfo", kUint_GrVertexAttribType);
- this->addVertexAttrib("shapeMatrixX", kVec3f_GrVertexAttribType, kHigh_GrSLPrecision);
- this->addVertexAttrib("shapeMatrixY", kVec3f_GrVertexAttribType, kHigh_GrSLPrecision);
- this->addVertexAttrib("color", kVec4f_GrVertexAttribType, kLow_GrSLPrecision);
- this->addVertexAttrib("localRect", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision);
+ this->addVertexAttrib("shapeMatrixX", kFloat3_GrVertexAttribType);
+ this->addVertexAttrib("shapeMatrixY", kFloat3_GrVertexAttribType);
+ this->addVertexAttrib("color", kHalf4_GrVertexAttribType);
+ this->addVertexAttrib("localRect", kFloat4_GrVertexAttribType);
GR_STATIC_ASSERT(0 == (int)Attrib::kShapeCoords);
GR_STATIC_ASSERT(1 == (int)Attrib::kVertexAttrs);
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 03dabe3b83..292f59420a 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -636,9 +636,9 @@ private:
QuadEdgeEffect(const SkMatrix& localMatrix, bool usesLocalCoords)
: fLocalMatrix(localMatrix), fUsesLocalCoords(usesLocalCoords) {
this->initClassID<QuadEdgeEffect>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInQuadEdge = &this->addVertexAttrib("inQuadEdge", kVec4f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInQuadEdge = &this->addVertexAttrib("inQuadEdge", kHalf4_GrVertexAttribType);
}
const Attribute* fInPosition;
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 0d8ef94413..8090f43d00 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -983,9 +983,9 @@ DashingCircleEffect::DashingCircleEffect(GrColor color,
, fUsesLocalCoords(usesLocalCoords)
, fAAMode(aaMode) {
this->initClassID<DashingCircleEffect>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
- fInDashParams = &this->addVertexAttrib("inDashParams", kVec3f_GrVertexAttribType);
- fInCircleParams = &this->addVertexAttrib("inCircleParams", kVec2f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInDashParams = &this->addVertexAttrib("inDashParams", kHalf3_GrVertexAttribType);
+ fInCircleParams = &this->addVertexAttrib("inCircleParams", kHalf2_GrVertexAttribType);
}
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
@@ -1205,9 +1205,9 @@ DashingLineEffect::DashingLineEffect(GrColor color,
, fUsesLocalCoords(usesLocalCoords)
, fAAMode(aaMode) {
this->initClassID<DashingLineEffect>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
- fInDashParams = &this->addVertexAttrib("inDashParams", kVec3f_GrVertexAttribType);
- fInRectParams = &this->addVertexAttrib("inRect", kVec4f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInDashParams = &this->addVertexAttrib("inDashParams", kHalf3_GrVertexAttribType);
+ fInRectParams = &this->addVertexAttrib("inRect", kHalf4_GrVertexAttribType);
}
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index c29fe12a7a..5c46563316 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -199,10 +199,9 @@ private:
MSAAQuadProcessor(const SkMatrix& viewMatrix)
: fViewMatrix(viewMatrix) {
this->initClassID<MSAAQuadProcessor>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInUV = &this->addVertexAttrib("inUV", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInUV = &this->addVertexAttrib("inUV", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
this->setSampleShading(1.0f);
}
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 89e3afb3dd..b29ecf7ee9 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -70,23 +70,21 @@ public:
const SkMatrix& localMatrix)
: fLocalMatrix(localMatrix) {
this->initClassID<CircleGeometryProcessor>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kVec4f_GrVertexAttribType,
- kHigh_GrSLPrecision);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kFloat4_GrVertexAttribType);
if (clipPlane) {
- fInClipPlane = &this->addVertexAttrib("inClipPlane", kVec3f_GrVertexAttribType);
+ fInClipPlane = &this->addVertexAttrib("inClipPlane", kHalf3_GrVertexAttribType);
} else {
fInClipPlane = nullptr;
}
if (isectPlane) {
- fInIsectPlane = &this->addVertexAttrib("inIsectPlane", kVec3f_GrVertexAttribType);
+ fInIsectPlane = &this->addVertexAttrib("inIsectPlane", kHalf3_GrVertexAttribType);
} else {
fInIsectPlane = nullptr;
}
if (unionPlane) {
- fInUnionPlane = &this->addVertexAttrib("inUnionPlane", kVec3f_GrVertexAttribType);
+ fInUnionPlane = &this->addVertexAttrib("inUnionPlane", kHalf3_GrVertexAttribType);
} else {
fInUnionPlane = nullptr;
}
@@ -242,10 +240,10 @@ class EllipseGeometryProcessor : public GrGeometryProcessor {
public:
EllipseGeometryProcessor(bool stroke, const SkMatrix& localMatrix) : fLocalMatrix(localMatrix) {
this->initClassID<EllipseGeometryProcessor>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInEllipseOffset = &this->addVertexAttrib("inEllipseOffset", kVec2f_GrVertexAttribType);
- fInEllipseRadii = &this->addVertexAttrib("inEllipseRadii", kVec4f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInEllipseOffset = &this->addVertexAttrib("inEllipseOffset", kHalf2_GrVertexAttribType);
+ fInEllipseRadii = &this->addVertexAttrib("inEllipseRadii", kHalf4_GrVertexAttribType);
fStroke = stroke;
}
@@ -383,11 +381,10 @@ public:
DIEllipseGeometryProcessor(const SkMatrix& viewMatrix, DIEllipseStyle style)
: fViewMatrix(viewMatrix) {
this->initClassID<DIEllipseGeometryProcessor>();
- fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInEllipseOffsets0 = &this->addVertexAttrib("inEllipseOffsets0", kVec2f_GrVertexAttribType);
- fInEllipseOffsets1 = &this->addVertexAttrib("inEllipseOffsets1", kVec2f_GrVertexAttribType);
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
+ fInEllipseOffsets0 = &this->addVertexAttrib("inEllipseOffsets0", kHalf2_GrVertexAttribType);
+ fInEllipseOffsets1 = &this->addVertexAttrib("inEllipseOffsets1", kHalf2_GrVertexAttribType);
fStyle = style;
}
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 724d26b981..7ef7757939 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -177,8 +177,7 @@ private:
: fColorSpaceXform(std::move(csxf)) {
SkASSERT(proxyCnt > 0 && samplerCnt >= proxyCnt);
this->initClassID<TextureGeometryProcessor>();
- fPositions =
- this->addVertexAttrib("position", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+ fPositions = this->addVertexAttrib("position", kFloat2_GrVertexAttribType);
fSamplers[0].reset(std::move(proxies[0]), filters[0]);
this->addTextureSampler(&fSamplers[0]);
for (int i = 1; i < proxyCnt; ++i) {
@@ -199,9 +198,8 @@ private:
fTextureIdx = this->addVertexAttrib("textureIdx", kInt_GrVertexAttribType);
}
- fTextureCoords = this->addVertexAttrib("textureCoords", kVec2f_GrVertexAttribType,
- kHigh_GrSLPrecision);
- fColors = this->addVertexAttrib("color", kVec4ub_GrVertexAttribType);
+ fTextureCoords = this->addVertexAttrib("textureCoords", kFloat2_GrVertexAttribType);
+ fColors = this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType);
}
Attribute fPositions;
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 11dd982fda..ba64532c4e 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -17,26 +17,30 @@
static inline VkFormat attrib_type_to_vkformat(GrVertexAttribType type) {
switch (type) {
case kFloat_GrVertexAttribType:
+ case kHalf_GrVertexAttribType:
return VK_FORMAT_R32_SFLOAT;
- case kVec2f_GrVertexAttribType:
+ case kFloat2_GrVertexAttribType:
+ case kHalf2_GrVertexAttribType:
return VK_FORMAT_R32G32_SFLOAT;
- case kVec3f_GrVertexAttribType:
+ case kFloat3_GrVertexAttribType:
+ case kHalf3_GrVertexAttribType:
return VK_FORMAT_R32G32B32_SFLOAT;
- case kVec4f_GrVertexAttribType:
+ case kFloat4_GrVertexAttribType:
+ case kHalf4_GrVertexAttribType:
return VK_FORMAT_R32G32B32A32_SFLOAT;
- case kVec2i_GrVertexAttribType:
+ case kInt2_GrVertexAttribType:
return VK_FORMAT_R32G32_SINT;
- case kVec3i_GrVertexAttribType:
+ case kInt3_GrVertexAttribType:
return VK_FORMAT_R32G32B32_SINT;
- case kVec4i_GrVertexAttribType:
+ case kInt4_GrVertexAttribType:
return VK_FORMAT_R32G32B32A32_SINT;
- case kUByte_GrVertexAttribType:
+ case kUByte_norm_GrVertexAttribType:
return VK_FORMAT_R8_UNORM;
- case kVec4ub_GrVertexAttribType:
+ case kUByte4_norm_GrVertexAttribType:
return VK_FORMAT_R8G8B8A8_UNORM;
- case kVec2us_norm_GrVertexAttribType:
+ case kUShort2_norm_GrVertexAttribType:
return VK_FORMAT_R16G16_UNORM;
- case kVec2us_uint_GrVertexAttribType:
+ case kUShort2_GrVertexAttribType:
return VK_FORMAT_R16G16_UINT;
case kInt_GrVertexAttribType:
return VK_FORMAT_R32_SINT;