diff options
author | Tony Wasserka <NeoBrainX@gmail.com> | 2014-12-04 17:37:59 +0100 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2014-12-20 18:05:53 +0100 |
commit | 0fba1d48a6ab7a9fa19ce65ec864da212ceb501a (patch) | |
tree | 37f0efbdb2e27c3d27828def51682329953b8683 /src/video_core/rasterizer.cpp | |
parent | Pica/DebugUtils: Add support for RGBA8, RGBA5551, RGBA4 and A8 texture formats. (diff) | |
download | yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.tar yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.tar.gz yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.tar.bz2 yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.tar.lz yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.tar.xz yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.tar.zst yuzu-0fba1d48a6ab7a9fa19ce65ec864da212ceb501a.zip |
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r-- | src/video_core/rasterizer.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 2ff6d19a6..e12f68a7f 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -181,7 +181,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, if (!texture.enabled) continue; - _dbg_assert_(GPU, 0 != texture.config.address); + _dbg_assert_(HW_GPU, 0 != texture.config.address); // Images are split into 8x8 tiles. Each tile is composed of four 4x4 subtiles each // of which is composed of four 2x2 subtiles each of which is composed of four texels. @@ -206,6 +206,25 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, // somewhat inefficient code around for now. int s = (int)(uv[i].u() * float24::FromFloat32(static_cast<float>(texture.config.width))).ToFloat32(); int t = (int)(uv[i].v() * float24::FromFloat32(static_cast<float>(texture.config.height))).ToFloat32(); + auto GetWrappedTexCoord = [](Regs::TextureConfig::WrapMode mode, int val, unsigned size) { + switch (mode) { + case Regs::TextureConfig::ClampToEdge: + val = std::max(val, 0); + val = std::min(val, (int)size - 1); + return val; + + case Regs::TextureConfig::Repeat: + return (int)(((unsigned)val) % size); + + default: + LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode); + _dbg_assert_(HW_GPU, 0); + return 0; + } + }; + s = GetWrappedTexCoord(registers.texture0.wrap_s, s, registers.texture0.width); + t = GetWrappedTexCoord(registers.texture0.wrap_t, t, registers.texture0.height); + int texel_index_within_tile = 0; for (int block_size_index = 0; block_size_index < 3; ++block_size_index) { int sub_tile_width = 1 << block_size_index; |