|
102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
|
#include "graphics_private.h"#include <dttr_config.h>#include <dttr_log.h>#include <math.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | DTTR_MESH_SEAM_FILL_PHYSICAL_PX 0.5f |
| #define | DTTR_MESH_SEAM_MAX_VERTEX_NUDGE_PHYSICAL_PX 0.75f |
| #define | DTTR_MESH_SEAM_MIN_AREA_PX 1.0e-4f |
Functions | |
| bool | dttr_graphics_ensure_staged_texture (DTTR_BackendState *state, DTTR_StagedTexture *st) |
| DTTR_PresentRect | dttr_graphics_compute_present_rect (int dst_w, int dst_h, int src_w, int src_h, bool stretch, bool integer_fit, float fallback_scale) |
| int | dttr_graphics_calc_mip_levels (int w, int h) |
| void | dttr_graphics_mat4_identity (float *m) |
| const char * | dttr_graphics_shader_format_name (SDL_GPUShaderFormat format) |
| SDL_GPUShaderFormat | dttr_graphics_requested_shader_formats () |
| SDL_GPUShaderFormat | dttr_graphics_select_shader_format (SDL_GPUShaderFormat formats) |
| SDL_GPUShaderFormat | dttr_graphics_shader_format_for_driver (const char *driver) |
| SDL_GPUShaderFormat | dttr_graphics_select_shader_format_for_driver (const char *driver, SDL_GPUShaderFormat formats) |
| bool | dttr_graphics_is_gpu_thread () |
| bool | dttr_graphics_should_fill_mesh_seams (DTTR_PrimitiveType type, bool transformed, bool depth_test, bool blend_enabled) |
| Returns true when a draw call should receive subpixel logical-scaling seam fill. | |
| static void | fill_mesh_seam_triangle (DTTR_Vertex *tri, float logical_to_px_x, float logical_to_px_y, float px_to_logical_x, float px_to_logical_y) |
| void | dttr_graphics_fill_mesh_seams (DTTR_Vertex *verts, uint32_t count, int logical_width, int logical_height, int render_width, int render_height) |
| Expands triangle-list vertices by a tiny physical-pixel amount to hide mesh cracks. | |
Variables | |
| DTTR_BackendState | dttr_backend |
| #define DTTR_MESH_SEAM_FILL_PHYSICAL_PX 0.5f |
Definition at line 10 of file util.c.
Referenced by fill_mesh_seam_triangle().
| #define DTTR_MESH_SEAM_MAX_VERTEX_NUDGE_PHYSICAL_PX 0.75f |
Definition at line 11 of file util.c.
Referenced by fill_mesh_seam_triangle().
| #define DTTR_MESH_SEAM_MIN_AREA_PX 1.0e-4f |
Definition at line 12 of file util.c.
Referenced by fill_mesh_seam_triangle().
| int dttr_graphics_calc_mip_levels | ( | int | w, |
| int | h ) |
| DTTR_PresentRect dttr_graphics_compute_present_rect | ( | int | dst_w, |
| int | dst_h, | ||
| int | src_w, | ||
| int | src_h, | ||
| bool | stretch, | ||
| bool | integer_fit, | ||
| float | fallback_scale ) |
Definition at line 48 of file util.c.
Referenced by end_frame(), end_frame(), present_video_frame_bgra(), and present_video_frame_bgra().
| bool dttr_graphics_ensure_staged_texture | ( | DTTR_BackendState * | state, |
| DTTR_StagedTexture * | st ) |
Definition at line 14 of file util.c.
References dttr_graphics_calc_mip_levels(), DTTR_LOG_WARN, NULL, st, and state.
Referenced by collect_and_upload_pending(), and d3d_device7_texture_bind().
| void dttr_graphics_fill_mesh_seams | ( | DTTR_Vertex * | verts, |
| uint32_t | count, | ||
| int | logical_width, | ||
| int | logical_height, | ||
| int | render_width, | ||
| int | render_height ) |
Expands triangle-list vertices by a tiny physical-pixel amount to hide mesh cracks.
Definition at line 280 of file util.c.
References count, fill_mesh_seam_triangle(), and float.
Referenced by d3d_device7_record_draw().
| bool dttr_graphics_is_gpu_thread | ( | ) |
Definition at line 182 of file util.c.
References dttr_backend, and state.
Referenced by begin_frame(), d3d_device7_record_clear(), d3d_device7_record_draw(), d3d_device7_texture_bind(), and present_video_frame_bgra().
Definition at line 116 of file util.c.
References DTTR_MAT4_SIZE.
Referenced by init_common_state(), and present_video_frame_bgra().
| SDL_GPUShaderFormat dttr_graphics_requested_shader_formats | ( | ) |
Definition at line 136 of file util.c.
Referenced by create_device().
| SDL_GPUShaderFormat dttr_graphics_select_shader_format | ( | SDL_GPUShaderFormat | formats | ) |
Definition at line 140 of file util.c.
Referenced by dttr_graphics_select_shader_format_for_driver().
| SDL_GPUShaderFormat dttr_graphics_select_shader_format_for_driver | ( | const char * | driver, |
| SDL_GPUShaderFormat | formats ) |
Definition at line 169 of file util.c.
References dttr_graphics_select_shader_format(), and dttr_graphics_shader_format_for_driver().
Referenced by try_create_device_for_driver().
| SDL_GPUShaderFormat dttr_graphics_shader_format_for_driver | ( | const char * | driver | ) |
Definition at line 152 of file util.c.
References DTTR_DRIVER_DIRECT3D12, and DTTR_DRIVER_VULKAN.
Referenced by dttr_graphics_select_shader_format_for_driver().
| const char * dttr_graphics_shader_format_name | ( | SDL_GPUShaderFormat | format | ) |
Definition at line 121 of file util.c.
Referenced by create_shader(), and dttr_graphics_sdl3gpu_init().
| bool dttr_graphics_should_fill_mesh_seams | ( | DTTR_PrimitiveType | type, |
| bool | transformed, | ||
| bool | depth_test, | ||
| bool | blend_enabled ) |
Returns true when a draw call should receive subpixel logical-scaling seam fill.
Definition at line 198 of file util.c.
References dttr_config, DTTR_PRIM_TRIANGLELIST, DTTR_SCALING_METHOD_LOGICAL, DTTR_VERTEX_PRECISION_SUBPIXEL, and type.
Referenced by d3d_device7_record_draw().
|
static |
Definition at line 211 of file util.c.
References c, DTTR_MESH_SEAM_FILL_PHYSICAL_PX, DTTR_MESH_SEAM_MAX_VERTEX_NUDGE_PHYSICAL_PX, DTTR_MESH_SEAM_MIN_AREA_PX, DTTR_Vertex::x, x, DTTR_Vertex::y, and y.
Referenced by dttr_graphics_fill_mesh_seams().
| DTTR_BackendState dttr_backend |
Definition at line 8 of file util.c.
Referenced by create_shader(), d3d_device7_get_transform_state(), d3d_device7_record_clear(), d3d_device7_record_draw(), d3d_device7_set_blend_func(), d3d_device7_set_texture_address_u(), d3d_device7_set_texture_address_v(), d3d_device7_set_viewport(), d3d_device7_texture_bind(), d3ddevice7_gettexturestagestate(), d3ddevice7_getviewport(), d3ddevice7_setrenderstate(), d3ddevice7_settexturestagestate(), dttr_graphics_begin_frame(), dttr_graphics_cleanup(), dttr_graphics_end_frame(), dttr_graphics_get_device(), dttr_graphics_get_window(), dttr_graphics_handle_window_resize(), dttr_graphics_init(), dttr_graphics_is_gpu_thread(), dttr_graphics_present_video_frame_bgra(), dttr_graphics_sdl3gpu_create_pipelines(), dttr_graphics_sdl3gpu_create_resources(), dttr_graphics_sdl3gpu_resize_render_textures(), dttr_graphics_set_logical_resolution(), DTTR_Hook_WinMainCallback(), surface_present(), surface_texture_cache_lookup_locked(), surface_texture_create_or_retain(), surface_texture_refcount(), surface_texture_release(), surface_texture_retain(), surface_texture_update_unique(), and toggle_fullscreen().