1
0
Fork 0

fix preload textures being enabled when it shouldn't

address more comments
This commit is contained in:
Khangaroo 2019-08-07 14:26:25 -04:00 committed by James Rowe
parent 391e552927
commit 8b881ac1fc
4 changed files with 15 additions and 22 deletions

View File

@ -23,7 +23,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
ui->hw_renderer_group->setEnabled(checked); ui->hw_renderer_group->setEnabled(checked);
ui->toggle_custom_textures->setEnabled(checked); ui->toggle_custom_textures->setEnabled(checked);
ui->toggle_dump_textures->setEnabled(checked); ui->toggle_dump_textures->setEnabled(checked);
ui->toggle_preload_textures->setEnabled(checked); ui->toggle_preload_textures->setEnabled(false);
if (!checked) { if (!checked) {
ui->toggle_custom_textures->setChecked(false); ui->toggle_custom_textures->setChecked(false);
ui->toggle_dump_textures->setChecked(false); ui->toggle_dump_textures->setChecked(false);

View File

@ -28,8 +28,7 @@ const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) {
return custom_textures.at(hash); return custom_textures.at(hash);
} }
void CustomTexCache::CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, void CustomTexCache::CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, u32 height) {
u32 height) {
custom_textures[hash] = {width, height, tex}; custom_textures[hash] = {width, height, tex};
} }
} // namespace Core } // namespace Core

View File

@ -13,19 +13,13 @@ namespace Frontend {
class ImageInterface { class ImageInterface {
public: public:
ImageInterface() = default; virtual ~ImageInterface() = default;
~ImageInterface() = default;
// Error logging should be handled by the frontend // Error logging should be handled by the frontend
virtual bool DecodePNG(std::vector<u8>& dst, u32& width, u32& height, const std::string& path) { virtual bool DecodePNG(std::vector<u8>& dst, u32& width, u32& height,
LOG_CRITICAL(Frontend, "Attempted to decode PNG without an image interface!"); const std::string& path) = 0;
return false;
};
virtual bool EncodePNG(const std::string& path, const std::vector<u8>& src, u32 width, virtual bool EncodePNG(const std::string& path, const std::vector<u8>& src, u32 width,
u32 height) { u32 height) = 0;
LOG_CRITICAL(Frontend, "Attempted to encode PNG without an image interface!");
return false;
};
}; };
} // namespace Frontend } // namespace Frontend

View File

@ -997,14 +997,7 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle<u32>& rect, GLuint r
// Ensure no bad interactions with GL_UNPACK_ALIGNMENT // Ensure no bad interactions with GL_UNPACK_ALIGNMENT
ASSERT(stride * GetGLBytesPerPixel(pixel_format) % 4 == 0); ASSERT(stride * GetGLBytesPerPixel(pixel_format) % 4 == 0);
if (!use_custom_tex) { if (use_custom_tex) {
glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast<GLint>(stride));
glActiveTexture(GL_TEXTURE0);
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, static_cast<GLsizei>(rect.GetWidth()),
static_cast<GLsizei>(rect.GetHeight()), tuple.format, tuple.type,
&gl_buffer[buffer_offset]);
} else {
if (res_scale == 1) { if (res_scale == 1) {
AllocateSurfaceTexture(texture.handle, GetFormatTuple(PixelFormat::RGBA8), AllocateSurfaceTexture(texture.handle, GetFormatTuple(PixelFormat::RGBA8),
custom_tex_info.width, custom_tex_info.height); custom_tex_info.width, custom_tex_info.height);
@ -1017,6 +1010,13 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle<u32>& rect, GLuint r
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, custom_tex_info.width, custom_tex_info.height, glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, custom_tex_info.width, custom_tex_info.height,
GL_RGBA, GL_UNSIGNED_BYTE, custom_tex_info.tex.data()); GL_RGBA, GL_UNSIGNED_BYTE, custom_tex_info.tex.data());
} else {
glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast<GLint>(stride));
glActiveTexture(GL_TEXTURE0);
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, static_cast<GLsizei>(rect.GetWidth()),
static_cast<GLsizei>(rect.GetHeight()), tuple.format, tuple.type,
&gl_buffer[buffer_offset]);
} }
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);