rasterizer_cache: Fix texture cube blitting
* The target was GL_TEXTURE_2D instead of GL_TEXTURE_CUBE_MAP_*
This commit is contained in:
@ -116,6 +116,7 @@ public:
|
||||
QSurfaceFormat format;
|
||||
format.setVersion(4, 4);
|
||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
format.setOption(QSurfaceFormat::DebugContext);
|
||||
// TODO: expose a setting for buffer value (ie default/single/double/triple)
|
||||
format.setSwapBehavior(QSurfaceFormat::DefaultSwapBehavior);
|
||||
format.setSwapInterval(0);
|
||||
|
@ -2426,14 +2426,6 @@ int main(int argc, char* argv[]) {
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("Citra team"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("Citra"));
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setVersion(4, 3);
|
||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
format.setSwapInterval(0);
|
||||
// TODO: expose a setting for buffer value (ie default/single/double/triple)
|
||||
format.setSwapBehavior(QSurfaceFormat::DefaultSwapBehavior);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
|
||||
#ifdef __APPLE__
|
||||
std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + "..";
|
||||
chdir(bin_path.c_str());
|
||||
|
@ -83,6 +83,8 @@ void RasterizerCache::CopySurface(const Surface& src_surface, const Surface& dst
|
||||
.surface_type = src_surface->type,
|
||||
.src_level = 0,
|
||||
.dst_level = 0,
|
||||
.src_layer = 0,
|
||||
.dst_layer = 0,
|
||||
.src_region = Region2D{
|
||||
.start = {src_rect.left, src_rect.bottom},
|
||||
.end = {src_rect.right, src_rect.top}
|
||||
@ -227,6 +229,8 @@ bool RasterizerCache::BlitSurfaces(const Surface& src_surface,
|
||||
.surface_type = src_surface->type,
|
||||
.src_level = 0,
|
||||
.dst_level = 0,
|
||||
.src_layer = 0,
|
||||
.dst_layer = 0,
|
||||
.src_region = Region2D{
|
||||
.start = {src_rect.left, src_rect.bottom},
|
||||
.end = {src_rect.right, src_rect.top}
|
||||
@ -463,6 +467,8 @@ Surface RasterizerCache::GetTextureSurface(const Pica::Texture::TextureInfo& inf
|
||||
.surface_type = surface->type,
|
||||
.src_level = 0,
|
||||
.dst_level = level,
|
||||
.src_layer = 0,
|
||||
.dst_layer = 0,
|
||||
.src_region = Region2D{
|
||||
.start = {src_rect.left, src_rect.bottom},
|
||||
.end = {src_rect.right, src_rect.top}
|
||||
@ -552,9 +558,11 @@ const CachedTextureCube& RasterizerCache::GetTextureCube(const TextureCubeConfig
|
||||
|
||||
const auto src_rect = surface->GetScaledRect();
|
||||
const TextureBlit texture_blit = {
|
||||
.surface_type = surface->type,
|
||||
.surface_type = SurfaceType::Color,
|
||||
.src_level = 0,
|
||||
.dst_level = 0,
|
||||
.src_layer = 0,
|
||||
.dst_layer = static_cast<u32>(i),
|
||||
.src_region = Region2D{
|
||||
.start = {src_rect.left, src_rect.bottom},
|
||||
.end = {src_rect.right, src_rect.top}
|
||||
@ -885,6 +893,8 @@ bool RasterizerCache::ValidateByReinterpretation(const Surface& surface,
|
||||
.surface_type = type,
|
||||
.src_level = 0,
|
||||
.dst_level = 0,
|
||||
.src_layer = 0,
|
||||
.dst_layer = 0,
|
||||
.src_region = Region2D{
|
||||
.start = {0, 0},
|
||||
.end = {width, height}
|
||||
|
@ -148,9 +148,14 @@ bool TextureRuntime::BlitTextures(OGLTexture& source, OGLTexture& dest, const Te
|
||||
state.draw.draw_framebuffer = draw_fbo.handle;
|
||||
state.Apply();
|
||||
|
||||
auto BindAttachment = [&blit](GLenum target, u32 src_tex, u32 dst_tex) -> void {
|
||||
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, target, GL_TEXTURE_2D, src_tex, blit.src_level);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, target, GL_TEXTURE_2D, dst_tex, blit.dst_level);
|
||||
auto BindAttachment = [&blit, &source, &dest](GLenum attachment, u32 src_tex, u32 dst_tex) -> void {
|
||||
const GLenum src_target = source.target == GL_TEXTURE_CUBE_MAP ?
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X + blit.src_layer : source.target;
|
||||
const GLenum dst_target = dest.target == GL_TEXTURE_CUBE_MAP ?
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X + blit.dst_layer : dest.target;
|
||||
|
||||
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, attachment, src_target, src_tex, blit.src_level);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, dst_target, dst_tex, blit.dst_level);
|
||||
};
|
||||
|
||||
switch (blit.surface_type) {
|
||||
|
@ -65,6 +65,8 @@ struct TextureBlit {
|
||||
SurfaceType surface_type;
|
||||
u32 src_level;
|
||||
u32 dst_level;
|
||||
u32 src_layer;
|
||||
u32 dst_layer;
|
||||
Region2D src_region;
|
||||
Region2D dst_region;
|
||||
};
|
||||
|
@ -52,8 +52,10 @@ void OGLTexture::Release() {
|
||||
handle = 0;
|
||||
}
|
||||
|
||||
void OGLTexture::Allocate(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
|
||||
void OGLTexture::Allocate(GLenum _target, GLsizei levels, GLenum internalformat, GLsizei width,
|
||||
GLsizei height, GLsizei depth) {
|
||||
target = _target;
|
||||
|
||||
GLuint old_tex = OpenGLState::GetCurState().texture_units[0].texture_2d;
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(target, handle);
|
||||
@ -80,7 +82,7 @@ void OGLTexture::Allocate(GLenum target, GLsizei levels, GLenum internalformat,
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, old_tex);
|
||||
glBindTexture(target, old_tex);
|
||||
}
|
||||
|
||||
void OGLTexture::CopyFrom(const OGLTexture& other, GLenum target, GLsizei levels, GLsizei width,
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
GLsizei height);
|
||||
|
||||
GLuint handle = 0;
|
||||
GLenum target = GL_TEXTURE_2D;
|
||||
};
|
||||
|
||||
class OGLSampler : private NonCopyable {
|
||||
|
Reference in New Issue
Block a user