GCC Code Coverage Report


ernie/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
28 / 28
100.0%
Branches:
-
-%
Functions:
28 / 28
100.0%

scene/schema/render.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 /// @file render.h
3 /// @brief UsdRender's settings, products, vars and passes, with Ernie's settings on every product.
4 ///
5 /// References:
6 /// - Pixar, UsdRender, https://openusd.org/release/api/usd_render_page_front.html
7 #pragma once
8
9 #include "ernie/scene/view.h"
10
11 #include <string>
12 #include <vector>
13
14 // clang-format off
15 // Ernie's settings are on RenderSettingsBase, so each product may override its settings'. Tiers
16 // give the defaults: 0 or -1 below means the tier's.
17 #define ERNIE_RENDER_SETTINGS_BASE_ATTRIBUTES(X) \
18 X(Path, Camera, "camera", Path(), "The camera it renders.", .group = "Render") \
19 X(glm::dvec2, Resolution, "resolution", glm::dvec2(2048.0, 1080.0), "Pixels across and down.", \
20 .group = "Render", .lower = AtLeast(1.0), .finite = true) \
21 X(double, PixelAspectRatio, "pixelAspectRatio", 1.0, "A pixel's width over its height.", \
22 .group = "Render", .lower = Above(0.0)) \
23 X(std::string, AspectRatioConformPolicy, "aspectRatioConformPolicy", "expandAperture", \
24 "How the camera's aperture meets the image's aspect.", .group = "Render", \
25 .options = {"expandAperture", "cropAperture", "adjustApertureWidth", "adjustApertureHeight", \
26 "adjustPixelAspectRatio"}) \
27 X(glm::dvec4, DataWindowNdc, "dataWindowNDC", glm::dvec4(0.0, 0.0, 1.0, 1.0), \
28 "The window of the image rendered, in normalized device coordinates.", .group = "Render") \
29 X(bool, DisableMotionBlur, "disableMotionBlur", false, "Renders the shutter's open instant.", \
30 .group = "Render") \
31 X(bool, DisableDepthOfField, "disableDepthOfField", false, "Renders as through a pinhole.", \
32 .group = "Render") \
33 X(std::string, Fidelity, "ernie:fidelity", "realtime", \
34 "The tier: minimal for learning at scale, realtime, or predictive for reference images.", \
35 .group = "Ernie", .options = {"minimal", "realtime", "predictive"}) \
36 X(int, Samples, "ernie:samples", 0, "Samples per pixel per frame; 0 the tier's.", \
37 .group = "Ernie", .lower = AtLeast(0.0)) \
38 X(int, Bounces, "ernie:bounces", -1, "Path bounces; -1 the tier's.", .group = "Ernie", \
39 .lower = AtLeast(-1.0)) \
40 X(int, Accumulation, "ernie:accumulation", -1, \
41 "Frames of temporal history; 0 none, -1 the tier's.", .group = "Ernie", \
42 .lower = AtLeast(-1.0)) \
43 X(std::string, Denoiser, "ernie:denoiser", "auto", \
44 "The denoiser; auto the tier's (none in minimal and predictive, svgf in realtime).", \
45 .group = "Ernie", \
46 .options = {"auto", "none", "svgf", "oidn", "optix", "dlss", "fidelityfx"}) \
47 X(int, Seed, "ernie:seed", 0, "The seed every random decision of its frames derives from.", \
48 .group = "Ernie") \
49 X(double, LodError, "ernie:lod:error", 1.0, "Pixels of geometric error LOD allows.", \
50 .group = "Ernie", .lower = Above(0.0)) \
51 X(std::string, SpectralMode, "ernie:spectral:mode", "spectral", \
52 "spectral: bands over the range; rgb: three bands of linear sRGB, faster.", \
53 .group = "Spectral", .options = {"spectral", "rgb"}) \
54 X(int, SpectralBands, "ernie:spectral:bands", 16, \
55 "Bands sampled across the camera's sensor range.", .group = "Spectral", \
56 .lower = AtLeast(1.0))
57
58 #define ERNIE_RENDER_SETTINGS_ATTRIBUTES(X) \
59 X(std::vector<Path>, Products, "products", std::vector<Path>{}, "The products it renders.", \
60 .group = "Render") \
61 X(std::vector<std::string>, IncludedPurposes, "includedPurposes", \
62 (std::vector<std::string>{"default", "render"}), "The purposes of the prims rendered.", \
63 .group = "Render", .dirty = Dirty::Visibility) \
64 X(std::vector<std::string>, MaterialBindingPurposes, "materialBindingPurposes", \
65 (std::vector<std::string>{"full", ""}), "The binding purposes tried, in order.", \
66 .group = "Render", .dirty = Dirty::Material) \
67 X(std::string, RenderingColorSpace, "renderingColorSpace", "", \
68 "The colour space rendering happens in; unset, linear Rec.709.", .group = "Render")
69
70 #define ERNIE_RENDER_PRODUCT_ATTRIBUTES(X) \
71 X(std::string, ProductType, "productType", "raster", "The kind of output.", \
72 .group = "Product") \
73 X(std::string, ProductName, "productName", "", "The output's name, as a file path.", \
74 .group = "Product") \
75 X(std::vector<Path>, OrderedVars, "orderedVars", std::vector<Path>{}, \
76 "The vars it holds, in order.", .group = "Product")
77
78 #define ERNIE_RENDER_VAR_ATTRIBUTES(X) \
79 X(std::string, DataType, "dataType", "color3f", \
80 "Each pixel's value type, as the output is written: an integer type holds a sensor's " \
81 "digital numbers of its bit depth. uint16 is Ernie's, for depths of 9 to 16 bits, which " \
82 "USD's types have no type for.", \
83 .group = "Var", \
84 .options = {"color3f", "color4f", "float", "float2", "float3", "float4", "half", "half3", \
85 "half4", "normal3f", "point3f", "vector3f", "uchar", "uint16", "uint", "int", \
86 "int64"}) \
87 X(std::string, SourceName, "sourceName", "", \
88 "What it holds: an Ernie output (LdrColor, depth, normal...), a primvar or an LPE.", \
89 .group = "Var") \
90 X(std::string, SourceType, "sourceType", "raw", "How the source name is read.", \
91 .group = "Var", .options = {"raw", "primvar", "lpe", "intrinsic"})
92
93 #define ERNIE_RENDER_PASS_ATTRIBUTES(X) \
94 X(std::string, PassType, "passType", "", "The kind of pass.", .group = "Pass") \
95 X(std::vector<std::string>, Command, "command", std::vector<std::string>{}, \
96 "The command a pipeline runs it with.", .group = "Pass") \
97 X(std::string, FileName, "fileName", "", "The file it renders from.", .group = "Pass", \
98 .asset = true) \
99 X(std::vector<Path>, RenderSource, "renderSource", std::vector<Path>{}, \
100 "The render settings it renders.", .group = "Pass") \
101 X(std::vector<Path>, InputPasses, "inputPasses", std::vector<Path>{}, \
102 "Passes it depends on.", .group = "Pass")
103 // clang-format on
104
105 namespace ernie {
106
107 31 ERNIE_SCHEMA(RenderSettingsBase, SchemaView, ERNIE_RENDER_SETTINGS_BASE_ATTRIBUTES,
108 "What settings and products share: the camera, image and Ernie's settings.");
109 18 ERNIE_CONCRETE_SCHEMA(RenderSettings, RenderSettingsBase, ERNIE_RENDER_SETTINGS_ATTRIBUTES,
110 "A render's settings and the products it makes.");
111 5 ERNIE_CONCRETE_SCHEMA(RenderProduct, RenderSettingsBase, ERNIE_RENDER_PRODUCT_ATTRIBUTES,
112 "One output, an image or a sensor's data, overriding its settings' where it "
113 "authors them.");
114 8 ERNIE_CONCRETE_SCHEMA(RenderVar, SchemaView, ERNIE_RENDER_VAR_ATTRIBUTES,
115 "One channel set of a product: colour, depth, normals, ids or an Ernie "
116 "output.");
117 2 ERNIE_CONCRETE_SCHEMA(RenderPass, SchemaView, ERNIE_RENDER_PASS_ATTRIBUTES,
118 "A render of a pipeline, with the prims and cameras it sees as collections.");
119
120 } // namespace ernie
121