(slang shader backends) Cleanups

This commit is contained in:
twinaphex 2020-08-16 02:29:54 +02:00
parent e35d2cb527
commit 4958e30d8f
4 changed files with 29 additions and 27 deletions

View File

@ -1000,9 +1000,11 @@ void Pass::set_pass_info(const gl_core_filter_chain_pass_info &info)
pass_info = info;
}
Size2D Pass::get_output_size(const Size2D &original, const Size2D &source) const
Size2D Pass::get_output_size(const Size2D &original,
const Size2D &source) const
{
float width, height;
float width = 0.0f;
float height = 0.0f;
switch (pass_info.scale_type_x)
{
case GLSLANG_FILTER_CHAIN_SCALE_ORIGINAL:
@ -1022,7 +1024,7 @@ Size2D Pass::get_output_size(const Size2D &original, const Size2D &source) const
break;
default:
width = 0.0f;
break;
}
switch (pass_info.scale_type_y)
@ -1044,7 +1046,7 @@ Size2D Pass::get_output_size(const Size2D &original, const Size2D &source) const
break;
default:
height = 0.0f;
break;
}
return { unsigned(roundf(width)), unsigned(roundf(height)) };

View File

@ -49,24 +49,22 @@ struct gl_core_viewport
struct gl_core_filter_chain_pass_info
{
/* Maximum number of mip-levels to use. */
unsigned max_levels;
float scale_x;
float scale_y;
/* Ignored for the last pass, swapchain info
* will be used instead. */
GLenum rt_format;
/* For the last pass, make sure VIEWPORT scale
* with scale factors of 1 are used. */
enum glslang_filter_chain_scale scale_type_x;
enum glslang_filter_chain_scale scale_type_y;
float scale_x;
float scale_y;
/* Ignored for the last pass, swapchain info
* will be used instead. */
GLenum rt_format;
/* The filter to use for source in this pass. */
enum glslang_filter_chain_filter source_filter;
enum glslang_filter_chain_filter mip_filter;
enum glslang_filter_chain_address address;
/* Maximum number of mip-levels to use. */
unsigned max_levels;
};
struct gl_core_buffer_locations

View File

@ -1465,7 +1465,8 @@ void Pass::set_shader(VkShaderStageFlags stage,
Size2D Pass::get_output_size(const Size2D &original,
const Size2D &source) const
{
float width, height;
float width = 0.0f;
float height = 0.0f;
switch (pass_info.scale_type_x)
{
case GLSLANG_FILTER_CHAIN_SCALE_ORIGINAL:
@ -1485,7 +1486,7 @@ Size2D Pass::get_output_size(const Size2D &original,
break;
default:
width = 0.0f;
break;
}
switch (pass_info.scale_type_y)
@ -1507,7 +1508,7 @@ Size2D Pass::get_output_size(const Size2D &original,
break;
default:
height = 0.0f;
break;
}
return { unsigned(roundf(width)), unsigned(roundf(height)) };
@ -2689,7 +2690,8 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
if (next_pass && next_pass->mipmap)
pass_info.max_levels = ~0u;
pass_info.mip_filter = pass->filter != RARCH_FILTER_NEAREST && pass_info.max_levels > 1
pass_info.mip_filter =
(pass->filter != RARCH_FILTER_NEAREST && pass_info.max_levels > 1)
? GLSLANG_FILTER_CHAIN_LINEAR
: GLSLANG_FILTER_CHAIN_NEAREST;

View File

@ -43,23 +43,23 @@ struct vulkan_filter_chain_texture
struct vulkan_filter_chain_pass_info
{
/* Maximum number of mip-levels to use. */
unsigned max_levels;
float scale_x;
float scale_y;
/* Ignored for the last pass, swapchain info
* will be used instead. */
VkFormat rt_format;
/* For the last pass, make sure VIEWPORT scale
* with scale factors of 1 are used. */
enum glslang_filter_chain_scale scale_type_x;
enum glslang_filter_chain_scale scale_type_y;
float scale_x;
float scale_y;
/* Ignored for the last pass, swapchain info will be used instead. */
VkFormat rt_format;
/* The filter to use for source in this pass. */
enum glslang_filter_chain_filter source_filter;
enum glslang_filter_chain_filter mip_filter;
enum glslang_filter_chain_address address;
/* Maximum number of mip-levels to use. */
unsigned max_levels;
};
struct vulkan_filter_chain_swapchain_info