-
Notifications
You must be signed in to change notification settings - Fork 0
/
_core_graphics.html
138 lines (136 loc) · 10 KB
/
_core_graphics.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Nebula: CoreGraphics</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>
<link href="custom_dark_theme.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Nebula
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function(){initNavTree('_core_graphics.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div><div class="header">
<div class="headertitle"><div class="title">CoreGraphics</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="NebulaCoreGraphicsSystem"></a>
The CoreGraphics Subsystem</h1>
<p>The <a class="el" href="namespace_core_graphics.html" title="Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.">CoreGraphics</a> subsystem is the interface between the programmer and the GPU. It wraps the multiplicity of graphics APIs in a single unified interface. The main class is called the CoreGraphics::GraphicsDevice, which is the central hub for managing command buffers, submission logic, GPU queries and such.</p>
<p>The way <a class="el" href="namespace_core_graphics.html" title="Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.">CoreGraphics</a> is implemented is by supplying a set of headers which define the interface. Then, during compile time and based on your compilation flags, the function linked to said header interface will also implement the renderer. We cannot change the renderer at runtime because of this reason.</p>
<p><a class="el" href="namespace_core_graphics.html" title="Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.">CoreGraphics</a> can be interface directly, an example of which can look like this:</p>
<div class="fragment"><div class="line"><a class="code hl_function" href="namespace_core_graphics.html#a9744ae7569760a865a105690a52a1e3c">CoreGraphics::SetShaderProgram</a>(myShaderProgram);</div>
<div class="line">CoreGraphics::BeginBatch(<a class="code hl_enumvalue" href="class_frame_1_1_frame_batch_type.html#a56e994192b9111c140e30a94285bebb3a044b888ece26851fc45730b61b2a85af">Frame::FrameBatchType::System</a>);</div>
<div class="line"><a class="code hl_function" href="namespace_core_graphics.html#a0ae21d98923c8146c58938babd0b0bef">CoreGraphics::MeshBind</a>(myMesh, 0);</div>
<div class="line">CoreGraphics::SetResourceTable(myResourceTable, NEBULA_BATCH_GROUP, <a class="code hl_enumvalue" href="namespace_core_graphics.html#abae9cceb5c5bb86ed89f84d3d3a8c8eeab9b94aa834e5393d4daf134d2034bc69">CoreGraphics::GraphicsPipeline</a>, <span class="keyword">nullptr</span>);</div>
<div class="line">CoreGraphics::Draw();</div>
<div class="line">CoreGraphics::EndBatch();</div>
<div class="ttc" id="aclass_frame_1_1_frame_batch_type_html_a56e994192b9111c140e30a94285bebb3a044b888ece26851fc45730b61b2a85af"><div class="ttname"><a href="class_frame_1_1_frame_batch_type.html#a56e994192b9111c140e30a94285bebb3a044b888ece26851fc45730b61b2a85af">Frame::FrameBatchType::System</a></div><div class="ttdeci">@ System</div><div class="ttdef"><b>Definition</b> framebatchtype.h:36</div></div>
<div class="ttc" id="anamespace_core_graphics_html_a0ae21d98923c8146c58938babd0b0bef"><div class="ttname"><a href="namespace_core_graphics.html#a0ae21d98923c8146c58938babd0b0bef">CoreGraphics::MeshBind</a></div><div class="ttdeci">const void MeshBind(const MeshId id, const CoreGraphics::CmdBufferId cmd)</div><div class="ttdoc">Bind mesh on command buffer.</div><div class="ttdef"><b>Definition</b> mesh.cc:155</div></div>
<div class="ttc" id="anamespace_core_graphics_html_a9744ae7569760a865a105690a52a1e3c"><div class="ttname"><a href="namespace_core_graphics.html#a9744ae7569760a865a105690a52a1e3c">CoreGraphics::SetShaderProgram</a></div><div class="ttdeci">void SetShaderProgram(const CoreGraphics::ShaderProgramId pro, const CoreGraphics::QueueType queue, const bool bindSharedResources)</div></div>
<div class="ttc" id="anamespace_core_graphics_html_abae9cceb5c5bb86ed89f84d3d3a8c8eeab9b94aa834e5393d4daf134d2034bc69"><div class="ttname"><a href="namespace_core_graphics.html#abae9cceb5c5bb86ed89f84d3d3a8c8eeab9b94aa834e5393d4daf134d2034bc69">CoreGraphics::GraphicsPipeline</a></div><div class="ttdeci">@ GraphicsPipeline</div><div class="ttdef"><b>Definition</b> config.h:113</div></div>
</div><!-- fragment --><p>This code will apply a shader program, start a rendering batch, bind a mesh, bind the necessary resources, issue the draw, and then end the batch. This will <em><b>indirectly</b></em> perform a render, as in, this series of commands will be recorded to what is called a command buffer, and is executed together with a bunch of other commands when the CoreGraphics::GraphicsDevice gets a call to do so.</p>
<p>In most cases, the rendering is done through what is called a FrameScript. However, we might want to implement plugins for the frame script, such as when we want to write some custom rendering code, but also have it executed in between two passes in a frame script. To do so, we simply register a callback as such:</p>
<div class="fragment"><div class="line"><a class="code hl_function" href="namespace_frame.html#a77f5e4db78be13d003454b0dd9fd551d">Frame::AddCallback</a>(<span class="stringliteral">"MyFramePluginName"</span>, [](<a class="code hl_typedef" href="types_8h.html#ad119735112d40fd29a3017de944ccc98">IndexT</a>) { ... });</div>
<div class="ttc" id="anamespace_frame_html_a77f5e4db78be13d003454b0dd9fd551d"><div class="ttname"><a href="namespace_frame.html#a77f5e4db78be13d003454b0dd9fd551d">Frame::AddCallback</a></div><div class="ttdeci">void AddCallback(const Util::StringAtom name, std::function< void(const CoreGraphics::CmdBufferId, IndexT, IndexT)> func)</div><div class="ttdoc">add function callback to global dictionary</div><div class="ttdef"><b>Definition</b> frameplugin.cc:106</div></div>
<div class="ttc" id="atypes_8h_html_ad119735112d40fd29a3017de944ccc98"><div class="ttname"><a href="types_8h.html#ad119735112d40fd29a3017de944ccc98">IndexT</a></div><div class="ttdeci">int IndexT</div><div class="ttdef"><b>Definition</b> types.h:48</div></div>
</div><!-- fragment --><p>And then replace the ... with the code from before. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="render.html">Render Systems</a></li>
<li class="footer">
Generated on Sat Oct 5 2024 16:49:15 for Nebula. Dark theme by <a href="http://majerle.eu" target="_new">Tilen Majerle</a>. All rights reserved.
</li>
</ul>
</div>
<script src="custom.js"></script>
</body>
</html>