Skip to content

Commit 585bb7b

Browse files
committed
Fixed Example 35.Geometry Creator
1 parent 0635fb2 commit 585bb7b

File tree

1 file changed

+58
-18
lines changed
  • examples_tests/35.GeometryCreator

1 file changed

+58
-18
lines changed

examples_tests/35.GeometryCreator/main.cpp

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
using namespace nbl;
1515
using namespace core;
16+
using namespace ui;
1617

1718
/*
1819
Uncomment for more detailed logging
@@ -138,6 +139,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
138139
static constexpr size_t NBL_FRAMES_TO_AVERAGE = 100ull;
139140
static_assert(FRAMES_IN_FLIGHT > SC_IMG_COUNT);
140141

142+
core::smart_refctd_ptr<nbl::system::ISystem> system;
141143
core::smart_refctd_ptr<nbl::ui::IWindow> window;
142144
core::smart_refctd_ptr<CommonAPI::CommonAPIEventCallback> windowCb;
143145
core::smart_refctd_ptr<nbl::system::ILogger> logger;
@@ -174,18 +176,54 @@ class GeometryCreatorSampleApp : public ApplicationBase
174176
std::unique_ptr<Objects> m_cpuGpuObjects = nullptr;
175177

176178
public:
177-
void setWindow(core::smart_refctd_ptr<nbl::ui::IWindow>&& wnd) override
178-
{
179-
window = std::move(wnd);
180-
}
181-
nbl::ui::IWindow* getWindow() override
182-
{
183-
return window.get();
184-
}
185-
void setSystem(core::smart_refctd_ptr<nbl::system::ISystem>&& system) override
186-
{
187-
system = std::move(system);
188-
}
179+
180+
void setWindow(core::smart_refctd_ptr<nbl::ui::IWindow>&& wnd) override
181+
{
182+
window = std::move(wnd);
183+
}
184+
void setSystem(core::smart_refctd_ptr<nbl::system::ISystem>&& s) override
185+
{
186+
system = std::move(s);
187+
}
188+
nbl::ui::IWindow* getWindow() override
189+
{
190+
return window.get();
191+
}
192+
video::IAPIConnection* getAPIConnection() override
193+
{
194+
return api.get();
195+
}
196+
video::ILogicalDevice* getLogicalDevice() override
197+
{
198+
return logicalDevice.get();
199+
}
200+
video::IGPURenderpass* getRenderpass() override
201+
{
202+
return renderpass.get();
203+
}
204+
void setSurface(core::smart_refctd_ptr<video::ISurface>&& s) override
205+
{
206+
surface = std::move(s);
207+
}
208+
void setFBOs(std::vector<core::smart_refctd_ptr<video::IGPUFramebuffer>>& f) override
209+
{
210+
for (int i = 0; i < f.size(); i++)
211+
{
212+
fbos[i] = core::smart_refctd_ptr(f[i]);
213+
}
214+
}
215+
void setSwapchain(core::smart_refctd_ptr<video::ISwapchain>&& s) override
216+
{
217+
swapchain = std::move(s);
218+
}
219+
uint32_t getSwapchainImageCount() override
220+
{
221+
return SC_IMG_COUNT;
222+
}
223+
virtual nbl::asset::E_FORMAT getDepthFormat() override
224+
{
225+
return nbl::asset::EF_D32_SFLOAT;
226+
}
189227

190228
APP_CONSTRUCTOR(GeometryCreatorSampleApp);
191229

@@ -209,10 +247,12 @@ class GeometryCreatorSampleApp : public ApplicationBase
209247
const video::ISurface::SFormat surfaceFormat(asset::EF_B8G8R8A8_SRGB, asset::ECP_COUNT, asset::EOTF_UNKNOWN);
210248

211249
CommonAPI::InitOutput initOutput;
212-
initOutput.window = core::smart_refctd_ptr(window);
250+
initOutput.window = window;
251+
initOutput.system = system;
252+
213253
CommonAPI::Init(
214254
initOutput,
215-
video::EAT_OPENGL,
255+
video::EAT_VULKAN,
216256
"35.GeometryCreator",
217257
requiredInstanceFeatures,
218258
optionalInstanceFeatures,
@@ -222,7 +262,8 @@ class GeometryCreatorSampleApp : public ApplicationBase
222262
WIN_H,
223263
SC_IMG_COUNT,
224264
swapchainImageUsage,
225-
surfaceFormat);
265+
surfaceFormat,
266+
nbl::asset::EF_D32_SFLOAT);
226267

227268
window = std::move(initOutput.window);
228269
windowCb = std::move(initOutput.windowCb);
@@ -236,6 +277,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
236277
swapchain = std::move(initOutput.swapchain);
237278
renderpass = std::move(initOutput.renderpass);
238279
fbos = std::move(initOutput.fbo);
280+
system = std::move(initOutput.system);
239281
commandPools = std::move(initOutput.commandPools);
240282
assetManager = std::move(initOutput.assetManager);
241283
cpu2gpuParams = std::move(initOutput.cpu2gpuParams);
@@ -293,8 +335,6 @@ class GeometryCreatorSampleApp : public ApplicationBase
293335
asset::SBlendParams blendParams;
294336
blendParams.logicOpEnable = false;
295337
blendParams.logicOp = nbl::asset::ELO_NO_OP;
296-
for (size_t i = 0ull; i < nbl::asset::SBlendParams::MAX_COLOR_ATTACHMENT_COUNT; i++)
297-
blendParams.blendParams[i].attachmentEnabled = (i == 0ull);
298338

299339
asset::SRasterizationParams rasterParams;
300340
rasterParams.faceCullingMode = asset::EFCM_NONE;
@@ -467,7 +507,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
467507
gpuSourceImageView.get(),
468508
assetManager.get(),
469509
"ScreenShot.png",
470-
asset::EIL_PRESENT_SRC_KHR,
510+
asset::EIL_PRESENT_SRC,
471511
static_cast<asset::E_ACCESS_FLAGS>(0u));
472512

473513
assert(status);

0 commit comments

Comments
 (0)