mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 22:05:38 +00:00
GPU: Various HW renderer fixes
This commit is contained in:
parent
d94d608ad7
commit
363d62e5c1
|
@ -513,6 +513,7 @@ void GPU::TextureConfig::SetColorMode(TextureColorMode new_color_mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color_mode = new_color_mode;
|
color_mode = new_color_mode;
|
||||||
|
page_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::TextureConfig::SetFromPolygonTexcoord(u32 texcoord0, u32 texcoord1)
|
void GPU::TextureConfig::SetFromPolygonTexcoord(u32 texcoord0, u32 texcoord1)
|
||||||
|
@ -534,6 +535,7 @@ void GPU::TextureConfig::SetFromPageAttribute(u16 value)
|
||||||
|
|
||||||
base_x = static_cast<s32>(ZeroExtend32(value & UINT16_C(0x1FF)) * UINT32_C(64));
|
base_x = static_cast<s32>(ZeroExtend32(value & UINT16_C(0x1FF)) * UINT32_C(64));
|
||||||
base_y = static_cast<s32>(ZeroExtend32((value >> 11) & UINT16_C(1)) * UINT32_C(512));
|
base_y = static_cast<s32>(ZeroExtend32((value >> 11) & UINT16_C(1)) * UINT32_C(512));
|
||||||
|
page_attribute = value;
|
||||||
page_changed = true;
|
page_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,4 +547,6 @@ void GPU::TextureConfig::SetFromPaletteAttribute(u16 value)
|
||||||
|
|
||||||
palette_x = static_cast<s32>(ZeroExtend32(value & UINT16_C(0x3F)) * UINT32_C(16));
|
palette_x = static_cast<s32>(ZeroExtend32(value & UINT16_C(0x3F)) * UINT32_C(16));
|
||||||
palette_y = static_cast<s32>(ZeroExtend32((value >> 6) & UINT16_C(0x1FF)));
|
palette_y = static_cast<s32>(ZeroExtend32((value >> 6) & UINT16_C(0x1FF)));
|
||||||
|
palette_attribute = value;
|
||||||
|
page_changed = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,10 +212,13 @@ void main()
|
||||||
{
|
{
|
||||||
#if TEXTURED
|
#if TEXTURED
|
||||||
vec4 texcol = texture(samp0, v_tex0);
|
vec4 texcol = texture(samp0, v_tex0);
|
||||||
|
if (all(texcol == vec4(0.0, 0.0, 0.0, 0.0)))
|
||||||
|
discard;
|
||||||
|
|
||||||
#if BLENDING
|
#if BLENDING
|
||||||
o_col0 = v_col0 * texcol;
|
o_col0 = v_col0 * texcol;
|
||||||
#else
|
#else
|
||||||
o_col0 = /*v_col0 + */texcol;
|
o_col0 = texcol;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
o_col0 = v_col0;
|
o_col0 = v_col0;
|
||||||
|
@ -338,6 +341,7 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices)
|
||||||
else
|
else
|
||||||
m_texture_config.SetFromPolygonTexcoord(m_GP0_command[2], m_GP0_command[4]);
|
m_texture_config.SetFromPolygonTexcoord(m_GP0_command[2], m_GP0_command[4]);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Primitive::Rectangle:
|
case Primitive::Rectangle:
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,9 +185,9 @@ inline u32 ConvertRGBA5551ToRGBA8888(u16 color)
|
||||||
u8 a = Truncate8((color >> 15) & 1);
|
u8 a = Truncate8((color >> 15) & 1);
|
||||||
|
|
||||||
// 00012345 -> 1234545
|
// 00012345 -> 1234545
|
||||||
b = (b << 3) | (b >> 3);
|
b = (b << 3) | (b & 0b111);
|
||||||
g = (g << 3) | (g >> 3);
|
g = (g << 3) | (g & 0b111);
|
||||||
r = (r << 3) | (r >> 3);
|
r = (r << 3) | (r & 0b111);
|
||||||
a = a ? 255 : 0;
|
a = a ? 255 : 0;
|
||||||
|
|
||||||
return ZeroExtend32(r) | (ZeroExtend32(g) << 8) | (ZeroExtend32(b) << 16) | (ZeroExtend32(a) << 24);
|
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
|
// we need to convert RGBA8 -> RGBA5551
|
||||||
std::vector<u32> temp_buffer(width * height);
|
std::vector<u32> temp_buffer(width * height);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_framebuffer_fbo_id);
|
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
|
// reverse copy because of lower-left origin
|
||||||
const u32 source_stride = width * sizeof(u32);
|
const u32 source_stride = width * sizeof(u32);
|
||||||
|
|
Loading…
Reference in a new issue