MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / checkAttachArguments

Function checkAttachArguments

Source/Falcor/Core/API/FBO.cpp:74–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72namespace
73{
74void checkAttachArguments(const Texture* pTexture, uint32_t mipLevel, uint32_t firstArraySlice, uint32_t arraySize, bool isDepthAttachment)
75{
76 if (pTexture == nullptr)
77 return;
78
79 FALCOR_CHECK(mipLevel < pTexture->getMipCount(), "'mipLevel' ({}) is out of bounds.", mipLevel);
80
81 if (arraySize != Fbo::kAttachEntireMipLevel)
82 {
83 FALCOR_CHECK(arraySize != 0, "'arraySize' must not be zero.");
84 if (pTexture->getType() == Texture::Type::Texture3D)
85 {
86 FALCOR_CHECK(
87 arraySize + firstArraySlice <= pTexture->getDepth(),
88 "'firstArraySlice' ({}) and 'arraySize' ({}) request depth index that is out of bounds.",
89 firstArraySlice,
90 arraySize
91 );
92 }
93 else
94 {
95 FALCOR_CHECK(
96 arraySize + firstArraySlice <= pTexture->getArraySize(),
97 "'frstArraySlice' ({}) and 'arraySize' ({}) request array index that is out of bounds.",
98 firstArraySlice,
99 arraySize
100 );
101 }
102 }
103
104 if (isDepthAttachment)
105 {
106 FALCOR_CHECK(isDepthStencilFormat(pTexture->getFormat()), "Depth-stencil texture must have a depth-stencil format.");
107 FALCOR_CHECK(
108 is_set(pTexture->getBindFlags(), ResourceBindFlags::DepthStencil), "Depth-stencil texture must have the DepthStencil bind flag."
109 );
110 }
111 else
112 {
113 FALCOR_CHECK(!isDepthStencilFormat(pTexture->getFormat()), "Color texture must not have a depth-stencil format.");
114 FALCOR_CHECK(
115 is_set(pTexture->getBindFlags(), ResourceBindFlags::RenderTarget), "Color texture must have the RenderTarget bind flag."
116 );
117 }
118}
119
120ref<Texture> createTexture2D(
121 ref<Device> pDevice,

Callers 2

attachColorTargetMethod · 0.85

Calls 3

isDepthStencilFormatFunction · 0.85
getFormatMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected