yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #789 from bunnei/tex-wrap-border

maxwell_to_gl: Implement Texture::WrapMode::Border.
This commit is contained in:
bunnei 2018-07-24 04:44:37 -07:00 committed by GitHub
commit 54af9c206a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View File

@ -601,7 +601,6 @@ void RasterizerOpenGL::SamplerInfo::Create() {
sampler.Create(); sampler.Create();
mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear; mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear;
wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap; wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap;
border_color_r = border_color_g = border_color_b = border_color_a = 0;
// default is GL_LINEAR_MIPMAP_LINEAR // default is GL_LINEAR_MIPMAP_LINEAR
glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@ -630,8 +629,12 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr
} }
if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) { if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) {
// TODO(Subv): Implement border color const GLvec4 new_border_color = {{config.border_color_r, config.border_color_g,
ASSERT(false); config.border_color_b, config.border_color_a}};
if (border_color != new_border_color) {
border_color = new_border_color;
glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data());
}
} }
} }

View File

@ -77,10 +77,7 @@ private:
Tegra::Texture::TextureFilter min_filter; Tegra::Texture::TextureFilter min_filter;
Tegra::Texture::WrapMode wrap_u; Tegra::Texture::WrapMode wrap_u;
Tegra::Texture::WrapMode wrap_v; Tegra::Texture::WrapMode wrap_v;
u32 border_color_r; GLvec4 border_color;
u32 border_color_g;
u32 border_color_b;
u32 border_color_a;
}; };
/// Configures the color and depth framebuffer states and returns the dirty <Color, Depth> /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth>

View File

@ -112,6 +112,8 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
return GL_MIRRORED_REPEAT; return GL_MIRRORED_REPEAT;
case Tegra::Texture::WrapMode::ClampToEdge: case Tegra::Texture::WrapMode::ClampToEdge:
return GL_CLAMP_TO_EDGE; return GL_CLAMP_TO_EDGE;
case Tegra::Texture::WrapMode::Border:
return GL_CLAMP_TO_BORDER;
case Tegra::Texture::WrapMode::ClampOGL: case Tegra::Texture::WrapMode::ClampOGL:
// TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use
// GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to

View File

@ -242,10 +242,10 @@ struct TSCEntry {
BitField<6, 2, TextureMipmapFilter> mip_filter; BitField<6, 2, TextureMipmapFilter> mip_filter;
}; };
INSERT_PADDING_BYTES(8); INSERT_PADDING_BYTES(8);
u32 border_color_r; float border_color_r;
u32 border_color_g; float border_color_g;
u32 border_color_b; float border_color_b;
u32 border_color_a; float border_color_a;
}; };
static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size");