Skip to content

Commit

Permalink
- Use VK_FALSE/VK_TRUE consistently for Vulkan structts
Browse files Browse the repository at this point in the history
- Some minuscule changes to file_path.c
  • Loading branch information
LibretroAdmin committed Jul 17, 2023
1 parent a5f2903 commit f1c6510
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion gfx/common/vulkan_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
info.preTransform = pre_transform;
info.compositeAlpha = composite;
info.presentMode = swapchain_present_mode;
info.clipped = true;
info.clipped = VK_TRUE;
info.oldSwapchain = old_swapchain;

#ifdef _WIN32
Expand Down
36 changes: 18 additions & 18 deletions gfx/drivers/vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2202,13 +2202,13 @@ static void vulkan_init_pipelines(vk_t *vk)
raster.polygonMode = VK_POLYGON_MODE_FILL;
raster.cullMode = VK_CULL_MODE_NONE;
raster.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
raster.depthClampEnable = false;
raster.rasterizerDiscardEnable = false;
raster.depthBiasEnable = false;
raster.depthClampEnable = VK_FALSE;
raster.rasterizerDiscardEnable = VK_FALSE;
raster.depthBiasEnable = VK_FALSE;
raster.lineWidth = 1.0f;

/* Blend state */
blend_attachment.blendEnable = false;
blend_attachment.blendEnable = VK_FALSE;
blend_attachment.colorWriteMask = 0xf;
blend.attachmentCount = 1;
blend.pAttachments = &blend_attachment;
Expand All @@ -2218,10 +2218,10 @@ static void vulkan_init_pipelines(vk_t *vk)
viewport.scissorCount = 1;

/* Depth-stencil state */
depth_stencil.depthTestEnable = false;
depth_stencil.depthWriteEnable = false;
depth_stencil.depthBoundsTestEnable = false;
depth_stencil.stencilTestEnable = false;
depth_stencil.depthTestEnable = VK_FALSE;
depth_stencil.depthWriteEnable = VK_FALSE;
depth_stencil.depthBoundsTestEnable = VK_FALSE;
depth_stencil.stencilTestEnable = VK_FALSE;
depth_stencil.minDepthBounds = 0.0f;
depth_stencil.maxDepthBounds = 1.0f;

Expand Down Expand Up @@ -2252,7 +2252,7 @@ static void vulkan_init_pipelines(vk_t *vk)
vkCreateShaderModule(vk->context->device,
&module_info, NULL, &shader_stages[0].module);

blend_attachment.blendEnable = true;
blend_attachment.blendEnable = VK_TRUE;
blend_attachment.colorWriteMask = 0xf;
blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
Expand Down Expand Up @@ -2298,13 +2298,13 @@ static void vulkan_init_pipelines(vk_t *vk)
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);

#ifdef VULKAN_HDR_SWAPCHAIN
blend_attachment.blendEnable = false;
blend_attachment.blendEnable = VK_FALSE;

/* HDR pipeline. */
module_info.codeSize = sizeof(hdr_frag);
module_info.pCode = hdr_frag;
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader_stages[1].pName = "main";
module_info.codeSize = sizeof(hdr_frag);
module_info.pCode = hdr_frag;
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader_stages[1].pName = "main";
vkCreateShaderModule(vk->context->device,
&module_info, NULL, &shader_stages[1].module);

Expand All @@ -2321,7 +2321,7 @@ static void vulkan_init_pipelines(vk_t *vk)

vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);

blend_attachment.blendEnable = true;
blend_attachment.blendEnable = VK_TRUE;
#endif /* VULKAN_HDR_SWAPCHAIN */

vkDestroyShaderModule(vk->context->device, shader_stages[0].module, NULL);
Expand Down Expand Up @@ -2453,13 +2453,13 @@ static void vulkan_init_samplers(vk_t *vk)
info.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.mipLodBias = 0.0f;
info.anisotropyEnable = false;
info.anisotropyEnable = VK_FALSE;
info.maxAnisotropy = 1.0f;
info.compareEnable = false;
info.compareEnable = VK_FALSE;
info.minLod = 0.0f;
info.maxLod = 0.0f;
info.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
info.unnormalizedCoordinates = false;
info.unnormalizedCoordinates = VK_FALSE;
vkCreateSampler(vk->context->device,
&info, NULL, &vk->samplers.nearest);

Expand Down
45 changes: 22 additions & 23 deletions libretro-common/file/file_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,24 +690,23 @@ const char *path_basename_nocompression(const char *path)
**/
bool path_is_absolute(const char *path)
{
if (string_is_empty(path))
return false;

if (path[0] == '/')
return true;

if (!string_is_empty(path))
{
if (path[0] == '/')
return true;
#if defined(_WIN32)
/* Many roads lead to Rome...
* Note: Drive letter can only be 1 character long */
return ( string_starts_with_size(path, "\\\\", STRLEN_CONST("\\\\"))
|| string_starts_with_size(path + 1, ":/", STRLEN_CONST(":/"))
|| string_starts_with_size(path + 1, ":\\", STRLEN_CONST(":\\")));
/* Many roads lead to Rome...
* Note: Drive letter can only be 1 character long */
return ( string_starts_with_size(path, "\\\\", STRLEN_CONST("\\\\"))
|| string_starts_with_size(path + 1, ":/", STRLEN_CONST(":/"))
|| string_starts_with_size(path + 1, ":\\", STRLEN_CONST(":\\")));
#elif defined(__wiiu__) || defined(VITA)
{
const char *seperator = strchr(path, ':');
return (seperator && (seperator[1] == '/'));
}
{
const char *seperator = strchr(path, ':');
return (seperator && (seperator[1] == '/'));
}
#endif
}

return false;
}
Expand All @@ -733,7 +732,7 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
#ifdef _WIN32
char *ret = NULL;
char *ret = NULL;
wchar_t *rel_path = utf8_to_utf16_string_alloc(buf);

if (rel_path)
Expand Down Expand Up @@ -787,7 +786,7 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
size_t len;
/* rebase on working directory */
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
if (!getcwd(tmp, PATH_MAX_LENGTH - 1))
return NULL;

len = strlen(tmp);
Expand Down Expand Up @@ -824,8 +823,8 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
return NULL;

/* delete previous segment in tmp by adjusting size t
* tmp[t-1] == '/', find '/' before that */
t = t-2;
* tmp[t - 1] == '/', find '/' before that */
t -= 2;
while (tmp[t] != '/')
t--;
t++;
Expand All @@ -837,7 +836,7 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
else
{
/* fail when truncating */
if (t + next - p + 1 > PATH_MAX_LENGTH-1)
if (t + next - p + 1 > PATH_MAX_LENGTH - 1)
return NULL;

while (p <= next)
Expand Down Expand Up @@ -1158,12 +1157,12 @@ size_t fill_pathname_abbreviate_special(char *out_path,
*
* Leaf function.
*
* Changes the slashes to the correct kind for the os
* Changes the slashes to the correct kind for the OS
* So forward slash on linux and backslash on Windows
**/
void pathname_conform_slashes_to_os(char *path)
{
/* Conform slashes to os standard so we get proper matching */
/* Conform slashes to OS standard so we get proper matching */
char *p;
for (p = path; *p; p++)
if (*p == '/' || *p == '\\')
Expand All @@ -1181,7 +1180,7 @@ void pathname_conform_slashes_to_os(char *path)
**/
void pathname_make_slashes_portable(char *path)
{
/* Conform slashes to os standard so we get proper matching */
/* Conform slashes to OS standard so we get proper matching */
char *p;
for (p = path; *p; p++)
if (*p == '/' || *p == '\\')
Expand Down

0 comments on commit f1c6510

Please sign in to comment.