13
13
14
14
using namespace nbl ;
15
15
using namespace core ;
16
+ using namespace ui ;
16
17
17
18
/*
18
19
Uncomment for more detailed logging
@@ -138,6 +139,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
138
139
static constexpr size_t NBL_FRAMES_TO_AVERAGE = 100ull ;
139
140
static_assert (FRAMES_IN_FLIGHT > SC_IMG_COUNT);
140
141
142
+ core::smart_refctd_ptr<nbl::system::ISystem> system;
141
143
core::smart_refctd_ptr<nbl::ui::IWindow> window;
142
144
core::smart_refctd_ptr<CommonAPI::CommonAPIEventCallback> windowCb;
143
145
core::smart_refctd_ptr<nbl::system::ILogger> logger;
@@ -174,18 +176,54 @@ class GeometryCreatorSampleApp : public ApplicationBase
174
176
std::unique_ptr<Objects> m_cpuGpuObjects = nullptr ;
175
177
176
178
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
+ }
189
227
190
228
APP_CONSTRUCTOR (GeometryCreatorSampleApp);
191
229
@@ -209,10 +247,12 @@ class GeometryCreatorSampleApp : public ApplicationBase
209
247
const video::ISurface::SFormat surfaceFormat (asset::EF_B8G8R8A8_SRGB, asset::ECP_COUNT, asset::EOTF_UNKNOWN);
210
248
211
249
CommonAPI::InitOutput initOutput;
212
- initOutput.window = core::smart_refctd_ptr (window);
250
+ initOutput.window = window;
251
+ initOutput.system = system;
252
+
213
253
CommonAPI::Init (
214
254
initOutput,
215
- video::EAT_OPENGL ,
255
+ video::EAT_VULKAN ,
216
256
" 35.GeometryCreator" ,
217
257
requiredInstanceFeatures,
218
258
optionalInstanceFeatures,
@@ -222,7 +262,8 @@ class GeometryCreatorSampleApp : public ApplicationBase
222
262
WIN_H,
223
263
SC_IMG_COUNT,
224
264
swapchainImageUsage,
225
- surfaceFormat);
265
+ surfaceFormat,
266
+ nbl::asset::EF_D32_SFLOAT);
226
267
227
268
window = std::move (initOutput.window );
228
269
windowCb = std::move (initOutput.windowCb );
@@ -236,6 +277,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
236
277
swapchain = std::move (initOutput.swapchain );
237
278
renderpass = std::move (initOutput.renderpass );
238
279
fbos = std::move (initOutput.fbo );
280
+ system = std::move (initOutput.system );
239
281
commandPools = std::move (initOutput.commandPools );
240
282
assetManager = std::move (initOutput.assetManager );
241
283
cpu2gpuParams = std::move (initOutput.cpu2gpuParams );
@@ -293,8 +335,6 @@ class GeometryCreatorSampleApp : public ApplicationBase
293
335
asset::SBlendParams blendParams;
294
336
blendParams.logicOpEnable = false ;
295
337
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 );
298
338
299
339
asset::SRasterizationParams rasterParams;
300
340
rasterParams.faceCullingMode = asset::EFCM_NONE;
@@ -467,7 +507,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
467
507
gpuSourceImageView.get (),
468
508
assetManager.get (),
469
509
" ScreenShot.png" ,
470
- asset::EIL_PRESENT_SRC_KHR ,
510
+ asset::EIL_PRESENT_SRC ,
471
511
static_cast <asset::E_ACCESS_FLAGS>(0u ));
472
512
473
513
assert (status);
0 commit comments