Utilities for loading and saving PNG images. More...
Namespaces | |
| namespace | anonymous_namespace{mxvk.cpp} |
| namespace | anonymous_namespace{mxvk_abstract_model.cpp} |
| namespace | anonymous_namespace{mxvk_ff_capture.cpp} |
| namespace | anonymous_namespace{mxvk_model.cpp} |
| namespace | anonymous_namespace{mxvk_resource.cpp} |
| namespace | detail |
Classes | |
| struct | BufferResource |
| Owned Vulkan buffer allocation with optional persistent host mapping. More... | |
| struct | CachedTexture |
| GPU texture resources cached for a rendered text string. More... | |
| struct | CacheKey |
| Cache key combining text content and colour. More... | |
| struct | CacheKeyHash |
| Hash functor for CacheKey. More... | |
| class | Camera |
| Camera and projection data for the simple software 3D pipeline. More... | |
| struct | CyType |
| Cylindrical coordinate. More... | |
| class | Exception |
| class | Font |
| Small RAII wrapper for an SDL_ttf font handle. More... | |
| class | Mat1D |
| Two-element column-vector storage used by 2x2 linear solves. More... | |
| class | Mat1x3D |
| Three-element column-vector storage used by 3x3 linear solves. More... | |
| class | Mat1x4D |
| Four-element column-vector storage. More... | |
| class | Mat2D |
| Two-by-two matrix with arithmetic, determinant, inverse, and solve helpers. More... | |
| class | Mat3D |
| Three-by-three matrix with multiplication, vector transform, inverse, and solve helpers. More... | |
| class | Mat4D |
| Four-by-four homogeneous transform matrix. More... | |
| class | Mat4x3D |
| Four-by-three matrix storage. More... | |
| struct | ModelFragmentPushConstants |
| Sprite-compatible fragment parameters for UV-based model effects. More... | |
| struct | ModelFragmentUniforms |
| Extended shader-viewer uniforms available to fragment shaders at binding 1. More... | |
| struct | MXMaterial |
| Parsed subset of Wavefront MTL material fields. More... | |
| class | MXModel |
| Loads OBJ/MXMOD meshes and uploads them to Vulkan buffers. More... | |
| class | mxObject |
| Simple mesh object loaded from PLG-style indexed triangle data. More... | |
| struct | OBJMaterial |
| Wavefront material data used by the software rasterizer. More... | |
| struct | paramLine2D |
| Parametric 2D line segment represented by a start point, end point, and direction. More... | |
| struct | paramLine3D |
| Parametric 3D line segment represented by a start point, end point, and direction. More... | |
| class | PipeLine |
| Clipped software rasterization pipeline for lines and filled triangles. More... | |
| struct | Plane3D |
| Plane represented by a point and a normal vector. More... | |
| struct | PointSpriteVertex |
| Vertex layout consumed by VK_PointSpriteBatch. More... | |
| struct | Polar |
| 2D polar coordinate. More... | |
| class | QuatType |
| Quaternion used for 3D rotations. More... | |
| class | RenderList |
| Flat list of triangles prepared for transformation and rasterization. More... | |
| struct | SDLRendererPixelPlotter |
| Pixel plotter adapter that writes packed MXVK colors to an SDL renderer. More... | |
| struct | SpType |
| Spherical coordinate. More... | |
| struct | SubMesh |
| One indexed sub-range that can reference a dedicated texture slot. More... | |
| struct | TextureResource |
| Owned sampled 2D texture resources. More... | |
| struct | Triangle |
| Triangle primitive used by the simple software rendering pipeline. More... | |
| struct | UniformBufferObject |
| Default transform UBO payload for model shaders. More... | |
| class | vec2D |
| Two-dimensional float vector with common arithmetic helpers. More... | |
| class | vec3D |
| Three-dimensional float vector with arithmetic, dot, and cross-product helpers. More... | |
| class | vec4D |
| Four-dimensional float vector used for homogeneous 3D coordinates. More... | |
| class | VK_Capture |
| Vulkan OpenCV video capture source. More... | |
| class | VK_Config |
| Parses and manages an INI-style configuration file. More... | |
| class | VK_ConfigItem |
| A single key/value pair read from a configuration file. More... | |
| class | VK_Console |
| Lightweight command console renderer for mxvk::VK_Window. More... | |
| class | VK_Controller |
| RAII wrapper for SDL_Gamepad (standard layout mapping). More... | |
| class | VK_FF_Capture |
| FFmpeg-backed video-file capture source. More... | |
| class | VK_IOWindow |
| class | VK_Joystick |
| RAII wrapper for a raw SDL_Joystick device. More... | |
| class | VK_Mixer |
| SDL3_mixer-based audio manager. More... | |
| class | VK_PointSpriteBatch |
| Reusable Vulkan point-list renderer for textured particle effects. More... | |
| class | VK_Sprite |
| class | VK_Sprite3D |
| Depth-tested 3D billboard sprite batch. More... | |
| class | VK_Stencil |
| Owns a stencil attachment and two fullscreen pipelines for stencil-masked rendering. More... | |
| class | VK_Text |
| class | VK_Window |
| Main Vulkan window wrapper for MXVK. More... | |
| class | VKAbstractModel |
| Convenience wrapper that owns mesh, textures, descriptors, and pipeline state. More... | |
| struct | VKSpritePixelPlotter |
| Pixel plotter adapter that draws square pixels into a VK_Sprite. More... | |
| struct | VKVertex |
| Vertex payload consumed by MXVK model shaders. More... | |
| struct | VKVertexHash |
| Hash functor for VKVertex. More... | |
| struct | VulkanContext |
| Minimal Vulkan handles required by MXVK resource helpers. More... | |
| class | Wrapper |
| A nullable smart wrapper around a raw pointer. More... | |
Concepts | |
| concept | WrapType |
| Constrains Wrapper<T> to pointer types only. | |
Typedefs | |
| using | ConfigFile = VK_Config |
| using | Console = VK_Console |
| using | Controller = VK_Controller |
| using | Item = VK_ConfigItem |
| using | Joystick = VK_Joystick |
| using | Mixer = VK_Mixer |
| using | MXCOLOR = std::uint32_t |
| Packed 32-bit color in ARGB byte order. | |
| using | VK_AbstractModel = VKAbstractModel |
Enumerations | |
| enum | { MX_ACTIVE = 0x1 , MX_VISIBLE = 0x2 , MX_BACKFACE = 0x4 , MX_CULLED = 0x8 } |
| Object and polygon state bit flags. More... | |
| enum | { MX_ACTIVE = 0x1 , MX_VISIBLE = 0x2 , MX_BACKFACE = 0x4 , MX_CULLED = 0x8 } |
| Object and polygon state bit flags. More... | |
Functions | |
| VkCommandBuffer | begin_one_time_commands (const VulkanContext &context) |
| Allocate and begin a primary one-time command buffer. | |
| std::array< float, 361 > | build_cos_table () |
| std::array< float, 361 > | build_sin_table () |
| void | BuildTables () |
| Rebuild the sine and cosine lookup tables. | |
| constexpr std::uint8_t | color_a (MXCOLOR color) |
| Extract the alpha component from a packed ARGB color. | |
| constexpr std::uint8_t | color_b (MXCOLOR color) |
| Extract the blue component from a packed ARGB color. | |
| constexpr std::uint8_t | color_g (MXCOLOR color) |
| Extract the green component from a packed ARGB color. | |
| constexpr std::uint8_t | color_r (MXCOLOR color) |
| Extract the red component from a packed ARGB color. | |
| void | copy_buffer (const VulkanContext &context, VkBuffer source, VkBuffer destination, VkDeviceSize size) |
| Copy one buffer into another with a one-shot Vulkan 1.3 copy command. | |
| void | copy_buffer_to_image (VkCommandBuffer command_buffer, VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) |
| Record a Vulkan 1.3 vkCmdCopyBufferToImage2 copy for a full 2D image. | |
| void | create_buffer (const VulkanContext &context, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, BufferResource &buffer) |
| Create and bind a Vulkan buffer allocation. | |
| void | create_image (const VulkanContext &context, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage &image, VkDeviceMemory &memory) |
| Create a 2D VkImage and allocate/bind its memory. | |
| VkImageView | create_image_view (VkDevice device, VkImage image, VkFormat format, VkImageAspectFlags aspect) |
| Create a 2D image view for an image. | |
| VkShaderModule | create_shader_module (VkDevice device, const std::vector< char > &spv_bytes) |
| Create a shader module from SPIR-V bytecode. | |
| void | create_texture_from_png (const VulkanContext &context, const std::string &path, TextureResource &texture, VkFormat format=VK_FORMAT_R8G8B8A8_UNORM) |
| Load a PNG and upload it into a sampled 2D texture. | |
| void | create_texture_from_surface (const VulkanContext &context, SDL_Surface *surface, TextureResource &texture, VkFormat format=VK_FORMAT_R8G8B8A8_UNORM) |
| Upload an SDL surface into a sampled 2D texture. | |
| bool | defaultEnableScreenshot () |
| bool & | defaultEnableScreenshotStorage () |
| const std::string & | defaultExecutableName () |
| std::string & | defaultExecutableNameStorage () |
| float | deg2rad (float ang) |
| Convert degrees to radians. | |
| void | destroy_buffer (VkDevice device, BufferResource &buffer) |
| Unmap and destroy a BufferResource. | |
| void | destroy_texture (VkDevice device, TextureResource &texture) |
| Destroy every Vulkan handle owned by a TextureResource. | |
| template<typename PlotPixel> | |
| void | draw_filled_triangle (const vec2D &p0, const vec2D &p1, const vec2D &p2, MXCOLOR color, PlotPixel &&plot_pixel) |
| Rasterize a filled triangle by testing pixels against edge functions. | |
| void | draw_filled_triangle (SDL_Renderer *renderer, const vec2D &p0, const vec2D &p1, const vec2D &p2, MXCOLOR color) |
| Draw a filled triangle directly to an SDL renderer. | |
| void | draw_filled_triangle (VK_Sprite &sprite, const vec2D &p0, const vec2D &p1, const vec2D &p2, MXCOLOR color, int pixel_size=1) |
| Draw a filled triangle directly to a VK_Sprite with optional square pixel size. | |
| template<typename DrawSpan> | |
| void | draw_filled_triangle_spans (vec2D p0, vec2D p1, vec2D p2, MXCOLOR color, DrawSpan &&draw_span) |
| template<typename DrawSpan> | |
| void | draw_filled_triangle_spans_clipped (vec2D p0, vec2D p1, vec2D p2, int clip_min_y, int clip_max_y, MXCOLOR color, DrawSpan &&draw_span) |
| Rasterize a filled triangle as horizontal spans. | |
| template<typename PlotPixel> | |
| void | draw_line (int x0, int y0, int x1, int y1, MXCOLOR color, PlotPixel &&plot_pixel) |
| Draw a line with Bresenham-style integer stepping. | |
| void | draw_line (SDL_Renderer *renderer, int x0, int y0, int x1, int y1, MXCOLOR color) |
| Draw a line directly to an SDL renderer. | |
| void | draw_line (VK_Sprite &sprite, int x0, int y0, int x1, int y1, MXCOLOR color, int pixel_size=1) |
| Draw a line directly to a VK_Sprite with optional square pixel size. | |
| float | edge_function (const vec2D &a, const vec2D &b, const vec2D &p) |
Compute the signed edge function value for point p relative to edge a- | |
| void | end_one_time_commands (const VulkanContext &context, VkCommandBuffer command_buffer) |
| End, submit with vkQueueSubmit2, wait idle, and free a one-time command buffer. | |
| float | fast_cosf (float theta_degrees) |
| Approximate cosine using the degree lookup table with linear interpolation. | |
| float | fast_sinf (float theta_degrees) |
| Approximate sine using the degree lookup table with linear interpolation. | |
| uint32_t | find_memory_type (VkPhysicalDevice physical_device, uint32_t type_filter, VkMemoryPropertyFlags properties) |
| Find a memory type satisfying a Vulkan memory type mask and property set. | |
| bool | HasPngExtension (const char *file) |
| std::vector< char > | load_spv (const std::string &path) |
| Load a SPIR-V file from disk. | |
| SDL_Surface * | LoadPNG (const char *file) |
| Load a PNG file into an SDL_Surface. | |
| void | map_buffer (VkDevice device, BufferResource &buffer) |
| Persistently map a host-visible buffer allocation. | |
| constexpr MXCOLOR | MXVK_RGB (int r, int g, int b) |
| Build an opaque ARGB color from red, green, and blue components. | |
| std::ostream & | operator<< (std::ostream &out, const vec2D &v) |
| Write a 2D vector to a stream using vec2D::Print(). | |
| std::ostream & | operator<< (std::ostream &out, const vec3D &v) |
| Write a 3D vector to a stream using vec3D::Print(). | |
| std::ostream & | operator<< (std::ostream &out, const vec4D &v) |
| Write a 4D vector to a stream using vec4D::Print(). | |
| std::istream & | operator>> (std::istream &in, vec2D &v) |
| Read a 2D vector from a stream as two scalar coordinates. | |
| std::istream & | operator>> (std::istream &in, vec3D &v) |
| Read a 3D vector from a stream as three scalar coordinates. | |
| std::istream & | operator>> (std::istream &in, vec4D &v) |
| Read a 4D vector from a stream as four scalar coordinates. | |
| float | rad2deg (float rad) |
| Convert radians to degrees. | |
| int | rrand (int x, int y) |
| Return a pseudo-random integer in the inclusive range between two bounds. | |
| bool | SavePNG (SDL_Texture *texture, SDL_Renderer *renderer, const char *filename) |
| Save an SDL_Texture to a PNG file. | |
| bool | SavePNG_RGBA (const char *filename, void *buffer, int w, int h) |
| Save a raw RGBA pixel buffer to a PNG file. | |
| bool | SavePNG_RGBA16 (const char *filename, const void *buffer, int w, int h) |
| Save a raw 16-bit RGBA pixel buffer to a PNG file. | |
| bool | SaveRawBytes (const char *filename, const void *buffer, size_t w, size_t h, size_t bpp) |
| Save raw data to a file. | |
| void | setDefaultEnableScreenshot (bool enabled) |
| void | setDefaultExecutableName (const std::string &name) |
| MXCOLOR | shade_color (MXCOLOR color, float intensity) |
| Scale the RGB channels of a color while preserving alpha. | |
| void | transition_image_layout (VkCommandBuffer command_buffer, VkImage image, VkImageLayout old_layout, VkImageLayout new_layout, VkImageAspectFlags aspect=VK_IMAGE_ASPECT_COLOR_BIT) |
| Record a Vulkan 1.3 synchronization2 image layout transition. | |
| void | unmap_buffer (VkDevice device, BufferResource &buffer) |
| Unmap a BufferResource if it is currently mapped. | |
| bool | WriteRgbaPng (const char *filename, const std::uint8_t *pixels, const int width, const int height, const int pitch, const int bit_depth, const bool swap_16bit_endianness) |
Variables | |
| std::array< float, 361 > | cos_look = build_cos_table() |
| Cosine lookup table with one entry per degree from 0 through 360. | |
| constexpr float | EPSILON = 1.0e-5f |
| Default tolerance used for floating-point singularity and zero-length checks. | |
| constexpr float | PI = 3.14159265358979323846f |
| Mathematical constant pi as a single-precision value. | |
| std::array< float, 361 > | sin_look = build_sin_table() |
| Sine lookup table with one entry per degree from 0 through 360. | |
Utilities for loading and saving PNG images.
| using mxvk::ConfigFile = VK_Config |
Definition at line 99 of file mxvk_cfg.hpp.
| using mxvk::Console = VK_Console |
Definition at line 183 of file mxvk_console.hpp.
| using mxvk::Controller = VK_Controller |
Definition at line 209 of file mxvk_controller.hpp.
| using mxvk::Item = VK_ConfigItem |
Definition at line 98 of file mxvk_cfg.hpp.
| using mxvk::Joystick = VK_Joystick |
Definition at line 210 of file mxvk_controller.hpp.
| using mxvk::Mixer = VK_Mixer |
Definition at line 110 of file mxvk_sound.hpp.
| using mxvk::MXCOLOR = std::uint32_t |
Packed 32-bit color in ARGB byte order.
Definition at line 40 of file mxvk_math.h.
Definition at line 305 of file mxvk_abstract_model.hpp.
| anonymous enum |
Object and polygon state bit flags.
| Enumerator | |
|---|---|
| MX_ACTIVE | Active object or polygon. |
| MX_VISIBLE | Visible object or polygon. |
| MX_BACKFACE | Polygon is marked as a backface. |
| MX_CULLED | Object or polygon is culled. |
Definition at line 1356 of file mxvk_math.h.
| anonymous enum |
Object and polygon state bit flags.
| Enumerator | |
|---|---|
| MX_ACTIVE | Active object or polygon. |
| MX_VISIBLE | Visible object or polygon. |
| MX_BACKFACE | Polygon is marked as a backface. |
| MX_CULLED | Object or polygon is culled. |
Definition at line 1356 of file mxvk_math_eigen.hpp.
|
nodiscard |
Allocate and begin a primary one-time command buffer.
| context | Valid upload context with device, queue, and command pool. |
| mxvk::Exception | if allocation or begin fails. |
Definition at line 229 of file mxvk_resource.cpp.
|
inline |
Definition at line 98 of file mxvk_math.h.
|
inline |
Definition at line 90 of file mxvk_math.h.
|
inline |
Rebuild the sine and cosine lookup tables.
Definition at line 113 of file mxvk_math.h.
|
inlinenodiscardconstexpr |
Extract the alpha component from a packed ARGB color.
Definition at line 69 of file mxvk_math.h.
|
inlinenodiscardconstexpr |
Extract the blue component from a packed ARGB color.
Definition at line 64 of file mxvk_math.h.
|
inlinenodiscardconstexpr |
Extract the green component from a packed ARGB color.
Definition at line 59 of file mxvk_math.h.
|
inlinenodiscardconstexpr |
Extract the red component from a packed ARGB color.
Definition at line 54 of file mxvk_math.h.
| void mxvk::copy_buffer | ( | const VulkanContext & | context, |
| VkBuffer | source, | ||
| VkBuffer | destination, | ||
| VkDeviceSize | size ) |
Copy one buffer into another with a one-shot Vulkan 1.3 copy command.
| context | Valid upload context. |
| source | Source buffer. |
| destination | Destination buffer. |
| size | Bytes to copy. |
| mxvk::Exception | if command allocation, submission, or completion fails. |
Definition at line 282 of file mxvk_resource.cpp.
| void mxvk::copy_buffer_to_image | ( | VkCommandBuffer | command_buffer, |
| VkBuffer | buffer, | ||
| VkImage | image, | ||
| uint32_t | width, | ||
| uint32_t | height ) |
Record a Vulkan 1.3 vkCmdCopyBufferToImage2 copy for a full 2D image.
| command_buffer | Command buffer in recording state. |
| buffer | Source buffer containing tightly packed RGBA pixels. |
| image | Destination image in VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL. |
| width | Copy width in pixels. |
| height | Copy height in pixels. |
Definition at line 347 of file mxvk_resource.cpp.
| void mxvk::create_buffer | ( | const VulkanContext & | context, |
| VkDeviceSize | size, | ||
| VkBufferUsageFlags | usage, | ||
| VkMemoryPropertyFlags | properties, | ||
| BufferResource & | buffer ) |
Create and bind a Vulkan buffer allocation.
| context | Valid Vulkan device and physical device handles. |
| size | Buffer size in bytes. |
| usage | VkBufferUsageFlagBits describing intended buffer use. |
| properties | Required memory properties. |
| buffer | Output buffer resource; any existing contents are destroyed first. |
| mxvk::Exception | on invalid input or Vulkan allocation failure. |
Definition at line 67 of file mxvk_resource.cpp.
| void mxvk::create_image | ( | const VulkanContext & | context, |
| uint32_t | width, | ||
| uint32_t | height, | ||
| VkFormat | format, | ||
| VkImageTiling | tiling, | ||
| VkImageUsageFlags | usage, | ||
| VkMemoryPropertyFlags | properties, | ||
| VkImage & | image, | ||
| VkDeviceMemory & | memory ) |
Create a 2D VkImage and allocate/bind its memory.
| context | Valid Vulkan device and physical device handles. |
| width | Image width in pixels. |
| height | Image height in pixels. |
| format | Image format. |
| tiling | Image tiling mode. |
| usage | VkImageUsageFlagBits describing intended image use. |
| properties | Required memory properties. |
| image | Output image handle. |
| memory | Output memory handle bound to image. |
| mxvk::Exception | on invalid dimensions or Vulkan allocation failure. |
Definition at line 142 of file mxvk_resource.cpp.
|
nodiscard |
Create a 2D image view for an image.
| device | Logical device. |
| image | Image to view. |
| format | View format. |
| aspect | Image aspect mask, usually VK_IMAGE_ASPECT_COLOR_BIT. |
| mxvk::Exception | if view creation fails. |
Definition at line 207 of file mxvk_resource.cpp.
|
nodiscard |
Create a shader module from SPIR-V bytecode.
| device | Logical Vulkan device used to create the module. |
| spv_bytes | SPIR-V bytecode payload. |
| mxvk::Exception | when inputs are invalid or module creation fails. |
Definition at line 30 of file mxvk_shader_module.cpp.
| void mxvk::create_texture_from_png | ( | const VulkanContext & | context, |
| const std::string & | path, | ||
| TextureResource & | texture, | ||
| VkFormat | format = VK_FORMAT_R8G8B8A8_UNORM ) |
Load a PNG and upload it into a sampled 2D texture.
| context | Valid upload context. |
| path | PNG path. |
| texture | Output texture resource; any existing contents are destroyed first. |
| format | Destination image format. Defaults to VK_FORMAT_R8G8B8A8_UNORM. |
| mxvk::Exception | if loading or upload fails. |
Definition at line 437 of file mxvk_resource.cpp.
| void mxvk::create_texture_from_surface | ( | const VulkanContext & | context, |
| SDL_Surface * | surface, | ||
| TextureResource & | texture, | ||
| VkFormat | format = VK_FORMAT_R8G8B8A8_UNORM ) |
Upload an SDL surface into a sampled 2D texture.
| context | Valid upload context. |
| surface | Source surface. Pixels are copied immediately. |
| texture | Output texture resource; any existing contents are destroyed first. |
| format | Destination image format. Defaults to VK_FORMAT_R8G8B8A8_UNORM. |
The source surface is copied row-by-row into a tight staging buffer to tolerate SDL pitch padding. The surface is expected to contain 4 bytes per pixel, as produced by MXVK's PNG loader.
| mxvk::Exception | on invalid input, allocation failure, or upload failure. |
Definition at line 374 of file mxvk_resource.cpp.
|
inlinenodiscard |
Definition at line 15 of file mxvk_runtime_options.hpp.
|
inlinenodiscard |
Definition at line 6 of file mxvk_runtime_options.hpp.
|
inlinenodiscard |
Definition at line 28 of file mxvk_runtime_options.hpp.
|
inlinenodiscard |
Definition at line 19 of file mxvk_runtime_options.hpp.
|
inlinenodiscard |
Convert degrees to radians.
Definition at line 124 of file mxvk_math.h.
| void mxvk::destroy_buffer | ( | VkDevice | device, |
| BufferResource & | buffer ) |
Unmap and destroy a BufferResource.
| device | Logical device that owns the resource. |
| buffer | Resource to release and reset. |
Definition at line 108 of file mxvk_resource.cpp.
| void mxvk::destroy_texture | ( | VkDevice | device, |
| TextureResource & | texture ) |
Destroy every Vulkan handle owned by a TextureResource.
| device | Logical device that owns the texture. |
| texture | Texture resource to release and reset. |
Definition at line 448 of file mxvk_resource.cpp.
| void mxvk::draw_filled_triangle | ( | const vec2D & | p0, |
| const vec2D & | p1, | ||
| const vec2D & | p2, | ||
| MXCOLOR | color, | ||
| PlotPixel && | plot_pixel ) |
Rasterize a filled triangle by testing pixels against edge functions.
| PlotPixel | Callable accepting (x, y, MXCOLOR). |
| p0 | First triangle vertex in screen coordinates. |
| p1 | Second triangle vertex in screen coordinates. |
| p2 | Third triangle vertex in screen coordinates. |
| color | Packed ARGB color. |
| plot_pixel | Pixel plotting callable. |
Definition at line 2141 of file mxvk_math.h.
|
inline |
Draw a filled triangle directly to an SDL renderer.
Definition at line 2167 of file mxvk_math.h.
|
inline |
Draw a filled triangle directly to a VK_Sprite with optional square pixel size.
Definition at line 2172 of file mxvk_math.h.
| void mxvk::draw_filled_triangle_spans | ( | vec2D | p0, |
| vec2D | p1, | ||
| vec2D | p2, | ||
| MXCOLOR | color, | ||
| DrawSpan && | draw_span ) |
Definition at line 2268 of file mxvk_math.h.
| void mxvk::draw_filled_triangle_spans_clipped | ( | vec2D | p0, |
| vec2D | p1, | ||
| vec2D | p2, | ||
| int | clip_min_y, | ||
| int | clip_max_y, | ||
| MXCOLOR | color, | ||
| DrawSpan && | draw_span ) |
Rasterize a filled triangle as horizontal spans.
| DrawSpan | Callable accepting (x0, x1, y, MXCOLOR). |
| p0 | First triangle vertex in screen coordinates. |
| p1 | Second triangle vertex in screen coordinates. |
| p2 | Third triangle vertex in screen coordinates. |
| clip_min_y | Minimum inclusive scanline to rasterize. |
| clip_max_y | Maximum inclusive scanline to rasterize. |
| color | Packed ARGB color. |
| draw_span | Span drawing callable. |
Definition at line 2188 of file mxvk_math.h.
| void mxvk::draw_line | ( | int | x0, |
| int | y0, | ||
| int | x1, | ||
| int | y1, | ||
| MXCOLOR | color, | ||
| PlotPixel && | plot_pixel ) |
Draw a line with Bresenham-style integer stepping.
| PlotPixel | Callable accepting (x, y, MXCOLOR). |
| x0 | Start X coordinate. |
| y0 | Start Y coordinate. |
| x1 | End X coordinate. |
| y1 | End Y coordinate. |
| color | Packed ARGB color. |
| plot_pixel | Pixel plotting callable. |
Definition at line 2092 of file mxvk_math.h.
|
inline |
Draw a line directly to an SDL renderer.
Definition at line 2117 of file mxvk_math.h.
|
inline |
Draw a line directly to a VK_Sprite with optional square pixel size.
Definition at line 2122 of file mxvk_math.h.
| void mxvk::end_one_time_commands | ( | const VulkanContext & | context, |
| VkCommandBuffer | command_buffer ) |
End, submit with vkQueueSubmit2, wait idle, and free a one-time command buffer.
| context | Valid upload context with device, queue, and command pool. |
| command_buffer | Command buffer returned by begin_one_time_commands(). |
| mxvk::Exception | if end, submit, or queue wait fails. |
Definition at line 253 of file mxvk_resource.cpp.
|
inlinenodiscard |
Approximate cosine using the degree lookup table with linear interpolation.
| theta_degrees | Angle in degrees. |
Definition at line 138 of file mxvk_math.h.
|
inlinenodiscard |
Approximate sine using the degree lookup table with linear interpolation.
| theta_degrees | Angle in degrees. |
Definition at line 153 of file mxvk_math.h.
|
nodiscard |
Find a memory type satisfying a Vulkan memory type mask and property set.
| physical_device | Physical device to query. |
| type_filter | Memory type bitmask from VkMemoryRequirements. |
| properties | Required VkMemoryPropertyFlagBits. |
| mxvk::Exception | if no matching memory type is available. |
Definition at line 48 of file mxvk_resource.cpp.
|
nodiscard |
Definition at line 22 of file mxvk_png.cpp.
|
nodiscard |
Load a SPIR-V file from disk.
| path | Absolute or relative path to a .spv file. |
| mxvk::Exception | when the file cannot be opened, is empty, or is not 4-byte aligned. |
Definition at line 9 of file mxvk_shader_module.cpp.
| SDL_Surface * mxvk::LoadPNG | ( | const char * | file | ) |
Load a PNG file into an SDL_Surface.
| file | Path to the PNG file. |
Definition at line 103 of file mxvk_png.cpp.
| void mxvk::map_buffer | ( | VkDevice | device, |
| BufferResource & | buffer ) |
Persistently map a host-visible buffer allocation.
| device | Logical device that owns the buffer memory. |
| buffer | Buffer resource to map. |
| mxvk::Exception | if the buffer is invalid or mapping fails. |
Definition at line 123 of file mxvk_resource.cpp.
|
inlinenodiscardconstexpr |
Build an opaque ARGB color from red, green, and blue components.
| r | Red component in the low 8 bits. |
| g | Green component in the low 8 bits. |
| b | Blue component in the low 8 bits. |
Definition at line 49 of file mxvk_math.h.
|
inline |
Write a 2D vector to a stream using vec2D::Print().
Definition at line 281 of file mxvk_math.h.
|
inline |
Write a 3D vector to a stream using vec3D::Print().
Definition at line 406 of file mxvk_math.h.
|
inline |
Write a 4D vector to a stream using vec4D::Print().
Definition at line 562 of file mxvk_math.h.
|
inline |
Read a 2D vector from a stream as two scalar coordinates.
Definition at line 286 of file mxvk_math.h.
|
inline |
Read a 3D vector from a stream as three scalar coordinates.
Definition at line 411 of file mxvk_math.h.
|
inline |
Read a 4D vector from a stream as four scalar coordinates.
Definition at line 567 of file mxvk_math.h.
|
inlinenodiscard |
Convert radians to degrees.
Definition at line 129 of file mxvk_math.h.
|
inlinenodiscard |
Return a pseudo-random integer in the inclusive range between two bounds.
| x | First bound. |
| y | Second bound. |
Definition at line 169 of file mxvk_math.h.
| bool mxvk::SavePNG | ( | SDL_Texture * | texture, |
| SDL_Renderer * | renderer, | ||
| const char * | filename ) |
Save an SDL_Texture to a PNG file.
| texture | Source texture. |
| renderer | Renderer used to read back the texture pixels. |
| filename | Destination file path. |
true on success, false on failure. Definition at line 200 of file mxvk_png.cpp.
| bool mxvk::SavePNG_RGBA | ( | const char * | filename, |
| void * | buffer, | ||
| int | w, | ||
| int | h ) |
Save a raw RGBA pixel buffer to a PNG file.
| filename | Destination file path. |
| buffer | Pointer to the raw RGBA pixel data. |
| w | Image width in pixels. |
| h | Image height in pixels. |
true on success, false on failure. Definition at line 300 of file mxvk_png.cpp.
| bool mxvk::SavePNG_RGBA16 | ( | const char * | filename, |
| const void * | buffer, | ||
| int | w, | ||
| int | h ) |
Save a raw 16-bit RGBA pixel buffer to a PNG file.
| filename | Destination file path. |
| buffer | Pointer to the raw 16-bit RGBA pixel data. |
| w | Image width in pixels. |
| h | Image height in pixels. |
true on success, false on failure. Definition at line 311 of file mxvk_png.cpp.
| bool mxvk::SaveRawBytes | ( | const char * | filename, |
| const void * | buffer, | ||
| size_t | w, | ||
| size_t | h, | ||
| size_t | bpp ) |
Save raw data to a file.
| filename | Output file path |
| buffer | Pointer to the source data (read-only) |
| w | Width of the image in pixels |
| h | Height of the image in pixels |
| bpp | Bytes per pixel (e.g., 2 for YUYV, 4 for RGBA) |
true on success, false on failure. Definition at line 265 of file mxvk_png.cpp.
|
inline |
Definition at line 11 of file mxvk_runtime_options.hpp.
|
inline |
Definition at line 24 of file mxvk_runtime_options.hpp.
Scale the RGB channels of a color while preserving alpha.
| color | Packed ARGB color to shade. |
| intensity | Multiplier clamped to the range [0, 1]. |
Definition at line 79 of file mxvk_math.h.
| void mxvk::transition_image_layout | ( | VkCommandBuffer | command_buffer, |
| VkImage | image, | ||
| VkImageLayout | old_layout, | ||
| VkImageLayout | new_layout, | ||
| VkImageAspectFlags | aspect = VK_IMAGE_ASPECT_COLOR_BIT ) |
Record a Vulkan 1.3 synchronization2 image layout transition.
| command_buffer | Command buffer in recording state. |
| image | Image to transition. |
| old_layout | Current image layout. |
| new_layout | Desired image layout. |
| aspect | Image aspect mask. |
Supported transitions are:
| mxvk::Exception | for unsupported transitions. |
Definition at line 307 of file mxvk_resource.cpp.
| void mxvk::unmap_buffer | ( | VkDevice | device, |
| BufferResource & | buffer ) |
Unmap a BufferResource if it is currently mapped.
| device | Logical device that owns the buffer memory. |
| buffer | Buffer resource to unmap. |
Definition at line 135 of file mxvk_resource.cpp.
|
nodiscard |
Definition at line 33 of file mxvk_png.cpp.
|
inline |
Cosine lookup table with one entry per degree from 0 through 360.
Definition at line 110 of file mxvk_math.h.
|
inlineconstexpr |
Default tolerance used for floating-point singularity and zero-length checks.
Definition at line 37 of file mxvk_math.h.
|
inlineconstexpr |
Mathematical constant pi as a single-precision value.
Definition at line 34 of file mxvk_math.h.
|
inline |
Sine lookup table with one entry per degree from 0 through 360.
Definition at line 107 of file mxvk_math.h.