Remove kLinesAdjacency and add kPath from/to GrPrimitiveType
kLinesAdjacency is no longer used while kPath has historically been left out. Change-Id: I84be64a2e8ec79ff299a2bced73ded0be04df38e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246307 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
fd7d6f1fdb
commit
571177f015
@ -90,24 +90,18 @@ enum class GrPrimitiveType {
|
||||
kPoints,
|
||||
kLines, // 1 pix wide only
|
||||
kLineStrip, // 1 pix wide only
|
||||
kLinesAdjacency // requires geometry shader support.
|
||||
kPath
|
||||
};
|
||||
static constexpr int kNumGrPrimitiveTypes = (int)GrPrimitiveType::kLinesAdjacency + 1;
|
||||
static constexpr int kNumGrPrimitiveTypes = (int)GrPrimitiveType::kPath + 1;
|
||||
|
||||
static constexpr bool GrIsPrimTypeLines(GrPrimitiveType type) {
|
||||
return GrPrimitiveType::kLines == type ||
|
||||
GrPrimitiveType::kLineStrip == type ||
|
||||
GrPrimitiveType::kLinesAdjacency == type;
|
||||
return GrPrimitiveType::kLines == type || GrPrimitiveType::kLineStrip == type;
|
||||
}
|
||||
|
||||
static constexpr bool GrIsPrimTypeTris(GrPrimitiveType type) {
|
||||
return GrPrimitiveType::kTriangles == type || GrPrimitiveType::kTriangleStrip == type;
|
||||
}
|
||||
|
||||
static constexpr bool GrPrimTypeRequiresGeometryShaderSupport(GrPrimitiveType type) {
|
||||
return GrPrimitiveType::kLinesAdjacency == type;
|
||||
}
|
||||
|
||||
enum class GrPrimitiveRestart : bool {
|
||||
kNo = false,
|
||||
kYes = true
|
||||
|
@ -83,8 +83,6 @@ bool GrOpsRenderPass::draw(const GrPrimitiveProcessor& primProc, const GrPipelin
|
||||
#ifdef SK_DEBUG
|
||||
SkASSERT(!primProc.hasInstanceAttributes() || this->gpu()->caps()->instanceAttribSupport());
|
||||
for (int i = 0; i < meshCount; ++i) {
|
||||
SkASSERT(!GrPrimTypeRequiresGeometryShaderSupport(meshes[i].primitiveType()) ||
|
||||
this->gpu()->caps()->shaderCaps()->geometryShaderSupport());
|
||||
SkASSERT(primProc.hasVertexAttributes() == meshes[i].hasVertexData());
|
||||
SkASSERT(primProc.hasInstanceAttributes() == meshes[i].hasInstanceData());
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ static dawn::PrimitiveTopology to_dawn_primitive_topology(GrPrimitiveType primit
|
||||
return dawn::PrimitiveTopology::LineList;
|
||||
case GrPrimitiveType::kLineStrip:
|
||||
return dawn::PrimitiveTopology::LineStrip;
|
||||
case GrPrimitiveType::kLinesAdjacency:
|
||||
case GrPrimitiveType::kPath:
|
||||
default:
|
||||
SkASSERT(!"unsupported primitive topology");
|
||||
return dawn::PrimitiveTopology::TriangleList;
|
||||
|
@ -2259,8 +2259,9 @@ static GrGLenum gr_primitive_type_to_gl_mode(GrPrimitiveType primitiveType) {
|
||||
return GR_GL_LINES;
|
||||
case GrPrimitiveType::kLineStrip:
|
||||
return GR_GL_LINE_STRIP;
|
||||
case GrPrimitiveType::kLinesAdjacency:
|
||||
return GR_GL_LINES_ADJACENCY;
|
||||
case GrPrimitiveType::kPath:
|
||||
SK_ABORT("non-mesh-based GrPrimitiveType");
|
||||
return 0;
|
||||
}
|
||||
SK_ABORT("invalid GrPrimitiveType");
|
||||
}
|
||||
|
@ -48,9 +48,7 @@ static const char* input_type_name(GrGLSLGeometryBuilder::InputType in) {
|
||||
switch (in) {
|
||||
case InputType::kPoints: return "points";
|
||||
case InputType::kLines: return "lines";
|
||||
case InputType::kLinesAdjacency: return "lines_adjacency";
|
||||
case InputType::kTriangles: return "triangles";
|
||||
case InputType::kTrianglesAdjacency: return "triangles_adjacency";
|
||||
}
|
||||
SK_ABORT("invalid input type");
|
||||
}
|
||||
|
@ -52,9 +52,7 @@ public:
|
||||
enum class InputType {
|
||||
kPoints,
|
||||
kLines,
|
||||
kLinesAdjacency,
|
||||
kTriangles,
|
||||
kTrianglesAdjacency
|
||||
};
|
||||
|
||||
enum class OutputType {
|
||||
|
@ -305,7 +305,6 @@ void GrMtlOpsRenderPass::sendMeshToGpu(GrPrimitiveType primitiveType,
|
||||
int baseVertex) {
|
||||
this->bindGeometry(vertexBuffer, 0, nullptr);
|
||||
|
||||
SkASSERT(primitiveType != GrPrimitiveType::kLinesAdjacency); // Geometry shaders not supported.
|
||||
[fActiveRenderCmdEncoder drawPrimitives:gr_to_mtl_primitive(primitiveType)
|
||||
vertexStart:baseVertex
|
||||
vertexCount:vertexCount];
|
||||
@ -322,7 +321,6 @@ void GrMtlOpsRenderPass::sendIndexedMeshToGpu(GrPrimitiveType primitiveType,
|
||||
GrPrimitiveRestart restart) {
|
||||
this->bindGeometry(vertexBuffer, fCurrentVertexStride*baseVertex, nullptr);
|
||||
|
||||
SkASSERT(primitiveType != GrPrimitiveType::kLinesAdjacency); // Geometry shaders not supported.
|
||||
id<MTLBuffer> mtlIndexBuffer = nil;
|
||||
if (indexBuffer) {
|
||||
SkASSERT(!indexBuffer->isCpuBuffer());
|
||||
@ -352,7 +350,6 @@ void GrMtlOpsRenderPass::sendInstancedMeshToGpu(GrPrimitiveType primitiveType,
|
||||
int baseInstance) {
|
||||
this->bindGeometry(vertexBuffer, 0, instanceBuffer);
|
||||
|
||||
SkASSERT(primitiveType != GrPrimitiveType::kLinesAdjacency); // Geometry shaders not supported.
|
||||
[fActiveRenderCmdEncoder drawPrimitives:gr_to_mtl_primitive(primitiveType)
|
||||
vertexStart:baseVertex
|
||||
vertexCount:vertexCount
|
||||
@ -372,7 +369,6 @@ void GrMtlOpsRenderPass::sendIndexedInstancedMeshToGpu(GrPrimitiveType primitive
|
||||
GrPrimitiveRestart restart) {
|
||||
this->bindGeometry(vertexBuffer, 0, instanceBuffer);
|
||||
|
||||
SkASSERT(primitiveType != GrPrimitiveType::kLinesAdjacency); // Geometry shaders not supported.
|
||||
id<MTLBuffer> mtlIndexBuffer = nil;
|
||||
if (indexBuffer) {
|
||||
SkASSERT(!indexBuffer->isCpuBuffer());
|
||||
|
@ -605,8 +605,9 @@ static uint32_t seed_vertices(GrPrimitiveType type) {
|
||||
case GrPrimitiveType::kLines:
|
||||
case GrPrimitiveType::kLineStrip:
|
||||
return 2;
|
||||
case GrPrimitiveType::kLinesAdjacency:
|
||||
return 4;
|
||||
case GrPrimitiveType::kPath:
|
||||
SkASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
SK_ABORT("Incomplete switch\n");
|
||||
}
|
||||
@ -621,8 +622,9 @@ static uint32_t primitive_vertices(GrPrimitiveType type) {
|
||||
case GrPrimitiveType::kPoints:
|
||||
case GrPrimitiveType::kLineStrip:
|
||||
return 1;
|
||||
case GrPrimitiveType::kLinesAdjacency:
|
||||
return 4;
|
||||
case GrPrimitiveType::kPath:
|
||||
SkASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
SK_ABORT("Incomplete switch\n");
|
||||
}
|
||||
@ -658,8 +660,7 @@ GR_DRAW_OP_TEST_DEFINE(DrawVerticesOp) {
|
||||
GrPrimitiveType type;
|
||||
do {
|
||||
type = GrPrimitiveType(random->nextULessThan(kNumGrPrimitiveTypes));
|
||||
} while (GrPrimTypeRequiresGeometryShaderSupport(type) &&
|
||||
!context->priv().caps()->shaderCaps()->geometryShaderSupport());
|
||||
} while (type == GrPrimitiveType::kPath);
|
||||
|
||||
uint32_t primitiveCount = random->nextRangeU(1, 100);
|
||||
|
||||
|
@ -160,8 +160,8 @@ static VkPrimitiveTopology gr_primitive_type_to_vk_topology(GrPrimitiveType prim
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
case GrPrimitiveType::kLineStrip:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
case GrPrimitiveType::kLinesAdjacency:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY;
|
||||
case GrPrimitiveType::kPath:
|
||||
SK_ABORT("Unsupported primitive type");
|
||||
}
|
||||
SK_ABORT("invalid GrPrimitiveType");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user