aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-06-13 10:55:06 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-13 18:18:23 +0000
commit3809bab7ed344ad140346c38e149dabf10bd525f (patch)
tree4bd274cb01c35b8f996bbb113df5cf684d6b48a7 /src/gpu/vk
parentf1debdf2b065cd3ec5f4501d84152366442719c4 (diff)
Add GrPrimitiveType::kLinesAdjacency
Converts GrPrimitiveType to an enum class and adds kLinesAdjacency. Bug: skia: Change-Id: I3b5e68acfb20476f6c6923968f5a4ac4f73ae12d Reviewed-on: https://skia-review.googlesource.com/19680 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r--src/gpu/vk/GrVkPipeline.cpp31
-rw-r--r--src/gpu/vk/GrVkPipelineState.cpp4
2 files changed, 23 insertions, 12 deletions
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 0b4289edec..567d6e89f6 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -94,24 +94,35 @@ static void setup_vertex_input_state(const GrPrimitiveProcessor& primProc,
vertexInputInfo->pVertexAttributeDescriptions = attributeDesc;
}
+static VkPrimitiveTopology gr_primitive_type_to_vk_topology(GrPrimitiveType primitiveType) {
+ switch (primitiveType) {
+ case GrPrimitiveType::kTriangles:
+ return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+ case GrPrimitiveType::kTriangleStrip:
+ return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
+ case GrPrimitiveType::kTriangleFan:
+ return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
+ case GrPrimitiveType::kPoints:
+ return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
+ case GrPrimitiveType::kLines:
+ 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;
+ }
+ SkFAIL("invalid GrPrimitiveType");
+ return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+}
static void setup_input_assembly_state(GrPrimitiveType primitiveType,
VkPipelineInputAssemblyStateCreateInfo* inputAssemblyInfo) {
- static const VkPrimitiveTopology gPrimitiveType2VkTopology[] = {
- VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
- VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
- VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
- VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
- VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
- VK_PRIMITIVE_TOPOLOGY_LINE_STRIP
- };
-
memset(inputAssemblyInfo, 0, sizeof(VkPipelineInputAssemblyStateCreateInfo));
inputAssemblyInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
inputAssemblyInfo->pNext = nullptr;
inputAssemblyInfo->flags = 0;
inputAssemblyInfo->primitiveRestartEnable = false;
- inputAssemblyInfo->topology = gPrimitiveType2VkTopology[primitiveType];
+ inputAssemblyInfo->topology = gr_primitive_type_to_vk_topology(primitiveType);
}
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 525d75f3da..eb4a516343 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -570,7 +570,7 @@ bool GrVkPipelineState::Desc::Build(Desc* desc,
const GrStencilSettings& stencil,
GrPrimitiveType primitiveType,
const GrShaderCaps& caps) {
- if (!INHERITED::Build(desc, primProc, primitiveType == kPoints_GrPrimitiveType, pipeline,
+ if (!INHERITED::Build(desc, primProc, primitiveType == GrPrimitiveType::kPoints, pipeline,
caps)) {
return false;
}
@@ -583,7 +583,7 @@ bool GrVkPipelineState::Desc::Build(Desc* desc,
b.add32(get_blend_info_key(pipeline));
- b.add32(primitiveType);
+ b.add32((uint32_t)primitiveType);
return true;
}