From 012cb25b7dd4e9f0ba4bff4a7d6af95f3fc98b66 Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Tue, 25 Apr 2017 11:25:50 -0400 Subject: [PATCH] CompilerMSL remove option to flip fragment coordinates. --- spirv_hlsl.cpp | 2 +- spirv_msl.cpp | 95 +++++++++----------------------------------------- spirv_msl.hpp | 1 - 3 files changed, 18 insertions(+), 80 deletions(-) diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp index 879d521d..75e60313 100644 --- a/spirv_hlsl.cpp +++ b/spirv_hlsl.cpp @@ -1369,7 +1369,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i) expr += ", "; } expr += coord_expr; - + if (dref) { forward = forward && should_forward(dref); diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 4d2e06b7..74ef7abb 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1071,79 +1071,37 @@ string CompilerMSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool break; case Dim2D: - if (options.flip_frag_y) - { - string coord_x = coord_expr + ".x"; - string coord_y = coord_expr + ".y"; - if (is_fetch) - tex_coords = "uint2(" + coord_x + ", (1.0 - " + coord_y + "))"; - else - tex_coords = "float2(" + coord_x + ", (1.0 - " + coord_y + "))"; - } - else - { - if (coord_type.vecsize > 2) - tex_coords += ".xy"; + if (coord_type.vecsize > 2) + tex_coords += ".xy"; - if (is_fetch) - tex_coords = "uint2(" + tex_coords + ")"; - } + if (is_fetch) + tex_coords = "uint2(" + tex_coords + ")"; alt_coord = ".z"; break; case Dim3D: - if (options.flip_frag_y) - { - string coord_x = coord_expr + ".x"; - string coord_y = coord_expr + ".y"; - string coord_z = coord_expr + ".z"; - if (is_fetch) - tex_coords = "uint3(" + coord_x + ", (1.0 - " + coord_y + "), " + coord_z + ")"; - else - tex_coords = "float3(" + coord_x + ", (1.0 - " + coord_y + "), " + coord_z + ")"; - } - else - { - if (coord_type.vecsize > 3) - tex_coords += ".xyz"; + if (coord_type.vecsize > 3) + tex_coords += ".xyz"; - if (is_fetch) - tex_coords = "uint3(" + tex_coords + ")"; - } + if (is_fetch) + tex_coords = "uint3(" + tex_coords + ")"; alt_coord = ".w"; break; case DimCube: - if (options.flip_frag_y) + if (is_fetch) { - string coord_x = coord_expr + ".x"; - string coord_y = coord_expr + ".y"; - string coord_z = coord_expr + ".z"; - - if (is_fetch) - { - tex_coords = "uint2(" + coord_x + ", (1.0 - " + coord_y + "))"; - face_expr = coord_z; - } - else - tex_coords = "float3(" + coord_x + ", (1.0 - " + coord_y + "), " + coord_z + ")"; + tex_coords = "uint2(" + tex_coords + ".xy)"; + face_expr = coord_expr + ".z"; } else { - if (is_fetch) - { - tex_coords = "uint2(" + tex_coords + ".xy)"; - face_expr = coord_expr + ".z"; - } - else - { - if (coord_type.vecsize > 3) - tex_coords += ".xyz"; - } + if (coord_type.vecsize > 3) + tex_coords += ".xyz"; } alt_coord = ".w"; @@ -1239,34 +1197,15 @@ string CompilerMSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool switch (imgtype.image.dim) { case Dim2D: - if (options.flip_frag_y) - { - string coord_x = offset_expr + ".x"; - string coord_y = offset_expr + ".y"; - offset_expr = "float2(" + coord_x + ", (1.0 - " + coord_y + "))"; - } - else - { - if (coord_type.vecsize > 2) - offset_expr += ".xy"; - } + if (coord_type.vecsize > 2) + offset_expr += ".xy"; farg_str += ", " + offset_expr; break; case Dim3D: - if (options.flip_frag_y) - { - string coord_x = offset_expr + ".x"; - string coord_y = offset_expr + ".y"; - string coord_z = offset_expr + ".z"; - offset_expr = "float3(" + coord_x + ", (1.0 - " + coord_y + "), " + coord_z + ")"; - } - else - { - if (coord_type.vecsize > 3) - offset_expr += ".xyz"; - } + if (coord_type.vecsize > 3) + offset_expr += ".xyz"; farg_str += ", " + offset_expr; break; diff --git a/spirv_msl.hpp b/spirv_msl.hpp index e5266c98..ecad29e6 100644 --- a/spirv_msl.hpp +++ b/spirv_msl.hpp @@ -77,7 +77,6 @@ public: struct Options { bool flip_vert_y = false; - bool flip_frag_y = false; bool is_rendering_points = false; bool pad_and_pack_uniform_structs = false; std::string entry_point_name;