GPU: Added registers for min and mag texture filters and implemented them in the hw renderer.
This commit is contained in:
parent
cd2bb2dc69
commit
009e34f08a
4 changed files with 37 additions and 3 deletions
|
@ -31,9 +31,8 @@ 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));
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue