From 3bd9f85af8e54454c23e54f4923f8299f197d12a Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 16 Sep 2020 11:49:58 +1000 Subject: [PATCH] PostProcessingShaderGen: Use ints instead of bools for options --- src/core/shadergen.cpp | 2 ++ src/frontend-common/postprocessing_shadergen.cpp | 4 ++-- src/frontend-common/vulkan_host_display.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/shadergen.cpp b/src/core/shadergen.cpp index 5df99f150..09beade19 100644 --- a/src/core/shadergen.cpp +++ b/src/core/shadergen.cpp @@ -146,6 +146,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss) ss << "#define lerp mix\n"; ss << "#define CONSTANT const\n"; + ss << "#define GLOBAL\n"; ss << "#define VECTOR_EQ(a, b) ((a) == (b))\n"; ss << "#define VECTOR_NEQ(a, b) ((a) != (b))\n"; ss << "#define VECTOR_COMP_EQ(a, b) equal((a), (b))\n"; @@ -181,6 +182,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss) ss << "#define mat3 float3x3\n"; ss << "#define mat4 float4x4\n"; ss << "#define CONSTANT static const\n"; + ss << "#define GLOBAL static\n"; ss << "#define VECTOR_EQ(a, b) (all((a) == (b)))\n"; ss << "#define VECTOR_NEQ(a, b) (any((a) != (b)))\n"; ss << "#define VECTOR_COMP_EQ(a, b) ((a) == (b))\n"; diff --git a/src/frontend-common/postprocessing_shadergen.cpp b/src/frontend-common/postprocessing_shadergen.cpp index 640c7b7f2..e04b35d21 100644 --- a/src/frontend-common/postprocessing_shadergen.cpp +++ b/src/frontend-common/postprocessing_shadergen.cpp @@ -161,9 +161,9 @@ void PostProcessingShaderGen::WriteUniformBuffer(std::stringstream& ss, const Po switch (option.type) { case PostProcessingShader::Option::Type::Bool: - ss << " bool " << option.name << ";\n"; + ss << " int " << option.name << ";\n"; for (u32 i = option.vector_size; i < PostProcessingShader::Option::MAX_VECTOR_COMPONENTS; i++) - ss << " bool ubo_pad" << (pad_counter++) << ";\n"; + ss << " int ubo_pad" << (pad_counter++) << ";\n"; break; case PostProcessingShader::Option::Type::Int: diff --git a/src/frontend-common/vulkan_host_display.cpp b/src/frontend-common/vulkan_host_display.cpp index 9f9ddf825..912a22ac4 100644 --- a/src/frontend-common/vulkan_host_display.cpp +++ b/src/frontend-common/vulkan_host_display.cpp @@ -925,7 +925,7 @@ void VulkanHostDisplay::ApplyPostProcessingChain(s32 final_left, s32 final_top, if (use_push_constants) { u8 buffer[PostProcessingShader::PUSH_CONSTANT_SIZE_THRESHOLD]; - Assert(pps.uniforms_size < sizeof(buffer)); + Assert(pps.uniforms_size <= sizeof(buffer)); m_post_processing_chain.GetShaderStage(i).FillUniformBuffer( buffer, texture_width, texture_height, texture_view_x, texture_view_y, texture_view_width, texture_view_height, texture_width, texture_width, 0.0f);