diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/common_paths.h | 2 | ||||
-rw-r--r-- | src/common/file_util.cpp | 2 | ||||
-rw-r--r-- | src/video_core/engines/maxwell_3d.h | 52 | ||||
-rw-r--r-- | src/video_core/engines/shader_bytecode.h | 20 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 15 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 14 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 22 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 40 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 16 | ||||
-rw-r--r-- | src/video_core/textures/decoders.cpp | 5 | ||||
-rw-r--r-- | src/yuzu_cmd/default_ini.h | 2 |
11 files changed, 166 insertions, 24 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index d03fca314..9bf3efaf2 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -40,7 +40,7 @@ #define DEBUGGER_CONFIG "debugger.ini" #define LOGGER_CONFIG "logger.ini" // Files in the directory returned by GetUserPath(D_LOGS_IDX) -#define LOG_FILE "citra_log.txt" +#define LOG_FILE "yuzu_log.txt" // Sys files #define SHARED_FONT "shared_font.bin" diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index b9e1fd1f6..7213abe18 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -678,7 +678,7 @@ std::string GetSysDirectory() { return sysDir; } -// Returns a string with a Citra data dir or file in the user's home +// Returns a string with a yuzu data dir or file in the user's home // directory. To be used in "multi-user" mode (that is, installed). const std::string& GetUserPath(const unsigned int DirIDX, const std::string& newPath) { static std::string paths[NUM_PATH_INDICES]; diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 988a6433e..5a7cf0107 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -281,14 +281,26 @@ public: }; enum class ComparisonOp : u32 { - Never = 0, - Less = 1, - Equal = 2, - LessEqual = 3, - Greater = 4, - NotEqual = 5, - GreaterEqual = 6, - Always = 7, + // These values are used by Nouveau and most games, they correspond to the OpenGL token + // values for these operations. + Never = 0x200, + Less = 0x201, + Equal = 0x202, + LessEqual = 0x203, + Greater = 0x204, + NotEqual = 0x205, + GreaterEqual = 0x206, + Always = 0x207, + + // These values are used by some games, they seem to be NV04 values. + NeverOld = 1, + LessOld = 2, + EqualOld = 3, + LessEqualOld = 4, + GreaterOld = 5, + NotEqualOld = 6, + GreaterEqualOld = 7, + AlwaysOld = 8, }; struct Cull { @@ -478,9 +490,11 @@ public: u32 depth_write_enabled; - INSERT_PADDING_WORDS(0x8); + INSERT_PADDING_WORDS(0x7); + + u32 d3d_cull_mode; - BitField<0, 3, ComparisonOp> depth_test_func; + ComparisonOp depth_test_func; INSERT_PADDING_WORDS(0xB); @@ -498,7 +512,13 @@ public: u32 enable[NumRenderTargets]; } blend; - INSERT_PADDING_WORDS(0x2D); + INSERT_PADDING_WORDS(0xB); + + union { + BitField<4, 1, u32> triangle_rast_flip; + } screen_y_control; + + INSERT_PADDING_WORDS(0x21); u32 vb_element_base; @@ -528,7 +548,12 @@ public: } } tic; - INSERT_PADDING_WORDS(0x22); + INSERT_PADDING_WORDS(0x21); + + union { + BitField<2, 1, u32> coord_origin; + BitField<3, 10, u32> enable; + } point_coord_replace; struct { u32 code_address_high; @@ -818,11 +843,14 @@ ASSERT_REG_POSITION(rt_control, 0x487); ASSERT_REG_POSITION(depth_test_enable, 0x4B3); ASSERT_REG_POSITION(independent_blend_enable, 0x4B9); ASSERT_REG_POSITION(depth_write_enabled, 0x4BA); +ASSERT_REG_POSITION(d3d_cull_mode, 0x4C2); ASSERT_REG_POSITION(depth_test_func, 0x4C3); ASSERT_REG_POSITION(blend, 0x4CF); +ASSERT_REG_POSITION(screen_y_control, 0x4EB); ASSERT_REG_POSITION(vb_element_base, 0x50D); ASSERT_REG_POSITION(tsc, 0x557); ASSERT_REG_POSITION(tic, 0x55D); +ASSERT_REG_POSITION(point_coord_replace, 0x581); ASSERT_REG_POSITION(code_address, 0x582); ASSERT_REG_POSITION(draw, 0x585); ASSERT_REG_POSITION(index_array, 0x5F2); diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 31684c410..2bc1782ad 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -343,6 +343,19 @@ union Instruction { } isetp; union { + BitField<0, 3, u64> pred0; + BitField<3, 3, u64> pred3; + BitField<12, 3, u64> pred12; + BitField<15, 1, u64> neg_pred12; + BitField<24, 2, PredOperation> cond; + BitField<29, 3, u64> pred29; + BitField<32, 1, u64> neg_pred29; + BitField<39, 3, u64> pred39; + BitField<42, 1, u64> neg_pred39; + BitField<45, 2, PredOperation> op; + } psetp; + + union { BitField<39, 3, u64> pred39; BitField<42, 1, u64> neg_pred; BitField<43, 1, u64> neg_a; @@ -452,6 +465,8 @@ public: enum class Id { KIL, SSY, + SYNC, + DEPBAR, BFE_C, BFE_R, BFE_IMM, @@ -548,6 +563,7 @@ public: Shift, Ffma, Flow, + Synch, Memory, FloatSet, FloatSetPredicate, @@ -652,10 +668,12 @@ private: INST("111000110011----", Id::KIL, Type::Flow, "KIL"), INST("111000101001----", Id::SSY, Type::Flow, "SSY"), INST("111000100100----", Id::BRA, Type::Flow, "BRA"), + INST("1111000011110---", Id::DEPBAR, Type::Synch, "DEPBAR"), + INST("1111000011111---", Id::SYNC, Type::Synch, "SYNC"), INST("1110111111011---", Id::LD_A, Type::Memory, "LD_A"), INST("1110111110010---", Id::LD_C, Type::Memory, "LD_C"), INST("1110111111110---", Id::ST_A, Type::Memory, "ST_A"), - INST("1100000000111---", Id::TEX, Type::Memory, "TEX"), + INST("110000----111---", Id::TEX, Type::Memory, "TEX"), INST("1101111101001---", Id::TEXQ, Type::Memory, "TEXQ"), INST("1101100---------", Id::TEXS, Type::Memory, "TEXS"), INST("1101101---------", Id::TLDS, Type::Memory, "TLDS"), diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index e516eb1ad..bacb389e1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -686,7 +686,10 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program, // Bind the uniform to the sampler. GLint uniform = glGetUniformLocation(program, entry.GetName().c_str()); - ASSERT(uniform != -1); + if (uniform == -1) { + continue; + } + glProgramUniform1i(program, uniform, current_bindpoint); const auto texture = maxwell3d.GetStageTexture(entry.GetStage(), entry.GetOffset()); @@ -771,6 +774,16 @@ void RasterizerOpenGL::SyncCullMode() { if (state.cull.enabled) { state.cull.front_face = MaxwellToGL::FrontFace(regs.cull.front_face); state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face); + + // If the GPU is configured to flip the rasterized triangles, then we need to flip the + // notion of front and back. Note: We flip the triangles when the value of the register is 0 + // because OpenGL already does it for us. + if (regs.screen_y_control.triangle_rast_flip == 0) { + if (state.cull.front_face == GL_CCW) + state.cull.front_face = GL_CW; + else if (state.cull.front_face == GL_CW) + state.cull.front_face = GL_CCW; + } } } diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 50469c05c..323ff7408 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -102,13 +102,16 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXT45 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1 + {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, + true}, // BC7U {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 // DepthStencil formats {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, false}, // Z24S8 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, - false}, // S8Z24 + false}, // S8Z24 + {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F }}; static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { @@ -190,8 +193,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, - MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::Z24S8>, - MortonCopy<true, PixelFormat::S8Z24>, + MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, + MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, + MortonCopy<true, PixelFormat::Z32F>, }; static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), @@ -205,7 +209,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), MortonCopy<false, PixelFormat::RGBA16F>, MortonCopy<false, PixelFormat::R11FG11FB10F>, MortonCopy<false, PixelFormat::RGBA32UI>, - // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1 formats is not yet supported + // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1/BC7U formats is not yet supported + nullptr, nullptr, nullptr, nullptr, @@ -213,6 +218,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), MortonCopy<false, PixelFormat::ABGR8>, MortonCopy<false, PixelFormat::Z24S8>, MortonCopy<false, PixelFormat::S8Z24>, + MortonCopy<false, PixelFormat::Z32F>, }; // Allocate an uninitialized texture of appropriate size and format for the surface diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 8005a81b8..1bedae992 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -35,13 +35,15 @@ struct SurfaceParams { DXT23 = 9, DXT45 = 10, DXN1 = 11, // This is also known as BC4 - ASTC_2D_4X4 = 12, + BC7U = 12, + ASTC_2D_4X4 = 13, MaxColorFormat, // DepthStencil formats - Z24S8 = 13, - S8Z24 = 14, + Z24S8 = 14, + S8Z24 = 15, + Z32F = 16, MaxDepthStencilFormat, @@ -91,9 +93,11 @@ struct SurfaceParams { 4, // DXT23 4, // DXT45 4, // DXN1 + 4, // BC7U 4, // ASTC_2D_4X4 1, // Z24S8 1, // S8Z24 + 1, // Z32F }}; ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); @@ -117,9 +121,11 @@ struct SurfaceParams { 128, // DXT23 128, // DXT45 64, // DXN1 + 128, // BC7U 32, // ASTC_2D_4X4 32, // Z24S8 32, // S8Z24 + 32, // Z32F }}; ASSERT(static_cast<size_t>(format) < bpp_table.size()); @@ -135,6 +141,8 @@ struct SurfaceParams { return PixelFormat::S8Z24; case Tegra::DepthFormat::Z24_S8_UNORM: return PixelFormat::Z24S8; + case Tegra::DepthFormat::Z32_FLOAT: + return PixelFormat::Z32F; default: LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); UNREACHABLE(); @@ -187,6 +195,8 @@ struct SurfaceParams { return PixelFormat::DXT45; case Tegra::Texture::TextureFormat::DXN1: return PixelFormat::DXN1; + case Tegra::Texture::TextureFormat::BC7U: + return PixelFormat::BC7U; case Tegra::Texture::TextureFormat::ASTC_2D_4X4: return PixelFormat::ASTC_2D_4X4; default: @@ -222,6 +232,8 @@ struct SurfaceParams { return Tegra::Texture::TextureFormat::DXT45; case PixelFormat::DXN1: return Tegra::Texture::TextureFormat::DXN1; + case PixelFormat::BC7U: + return Tegra::Texture::TextureFormat::BC7U; case PixelFormat::ASTC_2D_4X4: return Tegra::Texture::TextureFormat::ASTC_2D_4X4; default: @@ -235,6 +247,8 @@ struct SurfaceParams { return Tegra::DepthFormat::S8_Z24_UNORM; case PixelFormat::Z24S8: return Tegra::DepthFormat::Z24_S8_UNORM; + case PixelFormat::Z32F: + return Tegra::DepthFormat::Z32_FLOAT; default: UNREACHABLE(); } @@ -284,6 +298,8 @@ struct SurfaceParams { case Tegra::DepthFormat::S8_Z24_UNORM: case Tegra::DepthFormat::Z24_S8_UNORM: return ComponentType::UNorm; + case Tegra::DepthFormat::Z32_FLOAT: + return ComponentType::Float; default: LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); UNREACHABLE(); diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 9d43d0fb1..5914077e8 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1227,6 +1227,9 @@ private: switch (instr.conversion.f2f.rounding) { case Tegra::Shader::F2fRoundingOp::None: break; + case Tegra::Shader::F2fRoundingOp::Round: + op_a = "roundEven(" + op_a + ')'; + break; case Tegra::Shader::F2fRoundingOp::Floor: op_a = "floor(" + op_a + ')'; break; @@ -1491,6 +1494,36 @@ private: } break; } + case OpCode::Type::PredicateSetPredicate: { + std::string op_a = + GetPredicateCondition(instr.psetp.pred12, instr.psetp.neg_pred12 != 0); + std::string op_b = + GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); + + using Tegra::Shader::Pred; + // We can't use the constant predicate as destination. + ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); + + std::string second_pred = + GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); + + std::string combiner = GetPredicateCombiner(instr.psetp.op); + + std::string predicate = + '(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')'; + + // Set the primary predicate to the result of Predicate OP SecondPredicate + SetPredicate(instr.psetp.pred3, + '(' + predicate + ") " + combiner + " (" + second_pred + ')'); + + if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { + // Set the secondary predicate to the result of !Predicate OP SecondPredicate, + // if enabled + SetPredicate(instr.psetp.pred0, + "!(" + predicate + ") " + combiner + " (" + second_pred + ')'); + } + break; + } case OpCode::Type::FloatSet: { std::string op_a = instr.fset.neg_a ? "-" : ""; op_a += regs.GetRegisterAsFloat(instr.gpr8); @@ -1613,6 +1646,13 @@ private: // can ignore this when generating GLSL code. break; } + case OpCode::Id::DEPBAR: + case OpCode::Id::SYNC: { + // TODO(Subv): Find out if we actually have to care about these instructions or if + // the GLSL compiler takes care of that for us. + LOG_WARNING(HW_GPU, "DEPBAR/SYNC instruction is stubbed"); + break; + } default: { LOG_CRITICAL(HW_GPU, "Unhandled instruction: {}", opcode->GetName()); UNREACHABLE(); diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 6b9bb3df1..e19c3b280 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -29,6 +29,10 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) { switch (attrib.size) { case Maxwell::VertexAttribute::Size::Size_8_8_8_8: return GL_UNSIGNED_BYTE; + case Maxwell::VertexAttribute::Size::Size_16_16: + return GL_UNSIGNED_SHORT; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return GL_UNSIGNED_INT_2_10_10_10_REV; } LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString()); @@ -41,6 +45,10 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) { switch (attrib.size) { case Maxwell::VertexAttribute::Size::Size_8_8_8_8: return GL_BYTE; + case Maxwell::VertexAttribute::Size::Size_16_16: + return GL_SHORT; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return GL_INT_2_10_10_10_REV; } LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString()); @@ -203,20 +211,28 @@ inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) { inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { switch (comparison) { case Maxwell::ComparisonOp::Never: + case Maxwell::ComparisonOp::NeverOld: return GL_NEVER; case Maxwell::ComparisonOp::Less: + case Maxwell::ComparisonOp::LessOld: return GL_LESS; case Maxwell::ComparisonOp::Equal: + case Maxwell::ComparisonOp::EqualOld: return GL_EQUAL; case Maxwell::ComparisonOp::LessEqual: + case Maxwell::ComparisonOp::LessEqualOld: return GL_LEQUAL; case Maxwell::ComparisonOp::Greater: + case Maxwell::ComparisonOp::GreaterOld: return GL_GREATER; case Maxwell::ComparisonOp::NotEqual: + case Maxwell::ComparisonOp::NotEqualOld: return GL_NOTEQUAL; case Maxwell::ComparisonOp::GreaterEqual: + case Maxwell::ComparisonOp::GreaterEqualOld: return GL_GEQUAL; case Maxwell::ComparisonOp::Always: + case Maxwell::ComparisonOp::AlwaysOld: return GL_ALWAYS; } LOG_CRITICAL(Render_OpenGL, "Unimplemented comparison op={}", static_cast<u32>(comparison)); diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 7b06fea3e..b3937b2fe 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp @@ -52,6 +52,7 @@ u32 BytesPerPixel(TextureFormat format) { return 8; case TextureFormat::DXT23: case TextureFormat::DXT45: + case TextureFormat::BC7U: // In this case a 'pixel' actually refers to a 4x4 tile. return 16; case TextureFormat::ASTC_2D_4X4: @@ -78,6 +79,7 @@ static u32 DepthBytesPerPixel(DepthFormat format) { switch (format) { case DepthFormat::S8_Z24_UNORM: case DepthFormat::Z24_S8_UNORM: + case DepthFormat::Z32_FLOAT: return 4; default: UNIMPLEMENTED_MSG("Format not implemented"); @@ -97,6 +99,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, case TextureFormat::DXT23: case TextureFormat::DXT45: case TextureFormat::DXN1: + case TextureFormat::BC7U: // In the DXT and DXN formats, each 4x4 tile is swizzled instead of just individual pixel // values. CopySwizzledData(width / 4, height / 4, bytes_per_pixel, bytes_per_pixel, data, @@ -132,6 +135,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid switch (format) { case DepthFormat::S8_Z24_UNORM: case DepthFormat::Z24_S8_UNORM: + case DepthFormat::Z32_FLOAT: CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, unswizzled_data.data(), true, block_height); break; @@ -153,6 +157,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat case TextureFormat::DXT23: case TextureFormat::DXT45: case TextureFormat::DXN1: + case TextureFormat::BC7U: case TextureFormat::ASTC_2D_4X4: case TextureFormat::A8R8G8B8: case TextureFormat::A2B10G10R10: diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 5896971d4..71d2e040f 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -166,7 +166,7 @@ use_virtual_sd = # 1 (default): Yes, 0: No use_docked_mode = -# The system region that Citra will use during emulation +# The system region that yuzu will use during emulation # -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan region_value = |