-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
434 changed files
with
66,739 additions
and
65,301 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
/* | ||
***This is computer generated notice - Do not modify it*** | ||
VulkanRenderer (inclusive of its dependencies and subprojects | ||
such as toolchains written by the same author) is a software to render | ||
2D & 3D geometries by writing C/C++ code and shaders. | ||
File: assert.h is a part of VulkanRenderer | ||
Copyright (C) 2023 Author: Ravi Prakash Singh | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
#include <common/assert.h> | ||
|
||
#define release_assert__(condition, ...) ASSERT(DESCRIPTION((condition) == true), __VA_ARGS__) | ||
#define release_assert_wrn__(condition, ...) ASSERT_WRN(DESCRIPTION((condition) == true), __VA_ARGS__) | ||
#define release_assert_not_null__(ptr) _ASSERT((ptr) != NULL) | ||
#define release_assert_called_once__() static int __FUNCTION__##call_counter = 0; ++__FUNCTION__##call_counter; release_assert(__FUNCTION__##call_counter == 1, "%s has been called more than once\n", __FUNCTION__) | ||
#define _release_assert__(condition) _ASSERT(condition) | ||
#define _release_assert_wrn__(condition) _ASSERT_WRN(condition) | ||
|
||
#if defined(GLOBAL_DEBUG) | ||
# define debug_assert__(...) release_assert__(__VA_ARGS__) | ||
# define debug_assert_wrn__(...) release_assert_wrn__(__VA_ARGS__) | ||
# define debug_assert_not_null__(ptr) release_assert_not_null__(ptr) | ||
# define debug_assert_called_once__() release_assert_called_once__() | ||
# define _debug_assert__(condition) _release_assert__(condition) | ||
# define _debug_assert_wrn__(condition) _release_assert_wrn__(condition) | ||
#else | ||
# define debug_assert__(...) | ||
# define debug_assert_wrn__(...) | ||
# define debug_assert_not_null__(ptr) | ||
# define debug_assert_called_once__() | ||
# define _debug_assert__(condition) | ||
# define _debug_assert_wrn__(condition) | ||
#endif | ||
/* | ||
***This is computer generated notice - Do not modify it*** | ||
VulkanRenderer (inclusive of its dependencies and subprojects | ||
such as toolchains written by the same author) is a software to render | ||
2D & 3D geometries by writing C/C++ code and shaders. | ||
File: assert.h is a part of VulkanRenderer | ||
Copyright (C) 2021 - 2024 Author: Ravi Prakash Singh | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
#include <common/assert.h> | ||
|
||
#define release_assert__(condition, ...) ASSERT(DESCRIPTION((condition) == true), __VA_ARGS__) | ||
#define release_assert_wrn__(condition, ...) ASSERT_WRN(DESCRIPTION((condition) == true), __VA_ARGS__) | ||
#define release_assert_not_null__(ptr) _ASSERT((ptr) != NULL) | ||
#define release_assert_called_once__() static int __FUNCTION__##call_counter = 0; ++__FUNCTION__##call_counter; release_assert(__FUNCTION__##call_counter == 1, "%s has been called more than once\n", __FUNCTION__) | ||
#define _release_assert__(condition) _ASSERT(condition) | ||
#define _release_assert_wrn__(condition) _ASSERT_WRN(condition) | ||
|
||
#if defined(GLOBAL_DEBUG) | ||
# define debug_assert__(...) release_assert__(__VA_ARGS__) | ||
# define debug_assert_wrn__(...) release_assert_wrn__(__VA_ARGS__) | ||
# define debug_assert_not_null__(ptr) release_assert_not_null__(ptr) | ||
# define debug_assert_called_once__() release_assert_called_once__() | ||
# define _debug_assert__(condition) _release_assert__(condition) | ||
# define _debug_assert_wrn__(condition) _release_assert_wrn__(condition) | ||
#else | ||
# define debug_assert__(...) | ||
# define debug_assert_wrn__(...) | ||
# define debug_assert_not_null__(ptr) | ||
# define debug_assert_called_once__() | ||
# define _debug_assert__(condition) | ||
# define _debug_assert_wrn__(condition) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,94 @@ | ||
|
||
#pragma once | ||
|
||
#include <renderer/defines.h> | ||
|
||
#if defined(RENDERER_VULKAN_DRIVER) | ||
typedef struct vulkan_bitmap_glyph_atlas_texture_t vulkan_bitmap_glyph_atlas_texture_t; | ||
typedef vulkan_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
#elif defined(RENDERER_OPENGL_DRIVER) | ||
typedef struct opengl_bitmap_glyph_atlas_texture_t opengl_bitmap_glyph_atlas_texture_t; | ||
typedef opengl_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
#elif defined(RENDERER_DIRECTX_DRIVER) | ||
typedef struct directx_bitmap_glyph_atlas_texture_t directx_bitmap_glyph_atlas_texture_t; | ||
typedef directx_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
#elif defined(RENDERER_METAL_DRIVER) | ||
typedef struct metal_bitmap_glyph_atlas_texture_t metal_bitmap_glyph_atlas_texture_t; | ||
typedef metal_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
#endif | ||
|
||
#include <renderer/font.h> // font_t and utf32_t | ||
#include <renderer/bitmap_glyph_pool.h> // bitmap_glyph_pool_t and glyph_texcoord_t | ||
|
||
typedef struct bitmap_glyph_atlas_texture_create_info_t | ||
{ | ||
/* initial width of the texture */ | ||
u32 width; | ||
/* initial height of the texture */ | ||
u32 height; | ||
/* font used to rasterize glyphs */ | ||
font_t* font; | ||
} bitmap_glyph_atlas_texture_create_info_t; | ||
|
||
BEGIN_CPP_COMPATIBLE | ||
|
||
/* constructors & destructors */ | ||
RENDERER_API bitmap_glyph_atlas_texture_t* bitmap_glyph_atlas_texture_new(memory_allocator_t* allocator); | ||
RENDERER_API bitmap_glyph_atlas_texture_t* bitmap_glyph_atlas_texture_create(renderer_t* renderer, bitmap_glyph_atlas_texture_create_info_t* create_info); | ||
RENDERER_API void bitmap_glyph_atlas_texture_create_no_alloc(renderer_t* renderer, bitmap_glyph_atlas_texture_create_info_t* create_info, bitmap_glyph_atlas_texture_t OUT texture); | ||
RENDERER_API void bitmap_glyph_atlas_texture_destroy(bitmap_glyph_atlas_texture_t* texture); | ||
RENDERER_API void bitmap_glyph_atlas_texture_release_resources(bitmap_glyph_atlas_texture_t* texture); | ||
|
||
/* returns pointer to the bitmap_glyph_pool_t object */ | ||
RENDERER_API bitmap_glyph_pool_t* bitmap_glyph_atlas_texture_get_pool(bitmap_glyph_atlas_texture_t* texture); | ||
/* returns the font used by this BGA texture */ | ||
RENDERER_API font_t* bitmap_glyph_atlas_texture_get_font(bitmap_glyph_atlas_texture_t* texture); | ||
/* flushes the host side font bitmap to the GPU side memory (it might also destroy and create VkDeviceMemory) | ||
* is_resized: true if internal GPU and host memory has been resized | ||
* returns: true if internal API objects recreated or GPU side memory has been updated */ | ||
RENDERER_API bool bitmap_glyph_atlas_texture_commit(bitmap_glyph_atlas_texture_t* texture, bool OUT is_resized); | ||
/* quality: quality of the rasterized glyph, ranges from 0 to 255 inclusive | ||
* unicode: glyph's unicode value to rasterize | ||
* texcoords: the texture coordinates (list of 4 vec2(s)), filled by this function if the glyph has graphical representation | ||
* returns: true if the glyph has graphical representation and there are no errors */ | ||
RENDERER_API bool bitmap_glyph_atlas_texture_get_texcoord(bitmap_glyph_atlas_texture_t* texture, pair_t(utf32_t, u32) unicode, glyph_texcoord_t OUT texcoord); | ||
#ifdef GLOBAL_DEBUG | ||
RENDERER_API void bitmap_glyph_atlas_texture_dump(bitmap_glyph_atlas_texture_t* texture, const char* file_path); | ||
RENDERER_API void bitmap_glyph_atlas_texture_dump_bb(bitmap_glyph_atlas_texture_t* texture, const char* file_path); | ||
#endif /* GLOBAL_DEBUG */ | ||
END_CPP_COMPATIBLE | ||
/* | ||
***This is computer generated notice - Do not modify it*** | ||
VulkanRenderer (inclusive of its dependencies and subprojects | ||
such as toolchains written by the same author) is a software to render | ||
2D & 3D geometries by writing C/C++ code and shaders. | ||
File: bitmap_glyph_atlas_texture.h is a part of VulkanRenderer | ||
Copyright (C) 2021 - 2024 Author: Ravi Prakash Singh | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
#include <renderer/defines.h> | ||
|
||
#if defined(RENDERER_VULKAN_DRIVER) | ||
typedef struct vulkan_bitmap_glyph_atlas_texture_t vulkan_bitmap_glyph_atlas_texture_t; | ||
typedef vulkan_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
typedef struct vulkan_texture_t vulkan_texture_t; | ||
typedef vulkan_texture_t texture_t; | ||
#elif defined(RENDERER_OPENGL_DRIVER) | ||
typedef struct opengl_bitmap_glyph_atlas_texture_t opengl_bitmap_glyph_atlas_texture_t; | ||
typedef opengl_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
typedef struct opengl_texture_t opengl_texture_t; | ||
typedef opengl_texture_t texture_t; | ||
#elif defined(RENDERER_DIRECTX_DRIVER) | ||
typedef struct directx_bitmap_glyph_atlas_texture_t directx_bitmap_glyph_atlas_texture_t; | ||
typedef directx_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
typedef struct directx_texture_t directx_texture_t; | ||
typedef directx_texture_t texture_t; | ||
#elif defined(RENDERER_METAL_DRIVER) | ||
typedef struct metal_bitmap_glyph_atlas_texture_t metal_bitmap_glyph_atlas_texture_t; | ||
typedef metal_bitmap_glyph_atlas_texture_t bitmap_glyph_atlas_texture_t; | ||
typedef struct metal_texture_t metal_texture_t; | ||
typedef metal_texture_t texture_t; | ||
#endif | ||
|
||
#include <renderer/font.h> // font_t and utf32_t | ||
#include <renderer/bitmap_glyph_pool.h> // bitmap_glyph_pool_t and glyph_texcoord_t | ||
|
||
typedef struct bitmap_glyph_atlas_texture_create_info_t | ||
{ | ||
/* initial width of the texture */ | ||
u32 width; | ||
/* initial height of the texture */ | ||
u32 height; | ||
/* font used to rasterize glyphs */ | ||
font_t* font; | ||
} bitmap_glyph_atlas_texture_create_info_t; | ||
|
||
BEGIN_CPP_COMPATIBLE | ||
|
||
/* constructors & destructors */ | ||
RENDERER_API bitmap_glyph_atlas_texture_t* bitmap_glyph_atlas_texture_new(memory_allocator_t* allocator); | ||
RENDERER_API bitmap_glyph_atlas_texture_t* bitmap_glyph_atlas_texture_create(renderer_t* renderer, bitmap_glyph_atlas_texture_create_info_t* create_info); | ||
RENDERER_API void bitmap_glyph_atlas_texture_create_no_alloc(renderer_t* renderer, bitmap_glyph_atlas_texture_create_info_t* create_info, bitmap_glyph_atlas_texture_t OUT texture); | ||
RENDERER_API void bitmap_glyph_atlas_texture_destroy(bitmap_glyph_atlas_texture_t* texture); | ||
RENDERER_API void bitmap_glyph_atlas_texture_release_resources(bitmap_glyph_atlas_texture_t* texture); | ||
|
||
/* returns pointer to the bitmap_glyph_pool_t object */ | ||
RENDERER_API bitmap_glyph_pool_t* bitmap_glyph_atlas_texture_get_pool(bitmap_glyph_atlas_texture_t* texture); | ||
/* returns the font used by this BGA texture */ | ||
RENDERER_API font_t* bitmap_glyph_atlas_texture_get_font(bitmap_glyph_atlas_texture_t* texture); | ||
/* retursn a pointer to the underlying texture_t object */ | ||
RENDERER_API texture_t* bitmap_glyph_atlas_texture_get_texture(vulkan_bitmap_glyph_atlas_texture_t* texture); | ||
/* flushes the host side font bitmap to the GPU side memory (it might also destroy and create VkDeviceMemory) | ||
* is_resized: true if internal GPU and host memory has been resized | ||
* returns: true if internal API objects recreated or GPU side memory has been updated */ | ||
RENDERER_API bool bitmap_glyph_atlas_texture_commit(bitmap_glyph_atlas_texture_t* texture, bool OUT is_resized); | ||
/* quality: quality of the rasterized glyph, ranges from 0 to 255 inclusive | ||
* unicode: glyph's unicode value to rasterize | ||
* texcoords: the texture coordinates (list of 4 vec2(s)), filled by this function if the glyph has graphical representation | ||
* returns: true if the glyph has graphical representation and there are no errors */ | ||
RENDERER_API bool bitmap_glyph_atlas_texture_get_texcoord(bitmap_glyph_atlas_texture_t* texture, pair_t(utf32_t, u32) unicode, glyph_texcoord_t OUT texcoord); | ||
#ifdef GLOBAL_DEBUG | ||
RENDERER_API void bitmap_glyph_atlas_texture_dump(bitmap_glyph_atlas_texture_t* texture, const char* file_path); | ||
RENDERER_API void bitmap_glyph_atlas_texture_dump_bb(bitmap_glyph_atlas_texture_t* texture, const char* file_path); | ||
#endif /* GLOBAL_DEBUG */ | ||
END_CPP_COMPATIBLE |
Oops, something went wrong.