(Vk struct) Turn boolean variables into flags

This commit is contained in:
LibretroAdmin 2022-11-02 21:34:00 +01:00
parent 15048027e7
commit 56ad3fa091
4 changed files with 131 additions and 96 deletions

View File

@ -953,7 +953,7 @@ void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call)
/* Changing pipeline invalidates dynamic state. */
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
if (vk->tracker.use_scissor)
if (vk->flags & VK_FLAG_TRACKER_USE_SCISSOR)
sci = vk->tracker.scissor;
else
{
@ -972,7 +972,7 @@ void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call)
else if (vk->tracker.dirty & VULKAN_DIRTY_DYNAMIC_BIT)
{
VkRect2D sci;
if (vk->tracker.use_scissor)
if (vk->flags & VK_FLAG_TRACKER_USE_SCISSOR)
sci = vk->tracker.scissor;
else
{
@ -1051,7 +1051,7 @@ void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
vk->tracker.pipeline = quad->pipeline;
/* Changing pipeline invalidates dynamic state. */
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
if (vk->tracker.use_scissor)
if (vk->flags & VK_FLAG_TRACKER_USE_SCISSOR)
sci = vk->tracker.scissor;
else
{
@ -1070,7 +1070,7 @@ void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
else if (vk->tracker.dirty & VULKAN_DIRTY_DYNAMIC_BIT)
{
VkRect2D sci;
if (vk->tracker.use_scissor)
if (vk->flags & VK_FLAG_TRACKER_USE_SCISSOR)
sci = vk->tracker.scissor;
else
{

View File

@ -349,6 +349,26 @@ struct vk_draw_triangles
unsigned vertices;
};
enum vk_flags
{
VK_FLAG_VSYNC = (1 << 0),
VK_FLAG_KEEP_ASPECT = (1 << 1),
VK_FLAG_FULLSCREEN = (1 << 2),
VK_FLAG_QUITTING = (1 << 3),
VK_FLAG_SHOULD_RESIZE = (1 << 4),
VK_FLAG_TRACKER_USE_SCISSOR = (1 << 5),
VK_FLAG_HW_ENABLE = (1 << 6),
VK_FLAG_HW_VALID_SEMAPHORE = (1 << 7),
VK_FLAG_MENU_ENABLE = (1 << 8),
VK_FLAG_MENU_FULLSCREEN = (1 << 9),
VK_FLAG_HDR_SUPPORT = (1 << 10),
VK_FLAG_DISPLAY_BLEND = (1 << 11),
VK_FLAG_READBACK_PENDING = (1 << 12),
VK_FLAG_READBACK_STREAMED = (1 << 13),
VK_FLAG_OVERLAY_ENABLE = (1 << 14),
VK_FLAG_OVERLAY_FULLSCREEN = (1 << 15)
};
typedef struct vk
{
vulkan_filter_chain_t *filter_chain;
@ -391,8 +411,6 @@ typedef struct vk
struct scaler_ctx scaler_bgr;
struct scaler_ctx scaler_rgb;
struct vk_texture staging[VULKAN_MAX_SWAPCHAIN_IMAGES];
bool pending;
bool streamed;
} readback;
struct
@ -400,8 +418,6 @@ typedef struct vk
struct vk_texture *images;
struct vk_vertex *vertex;
unsigned count;
bool enable;
bool full_screen;
} overlay;
struct
@ -420,7 +436,6 @@ typedef struct vk
{
VkPipeline pipelines[8 * 2];
struct vk_texture blank_texture;
bool blend;
} display;
#ifdef VULKAN_HDR_SWAPCHAIN
@ -431,7 +446,6 @@ typedef struct vk
float min_output_nits;
float max_cll;
float max_fall;
bool support;
} hdr;
#endif /* VULKAN_HDR_SWAPCHAIN */
@ -442,8 +456,6 @@ typedef struct vk
unsigned last_index;
float alpha;
bool dirty[VULKAN_MAX_SWAPCHAIN_IMAGES];
bool enable;
bool full_screen;
} menu;
struct
@ -471,8 +483,6 @@ typedef struct vk
uint32_t num_cmd;
uint32_t src_queue_family;
bool enable;
bool valid_semaphore;
} hw;
struct
@ -483,15 +493,8 @@ typedef struct vk
VkSampler sampler; /* ptr alignment */
math_matrix_4x4 mvp;
VkRect2D scissor; /* int32_t alignment */
bool use_scissor;
} tracker;
bool vsync;
bool keep_aspect;
bool fullscreen;
bool quitting;
bool should_resize;
uint32_t flags;
} vk_t;
#define VK_BUFFER_CHAIN_DISCARD(chain) \

View File

@ -736,7 +736,7 @@ static void vulkan_init_textures(vk_t *vk)
{
const uint32_t zero = 0;
if (!vk->hw.enable)
if (!(vk->flags & VK_FLAG_HW_ENABLE))
{
unsigned i;
for (i = 0; i < vk->num_swapchain_images; i++)
@ -943,7 +943,7 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
* the inverse tonemapper and HDR10 conversion */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, false);
vk->should_resize = true;
vk->flags |= VK_FLAG_SHOULD_RESIZE;
break;
case VK_FORMAT_R16G16B16A16_SFLOAT:
/* If the last shader pass uses a RGBA16 backbuffer
@ -951,7 +951,7 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
* skip the inverse tonemapper */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, true);
vk->should_resize = true;
vk->flags |= VK_FLAG_SHOULD_RESIZE;
break;
case VK_FORMAT_UNDEFINED:
default:
@ -1010,7 +1010,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
* skip the inverse tonemapper and HDR10 conversion */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, false);
vk->should_resize = true;
vk->flags |= VK_FLAG_SHOULD_RESIZE;
break;
case VK_FORMAT_R16G16B16A16_SFLOAT:
/* If the last shader pass uses a RGBA16 backbuffer
@ -1018,7 +1018,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
* skip the inverse tonemapper */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, true);
vk->should_resize = true;
vk->flags |= VK_FLAG_SHOULD_RESIZE;
break;
case VK_FORMAT_UNDEFINED:
default:
@ -1227,11 +1227,11 @@ static void vulkan_set_image(void *handle,
for (i = 0; i < vk->hw.num_semaphores; i++)
{
vk->hw.wait_dst_stages[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
vk->hw.semaphores[i] = semaphores[i];
vk->hw.semaphores[i] = semaphores[i];
}
vk->hw.valid_semaphore = true;
vk->hw.src_queue_family = src_queue_family;
vk->flags |= VK_FLAG_HW_VALID_SEMAPHORE;
vk->hw.src_queue_family = src_queue_family;
}
}
@ -1296,7 +1296,7 @@ static void vulkan_init_hw_render(vk_t *vk)
if (hwr->context_type != RETRO_HW_CONTEXT_VULKAN)
return;
vk->hw.enable = true;
vk->flags |= VK_FLAG_HW_ENABLE;
iface->interface_type = RETRO_HW_RENDER_INTERFACE_VULKAN;
iface->interface_version = RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION;
@ -1332,10 +1332,14 @@ static void vulkan_init_readback(vk_t *vk, settings_t *settings)
*recording_st = recording_state_get_ptr();
bool recording_enabled = recording_st->enable;
bool video_gpu_record = settings->bools.video_gpu_record;
vk->readback.streamed = video_gpu_record && recording_enabled;
if (!vk->readback.streamed)
if (!(video_gpu_record && recording_enabled))
{
vk->flags &= ~VK_FLAG_READBACK_STREAMED;
return;
}
vk->flags |= VK_FLAG_READBACK_STREAMED;
vk->readback.scaler_bgr.in_width = vk->vp.width;
vk->readback.scaler_bgr.in_height = vk->vp.height;
@ -1355,13 +1359,13 @@ static void vulkan_init_readback(vk_t *vk, settings_t *settings)
if (!scaler_ctx_gen_filter(&vk->readback.scaler_bgr))
{
vk->readback.streamed = false;
vk->flags &= ~VK_FLAG_READBACK_STREAMED;
RARCH_ERR("[Vulkan]: Failed to initialize scaler context.\n");
}
if (!scaler_ctx_gen_filter(&vk->readback.scaler_rgb))
{
vk->readback.streamed = false;
vk->flags &= ~VK_FLAG_READBACK_STREAMED;
RARCH_ERR("[Vulkan]: Failed to initialize scaler context.\n");
}
}
@ -1468,13 +1472,22 @@ static void *vulkan_init(const video_info_t *video,
*(void**)&vk->context = vk->ctx_driver->get_context_data(vk->ctx_data);
vk->vsync = video->vsync;
vk->fullscreen = video->fullscreen;
if (video->vsync)
vk->flags |= VK_FLAG_VSYNC;
else
vk->flags &= ~VK_FLAG_VSYNC;
if (video->fullscreen)
vk->flags |= VK_FLAG_FULLSCREEN;
else
vk->flags &= ~VK_FLAG_FULLSCREEN;
vk->tex_w = RARCH_SCALE_BASE * video->input_scale;
vk->tex_h = RARCH_SCALE_BASE * video->input_scale;
vk->tex_fmt = video->rgb32
? VK_FORMAT_B8G8R8A8_UNORM : VK_FORMAT_R5G6B5_UNORM_PACK16;
vk->keep_aspect = video->force_aspect;
if (video->force_aspect)
vk->flags |= VK_FLAG_KEEP_ASPECT;
else
vk->flags &= ~VK_FLAG_KEEP_ASPECT;
RARCH_LOG("[Vulkan]: Using %s format.\n", video->rgb32 ? "BGRA8888" : "RGB565");
/* Set the viewport to fix recording, since it needs to know
@ -1708,11 +1721,11 @@ static bool vulkan_alive(void *data)
&quit, &resize, &temp_width, &temp_height);
if (quit)
vk->quitting = true;
vk->flags |= VK_FLAG_QUITTING;
else if (resize)
vk->should_resize = true;
vk->flags |= VK_FLAG_SHOULD_RESIZE;
ret = !vk->quitting;
ret = (!(vk->flags & VK_FLAG_QUITTING));
if (temp_width != 0 && temp_height != 0)
{
@ -1842,11 +1855,12 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
{
video_viewport_get_scaled_integer(&vk->vp,
viewport_width, viewport_height,
video_driver_get_aspect_ratio(), vk->keep_aspect);
video_driver_get_aspect_ratio(),
vk->flags & VK_FLAG_KEEP_ASPECT);
viewport_width = vk->vp.width;
viewport_height = vk->vp.height;
}
else if (vk->keep_aspect && !force_full)
else if ((vk->flags & VK_FLAG_KEEP_ASPECT) && !force_full)
{
float desired_aspect = video_driver_get_aspect_ratio();
@ -2129,15 +2143,16 @@ static bool vulkan_frame(void *data, const void *frame,
vk->tracker.scissor.offset.y = 0;
vk->tracker.scissor.extent.width = 0;
vk->tracker.scissor.extent.height = 0;
vk->tracker.use_scissor = false;
vk->flags &= ~VK_FLAG_TRACKER_USE_SCISSOR;
vk->tracker.pipeline = VK_NULL_HANDLE;
vk->tracker.view = VK_NULL_HANDLE;
vk->tracker.sampler = VK_NULL_HANDLE;
for (i = 0; i < 16; i++)
vk->tracker.mvp.data[i] = 0.0f;
waits_for_semaphores = vk->hw.enable && frame &&
!vk->hw.num_cmd && vk->hw.valid_semaphore;
waits_for_semaphores =
(vk->flags & VK_FLAG_HW_ENABLE) && frame &&
!vk->hw.num_cmd && (vk->flags & VK_FLAG_HW_VALID_SEMAPHORE);
if (waits_for_semaphores &&
vk->hw.src_queue_family != VK_QUEUE_FAMILY_IGNORED &&
@ -2157,7 +2172,7 @@ static bool vulkan_frame(void *data, const void *frame,
}
/* Upload texture */
if (frame && !vk->hw.enable)
if (frame && (!(vk->flags & VK_FLAG_HW_ENABLE)))
{
unsigned y;
uint8_t *dst = NULL;
@ -2231,7 +2246,7 @@ static bool vulkan_frame(void *data, const void *frame,
/* Set the source texture in the filter chain */
struct vulkan_filter_chain_texture input;
if (vk->hw.enable)
if (vk->flags & VK_FLAG_HW_ENABLE)
{
/* Does this make that this can happen at all? */
if (vk->hw.image && vk->hw.image->create_info.image)
@ -2306,7 +2321,7 @@ static bool vulkan_frame(void *data, const void *frame,
#if defined(HAVE_MENU)
/* Upload menu texture. */
if (vk->menu.enable)
if (vk->flags & VK_FLAG_MENU_ENABLE)
{
if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE ||
vk->menu.textures[vk->menu.last_index].buffer != VK_NULL_HANDLE)
@ -2370,12 +2385,12 @@ static bool vulkan_frame(void *data, const void *frame,
&vk->vk_vp, vk->mvp.data);
#ifdef HAVE_OVERLAY
if (vk->overlay.enable && overlay_behind_menu)
if ((vk->flags & VK_FLAG_OVERLAY_ENABLE) && overlay_behind_menu)
vulkan_render_overlay(vk, video_width, video_height);
#endif
#if defined(HAVE_MENU)
if (vk->menu.enable)
if (vk->flags & VK_FLAG_MENU_ENABLE)
{
menu_driver_frame(menu_is_alive, video_info);
@ -2387,7 +2402,8 @@ static bool vulkan_frame(void *data, const void *frame,
settings_t *settings = config_get_ptr();
bool menu_linear_filter = settings->bools.menu_linear_filter;
vulkan_set_viewport(vk, width, height, vk->menu.full_screen, false);
vulkan_set_viewport(vk, width, height, ((vk->flags &
VK_FLAG_MENU_FULLSCREEN) > 0), false);
quad.pipeline = vk->pipelines.alpha_blend;
quad.texture = &vk->menu.textures[vk->menu.last_index];
@ -2420,7 +2436,7 @@ static bool vulkan_frame(void *data, const void *frame,
#endif
#ifdef HAVE_OVERLAY
if (vk->overlay.enable && !overlay_behind_menu)
if ((vk->flags & VK_FLAG_OVERLAY_ENABLE) && !overlay_behind_menu)
vulkan_render_overlay(vk, video_width, video_height);
#endif
@ -2585,7 +2601,8 @@ static bool vulkan_frame(void *data, const void *frame,
&& (vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN)
)
{
if (vk->readback.pending || vk->readback.streamed)
if ( (vk->flags & VK_FLAG_READBACK_PENDING)
|| (vk->flags & VK_FLAG_READBACK_STREAMED))
{
/* We cannot safely read back from an image which
* has already been presented as we need to
@ -2617,7 +2634,7 @@ static bool vulkan_frame(void *data, const void *frame,
VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
vk->readback.pending = false;
vk->flags &= ~VK_FLAG_READBACK_PENDING;
}
else
{
@ -2678,7 +2695,7 @@ static bool vulkan_frame(void *data, const void *frame,
submit_info.pWaitDstStageMask = vk->hw.wait_dst_stages;
/* Consume the semaphores. */
vk->hw.valid_semaphore = false;
vk->flags &= ~VK_FLAG_HW_VALID_SEMAPHORE;
/* We allocated space for this. */
if ( (vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN)
@ -2753,11 +2770,11 @@ static bool vulkan_frame(void *data, const void *frame,
* i.e. right after swap buffers. */
#ifdef VULKAN_HDR_SWAPCHAIN
bool video_hdr_enable = video_info->hdr_enable;
if ( vk->should_resize
if ( (vk->flags & VK_FLAG_SHOULD_RESIZE)
|| (((vk->context->flags & VK_CTX_FLAG_HDR_ENABLE) > 0)
!= video_hdr_enable))
#else
if (vk->should_resize)
if (vk->flags & VK_FLAG_SHOULD_RESIZE)
#endif /* VULKAN_HDR_SWAPCHAIN */
{
#ifdef VULKAN_HDR_SWAPCHAIN
@ -2786,8 +2803,14 @@ static bool vulkan_frame(void *data, const void *frame,
vk->ctx_driver->set_resize(vk->ctx_data, mode.width, mode.height);
#ifdef VULKAN_HDR_SWAPCHAIN
if (!(vk->hdr.support = vk->context->swapchain_colour_space == VK_COLOR_SPACE_HDR10_ST2084_EXT))
if ( (vk->context->swapchain_colour_space)
== VK_COLOR_SPACE_HDR10_ST2084_EXT)
vk->flags |= VK_FLAG_HDR_SUPPORT;
else
{
vk->flags &= ~VK_FLAG_HDR_SUPPORT;
vk->context->flags &= ~VK_CTX_FLAG_HDR_ENABLE;
}
if (vk->context->flags & VK_CTX_FLAG_HDR_ENABLE)
{
@ -2870,8 +2893,7 @@ static bool vulkan_frame(void *data, const void *frame,
vkCreateFramebuffer(vk->context->device, &info, NULL, &vk->main_buffer.framebuffer);
}
#endif /* VULKAN_HDR_SWAPCHAIN */
vk->should_resize = false;
vk->flags &= ~VK_FLAG_SHOULD_RESIZE;
}
if (vk->context->flags & VK_CTX_FLAG_INVALID_SWAPCHAIN)
@ -2886,7 +2908,7 @@ static bool vulkan_frame(void *data, const void *frame,
&& !input_driver_nonblock_state
&& !runloop_is_slowmotion
&& !runloop_is_paused
&& !vk->menu.enable)
&& (!(vk->flags & VK_FLAG_MENU_ENABLE)))
{
unsigned n;
for (n = 0; n < black_frame_insertion; ++n)
@ -2924,19 +2946,15 @@ static bool vulkan_frame(void *data, const void *frame,
static void vulkan_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
vk_t *vk = (vk_t*)data;
if (!vk)
return;
vk->keep_aspect = true;
vk->should_resize = true;
if (vk)
vk->flags |= VK_FLAG_KEEP_ASPECT | VK_FLAG_SHOULD_RESIZE;
}
static void vulkan_apply_state_changes(void *data)
{
vk_t *vk = (vk_t*)data;
if (vk)
vk->should_resize = true;
vk->flags |= VK_FLAG_SHOULD_RESIZE;
}
static void vulkan_show_mouse(void *data, bool state)
@ -3018,7 +3036,7 @@ static bool vulkan_get_hw_render_interface(void *data,
{
vk_t *vk = (vk_t*)data;
*iface = (const struct retro_hw_render_interface*)&vk->hw.iface;
return vk->hw.enable;
return ((vk->flags & VK_FLAG_HW_ENABLE) > 0);
}
static void vulkan_set_texture_frame(void *data,
@ -3087,14 +3105,20 @@ static void vulkan_set_texture_frame(void *data,
vk->menu.dirty[index] = true;
}
static void vulkan_set_texture_enable(void *data, bool state, bool full_screen)
static void vulkan_set_texture_enable(void *data, bool state, bool fullscreen)
{
vk_t *vk = (vk_t*)data;
if (!vk)
return;
vk->menu.enable = state;
vk->menu.full_screen = full_screen;
if (state)
vk->flags |= VK_FLAG_MENU_ENABLE;
else
vk->flags &= ~VK_FLAG_MENU_ENABLE;
if (fullscreen)
vk->flags |= VK_FLAG_MENU_FULLSCREEN;
else
vk->flags &= ~VK_FLAG_MENU_FULLSCREEN;
}
static uintptr_t vulkan_load_texture(void *video_data, void *data,
@ -3292,7 +3316,7 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
staging = &vk->readback.staging[vk->context->current_frame_index];
if (vk->readback.streamed)
if (vk->flags & VK_FLAG_READBACK_STREAMED)
{
const uint8_t *src = NULL;
struct scaler_ctx *ctx = NULL;
@ -3339,8 +3363,7 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
/* TODO: How will we deal with format conversion?
* For now, take the simplest route and use image blitting
* with conversion. */
vk->readback.pending = true;
vk->flags |= VK_FLAG_READBACK_PENDING;
if (!is_idle)
video_driver_cached_frame();
@ -3420,7 +3443,10 @@ static void vulkan_overlay_enable(void *data, bool enable)
if (!vk)
return;
vk->overlay.enable = enable;
if (enable)
vk->flags |= VK_FLAG_OVERLAY_ENABLE;
else
vk->flags &= ~VK_FLAG_OVERLAY_ENABLE;
if (vk->ctx_driver->show_mouse)
vk->ctx_driver->show_mouse(vk->ctx_data, enable);
}
@ -3431,7 +3457,10 @@ static void vulkan_overlay_full_screen(void *data, bool enable)
if (!vk)
return;
vk->overlay.full_screen = enable;
if (enable)
vk->flags |= VK_FLAG_OVERLAY_FULLSCREEN;
else
vk->flags &= ~VK_FLAG_OVERLAY_FULLSCREEN;
}
static void vulkan_overlay_free(vk_t *vk)
@ -3483,7 +3512,9 @@ static void vulkan_render_overlay(vk_t *vk, unsigned width,
return;
vp = vk->vp;
vulkan_set_viewport(vk, width, height, vk->overlay.full_screen, false);
vulkan_set_viewport(vk, width, height,
((vk->flags & VK_FLAG_OVERLAY_FULLSCREEN) > 0),
false);
for (i = 0; i < vk->overlay.count; i++)
{
@ -3576,19 +3607,16 @@ static bool vulkan_overlay_load(void *data,
#ifdef HAVE_THREADS
slock_unlock(vk->context->queue_lock);
#endif
old_enabled = vk->overlay.enable;
old_enabled = vk->flags & VK_FLAG_OVERLAY_ENABLE;
vulkan_overlay_free(vk);
vk->overlay.images = (struct vk_texture*)
calloc(num_images, sizeof(*vk->overlay.images));
if (!vk->overlay.images)
if (!(vk->overlay.images = (struct vk_texture*)
calloc(num_images, sizeof(*vk->overlay.images))))
goto error;
vk->overlay.count = num_images;
vk->overlay.vertex = (struct vk_vertex*)
calloc(4 * num_images, sizeof(*vk->overlay.vertex));
if (!vk->overlay.vertex)
if (!(vk->overlay.vertex = (struct vk_vertex*)
calloc(4 * num_images, sizeof(*vk->overlay.vertex))))
goto error;
for (i = 0; i < num_images; i++)
@ -3604,7 +3632,11 @@ static bool vulkan_overlay_load(void *data,
vk->overlay.vertex[4 * i + j].color = white;
}
vk->overlay.enable = old_enabled;
if (old_enabled)
vk->flags |= VK_FLAG_OVERLAY_ENABLE;
else
vk->flags &= ~VK_FLAG_OVERLAY_ENABLE;
return true;
error:

View File

@ -249,9 +249,9 @@ static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
{
struct vk_draw_triangles call;
unsigned
disp_pipeline = ((draw->prim_type ==
GFX_DISPLAY_PRIM_TRIANGLESTRIP) << 1) |
(vk->display.blend << 0);
disp_pipeline =
((draw->prim_type == GFX_DISPLAY_PRIM_TRIANGLESTRIP) << 1)
| (((vk->flags & VK_FLAG_DISPLAY_BLEND) > 0) << 0);
call.pipeline = vk->display.pipelines[disp_pipeline];
call.texture = texture;
call.sampler = (texture->flags & VK_TEX_FLAG_MIPMAP) ?
@ -275,7 +275,7 @@ static void gfx_display_vk_blend_begin(void *data)
vk_t *vk = (vk_t*)data;
if (vk)
vk->display.blend = true;
vk->flags |= VK_FLAG_DISPLAY_BLEND;
}
static void gfx_display_vk_blend_end(void *data)
@ -283,7 +283,7 @@ static void gfx_display_vk_blend_end(void *data)
vk_t *vk = (vk_t*)data;
if (vk)
vk->display.blend = false;
vk->flags &= ~VK_FLAG_DISPLAY_BLEND;
}
static void gfx_display_vk_scissor_begin(
@ -294,11 +294,11 @@ static void gfx_display_vk_scissor_begin(
{
vk_t *vk = (vk_t*)data;
vk->tracker.use_scissor = true;
vk->tracker.scissor.offset.x = x;
vk->tracker.scissor.offset.y = y;
vk->tracker.scissor.extent.width = width;
vk->tracker.scissor.extent.height = height;
vk->flags |= VK_FLAG_TRACKER_USE_SCISSOR;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
}
@ -308,8 +308,8 @@ static void gfx_display_vk_scissor_end(void *data,
{
vk_t *vk = (vk_t*)data;
vk->tracker.use_scissor = false;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
vk->flags &= ~VK_FLAG_TRACKER_USE_SCISSOR;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
}
gfx_display_ctx_driver_t gfx_display_ctx_vulkan = {