8 #include "renderutils.h"
9 #include "irendertarget.h"
84 void onDestroy()
override;
92 const glm::ivec2 getSize()
const;
126 const glm::ivec2 getBufferSize()
const override;
142 const std::string&
getTitle()
const {
return mTitle; }
147 void setTitle(std::string newTitle);
159 void setFullscreen(
bool value);
164 void toggleFullscreen();
170 void setWidth(
int width);
176 void setHeight(
int height);
182 void setSize(
const glm::ivec2& size);
200 void setPosition(
const glm::ivec2& position)
const;
205 glm::ivec2 getPosition()
const;
213 float getPixelDensity()
const;
224 float getDisplayScale()
const;
230 void setAlwaysOnTop(
bool onTop);
235 SDL_Window* getNativeWindow()
const;
240 bool isEmbedded()
const {
return mExternalHandle !=
nullptr; }
245 bool isMinimized()
const;
251 bool isHidden()
const;
256 bool isOccluded()
const;
261 uint getNumber()
const override;
280 inline float getRatio()
const {
return static_cast<float>(getBufferSize().y) /
static_cast<float>(getBufferSize().x); }
285 void beginRendering()
override;
290 void endRendering()
override;
300 VkFormat getDepthFormat()
const override;
305 VkSampleCountFlagBits
getSampleCount()
const override {
return mRasterizationSamples; }
325 VkImageLayout
getFinalLayout()
const override {
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; }
330 int getDisplayIndex()
const;
332 bool mSampleShading =
true;
335 bool mBorderless =
false;
336 bool mResizable =
true;
337 bool mVisible =
true;
338 bool mAlwaysOnTop =
false;
340 std::string mTitle =
"";
343 int mAddedSwapImages = 1;
345 bool mRestorePosition =
true;
346 bool mRestoreSize =
true;
350 SDL_Window* mSDLWindow =
nullptr;
351 VkSampleCountFlagBits mRasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
352 VkDevice mDevice = VK_NULL_HANDLE;
353 VkSurfaceKHR mSurface = VK_NULL_HANDLE;
354 VkSwapchainKHR mSwapchain = VK_NULL_HANDLE;
355 VkRenderPass mRenderPass = VK_NULL_HANDLE;
356 VkQueue mPresentQueue = VK_NULL_HANDLE;
357 VkFormat mSwapchainFormat = VK_FORMAT_UNDEFINED;
358 std::vector<VkImageView> mSwapChainImageViews;
359 std::vector<VkFramebuffer> mSwapChainFramebuffers;
360 std::vector<VkCommandBuffer> mCommandBuffers;
361 std::vector<VkSemaphore> mAcquireSemaphores;
362 std::vector<VkSemaphore> mSubmitSemaphores;
363 VkPresentModeKHR mPresentationMode = VK_PRESENT_MODE_MAILBOX_KHR;
366 bool mSampleShadingEnabled =
false;
368 bool mRecreateSwapchain =
false;
369 VkSurfaceCapabilitiesKHR mSurfaceCapabilities;
370 VkExtent2D mSwapchainExtent = {0,0};
371 SDL_Window* mExternalHandle =
nullptr;
379 VkCommandBuffer beginRecording();
409 void destroySwapChainResources();
414 bool validSwapchainExtent()
const;