[graphite] Use 32 bit integers for SSBO indices
This hasn't been a problem in the past, because we've limited
the number of draws in a DrawPass to at most 16k (defined in
DrawList::kMaxRenderSteps), and we batch all uniform uploads for a
single pipeline such that all storage buffer indices will be within
16k elements of their respective storage buffer binding offset.
With changes to uniform management such that we no longer batch uniform
uploads by pipeline in http://review.skia.org/898257, we always bind to
the start of storage buffers and index relative to that binding. So our
indices may be greater than 16k, maybe even more than 64k, and we need
more than 16 bits to represent them.
Change-Id: Ica5833a681881943ee07984043d3c53c5e36bfc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/904783
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: James Godfrey-Kittle <jamesgk@google.com>
diff --git a/src/gpu/graphite/ContextUtils.cpp b/src/gpu/graphite/ContextUtils.cpp
index 7827065..612840b 100644
--- a/src/gpu/graphite/ContextUtils.cpp
+++ b/src/gpu/graphite/ContextUtils.cpp
@@ -525,7 +525,7 @@
};
if (emitSsboIndicesVarying) {
- appendVarying({RenderStep::ssboIndicesVarying(), SkSLType::kUShort2});
+ appendVarying({RenderStep::ssboIndicesVarying(), SkSLType::kUInt2});
}
if (emitLocalCoordsVarying) {
diff --git a/src/gpu/graphite/DrawPass.cpp b/src/gpu/graphite/DrawPass.cpp
index d472bfa..d23b6f8 100644
--- a/src/gpu/graphite/DrawPass.cpp
+++ b/src/gpu/graphite/DrawPass.cpp
@@ -674,7 +674,7 @@
(key.shadingUniformIndex() == UniformCache::kInvalidIndex)
? 0
: key.shadingUniformIndex();
- skvx::ushort2 ssboIndices = {SkToU16(geometrySsboIndex), SkToU16(shadingSsboIndex)};
+ skvx::uint2 ssboIndices = {geometrySsboIndex, shadingSsboIndex};
renderStep.writeVertices(&drawWriter, draw.fDrawParams, ssboIndices);
if (bufferMgr->hasMappingFailed()) {
diff --git a/src/gpu/graphite/DrawTypes.h b/src/gpu/graphite/DrawTypes.h
index 710b446..a2467bd 100644
--- a/src/gpu/graphite/DrawTypes.h
+++ b/src/gpu/graphite/DrawTypes.h
@@ -42,6 +42,7 @@
kInt2, // vector of 2 32-bit ints
kInt3, // vector of 3 32-bit ints
kInt4, // vector of 4 32-bit ints
+ kUInt2, // vector of 2 32-bit unsigned ints
kByte, // signed byte
kByte2, // vector of 2 8-bit signed bytes
@@ -96,6 +97,8 @@
return 3 * sizeof(int32_t);
case VertexAttribType::kInt4:
return 4 * sizeof(int32_t);
+ case VertexAttribType::kUInt2:
+ return 2 * sizeof(uint32_t);
case VertexAttribType::kByte:
return 1 * sizeof(char);
case VertexAttribType::kByte2:
diff --git a/src/gpu/graphite/Renderer.h b/src/gpu/graphite/Renderer.h
index df936d2..45bb968 100644
--- a/src/gpu/graphite/Renderer.h
+++ b/src/gpu/graphite/Renderer.h
@@ -67,7 +67,7 @@
// The DrawWriter is configured with the vertex and instance strides of the RenderStep, and its
// primitive type. The recorded draws will be executed with a graphics pipeline compatible with
// this RenderStep.
- virtual void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const = 0;
+ virtual void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const = 0;
// Write out the uniform values (aligned for the layout), textures, and samplers. The uniform
// values will be de-duplicated across all draws using the RenderStep before uploading to the
diff --git a/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp b/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp
index 764531a..43ce76c 100644
--- a/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp
+++ b/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp
@@ -55,6 +55,8 @@
return wgpu::VertexFormat::Sint32x3;
case VertexAttribType::kInt4:
return wgpu::VertexFormat::Sint32x4;
+ case VertexAttribType::kUInt2:
+ return wgpu::VertexFormat::Uint32x2;
case VertexAttribType::kByte2:
return wgpu::VertexFormat::Sint8x2;
case VertexAttribType::kByte4:
diff --git a/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm b/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm
index 8f2c00b..47a5c70 100644
--- a/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm
+++ b/src/gpu/graphite/mtl/MtlGraphicsPipeline.mm
@@ -53,6 +53,8 @@
return MTLVertexFormatInt3;
case VertexAttribType::kInt4:
return MTLVertexFormatInt4;
+ case VertexAttribType::kUInt2:
+ return MTLVertexFormatUInt2;
case VertexAttribType::kByte:
if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
return MTLVertexFormatChar;
diff --git a/src/gpu/graphite/render/AnalyticBlurRenderStep.cpp b/src/gpu/graphite/render/AnalyticBlurRenderStep.cpp
index 51c45d7..9b005da 100644
--- a/src/gpu/graphite/render/AnalyticBlurRenderStep.cpp
+++ b/src/gpu/graphite/render/AnalyticBlurRenderStep.cpp
@@ -30,7 +30,7 @@
kDirectDepthGreaterPass,
/*vertexAttrs=*/
{{"position", VertexAttribType::kFloat2, SkSLType::kFloat2},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}},
/*instanceAttrs=*/{},
/*varyings=*/
// scaledShapeCoords are the fragment coordinates in local shape space, where
@@ -60,7 +60,7 @@
void AnalyticBlurRenderStep::writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
const Rect& r = params.geometry().analyticBlurMask().drawBounds();
DrawWriter::Vertices verts{*writer};
verts.append(6) << skvx::float2(r.left(), r.top()) << ssboIndices
diff --git a/src/gpu/graphite/render/AnalyticBlurRenderStep.h b/src/gpu/graphite/render/AnalyticBlurRenderStep.h
index ca557cf..6ce68b3 100644
--- a/src/gpu/graphite/render/AnalyticBlurRenderStep.h
+++ b/src/gpu/graphite/render/AnalyticBlurRenderStep.h
@@ -22,7 +22,7 @@
int* nextBindingIndex) const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
};
diff --git a/src/gpu/graphite/render/AnalyticRRectRenderStep.cpp b/src/gpu/graphite/render/AnalyticRRectRenderStep.cpp
index 3de7170..e82e616 100644
--- a/src/gpu/graphite/render/AnalyticRRectRenderStep.cpp
+++ b/src/gpu/graphite/render/AnalyticRRectRenderStep.cpp
@@ -369,7 +369,7 @@
// TODO: pack depth and ssbo index into one 32-bit attribute, if we can
// go without needing both render step and paint ssbo index attributes.
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2},
{"mat0", VertexAttribType::kFloat3, SkSLType::kFloat3},
{"mat1", VertexAttribType::kFloat3, SkSLType::kFloat3},
@@ -458,7 +458,7 @@
void AnalyticRRectRenderStep::writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
SkASSERT(params.geometry().isShape() || params.geometry().isEdgeAAQuad());
DrawWriter::Instances instance{*writer, fVertexBuffer, fIndexBuffer, kIndexCount};
diff --git a/src/gpu/graphite/render/AnalyticRRectRenderStep.h b/src/gpu/graphite/render/AnalyticRRectRenderStep.h
index 3afd002..cd5ae3b 100644
--- a/src/gpu/graphite/render/AnalyticRRectRenderStep.h
+++ b/src/gpu/graphite/render/AnalyticRRectRenderStep.h
@@ -23,7 +23,7 @@
std::string vertexSkSL() const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/BitmapTextRenderStep.cpp b/src/gpu/graphite/render/BitmapTextRenderStep.cpp
index 507ab9a..6230375 100644
--- a/src/gpu/graphite/render/BitmapTextRenderStep.cpp
+++ b/src/gpu/graphite/render/BitmapTextRenderStep.cpp
@@ -63,7 +63,7 @@
{"indexAndFlags", VertexAttribType::kUShort2, SkSLType::kUShort2},
{"strikeToSourceScale", VertexAttribType::kFloat, SkSLType::kFloat},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}},
/*varyings=*/
{{"textureCoords", SkSLType::kFloat2},
{"texIndex", SkSLType::kHalf},
@@ -145,7 +145,7 @@
void BitmapTextRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
const SubRunData& subRunData = params.geometry().subRunData();
subRunData.subRun()->vertexFiller().fillInstanceData(dw,
diff --git a/src/gpu/graphite/render/BitmapTextRenderStep.h b/src/gpu/graphite/render/BitmapTextRenderStep.h
index 762d8c2..038e661 100644
--- a/src/gpu/graphite/render/BitmapTextRenderStep.h
+++ b/src/gpu/graphite/render/BitmapTextRenderStep.h
@@ -31,7 +31,7 @@
const char* fragmentColorSkSL() const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/CoverBoundsRenderStep.cpp b/src/gpu/graphite/render/CoverBoundsRenderStep.cpp
index 72acce3..6aa12b3 100644
--- a/src/gpu/graphite/render/CoverBoundsRenderStep.cpp
+++ b/src/gpu/graphite/render/CoverBoundsRenderStep.cpp
@@ -24,7 +24,7 @@
/*vertexAttrs=*/ {},
/*instanceAttrs=*/{{"bounds", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2},
{"mat0", VertexAttribType::kFloat3, SkSLType::kFloat3},
{"mat1", VertexAttribType::kFloat3, SkSLType::kFloat3},
{"mat2", VertexAttribType::kFloat3, SkSLType::kFloat3}}) {}
@@ -42,7 +42,7 @@
void CoverBoundsRenderStep::writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
// Each instance is 4 vertices, forming 2 triangles from a single triangle strip, so no indices
// are needed. sk_VertexID is used to place vertex positions, so no vertex buffer is needed.
DrawWriter::Instances instances{*writer, {}, {}, 4};
diff --git a/src/gpu/graphite/render/CoverBoundsRenderStep.h b/src/gpu/graphite/render/CoverBoundsRenderStep.h
index a2d0eff..b4767fd 100644
--- a/src/gpu/graphite/render/CoverBoundsRenderStep.h
+++ b/src/gpu/graphite/render/CoverBoundsRenderStep.h
@@ -19,7 +19,7 @@
~CoverBoundsRenderStep() override;
std::string vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/CoverageMaskRenderStep.cpp b/src/gpu/graphite/render/CoverageMaskRenderStep.cpp
index 4eb41a7..5f76056 100644
--- a/src/gpu/graphite/render/CoverageMaskRenderStep.cpp
+++ b/src/gpu/graphite/render/CoverageMaskRenderStep.cpp
@@ -57,7 +57,7 @@
// Remaining translation extracted from actual 'maskToDevice' transform.
{"deviceOrigin", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"depth" , VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2},
// deviceToLocal matrix for producing local coords for shader evaluation
{"mat0", VertexAttribType::kFloat3, SkSLType::kFloat3},
{"mat1", VertexAttribType::kFloat3, SkSLType::kFloat3},
@@ -97,7 +97,7 @@
void CoverageMaskRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
const CoverageMaskShape& coverageMask = params.geometry().coverageMaskShape();
const TextureProxy* proxy = coverageMask.textureProxy();
SkASSERT(proxy);
diff --git a/src/gpu/graphite/render/CoverageMaskRenderStep.h b/src/gpu/graphite/render/CoverageMaskRenderStep.h
index 80a8837..8c5be88 100644
--- a/src/gpu/graphite/render/CoverageMaskRenderStep.h
+++ b/src/gpu/graphite/render/CoverageMaskRenderStep.h
@@ -22,7 +22,7 @@
int* nextBindingIndex) const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
};
diff --git a/src/gpu/graphite/render/GraphiteVertexFiller.cpp b/src/gpu/graphite/render/GraphiteVertexFiller.cpp
index c964e46..adb49bf 100644
--- a/src/gpu/graphite/render/GraphiteVertexFiller.cpp
+++ b/src/gpu/graphite/render/GraphiteVertexFiller.cpp
@@ -25,7 +25,7 @@
void VertexFiller::fillInstanceData(skgpu::graphite::DrawWriter* dw,
int offset, int count,
unsigned short flags,
- skvx::ushort2 ssboIndex,
+ skvx::uint2 ssboIndex,
SkSpan<const Glyph*> glyphs,
SkScalar depth) const {
auto quadData = [&]() {
diff --git a/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp b/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp
index ced5223..9e57fe4 100644
--- a/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp
+++ b/src/gpu/graphite/render/MiddleOutFanRenderStep.cpp
@@ -27,7 +27,7 @@
/*vertexAttrs=*/
{{"position", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}},
/*instanceAttrs=*/{}) {}
MiddleOutFanRenderStep::~MiddleOutFanRenderStep() {}
@@ -42,7 +42,7 @@
void MiddleOutFanRenderStep::writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
// TODO: Have Shape provide a path-like iterator so we don't actually have to convert non
// paths to SkPath just to iterate their pts/verbs
SkPath path = params.geometry().shape().asPath();
diff --git a/src/gpu/graphite/render/MiddleOutFanRenderStep.h b/src/gpu/graphite/render/MiddleOutFanRenderStep.h
index 10d6320f..7f39f85 100644
--- a/src/gpu/graphite/render/MiddleOutFanRenderStep.h
+++ b/src/gpu/graphite/render/MiddleOutFanRenderStep.h
@@ -22,7 +22,7 @@
~MiddleOutFanRenderStep() override;
std::string vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
};
diff --git a/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.cpp b/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.cpp
index b9c163b..69ccc1e 100644
--- a/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.cpp
+++ b/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.cpp
@@ -194,7 +194,7 @@
// TODO: pack depth and ssbo index into one 32-bit attribute, if we can
// go without needing both render step and paint ssbo index attributes.
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2},
{"mat0", VertexAttribType::kFloat3, SkSLType::kFloat3},
{"mat1", VertexAttribType::kFloat3, SkSLType::kFloat3},
@@ -237,7 +237,7 @@
void PerEdgeAAQuadRenderStep::writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
SkASSERT(params.geometry().isEdgeAAQuad());
const EdgeAAQuad& quad = params.geometry().edgeAAQuad();
diff --git a/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.h b/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.h
index 8f07cf0..33c9c01 100644
--- a/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.h
+++ b/src/gpu/graphite/render/PerEdgeAAQuadRenderStep.h
@@ -23,7 +23,7 @@
std::string vertexSkSL() const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/SDFTextLCDRenderStep.cpp b/src/gpu/graphite/render/SDFTextLCDRenderStep.cpp
index ef9d8d1..7e94821 100644
--- a/src/gpu/graphite/render/SDFTextLCDRenderStep.cpp
+++ b/src/gpu/graphite/render/SDFTextLCDRenderStep.cpp
@@ -53,7 +53,7 @@
{"indexAndFlags", VertexAttribType::kUShort2, SkSLType::kUShort2},
{"strikeToSourceScale", VertexAttribType::kFloat, SkSLType::kFloat},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}},
/*varyings=*/
{{"unormTexCoords", SkSLType::kFloat2},
{"textureCoords", SkSLType::kFloat2},
@@ -114,7 +114,7 @@
void SDFTextLCDRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
const SubRunData& subRunData = params.geometry().subRunData();
subRunData.subRun()->vertexFiller().fillInstanceData(dw,
subRunData.startGlyphIndex(),
diff --git a/src/gpu/graphite/render/SDFTextLCDRenderStep.h b/src/gpu/graphite/render/SDFTextLCDRenderStep.h
index 6634eeb..230cdc4 100644
--- a/src/gpu/graphite/render/SDFTextLCDRenderStep.h
+++ b/src/gpu/graphite/render/SDFTextLCDRenderStep.h
@@ -25,7 +25,7 @@
int* nextBindingIndex) const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
};
diff --git a/src/gpu/graphite/render/SDFTextRenderStep.cpp b/src/gpu/graphite/render/SDFTextRenderStep.cpp
index e5c9c7a..7751a30 100644
--- a/src/gpu/graphite/render/SDFTextRenderStep.cpp
+++ b/src/gpu/graphite/render/SDFTextRenderStep.cpp
@@ -54,7 +54,7 @@
{"indexAndFlags", VertexAttribType::kUShort2, SkSLType::kUShort2},
{"strikeToSourceScale", VertexAttribType::kFloat, SkSLType::kFloat},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}},
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}},
/*varyings=*/
{{"unormTexCoords", SkSLType::kFloat2},
{"textureCoords", SkSLType::kFloat2},
@@ -114,7 +114,7 @@
void SDFTextRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
const SubRunData& subRunData = params.geometry().subRunData();
subRunData.subRun()->vertexFiller().fillInstanceData(dw,
subRunData.startGlyphIndex(),
diff --git a/src/gpu/graphite/render/SDFTextRenderStep.h b/src/gpu/graphite/render/SDFTextRenderStep.h
index cdcf646..5037cd3 100644
--- a/src/gpu/graphite/render/SDFTextRenderStep.h
+++ b/src/gpu/graphite/render/SDFTextRenderStep.h
@@ -25,7 +25,7 @@
int* nextBindingIndex) const override;
const char* fragmentCoverageSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
};
diff --git a/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp b/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp
index 655d09a..ee15d94 100644
--- a/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp
+++ b/src/gpu/graphite/render/TessellateCurvesRenderStep.cpp
@@ -46,14 +46,14 @@
{"p01", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"p23", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}};
static constexpr Attribute kAttributesWithCurveType[] = {
{"p01", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"p23", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
{"curveType", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}};
static constexpr SkSpan<const Attribute> kAttributes[2] = {kAttributesWithCurveType,
kBaseAttributes};
@@ -112,7 +112,7 @@
void TessellateCurvesRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
SkPath path = params.geometry().shape().asPath(); // TODO: Iterate the Shape directly
int patchReserveCount = FixedCountCurves::PreallocCount(path.countVerbs());
diff --git a/src/gpu/graphite/render/TessellateCurvesRenderStep.h b/src/gpu/graphite/render/TessellateCurvesRenderStep.h
index 41d58b2..2db55bb 100644
--- a/src/gpu/graphite/render/TessellateCurvesRenderStep.h
+++ b/src/gpu/graphite/render/TessellateCurvesRenderStep.h
@@ -27,7 +27,7 @@
~TessellateCurvesRenderStep() override;
std::string vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp b/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp
index 43ba3b1..60ef2e9 100644
--- a/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp
+++ b/src/gpu/graphite/render/TessellateStrokesRenderStep.cpp
@@ -59,7 +59,7 @@
{"prevPoint", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"stroke", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}};
static constexpr Attribute kAttributesWithCurveType[] = {
{"p01", VertexAttribType::kFloat4, SkSLType::kFloat4},
@@ -68,7 +68,7 @@
{"stroke", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
{"curveType", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}};
static constexpr SkSpan<const Attribute> kAttributes[2] = {kAttributesWithCurveType,
kBaseAttributes};
@@ -111,7 +111,7 @@
void TessellateStrokesRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
SkPath path = params.geometry().shape().asPath(); // TODO: Iterate the Shape directly
int patchReserveCount = FixedCountStrokes::PreallocCount(path.countVerbs());
diff --git a/src/gpu/graphite/render/TessellateStrokesRenderStep.h b/src/gpu/graphite/render/TessellateStrokesRenderStep.h
index ee92fec..b0198ed 100644
--- a/src/gpu/graphite/render/TessellateStrokesRenderStep.h
+++ b/src/gpu/graphite/render/TessellateStrokesRenderStep.h
@@ -22,7 +22,7 @@
~TessellateStrokesRenderStep() override;
std::string vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp b/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp
index 57cb102..86a5452 100644
--- a/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp
+++ b/src/gpu/graphite/render/TessellateWedgesRenderStep.cpp
@@ -48,7 +48,7 @@
{"p23", VertexAttribType::kFloat4, SkSLType::kFloat4},
{"fanPointAttrib", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}};
static constexpr Attribute kAttributesWithCurveType[] = {
{"p01", VertexAttribType::kFloat4, SkSLType::kFloat4},
@@ -56,7 +56,7 @@
{"fanPointAttrib", VertexAttribType::kFloat2, SkSLType::kFloat2},
{"depth", VertexAttribType::kFloat, SkSLType::kFloat},
{"curveType", VertexAttribType::kFloat, SkSLType::kFloat},
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2}};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2}};
static constexpr SkSpan<const Attribute> kAttributes[2] = {kAttributesWithCurveType,
kBaseAttributes};
@@ -124,7 +124,7 @@
void TessellateWedgesRenderStep::writeVertices(DrawWriter* dw,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
SkPath path = params.geometry().shape().asPath(); // TODO: Iterate the Shape directly
int patchReserveCount = FixedCountWedges::PreallocCount(path.countVerbs());
diff --git a/src/gpu/graphite/render/TessellateWedgesRenderStep.h b/src/gpu/graphite/render/TessellateWedgesRenderStep.h
index 93dcfa0..6f52e91 100644
--- a/src/gpu/graphite/render/TessellateWedgesRenderStep.h
+++ b/src/gpu/graphite/render/TessellateWedgesRenderStep.h
@@ -30,7 +30,7 @@
static std::pair<BindBufferInfo, BindBufferInfo> CreateVertexTemplate(StaticBufferManager*);
std::string vertexSkSL() const override;
- void writeVertices(DrawWriter*, const DrawParams&, skvx::ushort2 ssboIndices) const override;
+ void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
private:
diff --git a/src/gpu/graphite/render/VerticesRenderStep.cpp b/src/gpu/graphite/render/VerticesRenderStep.cpp
index 1834b41..c728356 100644
--- a/src/gpu/graphite/render/VerticesRenderStep.cpp
+++ b/src/gpu/graphite/render/VerticesRenderStep.cpp
@@ -27,7 +27,7 @@
static constexpr Attribute kColorAttr =
{"vertColor", VertexAttribType::kUByte4_norm, SkSLType::kHalf4};
static constexpr Attribute kSsboIndexAttr =
- {"ssboIndices", VertexAttribType::kUShort2, SkSLType::kUShort2};
+ {"ssboIndices", VertexAttribType::kUInt2, SkSLType::kUInt2};
static constexpr Attribute kAttributePositionOnly[] =
{kPositionAttr, kSsboIndexAttr};
@@ -124,7 +124,7 @@
void VerticesRenderStep::writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const {
+ skvx::uint2 ssboIndices) const {
SkVerticesPriv info(params.geometry().vertices()->priv());
const int vertexCount = info.vertexCount();
const int indexCount = info.indexCount();
diff --git a/src/gpu/graphite/render/VerticesRenderStep.h b/src/gpu/graphite/render/VerticesRenderStep.h
index 9611d53..875a4e2 100644
--- a/src/gpu/graphite/render/VerticesRenderStep.h
+++ b/src/gpu/graphite/render/VerticesRenderStep.h
@@ -22,7 +22,7 @@
std::string vertexSkSL() const override;
void writeVertices(DrawWriter* writer,
const DrawParams& params,
- skvx::ushort2 ssboIndices) const override;
+ skvx::uint2 ssboIndices) const override;
void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
const char* fragmentColorSkSL() const override;
diff --git a/src/gpu/graphite/vk/VulkanGraphicsPipeline.cpp b/src/gpu/graphite/vk/VulkanGraphicsPipeline.cpp
index 15465e1..de16e96 100644
--- a/src/gpu/graphite/vk/VulkanGraphicsPipeline.cpp
+++ b/src/gpu/graphite/vk/VulkanGraphicsPipeline.cpp
@@ -54,6 +54,8 @@
return VK_FORMAT_R32G32B32_SINT;
case VertexAttribType::kInt4:
return VK_FORMAT_R32G32B32A32_SINT;
+ case VertexAttribType::kUInt2:
+ return VK_FORMAT_R32G32_UINT;
case VertexAttribType::kByte:
return VK_FORMAT_R8_SINT;
case VertexAttribType::kByte2:
diff --git a/src/gpu/tessellate/PatchWriter.h b/src/gpu/tessellate/PatchWriter.h
index b83ab00..ce1d6f1 100644
--- a/src/gpu/tessellate/PatchWriter.h
+++ b/src/gpu/tessellate/PatchWriter.h
@@ -242,7 +242,7 @@
DEF_ATTRIB_TYPE(ColorAttrib, PatchAttribs::kColor, Color);
DEF_ATTRIB_TYPE(DepthAttrib, PatchAttribs::kPaintDepth, float);
DEF_ATTRIB_TYPE(CurveTypeAttrib, PatchAttribs::kExplicitCurveType, float);
- DEF_ATTRIB_TYPE(SsboIndexAttrib, PatchAttribs::kSsboIndex, skvx::ushort2);
+ DEF_ATTRIB_TYPE(SsboIndexAttrib, PatchAttribs::kSsboIndex, skvx::uint2);
#undef DEF_ATTRIB_TYPE
static constexpr size_t kMaxStride = 4 * sizeof(SkPoint) + // control points
@@ -252,7 +252,7 @@
(ColorAttrib::kEnabled ? std::min(sizeof(Color), sizeof(SkPMColor4f)) : 0) +
(DepthAttrib::kEnabled ? sizeof(float) : 0) +
(CurveTypeAttrib::kEnabled ? sizeof(float) : 0) +
- (SsboIndexAttrib::kEnabled ? sizeof(int) : 0);
+ (SsboIndexAttrib::kEnabled ? 2 * sizeof(uint32_t) : 0);
// Types that vary depending on the activated features, but do not define the patch data.
using DeferredPatch = std::conditional_t<kTrackJoinControlPoints,
@@ -379,7 +379,7 @@
// Updates the storage buffer index used to access uniforms.
ENABLE_IF(SsboIndexAttrib::kEnabled)
- updateSsboIndexAttrib(skvx::ushort2 ssboIndex) {
+ updateSsboIndexAttrib(skvx::uint2 ssboIndex) {
SkASSERT(fAttribs & PatchAttribs::kSsboIndex);
fSsboIndex = ssboIndex;
}
diff --git a/src/gpu/tessellate/Tessellation.h b/src/gpu/tessellate/Tessellation.h
index e1d2dd8..69d0b25 100644
--- a/src/gpu/tessellate/Tessellation.h
+++ b/src/gpu/tessellate/Tessellation.h
@@ -109,7 +109,7 @@
: sizeof(uint8_t)) * 4 : 0) +
(attribs & PatchAttribs::kPaintDepth ? sizeof(float) : 0) +
(attribs & PatchAttribs::kExplicitCurveType ? sizeof(float) : 0) +
- (attribs & PatchAttribs::kSsboIndex ? (sizeof(int)) : 0);
+ (attribs & PatchAttribs::kSsboIndex ? (sizeof(uint32_t) * 2) : 0);
}
constexpr size_t PatchStride(PatchAttribs attribs) {
return 4*sizeof(SkPoint) + PatchAttribsStride(attribs);
diff --git a/src/text/gpu/VertexFiller.h b/src/text/gpu/VertexFiller.h
index f15502a..9d3b063 100644
--- a/src/text/gpu/VertexFiller.h
+++ b/src/text/gpu/VertexFiller.h
@@ -97,7 +97,7 @@
void fillInstanceData(skgpu::graphite::DrawWriter* dw,
int offset, int count,
unsigned short flags,
- skvx::ushort2 ssboIndex,
+ skvx::uint2 ssboIndex,
SkSpan<const Glyph*> glyphs,
SkScalar depth) const;