diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 71db4b1728..15a0c52f4a 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -67,7 +67,7 @@ #ifdef HAVE_LIBNX #define SD_PREFIX -#include "../../gfx/common/switch_common.h" +#include "../../gfx/common/switch_defines.h" #else #define SD_PREFIX "/sd" #endif diff --git a/gfx/common/switch_common.h b/gfx/common/switch_defines.h similarity index 89% rename from gfx/common/switch_common.h rename to gfx/common/switch_defines.h index 41a74784f3..26ea89c200 100644 --- a/gfx/common/switch_common.h +++ b/gfx/common/switch_defines.h @@ -1,5 +1,5 @@ -#ifndef SWITCH_COMMON_H__ -#define SWITCH_COMMON_H__ +#ifndef SWITCH_DEFINES_H__ +#define SWITCH_DEFINES_H__ #include #include @@ -84,6 +84,4 @@ typedef struct NWindow *win; } switch_ctx_data_t; -void gfx_slow_swizzling_blit(uint32_t *buffer, uint32_t *image, int w, int h, int tx, int ty, bool blend); - #endif diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 9ff4b63d4f..8dc0fe1871 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -2272,35 +2272,6 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, return true; } -void vulkan_set_uniform_buffer( - VkDevice device, - VkDescriptorSet set, - unsigned binding, - VkBuffer buffer, - VkDeviceSize offset, - VkDeviceSize range) -{ - VkWriteDescriptorSet write; - VkDescriptorBufferInfo buffer_info; - - buffer_info.buffer = buffer; - buffer_info.offset = offset; - buffer_info.range = range; - - write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - write.pNext = NULL; - write.dstSet = set; - write.dstBinding = binding; - write.dstArrayElement = 0; - write.descriptorCount = 1; - write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; - write.pImageInfo = NULL; - write.pBufferInfo = &buffer_info; - write.pTexelBufferView = NULL; - - vkUpdateDescriptorSets(device, 1, &write, 0, NULL); -} - bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk, enum vulkan_wsi_type type) { diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index e6092a65c7..4007164612 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -135,6 +135,26 @@ vkUpdateDescriptorSets(device, 1, &write, 0, NULL); \ } +#define VULKAN_SET_UNIFORM_BUFFER(_device, _set, _binding, _buffer, _offset, _range) \ +{ \ + VkWriteDescriptorSet write; \ + VkDescriptorBufferInfo buffer_info; \ + buffer_info.buffer = _buffer; \ + buffer_info.offset = _offset; \ + buffer_info.range = _range; \ + write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; \ + write.pNext = NULL; \ + write.dstSet = _set; \ + write.dstBinding = _binding; \ + write.dstArrayElement = 0; \ + write.descriptorCount = 1; \ + write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; \ + write.pImageInfo = NULL; \ + write.pBufferInfo = &buffer_info; \ + write.pTexelBufferView = NULL; \ + vkUpdateDescriptorSets(_device, 1, &write, 0, NULL); \ +} + #define VULKAN_WRITE_QUAD_VBO(pv, _x, _y, _width, _height, _tex_x, _tex_y, _tex_width, _tex_height, vulkan_color) \ { \ float r = (vulkan_color)->r; \ @@ -705,14 +725,6 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, unsigned width, unsigned height, unsigned swap_interval); -void vulkan_set_uniform_buffer( - VkDevice device, - VkDescriptorSet set, - unsigned binding, - VkBuffer buffer, - VkDeviceSize offset, - VkDeviceSize range); - void vulkan_debug_mark_image(VkDevice device, VkImage image); void vulkan_debug_mark_memory(VkDevice device, VkDeviceMemory memory); diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index ee32fefc52..673fc0994c 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -199,7 +199,6 @@ d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT des return *format; } - static void d3d11_init_texture(D3D11Device device, d3d11_texture_t* texture) { bool is_render_target = texture->desc.BindFlags & D3D11_BIND_RENDER_TARGET; @@ -719,10 +718,10 @@ static void d3d11_font_render_line( int i; unsigned count; D3D11_MAPPED_SUBRESOURCE mapped_vbo; - d3d11_sprite_t *v = NULL; + d3d11_sprite_t *v = NULL; const struct font_glyph* glyph_q = NULL; - int x = roundf(pos_x * width); - int y = roundf((1.0 - pos_y) * height); + int x = roundf(pos_x * width); + int y = roundf((1.0 - pos_y) * height); if (d3d11->sprites.offset + msg_len > (unsigned)d3d11->sprites.capacity) d3d11->sprites.offset = 0; @@ -828,9 +827,9 @@ static void d3d11_font_render_message( unsigned height, unsigned text_align) { + float line_height; struct font_line_metrics *line_metrics = NULL; int lines = 0; - float line_height; if (!msg || !*msg) return; diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index f978759844..88e1b32eea 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -89,7 +89,7 @@ static INLINE D3D12_GPU_VIRTUAL_ADDRESS D3D12GetGPUVirtualAddress(void* resource return ((ID3D12Resource*)resource)->lpVtbl->GetGPUVirtualAddress((ID3D12Resource*)resource); } -D3D12_GPU_VIRTUAL_ADDRESS +static D3D12_GPU_VIRTUAL_ADDRESS d3d12_create_buffer(D3D12Device device, UINT size_in_bytes, D3D12Resource* buffer) { D3D12_HEAP_PROPERTIES heap_props = { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, diff --git a/gfx/drivers/switch_nx_gfx.c b/gfx/drivers/switch_nx_gfx.c index ce42f9900f..3139173493 100644 --- a/gfx/drivers/switch_nx_gfx.c +++ b/gfx/drivers/switch_nx_gfx.c @@ -49,7 +49,7 @@ #include "../../retroarch.h" #include "../../verbosity.h" -#include "../common/switch_common.h" +#include "../common/switch_defines.h" #ifndef HAVE_THREADS #include "../../tasks/tasks_internal.h" @@ -379,6 +379,7 @@ font_renderer_t switch_font = * VIDEO DRIVER */ +#if 0 /* (C) libtransistor */ static int pdep(uint32_t mask, uint32_t value) { @@ -400,7 +401,7 @@ static int pdep(uint32_t mask, uint32_t value) static uint32_t swizzle_x(uint32_t v) { return pdep(~0x7B4u, v); } static uint32_t swizzle_y(uint32_t v) { return pdep(0x7B4, v); } -void gfx_slow_swizzling_blit(uint32_t *buffer, uint32_t *image, int w, int h, int tx, int ty, bool blend) +static void gfx_slow_swizzling_blit(uint32_t *buffer, uint32_t *image, int w, int h, int tx, int ty, bool blend) { uint32_t *dest = buffer; uint32_t *src = image; @@ -451,6 +452,7 @@ void gfx_slow_swizzling_blit(uint32_t *buffer, uint32_t *image, int w, int h, in offs_x0 += incr_y; /* wrap into next tile row */ } } +#endif static void gfx_cpy_dsp_buf(uint32_t *buffer, uint32_t *image, int w, int h, uint32_t stride, bool blend) { diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 60d0d10876..54d876e72a 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -851,7 +851,7 @@ static void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd, return; memcpy(range.data, ubo, sizeof(ubo)); - vulkan_set_uniform_buffer(vk->context->device, + VULKAN_SET_UNIFORM_BUFFER(vk->context->device, set, 0, range.buffer, @@ -4408,7 +4408,7 @@ static bool vulkan_frame(void *data, const void *frame, vk->context->device, &vk->chain->descriptor_manager); - vulkan_set_uniform_buffer(vk->context->device, + VULKAN_SET_UNIFORM_BUFFER(vk->context->device, set, 0, vk->hdr.ubo.buffer, diff --git a/gfx/drivers_context/switch_ctx.c b/gfx/drivers_context/switch_ctx.c index 160f4d1d32..bc251f8ed5 100644 --- a/gfx/drivers_context/switch_ctx.c +++ b/gfx/drivers_context/switch_ctx.c @@ -24,7 +24,7 @@ #include -#include "../common/switch_common.h" +#include "../common/switch_defines.h" #include "../../frontend/frontend_driver.h" /* TODO/FIXME - global referenced */ diff --git a/gfx/drivers_shader/shader_vulkan.cpp b/gfx/drivers_shader/shader_vulkan.cpp index 31d2e1e07c..2479013de9 100644 --- a/gfx/drivers_shader/shader_vulkan.cpp +++ b/gfx/drivers_shader/shader_vulkan.cpp @@ -2565,12 +2565,14 @@ void Pass::build_commands( build_semantics(sets[sync_index], u, mvp, original, source); if (reflection.ubo_stage_mask) - vulkan_set_uniform_buffer(device, + { + VULKAN_SET_UNIFORM_BUFFER(device, sets[sync_index], reflection.ubo_binding, common->ubo->get_buffer(), ubo_offset + sync_index * common->ubo_sync_index_stride, reflection.ubo_size); + } /* The final pass is always executed inside * another render pass since the frontend will