Use [[nodiscard]] attribute more sparingly
Removed all uses of the [[nodiscard]] attribute unless ignoring the return value would lead to an error or leak e.g. memory allocations.
This commit is contained in:
@@ -19,13 +19,13 @@ namespace Nova {
|
||||
static WindowDriver* create();
|
||||
virtual ~WindowDriver() = default;
|
||||
|
||||
[[nodiscard]] virtual WindowAPI get_api() const = 0;
|
||||
[[nodiscard]] virtual std::string get_api_name() const = 0;
|
||||
virtual WindowAPI get_api() const = 0;
|
||||
virtual std::string get_api_name() const = 0;
|
||||
|
||||
virtual void poll_events() = 0;
|
||||
virtual void beep() = 0;
|
||||
|
||||
[[nodiscard]] virtual u32 get_window_count() const = 0;
|
||||
virtual u32 get_window_count() const = 0;
|
||||
[[nodiscard]] virtual WindowID create_window(std::string_view title, u32 width, u32 height) = 0;
|
||||
virtual void destroy_window(WindowID window) = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Nova {
|
||||
virtual void set_window_size(WindowID window, u32 width, u32 height) = 0;
|
||||
virtual void set_window_position(WindowID window, i32 x, i32 y) = 0;
|
||||
|
||||
[[nodiscard]] virtual const char* get_surface_extension() const = 0;
|
||||
virtual const char* get_surface_extension() const = 0;
|
||||
[[nodiscard]] virtual SurfaceID create_surface(WindowID window, RenderDriver* driver) = 0;
|
||||
};
|
||||
} // namespace Nova
|
||||
|
||||
@@ -20,17 +20,18 @@ namespace Nova {
|
||||
static RenderDriver* create(RenderAPI api, WindowDriver* window_driver = nullptr);
|
||||
virtual ~RenderDriver() = default;
|
||||
|
||||
[[nodiscard]] virtual RenderAPI get_api() const = 0;
|
||||
[[nodiscard]] virtual u32 get_api_version() const = 0;
|
||||
[[nodiscard]] virtual std::string get_api_name() const = 0;
|
||||
[[nodiscard]] virtual std::string get_api_version_string() const = 0;
|
||||
virtual RenderAPI get_api() const = 0;
|
||||
virtual u32 get_api_version() const = 0;
|
||||
virtual std::string get_api_name() const = 0;
|
||||
virtual std::string get_api_version_string() const = 0;
|
||||
|
||||
[[nodiscard]] virtual u32 get_device_count() const = 0;
|
||||
[[nodiscard]] virtual const RenderDevice& get_device(u32 index) const = 0;
|
||||
[[nodiscard]] virtual bool get_device_supports_surface(u32 index, SurfaceID surface) const = 0;
|
||||
virtual u32 get_device_count() const = 0;
|
||||
virtual const RenderDevice& get_device(u32 index) const = 0;
|
||||
virtual bool get_device_supports_surface(u32 index, SurfaceID surface) const = 0;
|
||||
virtual void select_device(u32 index) = 0;
|
||||
|
||||
[[nodiscard]] virtual u32 choose_queue_family(QueueType type, SurfaceID surface) = 0;
|
||||
virtual u32 choose_queue_family(QueueType type, SurfaceID surface) = 0;
|
||||
|
||||
[[nodiscard]] virtual QueueID get_queue(u32 queue_family) = 0;
|
||||
virtual void free_queue(QueueID queue) = 0;
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace Nova {
|
||||
|
||||
[[nodiscard]] virtual SwapchainID create_swapchain(SurfaceID surface) = 0;
|
||||
virtual void resize_swapchain(SwapchainID swapchain) = 0;
|
||||
[[nodiscard]] virtual RenderPassID get_swapchain_render_pass(SwapchainID swapchain) const = 0;
|
||||
virtual RenderPassID get_swapchain_render_pass(SwapchainID swapchain) const = 0;
|
||||
virtual void destroy_swapchain(SwapchainID swapchain) = 0;
|
||||
|
||||
[[nodiscard]] virtual ShaderID create_shader(const std::span<u8> bytes, ShaderStage stage) = 0;
|
||||
|
||||
@@ -70,17 +70,18 @@ namespace Nova {
|
||||
explicit VulkanRenderDriver(WindowDriver* window_driver);
|
||||
~VulkanRenderDriver() override;
|
||||
|
||||
[[nodiscard]] RenderAPI get_api() const override;
|
||||
[[nodiscard]] u32 get_api_version() const override;
|
||||
[[nodiscard]] std::string get_api_name() const override;
|
||||
[[nodiscard]] std::string get_api_version_string() const override;
|
||||
RenderAPI get_api() const override;
|
||||
u32 get_api_version() const override;
|
||||
std::string get_api_name() const override;
|
||||
std::string get_api_version_string() const override;
|
||||
|
||||
[[nodiscard]] u32 get_device_count() const override;
|
||||
[[nodiscard]] const RenderDevice& get_device(u32 index) const override;
|
||||
[[nodiscard]] bool get_device_supports_surface(u32 index, SurfaceID surface) const override;
|
||||
u32 get_device_count() const override;
|
||||
const RenderDevice& get_device(u32 index) const override;
|
||||
bool get_device_supports_surface(u32 index, SurfaceID surface) const override;
|
||||
void select_device(u32 index) override;
|
||||
|
||||
[[nodiscard]] u32 choose_queue_family(QueueType type, SurfaceID surface) override;
|
||||
u32 choose_queue_family(QueueType type, SurfaceID surface) override;
|
||||
|
||||
[[nodiscard]] QueueID get_queue(u32 queue_family) override;
|
||||
void free_queue(QueueID queue) override;
|
||||
|
||||
@@ -89,7 +90,7 @@ namespace Nova {
|
||||
|
||||
[[nodiscard]] SwapchainID create_swapchain(SurfaceID surface) override;
|
||||
void resize_swapchain(SwapchainID swapchain) override;
|
||||
[[nodiscard]] RenderPassID get_swapchain_render_pass(SwapchainID swapchain) const override;
|
||||
RenderPassID get_swapchain_render_pass(SwapchainID swapchain) const override;
|
||||
void destroy_swapchain(SwapchainID swapchain) override;
|
||||
|
||||
[[nodiscard]] ShaderID create_shader(const std::span<u8> bytes, ShaderStage stage) override;
|
||||
@@ -109,8 +110,8 @@ namespace Nova {
|
||||
void begin_command_buffer(CommandBufferID command_buffer) override;
|
||||
void end_command_buffer(CommandBufferID command_buffer) override;
|
||||
|
||||
[[nodiscard]] VkInstance get_instance() const;
|
||||
[[nodiscard]] VkAllocationCallbacks* get_allocator(VkObjectType type) const;
|
||||
VkInstance get_instance() const;
|
||||
VkAllocationCallbacks* get_allocator(VkObjectType type) const;
|
||||
|
||||
private:
|
||||
WindowDriver* m_window_driver = nullptr;
|
||||
|
||||
@@ -31,13 +31,13 @@ namespace Nova {
|
||||
X11WindowDriver();
|
||||
~X11WindowDriver() override;
|
||||
|
||||
[[nodiscard]] WindowAPI get_api() const override;
|
||||
[[nodiscard]] std::string get_api_name() const override;
|
||||
WindowAPI get_api() const override;
|
||||
std::string get_api_name() const override;
|
||||
|
||||
void poll_events() override;
|
||||
void beep() override;
|
||||
|
||||
[[nodiscard]] u32 get_window_count() const override;
|
||||
u32 get_window_count() const override;
|
||||
[[nodiscard]] WindowID create_window(std::string_view title, u32 width, u32 height) override;
|
||||
void destroy_window(WindowID window) override;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Nova {
|
||||
void set_window_size(WindowID window, u32 width, u32 height) override;
|
||||
void set_window_position(WindowID window, i32 x, i32 y) override;
|
||||
|
||||
[[nodiscard]] const char* get_surface_extension() const override;
|
||||
const char* get_surface_extension() const override;
|
||||
[[nodiscard]] SurfaceID create_surface(WindowID window, RenderDriver* driver) override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user