diff --git a/src/pse/gpu.cpp b/src/pse/gpu.cpp index f3cd1f54d..7091dc0f9 100644 --- a/src/pse/gpu.cpp +++ b/src/pse/gpu.cpp @@ -513,6 +513,7 @@ void GPU::TextureConfig::SetColorMode(TextureColorMode new_color_mode) return; color_mode = new_color_mode; + page_changed = true; } void GPU::TextureConfig::SetFromPolygonTexcoord(u32 texcoord0, u32 texcoord1) @@ -534,6 +535,7 @@ void GPU::TextureConfig::SetFromPageAttribute(u16 value) base_x = static_cast(ZeroExtend32(value & UINT16_C(0x1FF)) * UINT32_C(64)); base_y = static_cast(ZeroExtend32((value >> 11) & UINT16_C(1)) * UINT32_C(512)); + page_attribute = value; page_changed = true; } @@ -545,4 +547,6 @@ void GPU::TextureConfig::SetFromPaletteAttribute(u16 value) palette_x = static_cast(ZeroExtend32(value & UINT16_C(0x3F)) * UINT32_C(16)); palette_y = static_cast(ZeroExtend32((value >> 6) & UINT16_C(0x1FF))); + palette_attribute = value; + page_changed = true; } diff --git a/src/pse/gpu_hw.cpp b/src/pse/gpu_hw.cpp index 062108475..e89d50210 100644 --- a/src/pse/gpu_hw.cpp +++ b/src/pse/gpu_hw.cpp @@ -212,10 +212,13 @@ void main() { #if TEXTURED vec4 texcol = texture(samp0, v_tex0); + if (all(texcol == vec4(0.0, 0.0, 0.0, 0.0))) + discard; + #if BLENDING o_col0 = v_col0 * texcol; #else - o_col0 = /*v_col0 + */texcol; + o_col0 = texcol; #endif #else o_col0 = v_col0; @@ -338,6 +341,7 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices) else m_texture_config.SetFromPolygonTexcoord(m_GP0_command[2], m_GP0_command[4]); } + break; case Primitive::Rectangle: { diff --git a/src/pse/gpu_hw_opengl.cpp b/src/pse/gpu_hw_opengl.cpp index bf4dafd77..a8a91ae22 100644 --- a/src/pse/gpu_hw_opengl.cpp +++ b/src/pse/gpu_hw_opengl.cpp @@ -185,9 +185,9 @@ inline u32 ConvertRGBA5551ToRGBA8888(u16 color) u8 a = Truncate8((color >> 15) & 1); // 00012345 -> 1234545 - b = (b << 3) | (b >> 3); - g = (g << 3) | (g >> 3); - r = (r << 3) | (r >> 3); + b = (b << 3) | (b & 0b111); + g = (g << 3) | (g & 0b111); + r = (r << 3) | (r & 0b111); a = a ? 255 : 0; return ZeroExtend32(r) | (ZeroExtend32(g) << 8) | (ZeroExtend32(b) << 16) | (ZeroExtend32(a) << 24); @@ -214,7 +214,7 @@ void GPU_HW_OpenGL::ReadVRAM(u32 x, u32 y, u32 width, u32 height, void* buffer) // we need to convert RGBA8 -> RGBA5551 std::vector temp_buffer(width * height); glBindFramebuffer(GL_READ_FRAMEBUFFER, m_framebuffer_fbo_id); - glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, temp_buffer.data()); + glReadPixels(x, VRAM_HEIGHT - y - height, width, height, GL_RGBA, GL_UNSIGNED_BYTE, temp_buffer.data()); // reverse copy because of lower-left origin const u32 source_stride = width * sizeof(u32);