CMSC23740 Common Code Library
Support code for CS23740 programming projects
Toggle main menu visibility
Loading...
Searching...
No Matches
pipeline.hpp
Go to the documentation of this file.
1
10
11
/*
12
* COPYRIGHT (c) 2026 John Reppy (https://cs.uchicago.edu/~jhr)
13
* All rights reserved.
14
*/
15
16
#ifndef _CS237_PIPELINE_HPP_
17
#define _CS237_PIPELINE_HPP_
18
19
#ifndef _CS237_HPP_
20
#error "cs237/pipeline.hpp should not be included directly"
21
#endif
22
23
namespace
cs237
{
24
31
inline
32
vk::PipelineVertexInputStateCreateInfo
vertexInputInfo
(
33
std::vector<vk::VertexInputBindingDescription>
const
&descs,
34
std::vector<vk::VertexInputAttributeDescription>
const
&attrs)
35
{
36
vk::PipelineVertexInputStateCreateInfo vertexInfo{};
37
38
vertexInfo.vertexBindingDescriptionCount = descs.size();
39
if
(descs.size() > 0) {
40
// we copy the data into the heap to ensure that it is still around
41
// when we create the pipeline
42
auto
pDescs =
new
vk::VertexInputBindingDescription[descs.size()];
43
for
(
int
i = 0; i < descs.size(); ++i) {
44
pDescs[i] = descs[i];
45
}
46
vertexInfo.pVertexBindingDescriptions = pDescs;
47
}
48
49
vertexInfo.vertexAttributeDescriptionCount = attrs.size();
50
if
(attrs.size() > 0) {
51
auto
pAttrs =
new
vk::VertexInputAttributeDescription[attrs.size()];
52
for
(
int
i = 0; i < attrs.size(); ++i) {
53
pAttrs[i] = attrs[i];
54
}
55
vertexInfo.pVertexAttributeDescriptions = pAttrs;
56
}
57
58
return
vertexInfo;
59
}
60
62
inline
63
void
destroyVertexInputInfo
(vk::PipelineVertexInputStateCreateInfo &info)
64
{
65
if
(info.pVertexBindingDescriptions !=
nullptr
) {
66
delete
info.pVertexBindingDescriptions;
67
info.pVertexBindingDescriptions =
nullptr
;
68
}
69
if
(info.pVertexAttributeDescriptions !=
nullptr
) {
70
delete
info.pVertexAttributeDescriptions;
71
info.pVertexAttributeDescriptions =
nullptr
;
72
}
73
}
74
75
}
// namespace cs237
76
77
#endif
// !_CS237_PIPELINE_HPP_
cs237
Definition
aabb.hpp:22
cs237::destroyVertexInputInfo
void destroyVertexInputInfo(vk::PipelineVertexInputStateCreateInfo &info)
release resources allocated by vertexInputInfo
Definition
pipeline.hpp:63
cs237::vertexInputInfo
vk::PipelineVertexInputStateCreateInfo vertexInputInfo(std::vector< vk::VertexInputBindingDescription > const &descs, std::vector< vk::VertexInputAttributeDescription > const &attrs)
initialize info for the vertex input stage of the pipeline
Definition
pipeline.hpp:32
cs237-library
include
cs237
pipeline.hpp
Generated by
1.18.0