(Vulkan) Add fancy snow for Vulkan

This commit is contained in:
twinaphex 2017-02-20 21:51:58 +01:00
parent 962149ef63
commit 0d873b6da1
3 changed files with 20 additions and 3 deletions

View File

@ -331,7 +331,7 @@ typedef struct vk
struct
{
bool blend;
VkPipeline pipelines[5 * 2];
VkPipeline pipelines[12];
struct vk_texture blank_texture;
} display;

View File

@ -229,6 +229,10 @@ static void vulkan_init_pipelines(
#include "vulkan_shaders/pipeline_snow_simple.frag.inc"
;
static const uint32_t pipeline_snow_frag[] =
#include "vulkan_shaders/pipeline_snow.frag.inc"
;
unsigned i;
VkPipelineInputAssemblyStateCreateInfo input_assembly = {
VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO };
@ -413,6 +417,11 @@ static void vulkan_init_pipelines(
module_info.pCode = alpha_blend_vert;
break;
case 3:
module_info.codeSize = sizeof(alpha_blend_vert);
module_info.pCode = alpha_blend_vert;
break;
default:
retro_assert(0 && "No shader for menu pipeline.");
break;
@ -440,6 +449,11 @@ static void vulkan_init_pipelines(
module_info.pCode = pipeline_snow_simple_frag;
break;
case 3:
module_info.codeSize = sizeof(pipeline_snow_frag);
module_info.pCode = pipeline_snow_frag;
break;
default:
retro_assert(0 && "No shader for menu pipeline.");
break;

View File

@ -90,6 +90,8 @@ static unsigned to_menu_pipeline(
return 6 + (type == MENU_DISPLAY_PRIM_TRIANGLESTRIP);
case VIDEO_SHADER_MENU_3:
return 8 + (type == MENU_DISPLAY_PRIM_TRIANGLESTRIP);
case VIDEO_SHADER_MENU_4:
return 10 + (type == MENU_DISPLAY_PRIM_TRIANGLESTRIP);
default:
return 0;
}
@ -119,7 +121,7 @@ static void menu_display_vk_draw_pipeline(void *data)
vk_t *vk = (vk_t*)video_driver_get_ptr(false);
video_coord_array_t *ca = NULL;
static uint8_t ubo_scratch_data[256];
static uint8_t ubo_scratch_data[512];
static float t = 0.0f;
static struct video_coords blank_coords;
@ -149,6 +151,7 @@ static void menu_display_vk_draw_pipeline(void *data)
/* Snow simple */
case VIDEO_SHADER_MENU_3:
case VIDEO_SHADER_MENU_4:
draw->pipeline.backend_data = ubo_scratch_data;
draw->pipeline.backend_data_size = sizeof(math_matrix_4x4) + 3 * sizeof(float);
@ -225,6 +228,7 @@ static void menu_display_vk_draw(void *data)
case VIDEO_SHADER_MENU:
case VIDEO_SHADER_MENU_2:
case VIDEO_SHADER_MENU_3:
case VIDEO_SHADER_MENU_4:
{
const struct vk_draw_triangles call = {
vk->display.pipelines[
@ -241,7 +245,6 @@ static void menu_display_vk_draw(void *data)
}
/* Not implemented yet. */
case VIDEO_SHADER_MENU_4:
case VIDEO_SHADER_MENU_5:
break;
#endif