mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-09-03 01:10:00 +02:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0494ceff27 | ||
|
|
ff1a0bb4cb | ||
|
|
bd7cd52c4f | ||
|
|
d276899e8b | ||
|
|
42f0d52bfa | ||
|
|
f1c7f8ab27 | ||
|
|
1e27c05789 | ||
|
|
9800d2f78d | ||
|
|
0491089463 | ||
|
|
83b9f8f9da | ||
|
|
f53d90e72c | ||
|
|
b9c54dc469 | ||
|
|
63fe3088bf | ||
|
|
c9df651a14 | ||
|
|
2d0c02ae7e | ||
|
|
ddfbe32cea |
+3
-1
@@ -177,6 +177,8 @@ int main(void)
|
||||
mlx.logo_png = mlx_new_image_from_file(mlx.mlx, "42_logo.png", &dummy, &dummy);
|
||||
mlx.logo_jpg = mlx_new_image_from_file(mlx.mlx, "42_logo.jpg", &dummy, &dummy);
|
||||
|
||||
mlx_set_window_icon(mlx.mlx, mlx.win, mlx.logo_png);
|
||||
|
||||
mlx_pixel_put(mlx.mlx, mlx.win, 200, 10, (mlx_color){ .rgba = 0xFF00FFFF });
|
||||
mlx_put_image_to_window(mlx.mlx, mlx.win, mlx.logo_png, 0, 0);
|
||||
|
||||
@@ -193,7 +195,7 @@ int main(void)
|
||||
mlx_destroy_image(mlx.mlx, mlx.logo_bmp);
|
||||
mlx_destroy_image(mlx.mlx, mlx.img);
|
||||
mlx_destroy_window(mlx.mlx, mlx.win);
|
||||
|
||||
|
||||
mlx_destroy_context(mlx.mlx);
|
||||
|
||||
return 0;
|
||||
|
||||
+17
-5
@@ -148,7 +148,7 @@ MLX_API void mlx_set_window_position(mlx_context mlx, mlx_window win, int x, int
|
||||
* @brief Sets window size
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to move
|
||||
* @param win Internal window to resize
|
||||
* @param width New width
|
||||
* @param height New height
|
||||
*/
|
||||
@@ -158,16 +158,25 @@ MLX_API void mlx_set_window_size(mlx_context mlx, mlx_window win, int width, int
|
||||
* @brief Sets window title
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to move
|
||||
* @param win Internal window to modify
|
||||
* @param title New title
|
||||
*/
|
||||
MLX_API void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title);
|
||||
|
||||
/**
|
||||
* @brief Sets window icon
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to modify
|
||||
* @param image New icon image
|
||||
*/
|
||||
MLX_API void mlx_set_window_icon(mlx_context mlx, mlx_window win, mlx_image image);
|
||||
|
||||
/**
|
||||
* @brief Enables/Disables window fullscreen mode
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to move
|
||||
* @param win Internal window to modify
|
||||
* @param enable Switch or not to fullscreen
|
||||
*/
|
||||
MLX_API void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool enable);
|
||||
@@ -176,7 +185,7 @@ MLX_API void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool ena
|
||||
* @brief Gets window position
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to move
|
||||
* @param win Internal window to get from
|
||||
* @param x Pointers to get position of the window
|
||||
* @param y Pointers to get position of the window
|
||||
*/
|
||||
@@ -186,7 +195,7 @@ MLX_API void mlx_get_window_position(mlx_context mlx, mlx_window win, int* x, in
|
||||
* @brief Gets window size
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param win Internal window to move
|
||||
* @param win Internal window to get from
|
||||
* @param x Pointers to get size of the window
|
||||
* @param y Pointers to get size of the window
|
||||
*/
|
||||
@@ -313,7 +322,10 @@ MLX_API void mlx_on_event(mlx_context mlx, mlx_window win, mlx_event_type event,
|
||||
* @param x X coordinate
|
||||
* @param y Y coordinate
|
||||
* @param color Color of the pixel
|
||||
*
|
||||
* WARNING: This function isn't performant, consider drawing to an image beforehand.
|
||||
*/
|
||||
MLX_DEPRECATED("Use an image rather than directly communicating with the window")
|
||||
MLX_API void mlx_pixel_put(mlx_context mlx, mlx_window win, int x, int y, mlx_color color);
|
||||
|
||||
|
||||
|
||||
+20
-2
@@ -75,7 +75,6 @@ MLX_API void mlx_restore_window(mlx_context mlx, mlx_window win);
|
||||
|
||||
/* Pixels drawing related functions */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Put an array of pixels in the window
|
||||
*
|
||||
@@ -85,7 +84,12 @@ MLX_API void mlx_restore_window(mlx_context mlx, mlx_window win);
|
||||
* @param y Y coordinate
|
||||
* @param pixels Array of pixels
|
||||
* @param pixels_number Number of pixels
|
||||
*
|
||||
* Note: it is responsability of the user to make sure the size of `pixels` is
|
||||
* big enough for the given array.
|
||||
* WARNING: This function isn't performant, consider drawing to an image beforehand.
|
||||
*/
|
||||
MLX_DEPRECATED("Use an image rather than directly communicating with the window")
|
||||
MLX_API void mlx_pixel_put_array(mlx_context mlx, mlx_window win, int x, int y, mlx_color* pixels, size_t pixels_number);
|
||||
|
||||
/**
|
||||
@@ -101,13 +105,27 @@ MLX_API void mlx_pixel_put_array(mlx_context mlx, mlx_window win, int x, int y,
|
||||
*
|
||||
* Note: it is responsability of the user to make sure the size of `pixels` is
|
||||
* big enough for the given region.
|
||||
* WARNING: This function isn't performant, consider drawing to an image beforehand.
|
||||
*/
|
||||
MLX_DEPRECATED("Use an image rather than directly communicating with the window")
|
||||
MLX_API void mlx_pixel_put_region(mlx_context mlx, mlx_window win, int x, int y, int w, int h, mlx_color* pixels);
|
||||
|
||||
|
||||
|
||||
/* Images related functions */
|
||||
|
||||
/**
|
||||
* @brief Set image rectangle
|
||||
*
|
||||
* @param mlx Internal MLX application
|
||||
* @param img Internal image
|
||||
* @param x X coordinate in the image
|
||||
* @param y Y coordinate in the image
|
||||
* @param w Width of the rectangle
|
||||
* @param y Height of the rectangle
|
||||
* @param color Color of the rectangle
|
||||
*/
|
||||
MLX_API void mlx_set_image_rectangle(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color color);
|
||||
|
||||
/**
|
||||
* @brief Get image region
|
||||
@@ -153,7 +171,7 @@ MLX_API void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y
|
||||
* @param scale_y Scale y of the image
|
||||
* @param angle Rotation angle of the image (clockwise)
|
||||
*/
|
||||
MLX_API void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, int x, int y, float scale_x, float scale_y, float angle);
|
||||
MLX_API void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, float x, float y, float scale_x, float scale_y, float angle);
|
||||
|
||||
/**
|
||||
* @brief Get direct pointers to hidden functions
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* mlx_keycodes.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rprieur <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/08/09 00:15:49 by rprieur #+# #+# */
|
||||
/* Updated: 2026/08/09 00:16:30 by rprieur ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
// MacroLibX official repo https://github.com/seekrs/MacroLibX
|
||||
// MacroLibX official website https://macrolibx.kbz8.me/
|
||||
|
||||
#ifndef MACROLIB_X_KEYCODES_H
|
||||
#define MACROLIB_X_KEYCODES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Event codes for physical keyboard keys
|
||||
*/
|
||||
typedef enum mlx_key_event_code
|
||||
{
|
||||
MLX_KEY_A = 4,
|
||||
MLX_KEY_B = 5,
|
||||
MLX_KEY_C = 6,
|
||||
MLX_KEY_D = 7,
|
||||
MLX_KEY_E = 8,
|
||||
MLX_KEY_F = 9,
|
||||
MLX_KEY_G = 10,
|
||||
MLX_KEY_H = 11,
|
||||
MLX_KEY_I = 12,
|
||||
MLX_KEY_J = 13,
|
||||
MLX_KEY_K = 14,
|
||||
MLX_KEY_L = 15,
|
||||
MLX_KEY_M = 16,
|
||||
MLX_KEY_N = 17,
|
||||
MLX_KEY_O = 18,
|
||||
MLX_KEY_P = 19,
|
||||
MLX_KEY_Q = 20,
|
||||
MLX_KEY_R = 21,
|
||||
MLX_KEY_S = 22,
|
||||
MLX_KEY_T = 23,
|
||||
MLX_KEY_U = 24,
|
||||
MLX_KEY_V = 25,
|
||||
MLX_KEY_W = 26,
|
||||
MLX_KEY_X = 27,
|
||||
MLX_KEY_Y = 28,
|
||||
MLX_KEY_Z = 29,
|
||||
MLX_KEY_1 = 30,
|
||||
MLX_KEY_2 = 31,
|
||||
MLX_KEY_3 = 32,
|
||||
MLX_KEY_4 = 33,
|
||||
MLX_KEY_5 = 34,
|
||||
MLX_KEY_6 = 35,
|
||||
MLX_KEY_7 = 36,
|
||||
MLX_KEY_8 = 37,
|
||||
MLX_KEY_9 = 38,
|
||||
MLX_KEY_0 = 39,
|
||||
MLX_KEY_RETURN = 40,
|
||||
MLX_KEY_ENTER = 40,
|
||||
MLX_KEY_ESCAPE = 41,
|
||||
MLX_KEY_BACKSPACE = 42,
|
||||
MLX_KEY_TAB = 43,
|
||||
MLX_KEY_SPACE = 44,
|
||||
MLX_KEY_MINUS = 45,
|
||||
MLX_KEY_EQUALS = 46,
|
||||
MLX_KEY_LEFTBRACKET = 47,
|
||||
MLX_KEY_RIGHTBRACKET = 48,
|
||||
MLX_KEY_BACKSLASH = 49,
|
||||
MLX_KEY_SEMICOLON = 51,
|
||||
MLX_KEY_APOSTROPHE = 52,
|
||||
MLX_KEY_GRAVE = 53,
|
||||
MLX_KEY_COMMA = 54,
|
||||
MLX_KEY_PERIOD = 55,
|
||||
MLX_KEY_SLASH = 56,
|
||||
MLX_KEY_CAPSLOCK = 57,
|
||||
MLX_KEY_F1 = 58,
|
||||
MLX_KEY_F2 = 59,
|
||||
MLX_KEY_F3 = 60,
|
||||
MLX_KEY_F4 = 61,
|
||||
MLX_KEY_F5 = 62,
|
||||
MLX_KEY_F6 = 63,
|
||||
MLX_KEY_F7 = 64,
|
||||
MLX_KEY_F8 = 65,
|
||||
MLX_KEY_F9 = 66,
|
||||
MLX_KEY_F10 = 67,
|
||||
MLX_KEY_F11 = 68,
|
||||
MLX_KEY_F12 = 69,
|
||||
MLX_KEY_PRINTSCREEN = 70,
|
||||
MLX_KEY_SCROLLLOCK = 71,
|
||||
MLX_KEY_PAUSE = 72,
|
||||
MLX_KEY_INSERT = 73,
|
||||
MLX_KEY_HOME = 74,
|
||||
MLX_KEY_PAGEUP = 75,
|
||||
MLX_KEY_DELETE = 76,
|
||||
MLX_KEY_END = 77,
|
||||
MLX_KEY_PAGEDOWN = 78,
|
||||
MLX_KEY_RIGHT = 79,
|
||||
MLX_KEY_LEFT = 80,
|
||||
MLX_KEY_DOWN = 81,
|
||||
MLX_KEY_UP = 82,
|
||||
MLX_KEY_NUMLOCKCLEAR = 83,
|
||||
MLX_KEY_KP_DIVIDE = 84,
|
||||
MLX_KEY_KP_MULTIPLY = 85,
|
||||
MLX_KEY_KP_MINUS = 86,
|
||||
MLX_KEY_KP_PLUS = 87,
|
||||
MLX_KEY_KP_ENTER = 88,
|
||||
MLX_KEY_KP_1 = 89,
|
||||
MLX_KEY_KP_2 = 90,
|
||||
MLX_KEY_KP_3 = 91,
|
||||
MLX_KEY_KP_4 = 92,
|
||||
MLX_KEY_KP_5 = 93,
|
||||
MLX_KEY_KP_6 = 94,
|
||||
MLX_KEY_KP_7 = 95,
|
||||
MLX_KEY_KP_8 = 96,
|
||||
MLX_KEY_KP_9 = 97,
|
||||
MLX_KEY_KP_0 = 98,
|
||||
MLX_KEY_KP_PERIOD = 99,
|
||||
MLX_KEY_LCTRL = 224,
|
||||
MLX_KEY_LSHIFT = 225,
|
||||
MLX_KEY_LALT = 226,
|
||||
MLX_KEY_LGUI = 227,
|
||||
MLX_KEY_RCTRL = 228,
|
||||
MLX_KEY_RSHIFT = 229,
|
||||
MLX_KEY_RALT = 230,
|
||||
MLX_KEY_RGUI = 231
|
||||
} mlx_key_codes;
|
||||
|
||||
/**
|
||||
* @brief Event codes for mouse buttons
|
||||
*/
|
||||
typedef enum mlx_mouse_code
|
||||
{
|
||||
MLX_MOUSE_LEFT = 1,
|
||||
MLX_MOUSE_MIDDLE = 2,
|
||||
MLX_MOUSE_RIGHT = 3,
|
||||
MLX_MOUSE_4 = 4,
|
||||
MLX_MOUSE_5 = 5,
|
||||
} mlx_mouse_code;
|
||||
|
||||
/**
|
||||
* @brief Event codes for window events
|
||||
*/
|
||||
typedef enum mlx_window_code
|
||||
{
|
||||
MLX_WINDOW_CLOSE = 0,
|
||||
MLX_WINDOW_MOVED = 1,
|
||||
MLX_WINDOW_MINIMIZED = 2,
|
||||
MLX_WINDOW_MAXIMIZED = 3,
|
||||
MLX_WINDOW_ENTER = 4,
|
||||
MLX_WINDOW_FOCUS = 5,
|
||||
MLX_WINDOW_LEAVE = 6,
|
||||
MLX_WINDOW_UNFOCUS = 7,
|
||||
MLX_WINDOW_SIZE_CHANGED = 8,
|
||||
MLX_WINDOW_RESIZED = 9,
|
||||
MLX_WINDOW_RESTORED = 11
|
||||
} mlx_window_code;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -83,6 +83,25 @@
|
||||
#define MLX_API
|
||||
#endif
|
||||
|
||||
#define MLX_NO_DEPRECATE
|
||||
#ifdef MLX_NO_DEPRECATE
|
||||
#define MLX_DEPRECATED(msg)
|
||||
#elif defined(__has_c_attribute)
|
||||
#if __has_c_attribute(deprecated)
|
||||
#define MLX_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MLX_DEPRECATED
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define MLX_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define MLX_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#else
|
||||
#define MLX_DEPRECATED(msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
|
||||
#define MLX_FUNC_SIG __PRETTY_FUNCTION__
|
||||
#elif defined(__DMC__) && (__DMC__ >= 0x810)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace mlx
|
||||
|
||||
inline void OnEvent(mlx_window win, int event, void(*f)(int, void*), void* param) noexcept;
|
||||
|
||||
inline mlx_window NewGraphicsSuport(const mlx_window_create_info* info);
|
||||
inline mlx_window NewGraphicsSupport(const mlx_window_create_info* info);
|
||||
inline NonOwningPtr<GraphicsSupport> GetGraphicsSupport(mlx_window win);
|
||||
inline void DestroyGraphicsSupport(mlx_window win);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace mlx
|
||||
m_fps.SetMaxFPS(fps);
|
||||
}
|
||||
|
||||
mlx_window Application::NewGraphicsSuport(const mlx_window_create_info* info)
|
||||
mlx_window Application::NewGraphicsSupport(const mlx_window_create_info* info)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(!info)
|
||||
@@ -68,6 +68,11 @@ namespace mlx
|
||||
Error("invalid window create info (NULL)");
|
||||
return nullptr;
|
||||
}
|
||||
if (info->title == nullptr)
|
||||
{
|
||||
Error("invalid window title (NULL)");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mlx_window window;
|
||||
try { window = new mlx_window_handler; }
|
||||
@@ -134,7 +139,7 @@ namespace mlx
|
||||
{
|
||||
m_hooks.emplace_back(f, param);
|
||||
}
|
||||
|
||||
|
||||
void Application::LoopEnd() noexcept
|
||||
{
|
||||
m_in.Finish();
|
||||
|
||||
@@ -19,9 +19,10 @@ namespace mlx
|
||||
|
||||
enum class Event
|
||||
{
|
||||
ResizeEventCode = 56,
|
||||
FrameBeginEventCode = 57,
|
||||
FatalErrorEventCode = 168,
|
||||
ResizeEventCode = 1,
|
||||
SwapchainResizeEventCode,
|
||||
FrameBeginEventCode,
|
||||
FatalErrorEventCode,
|
||||
|
||||
EndEnum
|
||||
};
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
#ifndef __MLX_FPS__
|
||||
#define __MLX_FPS__
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
typedef std::chrono::steady_clock fps_clock;
|
||||
|
||||
class FpsManager
|
||||
{
|
||||
public:
|
||||
FpsManager() = default;
|
||||
|
||||
void Init();
|
||||
bool Update();
|
||||
inline void SetMaxFPS(std::uint32_t fps) noexcept { m_max_fps = fps; m_ns = 1000000000.0 / fps; }
|
||||
void WaitUntilNextFrame();
|
||||
inline void SetMaxFPS(std::uint32_t fps) noexcept { m_target_delta = fps_clock::duration(std::chrono::seconds(1)) / fps;}
|
||||
|
||||
~FpsManager() = default;
|
||||
|
||||
private:
|
||||
double m_ns = 1000000000.0 / 1'337'000.0;
|
||||
std::int64_t m_fps_before = 0;
|
||||
std::int64_t m_fps_now = 0;
|
||||
std::int64_t m_timer = 0;
|
||||
std::uint32_t m_max_fps = 1'337'000;
|
||||
std::uint32_t m_fps_elapsed_time = 0;
|
||||
fps_clock::time_point m_current_time;
|
||||
fps_clock::time_point m_target_time;
|
||||
fps_clock::time_point m_last_time_record;
|
||||
fps_clock::duration m_delta_time = fps_clock::duration().zero();
|
||||
fps_clock::duration m_target_delta = fps_clock::duration().zero();
|
||||
fps_clock::duration m_sleep_margin = std::chrono::microseconds(200);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace mlx
|
||||
void PixelPutArray(int x, int y, mlx_color* color, std::size_t pixels_size) noexcept;
|
||||
void PixelPutRegion(int x, int y, int w, int h, mlx_color* color) noexcept;
|
||||
void StringPut(int x, int y, mlx_color color, std::string str);
|
||||
void TexturePut(NonOwningPtr<class Texture> texture, int x, int y, float scale_x, float scale_y, float angle);
|
||||
void TexturePut(NonOwningPtr<class Texture> texture, float x, float y, float scale_x, float scale_y, float angle);
|
||||
|
||||
inline void TryEraseSpritesInScene(NonOwningPtr<Texture> texture) noexcept;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <mlx.h>
|
||||
#include <Maths/Vec2.h>
|
||||
#include <Renderer/Image.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -26,6 +27,7 @@ namespace mlx
|
||||
void SetWindowPosition(Handle window, int x, int y) const noexcept;
|
||||
void SetWindowSize(Handle window, int x, int y) const noexcept;
|
||||
void SetWindowTitle(Handle window, std::string_view title) const noexcept;
|
||||
void SetWindowIcon(Handle window, NonOwningPtr<Texture> texture) const noexcept;
|
||||
void SetWindowFullscreen(Handle window, bool enable) const noexcept;
|
||||
void SetWindowMaxSize(Handle window, int x, int y) const noexcept;
|
||||
void SetWindowMinSize(Handle window, int x, int y) const noexcept;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mlx.h>
|
||||
#include <Maths/Vec2.h>
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Renderer/Image.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -24,6 +25,7 @@ namespace mlx
|
||||
MLX_FORCEINLINE void SetPosition(int x, int y) { SDLManager::Get().SetWindowPosition(p_window, x, y); }
|
||||
MLX_FORCEINLINE void SetSize(int x, int y) { SDLManager::Get().SetWindowSize(p_window, x, y); m_width = x; m_height = y; }
|
||||
MLX_FORCEINLINE void SetTitle(std::string title) { SDLManager::Get().SetWindowTitle(p_window, title); m_name = std::move(title); }
|
||||
MLX_FORCEINLINE void SetIcon(NonOwningPtr<Texture> texture) {SDLManager::Get().SetWindowIcon(p_window, texture); }
|
||||
MLX_FORCEINLINE void SetFullscreen(bool enable) { SDLManager::Get().SetWindowFullscreen(p_window, enable); }
|
||||
MLX_FORCEINLINE void SetMaxSize(int x, int y) { SDLManager::Get().SetWindowMaxSize(p_window, x, y); }
|
||||
MLX_FORCEINLINE void SetMinSize(int x, int y) { SDLManager::Get().SetWindowMinSize(p_window, x, y); }
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace mlx
|
||||
void SetPixel(int x, int y, mlx_color color) noexcept;
|
||||
void SetRegion(int x, int y, int w, int h, mlx_color* color) noexcept;
|
||||
void SetLinearRegion(int x, int y, std::size_t len, mlx_color* color) noexcept;
|
||||
void SetRectangle(int x, int y, int w, int h, mlx_color color) noexcept;
|
||||
mlx_color GetPixel(int x, int y) noexcept;
|
||||
void GetRegion(int x, int y, int w, int h, mlx_color* dst) noexcept;
|
||||
void Clear(VkCommandBuffer cmd, Vec4f color) override;
|
||||
@@ -94,6 +95,8 @@ namespace mlx
|
||||
|
||||
void Swap(Texture& texture) noexcept;
|
||||
|
||||
mlx_color* GetBufferCopy() noexcept;
|
||||
|
||||
// If a valid cmd buffer is passed, this function takes ownership and makes it invalid after
|
||||
void SyncCPUBuffer(VkCommandBuffer cmd = VK_NULL_HANDLE);
|
||||
void Update(VkCommandBuffer cmd);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef __MLX_CPU_BUFFER__
|
||||
#define __MLX_CPU_BUFFER__
|
||||
|
||||
#include <PreCompiled.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class CPUBuffer
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
Application::Application() : p_mem_manager(std::make_unique<MemManager>()), p_sdl_manager(std::make_unique<SDLManager>()), m_fps(), m_in()
|
||||
Application::Application() : p_mem_manager(std::make_unique<MemManager>()), p_sdl_manager(std::make_unique<SDLManager>()), m_fps(), m_in()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
std::srand(std::time(nullptr));
|
||||
@@ -33,8 +33,7 @@ namespace mlx
|
||||
|
||||
while(m_in.IsRunning())
|
||||
{
|
||||
if(!m_fps.Update())
|
||||
continue;
|
||||
m_fps.WaitUntilNextFrame();
|
||||
|
||||
m_in.FetchInputs();
|
||||
|
||||
|
||||
@@ -45,10 +45,9 @@ extern "C"
|
||||
void mlx_set_fps_goal(mlx_context mlx, int fps)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
if(fps < 0)
|
||||
mlx::Error("You cannot set a negative FPS cap (nice try)");
|
||||
else
|
||||
mlx->app->SetFPSCap(static_cast<std::uint32_t>(fps));
|
||||
if(fps <= 0)
|
||||
fps = -1;
|
||||
mlx->app->SetFPSCap(static_cast<std::uint32_t>(fps));
|
||||
}
|
||||
|
||||
void mlx_destroy_context(mlx_context mlx)
|
||||
@@ -62,7 +61,7 @@ extern "C"
|
||||
mlx_window mlx_new_window(mlx_context mlx, const mlx_window_create_info* info)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
return mlx->app->NewGraphicsSuport(info);
|
||||
return mlx->app->NewGraphicsSupport(info);
|
||||
}
|
||||
|
||||
void mlx_destroy_window(mlx_context mlx, mlx_window win)
|
||||
@@ -92,12 +91,29 @@ extern "C"
|
||||
void mlx_set_window_title(mlx_context mlx, mlx_window win, const char* title)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
if (title == nullptr)
|
||||
{
|
||||
mlx::Error("invalid window title (NULL)");
|
||||
return;
|
||||
}
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
gs->GetWindow()->SetTitle(title);
|
||||
}
|
||||
|
||||
void mlx_set_window_icon(mlx_context mlx, mlx_window win, mlx_image image)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
if(!gs && !gs->HasWindow())
|
||||
return;
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
if(!texture)
|
||||
return;
|
||||
gs->GetWindow()->SetIcon(texture);
|
||||
}
|
||||
|
||||
void mlx_set_window_fullscreen(mlx_context mlx, mlx_window win, bool enable)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
@@ -313,14 +329,14 @@ extern "C"
|
||||
mlx::Error("Font loader: filepath is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::filesystem::path file(filepath);
|
||||
if (std::strcmp(filepath, "default") != 0 && !std::filesystem::exists(file))
|
||||
{
|
||||
mlx::Error("TTF loader: unable to find file '%'", filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(std::strcmp(filepath, "default") != 0)
|
||||
{
|
||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||
@@ -350,7 +366,7 @@ extern "C"
|
||||
mlx::Error("Font loader: filepath is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::filesystem::path file(filepath);
|
||||
if (std::strcmp(filepath, "default") != 0 && !std::filesystem::exists(file))
|
||||
{
|
||||
@@ -441,6 +457,15 @@ extern "C"
|
||||
gs->PixelPutRegion(x, y, w, h, pixels);
|
||||
}
|
||||
|
||||
void mlx_set_image_rectangle(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color color)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
if(!texture)
|
||||
return;
|
||||
texture->SetRectangle(x, y, w, h, color);
|
||||
}
|
||||
|
||||
void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* dst)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
@@ -459,7 +484,7 @@ extern "C"
|
||||
texture->SetRegion(x, y, w, h, pixels);
|
||||
}
|
||||
|
||||
void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, int x, int y, float scale_x, float scale_y, float angle)
|
||||
void mlx_put_transformed_image_to_window(mlx_context mlx, mlx_window win, mlx_image image, float x, float y, float scale_x, float scale_y, float angle)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
|
||||
@@ -1,30 +1,37 @@
|
||||
#include <PreCompiled.h>
|
||||
#include <Core/Fps.h>
|
||||
|
||||
#ifndef __APPLE__
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
void FpsManager::Init()
|
||||
{
|
||||
m_timer = static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
m_fps_before = m_timer;
|
||||
m_fps_now = m_timer;
|
||||
m_current_time = fps_clock::now();
|
||||
m_target_time = m_current_time + m_target_delta;
|
||||
}
|
||||
|
||||
bool FpsManager::Update()
|
||||
void FpsManager::WaitUntilNextFrame()
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
m_fps_now = static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
|
||||
if(std::chrono::duration<std::uint64_t>{m_fps_now - m_timer} >= 1s)
|
||||
m_timer += m_fps_now;
|
||||
|
||||
m_fps_elapsed_time = m_fps_now - m_fps_before;
|
||||
if(m_fps_elapsed_time >= m_ns)
|
||||
m_current_time = fps_clock::now();
|
||||
if(m_current_time < m_target_time)
|
||||
{
|
||||
m_fps_before += m_ns;
|
||||
return true;
|
||||
std::this_thread::sleep_until(m_target_time - m_sleep_margin);
|
||||
m_current_time = fps_clock::now();
|
||||
while (m_current_time < m_target_time)
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
_mm_pause(); // reduces CPU usage on x86 without yielding
|
||||
#endif
|
||||
m_current_time = fps_clock::now();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::duration<double, std::nano>(m_ns - 1));
|
||||
return false;
|
||||
else if (m_target_time < m_current_time - m_target_delta * 4)
|
||||
m_target_time = m_current_time;
|
||||
m_target_time += m_target_delta;
|
||||
m_delta_time = m_current_time - m_last_time_record;
|
||||
m_last_time_record = m_current_time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace mlx
|
||||
p_scene->BringToDrawLayer(text.Get(), m_draw_layer);
|
||||
}
|
||||
|
||||
void GraphicsSupport::TexturePut(NonOwningPtr<Texture> texture, int x, int y, float scale_x, float scale_y, float angle)
|
||||
void GraphicsSupport::TexturePut(NonOwningPtr<Texture> texture, float x, float y, float scale_x, float scale_y, float angle)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
NonOwningPtr<Sprite> sprite = p_scene->GetSpriteFromTexturePositionScaleRotation(texture, Vec2f{ static_cast<float>(x), static_cast<float>(y) }, scale_x, scale_y, angle);
|
||||
@@ -146,14 +146,14 @@ namespace mlx
|
||||
{
|
||||
m_draw_layer++;
|
||||
m_pixelput_called = false;
|
||||
}
|
||||
}
|
||||
Sprite& new_sprite = p_scene->CreateSprite(texture);
|
||||
new_sprite.SetCenter(Vec2f{ texture->GetWidth() * 0.5f, texture->GetHeight() * 0.5f });
|
||||
new_sprite.SetPosition(Vec2f{ static_cast<float>(x), static_cast<float>(y) });
|
||||
new_sprite.SetScale(Vec2f{ scale_x, scale_y });
|
||||
new_sprite.SetRotation(angle);
|
||||
}
|
||||
else if(!p_scene->IsTextureAtGivenDrawLayer(texture, m_draw_layer))
|
||||
else if(!p_scene->IsTextureAtGivenDrawLayer(texture, m_draw_layer))
|
||||
p_scene->BringToDrawLayer(sprite.Get(), m_draw_layer);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "Utils/Buffer.h"
|
||||
#include "mlx.h"
|
||||
#include <PreCompiled.h>
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Core/Memory.h>
|
||||
@@ -56,7 +58,12 @@ namespace mlx
|
||||
infos->window = SDL_CreateWindow(info->title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, info->width, info->height, flags);
|
||||
if(!infos->window)
|
||||
FatalError("SDL: unable to open a new window; %", SDL_GetError());
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(static_cast<void*>(logo_mlx), logo_mlx_width, logo_mlx_height, 32, 4 * logo_mlx_width, Rmask(), Gmask(), Bmask(), Amask());
|
||||
|
||||
mlx_color* buffer = new mlx_color[logo_mlx_size];
|
||||
std::memcpy(buffer, logo_mlx, logo_mlx_size);
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(buffer, logo_mlx_width, logo_mlx_height, 32, logo_mlx_width * 4, Rmask(), Gmask(), Bmask(), Amask());
|
||||
if(!infos->icon)
|
||||
FatalError("SDL: unable to create a window icon; %", SDL_GetError());
|
||||
SDL_SetWindowIcon(infos->window, infos->icon);
|
||||
|
||||
m_windows_registry.insert(infos);
|
||||
@@ -74,7 +81,10 @@ namespace mlx
|
||||
if(infos->window != nullptr)
|
||||
SDL_DestroyWindow(infos->window);
|
||||
if(infos->icon != nullptr)
|
||||
{
|
||||
delete[] reinterpret_cast<mlx_color*>(infos->icon->pixels);
|
||||
SDL_FreeSurface(infos->icon);
|
||||
}
|
||||
|
||||
m_windows_registry.erase(infos);
|
||||
delete infos;
|
||||
@@ -152,6 +162,21 @@ namespace mlx
|
||||
SDL_SetWindowTitle(static_cast<Internal::WindowInfos*>(window)->window, title.data());
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowIcon(Handle window, NonOwningPtr<Texture> texture) const noexcept
|
||||
{
|
||||
Internal::WindowInfos* infos = static_cast<Internal::WindowInfos*>(window);
|
||||
if(infos->icon != nullptr)
|
||||
{
|
||||
delete[] reinterpret_cast<mlx_color*>(infos->icon->pixels);
|
||||
SDL_FreeSurface(infos->icon);
|
||||
}
|
||||
|
||||
int width = texture->GetWidth(), height = texture->GetHeight();
|
||||
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(texture->GetBufferCopy(), width, height, 32, width * 4, Rmask(), Gmask(), Bmask(), Amask());
|
||||
SDL_SetWindowIcon(infos->window, infos->icon);
|
||||
}
|
||||
|
||||
void SDLManager::SetWindowFullscreen(Handle window, bool enable) const noexcept
|
||||
{
|
||||
SDL_SetWindowFullscreen(static_cast<Internal::WindowInfos*>(window)->window, (enable ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
||||
@@ -276,6 +301,7 @@ namespace mlx
|
||||
case SDL_WINDOWEVENT_LEAVE: functor(MLX_WINDOW_EVENT, id, 6); break;
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST: functor(MLX_WINDOW_EVENT, id, 7); break;
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED: functor(MLX_WINDOW_EVENT, id, 8); break;
|
||||
case SDL_WINDOWEVENT_RESIZED: functor(MLX_WINDOW_EVENT, id, 9); break;
|
||||
case SDL_WINDOWEVENT_RESTORED: functor(MLX_WINDOW_EVENT, id, 11); break;
|
||||
|
||||
default : break;
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace mlx
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
struct ResizeEventBroadcast : public EventBase
|
||||
struct SwapchainResizeEventBroadcast : public EventBase
|
||||
{
|
||||
Event What() const override { return Event::ResizeEventCode; }
|
||||
Event What() const override { return Event::SwapchainResizeEventCode; }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace mlx
|
||||
if(!m_events_hooks.contains(window_id) || m_events_hooks[window_id][event].empty())
|
||||
return;
|
||||
if(event == MLX_WINDOW_EVENT && code == 8)
|
||||
EventBus::SendBroadcast(Internal::ResizeEventBroadcast{});
|
||||
EventBus::SendBroadcast(Internal::SwapchainResizeEventBroadcast{});
|
||||
for(const auto& hook : m_events_hooks[window_id][event])
|
||||
{
|
||||
if(hook.fn)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "Utils/Buffer.h"
|
||||
#include "mlx.h"
|
||||
#include <PreCompiled.h>
|
||||
#include <Renderer/Image.h>
|
||||
#include <Maths/Vec4.h>
|
||||
@@ -226,25 +228,34 @@ namespace mlx
|
||||
void Texture::SetRegion(int x, int y, int w, int h, mlx_color* pixels) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||
return;
|
||||
if(w < 0 || h < 0)
|
||||
if(w < 0 || h < 0 || x < -w || y < -h
|
||||
|| x >= static_cast<int>(m_width) || y >= static_cast<int>(m_height))
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
for(std::uint32_t i = 0, moving_x = x, moving_y = y;; i++, moving_x++)
|
||||
const int
|
||||
start_x = std::max<int>(x, 0),
|
||||
start_y = std::max<int>(y, 0),
|
||||
start_row = start_y * m_width,
|
||||
start_i = (start_y - y) * w + (start_x - x),
|
||||
end_x = std::min<int>(x + w, m_width),
|
||||
end_y = std::min<int>(y + h, m_height),
|
||||
end_row = end_y * m_width,
|
||||
incr = (x + w) - end_x + (start_x - x);
|
||||
for(int i = start_i, dx = start_x, row = start_row;; i++, dx++)
|
||||
{
|
||||
if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width)
|
||||
if(dx >= end_x)
|
||||
{
|
||||
moving_x = x;
|
||||
moving_y++;
|
||||
if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height)
|
||||
i += incr;
|
||||
dx = start_x;
|
||||
row += m_width;
|
||||
if(row >= end_row)
|
||||
break;
|
||||
}
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x] = ReverseColor(pixels[i]);
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = ReverseColor(pixels[i]);
|
||||
else
|
||||
m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x] = pixels[i];
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = pixels[i];
|
||||
}
|
||||
m_has_been_modified = true;
|
||||
}
|
||||
@@ -252,23 +263,55 @@ namespace mlx
|
||||
void Texture::SetLinearRegion(int x, int y, std::size_t len, mlx_color* pixels) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||
if(x >= static_cast<int>(m_width) || y >= static_cast<int>(m_height))
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
int
|
||||
start = y * m_width + x,
|
||||
dest_start = std::max<int>(start, 0),
|
||||
src_start = dest_start - start,
|
||||
dest_end = std::min<int>(start + len, m_width * m_height);
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
{
|
||||
for(std::size_t i = 0; i < len && (y * m_width) + x + i < m_width * m_height; i++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[(y * m_width) + x + i] = ReverseColor(pixels[i]);
|
||||
for(int i = dest_start, j = src_start; i < dest_end; i++, j++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[i] = ReverseColor(pixels[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::size_t len_guard;
|
||||
if((y * m_width + x + len) < m_width * m_height)
|
||||
len_guard = len;
|
||||
std::memcpy(
|
||||
&m_staging_buffer->GetMap<mlx_color*>()[dest_start],
|
||||
&pixels[src_start], dest_end - dest_start);
|
||||
}
|
||||
m_has_been_modified = true;
|
||||
}
|
||||
|
||||
void Texture::SetRectangle(int x, int y, int w, int h, mlx_color color) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(w < 0 || h < 0 || x < -w || y < -h
|
||||
|| x >= static_cast<int>(m_width) || y >= static_cast<int>(m_height))
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
const int
|
||||
start_x = std::max<int>(x, 0),
|
||||
start_row = std::max<int>(y, 0) * m_width,
|
||||
end_x = std::min<int>(x + w, m_width),
|
||||
end_row = std::min<int>(y + h, m_height) * m_width;
|
||||
for(int dx = start_x, row = start_row;; dx++)
|
||||
{
|
||||
if(dx >= end_x)
|
||||
{
|
||||
dx = start_x;
|
||||
row += m_width;
|
||||
if(row >= end_row)
|
||||
break;
|
||||
}
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = ReverseColor(color);
|
||||
else
|
||||
len_guard = len - (m_width * m_height - (y * m_width + x + len));
|
||||
std::memcpy(&m_staging_buffer->GetMap<mlx_color*>()[(y * m_width) + x], pixels, len_guard);
|
||||
m_staging_buffer->GetMap<mlx_color*>()[row + dx] = color;
|
||||
}
|
||||
m_has_been_modified = true;
|
||||
}
|
||||
@@ -289,23 +332,23 @@ namespace mlx
|
||||
void Texture::GetRegion(int x, int y, int w, int h, mlx_color* dst) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||
if(w < 0 || h < 0 || x < 0 || y < 0 || static_cast<std::uint32_t>(x + w) >= m_width || static_cast<std::uint32_t>(y + h) >= m_height)
|
||||
return;
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
for(std::uint32_t i = 0, moving_x = x, moving_y = y;; i++, moving_x++)
|
||||
for(std::uint32_t i = 0, dx = x, row = y * m_width;; i++, dx++)
|
||||
{
|
||||
if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width)
|
||||
if(dx >= m_width)
|
||||
{
|
||||
moving_x = x;
|
||||
moving_y++;
|
||||
if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height)
|
||||
dx = x;
|
||||
row += m_width;
|
||||
if(row >= m_height * m_width)
|
||||
break;
|
||||
}
|
||||
if constexpr(std::endian::native == std::endian::little)
|
||||
dst[i] = ReverseColor(m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x]);
|
||||
dst[i] = ReverseColor(m_staging_buffer->GetMap<mlx_color*>()[row + dx]);
|
||||
else
|
||||
dst[i] = m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x];
|
||||
dst[i] = m_staging_buffer->GetMap<mlx_color*>()[row + dx];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,16 +363,8 @@ namespace mlx
|
||||
processed_color.g = static_cast<std::uint8_t>(color.g * 255.f);
|
||||
processed_color.b = static_cast<std::uint8_t>(color.b * 255.f);
|
||||
processed_color.a = static_cast<std::uint8_t>(color.a * 255.f);
|
||||
if(processed_color.r == 0 && processed_color.g == 0 && processed_color.b == 0)
|
||||
std::memset(m_staging_buffer->GetMap(), processed_color.a, m_staging_buffer->GetSize());
|
||||
else
|
||||
{
|
||||
for(std::size_t y = 0; y < m_height; y++)
|
||||
{
|
||||
for(std::size_t x = 0; x < m_width; x++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[y * m_width + x] = processed_color;
|
||||
}
|
||||
}
|
||||
for(std::size_t i = 0; i < m_width * m_height; i++)
|
||||
m_staging_buffer->GetMap<mlx_color*>()[i] = processed_color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,6 +381,17 @@ namespace mlx
|
||||
m_has_been_modified = false;
|
||||
}
|
||||
|
||||
mlx_color* Texture::GetBufferCopy() noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
if(!m_staging_buffer.has_value())
|
||||
OpenCPUBuffer();
|
||||
|
||||
mlx_color* dst = new mlx_color[m_width * m_height];
|
||||
std::memcpy(dst, m_staging_buffer->GetMap<mlx_color*>(), m_width * m_height * sizeof(mlx_color));
|
||||
return dst;
|
||||
}
|
||||
|
||||
void Texture::OpenCPUBuffer()
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace mlx
|
||||
Event What() const override { return Event::ResizeEventCode; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
std::string VulkanFormatName(VkFormat format)
|
||||
{
|
||||
#define STRINGIFY(x) case x: return #x
|
||||
@@ -161,7 +161,7 @@ namespace mlx
|
||||
|
||||
std::function<void(const EventBase&)> functor = [this](const EventBase& event)
|
||||
{
|
||||
if(event.What() == Event::ResizeEventCode && !m_resize)
|
||||
if(event.What() == Event::SwapchainResizeEventCode && !m_resize)
|
||||
m_resize = true;
|
||||
};
|
||||
EventBus::RegisterListener({ functor, "mlx_swapchain_" + std::to_string(reinterpret_cast<std::uintptr_t>(this)) });
|
||||
|
||||
Vendored
+2
-2
@@ -24,9 +24,9 @@ VULKAN_HPP_COMPILE_WARNING( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
|
||||
|
||||
export module vulkan;
|
||||
|
||||
export import std;
|
||||
import std;
|
||||
|
||||
VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == 359, "Wrong VK_HEADER_VERSION!" );
|
||||
VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == 361, "Wrong VK_HEADER_VERSION!" );
|
||||
|
||||
#if defined( __clang__ )
|
||||
# pragma clang diagnostic push
|
||||
|
||||
Vendored
+185
-20
@@ -18,6 +18,9 @@
|
||||
# include <string.h> // strnlen
|
||||
# include <string> // std::string
|
||||
# include <utility> // std::exchange
|
||||
# if defined( __APPLE__ )
|
||||
# include <cstdlib> // std::getenv
|
||||
# endif
|
||||
# if 17 <= VULKAN_HPP_CPP_VERSION
|
||||
# include <string_view>
|
||||
# endif
|
||||
@@ -36,7 +39,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == 359, "Wrong VK_HEADER_VERSION!" );
|
||||
VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == 361, "Wrong VK_HEADER_VERSION!" );
|
||||
|
||||
VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
@@ -87,14 +90,24 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
VULKAN_HPP_CONSTEXPR ArrayWrapper1D( std::array<T, N> const & data ) VULKAN_HPP_NOEXCEPT : std::array<T, N>( data ) {}
|
||||
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
|
||||
#else
|
||||
template <typename B = T>
|
||||
requires std::is_same<B, char>::value
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR_14 ArrayWrapper1D( std::string const & data ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
copy( data.data(), data.length() );
|
||||
}
|
||||
|
||||
#if 17 <= VULKAN_HPP_CPP_VERSION
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
|
||||
# else
|
||||
template <typename B = T>
|
||||
requires std::is_same<B, char>::value
|
||||
# endif
|
||||
VULKAN_HPP_CONSTEXPR_14 ArrayWrapper1D( std::string_view data ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
copy( data.data(), data.length() );
|
||||
@@ -124,14 +137,24 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
return this->data();
|
||||
}
|
||||
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
|
||||
#else
|
||||
template <typename B = T>
|
||||
requires std::is_same<B, char>::value
|
||||
#endif
|
||||
operator std::string() const
|
||||
{
|
||||
return std::string( this->data(), strnlen( this->data(), N ) );
|
||||
}
|
||||
|
||||
#if 17 <= VULKAN_HPP_CPP_VERSION
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
|
||||
# else
|
||||
template <typename B = T>
|
||||
requires std::is_same<B, char>::value
|
||||
# endif
|
||||
operator std::string_view() const
|
||||
{
|
||||
return std::string_view( this->data(), strnlen( this->data(), N ) );
|
||||
@@ -344,7 +367,12 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>
|
||||
# else
|
||||
template <typename B = T>
|
||||
requires std::is_const<B>::value
|
||||
# endif
|
||||
ArrayProxy( std::initializer_list<typename std::remove_const<T>::type> const & list ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( list.size() ) )
|
||||
, m_ptr( list.begin() )
|
||||
@@ -357,9 +385,15 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
// Any type with a .data() return type implicitly convertible to T*, and a .size() return type implicitly
|
||||
// convertible to size_t. The const version can capture temporaries, with lifetime ending at end of statement.
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename V,
|
||||
typename std::enable_if<std::is_convertible<decltype( std::declval<V>().data() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value>::type * = nullptr>
|
||||
# else
|
||||
template <typename V>
|
||||
requires std::is_convertible<decltype( std::declval<V>().data() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value
|
||||
# endif
|
||||
ArrayProxy( V const & v ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( v.size() ) )
|
||||
, m_ptr( v.data() )
|
||||
@@ -424,8 +458,13 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
}
|
||||
|
||||
template <typename B = T, typename std::enable_if<std::is_convertible<B, T>::value && std::is_lvalue_reference<B>::value, int>::type = 0>
|
||||
ArrayProxyNoTemporaries( B && value ) VULKAN_HPP_NOEXCEPT
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename S, typename std::enable_if<std::is_convertible<S, T>::value && std::is_lvalue_reference<S>::value, int>::type = 0>
|
||||
# else
|
||||
template <typename S>
|
||||
requires std::is_convertible<S, T>::value && std::is_lvalue_reference<S>::value
|
||||
# endif
|
||||
ArrayProxyNoTemporaries( S && value ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( 1 )
|
||||
, m_ptr( &value )
|
||||
{
|
||||
@@ -448,11 +487,18 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
ArrayProxyNoTemporaries( T ( &&ptr )[C] ) = delete;
|
||||
|
||||
// Any l-value reference with a .data() return type implicitly convertible to T*, and a .size() return type implicitly convertible to size_t.
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename V,
|
||||
typename std::enable_if<!std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().data() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value,
|
||||
int>::type = 0>
|
||||
# else
|
||||
template <typename V>
|
||||
requires( !std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().data() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value )
|
||||
# endif
|
||||
ArrayProxyNoTemporaries( V && v ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( v.size() ) )
|
||||
, m_ptr( v.data() )
|
||||
@@ -460,10 +506,16 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
// Any l-value reference with a .begin() return type implicitly convertible to T*, and a .size() return type implicitly convertible to size_t.
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename V,
|
||||
typename std::enable_if<std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value,
|
||||
int>::type = 0>
|
||||
# else
|
||||
template <typename V>
|
||||
requires std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
|
||||
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value
|
||||
# endif
|
||||
ArrayProxyNoTemporaries( V && v ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( v.size() ) )
|
||||
, m_ptr( v.begin() )
|
||||
@@ -605,16 +657,28 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Type, class...>
|
||||
struct IsFirstInStructureChain
|
||||
{
|
||||
static bool const value = false;
|
||||
};
|
||||
|
||||
template <typename Type, typename Head, typename... Tail>
|
||||
struct IsFirstInStructureChain<Type, Head, Tail...>
|
||||
{
|
||||
static bool const value = std::is_same<Type, Head>::value;
|
||||
};
|
||||
|
||||
template <typename Type, class...>
|
||||
struct IsPartOfStructureChain
|
||||
{
|
||||
static bool const valid = false;
|
||||
static bool const value = false;
|
||||
};
|
||||
|
||||
template <typename Type, typename Head, typename... Tail>
|
||||
struct IsPartOfStructureChain<Type, Head, Tail...>
|
||||
{
|
||||
static bool const valid = std::is_same<Type, Head>::value || IsPartOfStructureChain<Type, Tail...>::valid;
|
||||
static bool const value = std::is_same<Type, Head>::value || IsPartOfStructureChain<Type, Tail...>::value;
|
||||
};
|
||||
|
||||
template <size_t Index, typename T, typename... ChainElements>
|
||||
@@ -772,28 +836,46 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
return *this;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename ClassType,
|
||||
size_t Which = 0,
|
||||
typename std::enable_if<IsFirstInStructureChain<ClassType, ChainElements...>::value && ( Which == 0 ), int>::type = 0>
|
||||
# else
|
||||
template <typename ClassType, size_t Which = 0>
|
||||
VULKAN_HPP_NODISCARD
|
||||
typename std::enable_if<std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value && ( Which == 0 ), bool>::type
|
||||
isLinked() const VULKAN_HPP_NOEXCEPT
|
||||
requires IsFirstInStructureChain<ClassType, ChainElements...>::value && ( Which == 0 )
|
||||
# endif
|
||||
VULKAN_HPP_NODISCARD bool isLinked() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename ClassType,
|
||||
size_t Which = 0,
|
||||
typename std::enable_if<( !IsFirstInStructureChain<ClassType, ChainElements...>::value || ( Which != 0 ) ) &&
|
||||
IsPartOfStructureChain<ClassType, ChainElements...>::value,
|
||||
int>::type = 0>
|
||||
# else
|
||||
template <typename ClassType, size_t Which = 0>
|
||||
VULKAN_HPP_NODISCARD
|
||||
typename std::enable_if<!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value || ( Which != 0 ), bool>::type
|
||||
isLinked() const VULKAN_HPP_NOEXCEPT
|
||||
requires( !IsFirstInStructureChain<ClassType, ChainElements...>::value || ( Which != 0 ) ) && IsPartOfStructureChain<ClassType, ChainElements...>::value
|
||||
# endif
|
||||
VULKAN_HPP_NODISCARD bool isLinked() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
VULKAN_HPP_STATIC_ASSERT( IsPartOfStructureChain<ClassType, ChainElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!" );
|
||||
return isLinked( reinterpret_cast<VkBaseInStructure const *>( &get<ClassType, Which>() ) );
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename ClassType,
|
||||
size_t Which = 0,
|
||||
typename std::enable_if<( !IsFirstInStructureChain<ClassType, ChainElements...>::value || ( Which != 0 ) ) &&
|
||||
IsPartOfStructureChain<ClassType, ChainElements...>::value,
|
||||
int>::type = 0>
|
||||
# else
|
||||
template <typename ClassType, size_t Which = 0>
|
||||
typename std::enable_if<!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value || ( Which != 0 ), void>::type
|
||||
relink() VULKAN_HPP_NOEXCEPT
|
||||
requires( !IsFirstInStructureChain<ClassType, ChainElements...>::value || ( Which != 0 ) ) && IsPartOfStructureChain<ClassType, ChainElements...>::value
|
||||
# endif
|
||||
void relink() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
VULKAN_HPP_STATIC_ASSERT( IsPartOfStructureChain<ClassType, ChainElements...>::valid, "Can't relink Structure that's not part of this StructureChain!" );
|
||||
auto pNext = reinterpret_cast<VkBaseInStructure *>( &get<ClassType, Which>() );
|
||||
VULKAN_HPP_ASSERT( !isLinked( pNext ) );
|
||||
auto & headElement = std::get<0>( static_cast<std::tuple<ChainElements...> &>( *this ) );
|
||||
@@ -801,11 +883,18 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
headElement.pNext = pNext;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename ClassType,
|
||||
size_t Which = 0,
|
||||
typename std::enable_if<( !IsFirstInStructureChain<ClassType, ChainElements...>::value || ( Which != 0 ) ) &&
|
||||
IsPartOfStructureChain<ClassType, ChainElements...>::value,
|
||||
int>::type = 0>
|
||||
# else
|
||||
template <typename ClassType, size_t Which = 0>
|
||||
typename std::enable_if<!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value || ( Which != 0 ), void>::type
|
||||
unlink() VULKAN_HPP_NOEXCEPT
|
||||
requires( !IsFirstInStructureChain<ClassType, ChainElements...>::value || ( Which != 0 ) ) && IsPartOfStructureChain<ClassType, ChainElements...>::value
|
||||
# endif
|
||||
void unlink() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
VULKAN_HPP_STATIC_ASSERT( IsPartOfStructureChain<ClassType, ChainElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!" );
|
||||
unlink( reinterpret_cast<VkBaseOutStructure const *>( &get<ClassType, Which>() ) );
|
||||
}
|
||||
|
||||
@@ -848,16 +937,26 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
return false;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <size_t Index, typename std::enable_if<Index != 0, int>::type = 0>
|
||||
# else
|
||||
template <size_t Index>
|
||||
typename std::enable_if<Index != 0, void>::type link() VULKAN_HPP_NOEXCEPT
|
||||
requires( Index != 0 )
|
||||
# endif
|
||||
void link() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
auto & x = std::get<Index - 1>( static_cast<std::tuple<ChainElements...> &>( *this ) );
|
||||
x.pNext = &std::get<Index>( static_cast<std::tuple<ChainElements...> &>( *this ) );
|
||||
link<Index - 1>();
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <size_t Index, typename std::enable_if<Index == 0, int>::type = 0>
|
||||
# else
|
||||
template <size_t Index>
|
||||
typename std::enable_if<Index == 0, void>::type link() VULKAN_HPP_NOEXCEPT
|
||||
requires( Index == 0 )
|
||||
# endif
|
||||
void link() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
@@ -9338,47 +9437,83 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
//=========================
|
||||
//=== CONSTEXPR CALLEEs ===
|
||||
//=========================
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t apiVersionMajor( T const version )
|
||||
{
|
||||
return ( ( (uint32_t)( version ) >> 22U ) & 0x7FU );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t apiVersionMinor( T const version )
|
||||
{
|
||||
return ( ( (uint32_t)( version ) >> 12U ) & 0x3FFU );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t apiVersionPatch( T const version )
|
||||
{
|
||||
return ( (uint32_t)( version ) & 0xFFFU );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t apiVersionVariant( T const version )
|
||||
{
|
||||
return ( (uint32_t)( version ) >> 29U );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t makeApiVersion( T const variant, T const major, T const minor, T const patch )
|
||||
{
|
||||
return ( ( ( (uint32_t)( variant ) ) << 29U ) | ( ( (uint32_t)( major ) ) << 22U ) | ( ( (uint32_t)( minor ) ) << 12U ) | ( (uint32_t)( patch ) ) );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t makeVersion( T const major, T const minor, T const patch )
|
||||
{
|
||||
return ( ( ( (uint32_t)( major ) ) << 22U ) | ( ( (uint32_t)( minor ) ) << 12U ) | ( (uint32_t)( patch ) ) );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t versionMajor( T const version )
|
||||
{
|
||||
return ( (uint32_t)( version ) >> 22U );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t versionMinor( T const version )
|
||||
{
|
||||
return ( ( (uint32_t)( version ) >> 12U ) & 0x3FFU );
|
||||
}
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
#else
|
||||
template <std::integral T>
|
||||
#endif
|
||||
VULKAN_HPP_CONSTEXPR uint32_t versionPatch( T const version )
|
||||
{
|
||||
return ( (uint32_t)( version ) & 0xFFFU );
|
||||
@@ -11413,6 +11548,17 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
VULKAN_HPP_CONSTEXPR_INLINE auto NVCooperativeMatrixDecodeVectorSpecVersion = VK_NV_COOPERATIVE_MATRIX_DECODE_VECTOR_SPEC_VERSION;
|
||||
VULKAN_HPP_CONSTEXPR_INLINE auto NVCooperativeMatrixDecodeVectorExtensionName = VK_NV_COOPERATIVE_MATRIX_DECODE_VECTOR_EXTENSION_NAME;
|
||||
|
||||
//=== VK_NV_private_data_base_handle ===
|
||||
VULKAN_HPP_CONSTEXPR_INLINE auto NVPrivateDataBaseHandleSpecVersion = VK_NV_PRIVATE_DATA_BASE_HANDLE_SPEC_VERSION;
|
||||
VULKAN_HPP_CONSTEXPR_INLINE auto NVPrivateDataBaseHandleExtensionName = VK_NV_PRIVATE_DATA_BASE_HANDLE_EXTENSION_NAME;
|
||||
|
||||
#if 20 <= VULKAN_HPP_CPP_VERSION
|
||||
template <typename Allocator, typename T>
|
||||
concept IsAllocator = requires( Allocator allocator, std::size_t n ) {
|
||||
{ *allocator.allocate( n ) } -> std::same_as<typename Allocator::value_type &>;
|
||||
{ allocator.deallocate( allocator.allocate( n ), n ) };
|
||||
} && std::copy_constructible<Allocator> && std::equality_comparable<Allocator> && std::same_as<typename Allocator ::value_type, T>;
|
||||
#endif
|
||||
} // namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
// clang-format off
|
||||
@@ -23050,6 +23196,25 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
};
|
||||
};
|
||||
|
||||
//=== VK_NV_private_data_base_handle ===
|
||||
template <>
|
||||
struct StructExtends<PhysicalDevicePrivateDataBaseHandleFeaturesNV, PhysicalDeviceFeatures2>
|
||||
{
|
||||
enum
|
||||
{
|
||||
value = true
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct StructExtends<PhysicalDevicePrivateDataBaseHandleFeaturesNV, DeviceCreateInfo>
|
||||
{
|
||||
enum
|
||||
{
|
||||
value = true
|
||||
};
|
||||
};
|
||||
|
||||
#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
|
||||
namespace detail
|
||||
|
||||
Vendored
+22
-2
@@ -66,7 +66,7 @@ extern "C" {
|
||||
//#define VK_API_VERSION VK_MAKE_API_VERSION(0, 1, 0, 0) // Patch version should always be set to 0
|
||||
|
||||
// Version of this file
|
||||
#define VK_HEADER_VERSION 359
|
||||
#define VK_HEADER_VERSION 361
|
||||
|
||||
// Complete version of this file
|
||||
#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 4, VK_HEADER_VERSION)
|
||||
@@ -1493,6 +1493,7 @@ typedef enum VkStructureType {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_TILING_CONTROL_FEATURES_EXT = 1000687000,
|
||||
VK_STRUCTURE_TYPE_IMAGE_TILING_CONTROL_CREATE_INFO_EXT = 1000687001,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_DECODE_VECTOR_FEATURES_NV = 1000689000,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_BASE_HANDLE_FEATURES_NV = 1000707000,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES,
|
||||
// VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT is a legacy alias
|
||||
@@ -7127,6 +7128,11 @@ typedef enum VkToolPurposeFlagBits {
|
||||
VK_TOOL_PURPOSE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkToolPurposeFlagBits;
|
||||
typedef VkFlags VkToolPurposeFlags;
|
||||
|
||||
typedef enum VkPrivateDataSlotCreateFlagBits {
|
||||
VK_PRIVATE_DATA_SLOT_CREATE_BASE_OBJECT_HANDLE_BIT_NV = 0x00000001,
|
||||
VK_PRIVATE_DATA_SLOT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkPrivateDataSlotCreateFlagBits;
|
||||
typedef VkFlags VkPrivateDataSlotCreateFlags;
|
||||
typedef VkFlags64 VkPipelineStageFlags2;
|
||||
|
||||
@@ -20070,6 +20076,8 @@ typedef VkPrivateDataSlot VkPrivateDataSlotEXT;
|
||||
#define VK_EXT_PRIVATE_DATA_EXTENSION_NAME "VK_EXT_private_data"
|
||||
typedef VkPrivateDataSlotCreateFlags VkPrivateDataSlotCreateFlagsEXT;
|
||||
|
||||
typedef VkPrivateDataSlotCreateFlagBits VkPrivateDataSlotCreateFlagBitsEXT;
|
||||
|
||||
typedef VkPhysicalDevicePrivateDataFeatures VkPhysicalDevicePrivateDataFeaturesEXT;
|
||||
|
||||
typedef VkDevicePrivateDataCreateInfo VkDevicePrivateDataCreateInfoEXT;
|
||||
@@ -24007,7 +24015,7 @@ typedef struct VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT {
|
||||
|
||||
// VK_NV_low_latency2 is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_NV_low_latency2 1
|
||||
#define VK_NV_LOW_LATENCY_2_SPEC_VERSION 2
|
||||
#define VK_NV_LOW_LATENCY_2_SPEC_VERSION 3
|
||||
#define VK_NV_LOW_LATENCY_2_EXTENSION_NAME "VK_NV_low_latency2"
|
||||
|
||||
typedef enum VkLatencyMarkerNV {
|
||||
@@ -26588,6 +26596,18 @@ typedef struct VkPhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV {
|
||||
|
||||
|
||||
|
||||
// VK_NV_private_data_base_handle is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_NV_private_data_base_handle 1
|
||||
#define VK_NV_PRIVATE_DATA_BASE_HANDLE_SPEC_VERSION 1
|
||||
#define VK_NV_PRIVATE_DATA_BASE_HANDLE_EXTENSION_NAME "VK_NV_private_data_base_handle"
|
||||
typedef struct VkPhysicalDevicePrivateDataBaseHandleFeaturesNV {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkBool32 privateDataBaseHandle;
|
||||
} VkPhysicalDevicePrivateDataBaseHandleFeaturesNV;
|
||||
|
||||
|
||||
|
||||
// VK_KHR_acceleration_structure is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_acceleration_structure 1
|
||||
#define VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION 13
|
||||
|
||||
Vendored
+58
-33
@@ -22,6 +22,11 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = false;
|
||||
};
|
||||
|
||||
#if 20 <= VULKAN_HPP_CPP_VERSION
|
||||
template <typename T>
|
||||
concept Bitmask = FlagTraits<T>::isBitmask;
|
||||
#endif
|
||||
|
||||
template <typename BitType>
|
||||
class Flags
|
||||
{
|
||||
@@ -142,85 +147,101 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
#if !defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
// relational operators only needed for pre C++20
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator<( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR bool operator<( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator>( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator<=( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR bool operator<=( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator>=( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator>( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR bool operator>( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator<( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator>=( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR bool operator>=( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator<=( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator==( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR bool operator==( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator==( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator!=( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR bool operator!=( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator!=( bit );
|
||||
}
|
||||
#endif
|
||||
|
||||
// bitwise operators
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR Flags<T> operator&( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator&( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR Flags<T> operator|( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator|( bit );
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^( BitType bit, Flags<BitType> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
template <typename T>
|
||||
VULKAN_HPP_CONSTEXPR Flags<T> operator^( T bit, Flags<T> const & flags ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags.operator^( bit );
|
||||
}
|
||||
|
||||
// bitwise operators on BitType
|
||||
template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask, bool>::type = true>
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<BitType> operator&( BitType lhs, BitType rhs ) VULKAN_HPP_NOEXCEPT
|
||||
// bitwise operators on BitType T
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<FlagTraits<T>::isBitmask, bool>::type = true>
|
||||
#else
|
||||
template <Bitmask T>
|
||||
#endif
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<T> operator&( T lhs, T rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>( lhs ) & rhs;
|
||||
return Flags<T>( lhs ) & rhs;
|
||||
}
|
||||
|
||||
template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask, bool>::type = true>
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<BitType> operator|( BitType lhs, BitType rhs ) VULKAN_HPP_NOEXCEPT
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<FlagTraits<T>::isBitmask, bool>::type = true>
|
||||
#else
|
||||
template <Bitmask T>
|
||||
#endif
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<T> operator|( T lhs, T rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>( lhs ) | rhs;
|
||||
return Flags<T>( lhs ) | rhs;
|
||||
}
|
||||
|
||||
template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask, bool>::type = true>
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<BitType> operator^( BitType lhs, BitType rhs ) VULKAN_HPP_NOEXCEPT
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<FlagTraits<T>::isBitmask, bool>::type = true>
|
||||
#else
|
||||
template <Bitmask T>
|
||||
#endif
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<T> operator^( T lhs, T rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>( lhs ) ^ rhs;
|
||||
return Flags<T>( lhs ) ^ rhs;
|
||||
}
|
||||
|
||||
template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask, bool>::type = true>
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<BitType> operator~( BitType bit ) VULKAN_HPP_NOEXCEPT
|
||||
#if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<FlagTraits<T>::isBitmask, bool>::type = true>
|
||||
#else
|
||||
template <Bitmask T>
|
||||
#endif
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags<T> operator~( T bit ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return ~( Flags<BitType>( bit ) );
|
||||
return ~( Flags<T>( bit ) );
|
||||
}
|
||||
|
||||
//=============
|
||||
@@ -1871,7 +1892,8 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
ePhysicalDevicePrimitiveRestartIndexFeaturesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_RESTART_INDEX_FEATURES_EXT,
|
||||
ePhysicalDeviceImageTilingControlFeaturesEXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_TILING_CONTROL_FEATURES_EXT,
|
||||
eImageTilingControlCreateInfoEXT = VK_STRUCTURE_TYPE_IMAGE_TILING_CONTROL_CREATE_INFO_EXT,
|
||||
ePhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_DECODE_VECTOR_FEATURES_NV
|
||||
ePhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_DECODE_VECTOR_FEATURES_NV,
|
||||
ePhysicalDevicePrivateDataBaseHandleFeaturesNV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_BASE_HANDLE_FEATURES_NV
|
||||
};
|
||||
|
||||
// wrapper class for enum VkObjectType, see https://registry.khronos.org/vulkan/specs/latest/man/html/VkObjectType.html
|
||||
@@ -5078,8 +5100,10 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
ToolPurposeFlagBits::eModifyingFeatures | ToolPurposeFlagBits::eDebugReportingEXT | ToolPurposeFlagBits::eDebugMarkersEXT;
|
||||
};
|
||||
|
||||
// wrapper class for enum VkPrivateDataSlotCreateFlagBits, see https://registry.khronos.org/vulkan/specs/latest/man/html/VkPrivateDataSlotCreateFlagBits.html
|
||||
enum class PrivateDataSlotCreateFlagBits : VkPrivateDataSlotCreateFlags
|
||||
{
|
||||
eBaseObjectHandleNV = VK_PRIVATE_DATA_SLOT_CREATE_BASE_OBJECT_HANDLE_BIT_NV
|
||||
};
|
||||
|
||||
using PrivateDataSlotCreateFlagBitsEXT = PrivateDataSlotCreateFlagBits;
|
||||
@@ -5091,8 +5115,9 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
template <>
|
||||
struct FlagTraits<PrivateDataSlotCreateFlagBits>
|
||||
{
|
||||
using WrappedType = VkPrivateDataSlotCreateFlagBits;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR PrivateDataSlotCreateFlags allFlags = {};
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR PrivateDataSlotCreateFlags allFlags = PrivateDataSlotCreateFlagBits::eBaseObjectHandleNV;
|
||||
};
|
||||
|
||||
// wrapper class for enum VkPipelineStageFlagBits2, see https://registry.khronos.org/vulkan/specs/latest/man/html/VkPipelineStageFlagBits2.html
|
||||
|
||||
+23
-3
@@ -552,7 +552,8 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
"VK_ARM_data_graph_neural_accelerator_statistics",
|
||||
"VK_EXT_primitive_restart_index",
|
||||
"VK_EXT_image_tiling_control",
|
||||
"VK_NV_cooperative_matrix_decode_vector" };
|
||||
"VK_NV_cooperative_matrix_decode_vector",
|
||||
"VK_NV_private_data_base_handle" };
|
||||
return deviceExtensions;
|
||||
}
|
||||
|
||||
@@ -2450,6 +2451,7 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
{ { "VK_VERSION_1_0",
|
||||
{ {
|
||||
"VK_EXT_image_compression_control",
|
||||
"VK_KHR_swapchain",
|
||||
} } } } },
|
||||
{ "VK_QCOM_image_processing",
|
||||
{ { "VK_VERSION_1_0",
|
||||
@@ -3292,17 +3294,35 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
"VK_KHR_shader_float16_int8",
|
||||
} } },
|
||||
{ "VK_VERSION_1_2", { {} } } } },
|
||||
{ "VK_ARM_data_graph_neural_accelerator_statistics",
|
||||
{ { "VK_VERSION_1_0",
|
||||
{ {
|
||||
"VK_KHR_get_physical_device_properties2",
|
||||
} } },
|
||||
{ "VK_VERSION_1_1", { {} } } } },
|
||||
{ "VK_EXT_primitive_restart_index",
|
||||
{ { "VK_VERSION_1_0",
|
||||
{ {
|
||||
"VK_KHR_get_physical_device_properties2",
|
||||
} } },
|
||||
{ "VK_VERSION_1_1", { {} } } } },
|
||||
{ "VK_EXT_image_tiling_control",
|
||||
{ { "VK_VERSION_1_0",
|
||||
{ {
|
||||
"VK_KHR_get_physical_device_properties2",
|
||||
} } },
|
||||
{ "VK_VERSION_1_1", { {} } } } },
|
||||
{ "VK_NV_cooperative_matrix_decode_vector",
|
||||
{ { "VK_VERSION_1_0",
|
||||
{ {
|
||||
"VK_NV_cooperative_matrix2",
|
||||
} } } } }
|
||||
} } } } },
|
||||
{ "VK_NV_private_data_base_handle",
|
||||
{ { "VK_VERSION_1_0",
|
||||
{ {
|
||||
"VK_EXT_private_data",
|
||||
} } },
|
||||
{ "VK_VERSION_1_3", { {} } } } }
|
||||
};
|
||||
auto depIt = dependencies.find( extension );
|
||||
return ( depIt != dependencies.end() ) ? depIt->second : noDependencies;
|
||||
@@ -4292,7 +4312,7 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
( extension == "VK_EXT_shader_ocp_microscaling_types" ) || ( extension == "VK_VALVE_shader_mixed_float_dot_product" ) ||
|
||||
( extension == "VK_SEC_throttle_hint" ) || ( extension == "VK_ARM_data_graph_neural_accelerator_statistics" ) ||
|
||||
( extension == "VK_EXT_primitive_restart_index" ) || ( extension == "VK_EXT_image_tiling_control" ) ||
|
||||
( extension == "VK_NV_cooperative_matrix_decode_vector" );
|
||||
( extension == "VK_NV_cooperative_matrix_decode_vector" ) || ( extension == "VK_NV_private_data_base_handle" );
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 bool isInstanceExtension( std::string const & extension )
|
||||
|
||||
Vendored
+4955
-4
File diff suppressed because it is too large
Load Diff
+5162
-4
File diff suppressed because it is too large
Load Diff
Vendored
+14
@@ -14423,6 +14423,20 @@ VULKAN_HPP_EXPORT namespace std
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<VULKAN_HPP_NAMESPACE::PhysicalDevicePrivateDataBaseHandleFeaturesNV>
|
||||
{
|
||||
std::size_t operator()( VULKAN_HPP_NAMESPACE::PhysicalDevicePrivateDataBaseHandleFeaturesNV const & physicalDevicePrivateDataBaseHandleFeaturesNV ) const
|
||||
VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
VULKAN_HPP_HASH_COMBINE( seed, physicalDevicePrivateDataBaseHandleFeaturesNV.sType );
|
||||
VULKAN_HPP_HASH_COMBINE( seed, physicalDevicePrivateDataBaseHandleFeaturesNV.pNext );
|
||||
VULKAN_HPP_HASH_COMBINE( seed, physicalDevicePrivateDataBaseHandleFeaturesNV.privateDataBaseHandle );
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<VULKAN_HPP_NAMESPACE::PhysicalDevicePrivateDataFeatures>
|
||||
{
|
||||
|
||||
Vendored
+34
-2
@@ -3344,6 +3344,11 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool value = false;
|
||||
};
|
||||
|
||||
# if 20 <= VULKAN_HPP_CPP_VERSION
|
||||
template <typename T>
|
||||
concept VulkanRAIIHandleType = isVulkanRAIIHandleType<T>::value;
|
||||
# endif
|
||||
|
||||
class Context
|
||||
{
|
||||
public:
|
||||
@@ -15877,51 +15882,78 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
};
|
||||
|
||||
// operators to compare VULKAN_HPP_NAMESPACE::raii-handles
|
||||
# if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
# if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>( T const & a, T const & b ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *a <=> *b;
|
||||
}
|
||||
# else
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
bool operator<( T const & a, T const & b ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *a < *b;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
bool operator==( T const & a, T const & b ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *a == *b;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
bool operator!=( T const & a, T const & b ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *a != *b;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
bool operator==( T const & v, std::nullptr_t ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !*v;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
bool operator==( std::nullptr_t, T const & v ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !*v;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
bool operator!=( T const & v, std::nullptr_t ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *v;
|
||||
}
|
||||
|
||||
# if VULKAN_HPP_CPP_VERSION < 20
|
||||
template <typename T, typename std::enable_if<isVulkanRAIIHandleType<T>::value, bool>::type = 0>
|
||||
# else
|
||||
template <VulkanRAIIHandleType T>
|
||||
# endif
|
||||
bool operator!=( std::nullptr_t, T const & v ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *v;
|
||||
|
||||
+10
@@ -10588,4 +10588,14 @@ VULKAN_HPP_STATIC_ASSERT( std::is_standard_layout<VULKAN_HPP_NAMESPACE::Physical
|
||||
VULKAN_HPP_STATIC_ASSERT( std::is_nothrow_move_constructible<VULKAN_HPP_NAMESPACE::PhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV>::value,
|
||||
"PhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV is not nothrow_move_constructible!" );
|
||||
|
||||
//=== VK_NV_private_data_base_handle ===
|
||||
|
||||
VULKAN_HPP_STATIC_ASSERT( sizeof( VULKAN_HPP_NAMESPACE::PhysicalDevicePrivateDataBaseHandleFeaturesNV ) ==
|
||||
sizeof( VkPhysicalDevicePrivateDataBaseHandleFeaturesNV ),
|
||||
"struct and wrapper have different size!" );
|
||||
VULKAN_HPP_STATIC_ASSERT( std::is_standard_layout<VULKAN_HPP_NAMESPACE::PhysicalDevicePrivateDataBaseHandleFeaturesNV>::value,
|
||||
"struct wrapper is not a standard layout!" );
|
||||
VULKAN_HPP_STATIC_ASSERT( std::is_nothrow_move_constructible<VULKAN_HPP_NAMESPACE::PhysicalDevicePrivateDataBaseHandleFeaturesNV>::value,
|
||||
"PhysicalDevicePrivateDataBaseHandleFeaturesNV is not nothrow_move_constructible!" );
|
||||
|
||||
#endif
|
||||
|
||||
+125
@@ -56665,6 +56665,7 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
using Type = DeviceOrHostAddressConstAMDX;
|
||||
};
|
||||
# endif
|
||||
|
||||
#endif /*VK_ENABLE_BETA_EXTENSIONS*/
|
||||
|
||||
// wrapper struct for struct VkDevicePipelineBinaryInternalCacheControlKHR, see
|
||||
@@ -138091,6 +138092,130 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
using Type = PhysicalDevicePrimitivesGeneratedQueryFeaturesEXT;
|
||||
};
|
||||
|
||||
// wrapper struct for struct VkPhysicalDevicePrivateDataBaseHandleFeaturesNV, see
|
||||
// https://registry.khronos.org/vulkan/specs/latest/man/html/VkPhysicalDevicePrivateDataBaseHandleFeaturesNV.html
|
||||
struct PhysicalDevicePrivateDataBaseHandleFeaturesNV
|
||||
{
|
||||
using NativeType = VkPhysicalDevicePrivateDataBaseHandleFeaturesNV;
|
||||
|
||||
static bool const allowDuplicate = false;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR StructureType structureType = StructureType::ePhysicalDevicePrivateDataBaseHandleFeaturesNV;
|
||||
|
||||
#if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
|
||||
VULKAN_HPP_CONSTEXPR PhysicalDevicePrivateDataBaseHandleFeaturesNV( Bool32 privateDataBaseHandle_ = {}, void * pNext_ = nullptr ) VULKAN_HPP_NOEXCEPT
|
||||
: pNext{ pNext_ }
|
||||
, privateDataBaseHandle{ privateDataBaseHandle_ }
|
||||
{
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR
|
||||
PhysicalDevicePrivateDataBaseHandleFeaturesNV( PhysicalDevicePrivateDataBaseHandleFeaturesNV const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
|
||||
PhysicalDevicePrivateDataBaseHandleFeaturesNV( VkPhysicalDevicePrivateDataBaseHandleFeaturesNV const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
: PhysicalDevicePrivateDataBaseHandleFeaturesNV( *reinterpret_cast<PhysicalDevicePrivateDataBaseHandleFeaturesNV const *>( &rhs ) )
|
||||
{
|
||||
}
|
||||
|
||||
PhysicalDevicePrivateDataBaseHandleFeaturesNV & operator=( PhysicalDevicePrivateDataBaseHandleFeaturesNV const & rhs ) VULKAN_HPP_NOEXCEPT = default;
|
||||
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
|
||||
|
||||
PhysicalDevicePrivateDataBaseHandleFeaturesNV & operator=( VkPhysicalDevicePrivateDataBaseHandleFeaturesNV const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
*this = *reinterpret_cast<PhysicalDevicePrivateDataBaseHandleFeaturesNV const *>( &rhs );
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined( VULKAN_HPP_NO_SETTERS ) && !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
|
||||
VULKAN_HPP_CONSTEXPR_14 PhysicalDevicePrivateDataBaseHandleFeaturesNV & setPNext( void * pNext_ ) & VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
pNext = pNext_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 PhysicalDevicePrivateDataBaseHandleFeaturesNV && setPNext( void * pNext_ ) && VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
pNext = pNext_;
|
||||
return std::move( *this );
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 PhysicalDevicePrivateDataBaseHandleFeaturesNV & setPrivateDataBaseHandle( Bool32 privateDataBaseHandle_ ) & VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
privateDataBaseHandle = privateDataBaseHandle_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 PhysicalDevicePrivateDataBaseHandleFeaturesNV && setPrivateDataBaseHandle( Bool32 privateDataBaseHandle_ ) && VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
privateDataBaseHandle = privateDataBaseHandle_;
|
||||
return std::move( *this );
|
||||
}
|
||||
#endif /*VULKAN_HPP_NO_SETTERS*/
|
||||
|
||||
operator VkPhysicalDevicePrivateDataBaseHandleFeaturesNV const &() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *reinterpret_cast<VkPhysicalDevicePrivateDataBaseHandleFeaturesNV const *>( this );
|
||||
}
|
||||
|
||||
operator VkPhysicalDevicePrivateDataBaseHandleFeaturesNV &() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *reinterpret_cast<VkPhysicalDevicePrivateDataBaseHandleFeaturesNV *>( this );
|
||||
}
|
||||
|
||||
operator VkPhysicalDevicePrivateDataBaseHandleFeaturesNV const *() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<VkPhysicalDevicePrivateDataBaseHandleFeaturesNV const *>( this );
|
||||
}
|
||||
|
||||
operator VkPhysicalDevicePrivateDataBaseHandleFeaturesNV *() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<VkPhysicalDevicePrivateDataBaseHandleFeaturesNV *>( this );
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_USE_REFLECT )
|
||||
std::tuple<StructureType const &, void * const &, Bool32 const &> reflect() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return std::tie( sType, pNext, privateDataBaseHandle );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>( PhysicalDevicePrivateDataBaseHandleFeaturesNV const & ) const = default;
|
||||
#else
|
||||
bool operator==( PhysicalDevicePrivateDataBaseHandleFeaturesNV const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
# if defined( VULKAN_HPP_USE_REFLECT )
|
||||
return this->reflect() == rhs.reflect();
|
||||
# else
|
||||
return ( sType == rhs.sType ) && ( pNext == rhs.pNext ) && ( privateDataBaseHandle == rhs.privateDataBaseHandle );
|
||||
# endif
|
||||
}
|
||||
|
||||
bool operator!=( PhysicalDevicePrivateDataBaseHandleFeaturesNV const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !operator==( rhs );
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
StructureType sType = StructureType::ePhysicalDevicePrivateDataBaseHandleFeaturesNV;
|
||||
void * pNext = {};
|
||||
Bool32 privateDataBaseHandle = {};
|
||||
};
|
||||
|
||||
#if 20 <= VULKAN_HPP_CPP_VERSION
|
||||
template <>
|
||||
struct CppType<VkPhysicalDevicePrivateDataBaseHandleFeaturesNV>
|
||||
{
|
||||
using Type = PhysicalDevicePrivateDataBaseHandleFeaturesNV;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct CppType<StructureType, StructureType::ePhysicalDevicePrivateDataBaseHandleFeaturesNV>
|
||||
{
|
||||
using Type = PhysicalDevicePrivateDataBaseHandleFeaturesNV;
|
||||
};
|
||||
|
||||
// wrapper struct for struct VkPhysicalDevicePrivateDataFeatures, see
|
||||
// https://registry.khronos.org/vulkan/specs/latest/man/html/VkPhysicalDevicePrivateDataFeatures.html
|
||||
struct PhysicalDevicePrivateDataFeatures
|
||||
|
||||
+17
-4
@@ -1650,9 +1650,17 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
return result;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string to_string( PrivateDataSlotCreateFlags )
|
||||
VULKAN_HPP_INLINE std::string to_string( PrivateDataSlotCreateFlags value )
|
||||
{
|
||||
return "{}";
|
||||
std::string result = "{";
|
||||
if ( value & PrivateDataSlotCreateFlagBits::eBaseObjectHandleNV )
|
||||
result += " BaseObjectHandleNV |";
|
||||
|
||||
if ( result.size() > 1 )
|
||||
result.back() = '}';
|
||||
else
|
||||
result = "{}";
|
||||
return result;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE std::string to_string( PipelineStageFlags2 value )
|
||||
@@ -6202,6 +6210,7 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
case StructureType::ePhysicalDeviceImageTilingControlFeaturesEXT : return "PhysicalDeviceImageTilingControlFeaturesEXT";
|
||||
case StructureType::eImageTilingControlCreateInfoEXT : return "ImageTilingControlCreateInfoEXT";
|
||||
case StructureType::ePhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV: return "PhysicalDeviceCooperativeMatrixDecodeVectorFeaturesNV";
|
||||
case StructureType::ePhysicalDevicePrivateDataBaseHandleFeaturesNV : return "PhysicalDevicePrivateDataBaseHandleFeaturesNV";
|
||||
default : return "invalid ( " + toHexString( static_cast<uint32_t>( value ) ) + " )";
|
||||
}
|
||||
}
|
||||
@@ -8347,9 +8356,13 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string to_string( PrivateDataSlotCreateFlagBits )
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string to_string( PrivateDataSlotCreateFlagBits value )
|
||||
{
|
||||
return "(void)";
|
||||
switch ( value )
|
||||
{
|
||||
case PrivateDataSlotCreateFlagBits::eBaseObjectHandleNV: return "BaseObjectHandleNV";
|
||||
default : return "invalid ( " + toHexString( static_cast<uint32_t>( value ) ) + " )";
|
||||
}
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_20 std::string to_string( PipelineStageFlagBits2 value )
|
||||
|
||||
Vendored
+1
@@ -51,6 +51,7 @@ module;
|
||||
|
||||
export module vulkan_video;
|
||||
|
||||
import std;
|
||||
import vulkan;
|
||||
|
||||
#if defined( __clang__ )
|
||||
|
||||
Reference in New Issue
Block a user