本文整理汇总了C++中GrPrimitiveProcessor::getVertexStride方法的典型用法代码示例。如果您正苦于以下问题:C++ GrPrimitiveProcessor::getVertexStride方法的具体用法?C++ GrPrimitiveProcessor::getVertexStride怎么用?C++ GrPrimitiveProcessor::getVertexStride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrPrimitiveProcessor
的用法示例。
在下文中一共展示了GrPrimitiveProcessor::getVertexStride方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup_vertex_input_state
static void setup_vertex_input_state(const GrPrimitiveProcessor& primProc,
VkPipelineVertexInputStateCreateInfo* vertexInputInfo,
VkVertexInputBindingDescription* bindingDesc,
int maxBindingDescCount,
VkVertexInputAttributeDescription* attributeDesc,
int maxAttributeDescCount) {
// for now we have only one vertex buffer and one binding
memset(bindingDesc, 0, sizeof(VkVertexInputBindingDescription));
bindingDesc->binding = 0;
bindingDesc->stride = (uint32_t)primProc.getVertexStride();
bindingDesc->inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
// setup attribute descriptions
int vaCount = primProc.numAttribs();
SkASSERT(vaCount < maxAttributeDescCount);
if (vaCount > 0) {
size_t offset = 0;
for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) {
const GrGeometryProcessor::Attribute& attrib = primProc.getAttrib(attribIndex);
GrVertexAttribType attribType = attrib.fType;
VkVertexInputAttributeDescription& vkAttrib = attributeDesc[attribIndex];
vkAttrib.location = attribIndex; // for now assume location = attribIndex
vkAttrib.binding = 0; // for now only one vertex buffer & binding
vkAttrib.format = attrib_type_to_vkformat(attribType);
vkAttrib.offset = static_cast<uint32_t>(offset);
offset += attrib.fOffset;
}
}
memset(vertexInputInfo, 0, sizeof(VkPipelineVertexInputStateCreateInfo));
vertexInputInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertexInputInfo->pNext = nullptr;
vertexInputInfo->flags = 0;
vertexInputInfo->vertexBindingDescriptionCount = 1;
vertexInputInfo->pVertexBindingDescriptions = bindingDesc;
vertexInputInfo->vertexAttributeDescriptionCount = vaCount;
vertexInputInfo->pVertexAttributeDescriptions = attributeDesc;
}