diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/am/am.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/am/am.h | 13 | ||||
-rw-r--r-- | src/core/hle/service/am/am_app.cpp | 14 | ||||
-rw-r--r-- | src/video_core/pica.h | 7 | ||||
-rw-r--r-- | src/video_core/rasterizer.cpp | 1 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 16 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/pica_to_gl.h | 27 |
7 files changed, 79 insertions, 8 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 57dc1ece7..7332478fb 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -38,6 +38,15 @@ void GetTitleIDList(Service::Interface* self) { LOG_WARNING(Service_AM, "(STUBBED) Requested %u titles from media type %u", num_titles, media_type); } +void GetNumContentInfos(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + cmd_buff[1] = RESULT_SUCCESS.raw; + cmd_buff[2] = 1; // Number of content infos plus one + + LOG_WARNING(Service_AM, "(STUBBED) called"); +} + void Init() { using namespace Kernel; diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 063b8bd09..0b78f5393 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -37,6 +37,19 @@ void TitleIDListGetTotal(Service::Interface* self); */ void GetTitleIDList(Service::Interface* self); +/** + * AM::GetNumContentInfos service function + * Inputs: + * 0 : Command header (0x100100C0) + * 1 : Unknown + * 2 : Unknown + * 3 : Unknown + * Outputs: + * 1 : Result, 0 on success, otherwise error code + * 2 : Number of content infos plus one + */ +void GetNumContentInfos(Service::Interface* self); + /// Initialize AM service void Init(); diff --git a/src/core/hle/service/am/am_app.cpp b/src/core/hle/service/am/am_app.cpp index c6fc81bc3..f40a87cb4 100644 --- a/src/core/hle/service/am/am_app.cpp +++ b/src/core/hle/service/am/am_app.cpp @@ -9,11 +9,19 @@ namespace Service { namespace AM { -// Empty arrays are illegal -- commented out until an entry is added. -//const Interface::FunctionInfo FunctionTable[] = { }; +const Interface::FunctionInfo FunctionTable[] = { + {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, + {0x10020104, nullptr, "FindContentInfos"}, + {0x10030142, nullptr, "ListContentInfos"}, + {0x10040102, nullptr, "DeleteContents"}, + {0x10050084, nullptr, "GetDataTitleInfos"}, + {0x10070102, nullptr, "ListDataTitleTicketInfos"}, + {0x100900C0, nullptr, "IsDataTitleInUse"}, + {0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"}, +}; AM_APP_Interface::AM_APP_Interface() { - //Register(FunctionTable); + Register(FunctionTable); } } // namespace AM diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 5da182794..aec6f0660 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -119,6 +119,11 @@ struct Regs { MirroredRepeat = 3, }; + enum TextureFilter : u32 { + Nearest = 0, + Linear = 1 + }; + union { BitField< 0, 8, u32> r; BitField< 8, 8, u32> g; @@ -132,6 +137,8 @@ struct Regs { }; union { + BitField< 1, 1, TextureFilter> mag_filter; + BitField< 2, 1, TextureFilter> min_filter; BitField< 8, 2, WrapMode> wrap_t; BitField<12, 2, WrapMode> wrap_s; }; diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index a6b7997ce..e2b90ad1c 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -460,6 +460,7 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress()); auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format); + // TODO: Apply the min and mag filters to the texture texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info); DebugUtils::DumpTexture(texture.config, texture_data); } diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 2e4110a88..dc3ffdf22 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -31,12 +31,18 @@ void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned text state.texture_units[texture_unit].texture_2d = new_texture->texture.handle; state.Apply(); - // TODO: Need to choose filters that correspond to PICA once register is declared - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, PicaToGL::TextureFilterMode(config.config.mag_filter)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, PicaToGL::TextureFilterMode(config.config.min_filter)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, PicaToGL::WrapMode(config.config.wrap_s)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, PicaToGL::WrapMode(config.config.wrap_t)); + GLenum wrap_s = PicaToGL::WrapMode(config.config.wrap_s); + GLenum wrap_t = PicaToGL::WrapMode(config.config.wrap_t); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_s); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t); + + if (wrap_s == GL_CLAMP_TO_BORDER || wrap_t == GL_CLAMP_TO_BORDER) { + auto border_color = PicaToGL::ColorRGBA8((u8*)&config.config.border_color.r); + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border_color.data()); + } const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format); diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index 73f63c55d..3b562da86 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -12,6 +12,33 @@ namespace PicaToGL { +inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) { + static const GLenum filter_mode_table[] = { + GL_NEAREST, // TextureFilter::Nearest + GL_LINEAR // TextureFilter::Linear + }; + + // Range check table for input + if (mode >= ARRAY_SIZE(filter_mode_table)) { + LOG_CRITICAL(Render_OpenGL, "Unknown texture filtering mode %d", mode); + UNREACHABLE(); + + return GL_LINEAR; + } + + GLenum gl_mode = filter_mode_table[mode]; + + // Check for dummy values indicating an unknown mode + if (gl_mode == 0) { + LOG_CRITICAL(Render_OpenGL, "Unknown texture filtering mode %d", mode); + UNIMPLEMENTED(); + + return GL_LINEAR; + } + + return gl_mode; +} + inline GLenum WrapMode(Pica::Regs::TextureConfig::WrapMode mode) { static const GLenum wrap_mode_table[] = { GL_CLAMP_TO_EDGE, // WrapMode::ClampToEdge |