Merge branch 'master' of https://github.com/86Box/86Box into qt-opengl-renderer
This commit is contained in:
@@ -158,7 +158,8 @@ typedef struct svga_t
|
||||
|
||||
/*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/
|
||||
int force_dword_mode;
|
||||
int force_byte_mode;
|
||||
|
||||
int force_old_addr;
|
||||
|
||||
int remap_required;
|
||||
uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -37,7 +37,14 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="RendererStack" name="stackedWidget"/>
|
||||
<widget class="RendererStack" name="stackedWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -169,10 +169,10 @@ OpenGLOptions::addShader(const QString &path)
|
||||
.toStdString());
|
||||
};
|
||||
|
||||
if (!shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version_line % "\n#define VERTEX\n" % shader_text))
|
||||
if (!shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version_line % "\n#extension GL_ARB_shading_language_420pack : enable\n" % "\n#define VERTEX\n" % shader_text))
|
||||
throw_shader_error(tr("Error compiling vertex shader in file \"%1\""));
|
||||
|
||||
if (!shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version_line % "\n#define FRAGMENT\n" % shader_text))
|
||||
if (!shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version_line % "\n#extension GL_ARB_shading_language_420pack : enable\n" "\n#define FRAGMENT\n" % shader_text))
|
||||
throw_shader_error(tr("Error compiling fragment shader in file \"%1\""));
|
||||
|
||||
if (!shader->link())
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLTexture>
|
||||
#include <QSurfaceFormat>
|
||||
#include <QOpenGLTexture>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@@ -89,8 +90,8 @@ OpenGLRenderer::resizeEvent(QResizeEvent *event)
|
||||
glViewport(
|
||||
destination.x(),
|
||||
destination.y(),
|
||||
destination.width(),
|
||||
destination.height());
|
||||
destination.width() * devicePixelRatio(),
|
||||
destination.height() * devicePixelRatio());
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -374,7 +375,7 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h)
|
||||
|
||||
/* Resize the texture */
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, QOpenGLTexture::RGBA8_UNorm, source.width(), source.height(), 0, QOpenGLTexture::BGRA, QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, (GLenum)QOpenGLTexture::RGBA8_UNorm, source.width(), source.height(), 0, (GLenum)QOpenGLTexture::BGRA, (GLenum)QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, unpackBufferID);
|
||||
}
|
||||
|
||||
@@ -383,7 +384,7 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h)
|
||||
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, BUFFERPIXELS * buf_idx + y * ROW_LENGTH + x);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, ROW_LENGTH);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, QOpenGLTexture::BGRA, QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, (GLenum)QOpenGLTexture::BGRA, (GLenum)QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
||||
|
||||
/* TODO: check if fence sync is implementable here and still has any benefit. */
|
||||
glFinish();
|
||||
|
||||
@@ -202,6 +202,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Time synchronization</string>
|
||||
</property>
|
||||
|
||||
@@ -404,9 +404,9 @@ static void s3_pci_write(int func, int addr, uint8_t val, void *p);
|
||||
static __inline uint32_t
|
||||
dword_remap(svga_t *svga, uint32_t in_addr)
|
||||
{
|
||||
if (svga->packed_chain4)
|
||||
if (svga->packed_chain4 || svga->force_old_addr)
|
||||
return in_addr;
|
||||
|
||||
|
||||
return ((in_addr << 2) & 0x3fff0) |
|
||||
((in_addr >> 14) & 0xc) |
|
||||
(in_addr & ~0x3fffc);
|
||||
@@ -414,9 +414,9 @@ dword_remap(svga_t *svga, uint32_t in_addr)
|
||||
static __inline uint32_t
|
||||
dword_remap_w(svga_t *svga, uint32_t in_addr)
|
||||
{
|
||||
if (svga->packed_chain4)
|
||||
return in_addr;
|
||||
|
||||
if (svga->packed_chain4 || svga->force_old_addr)
|
||||
return in_addr;
|
||||
|
||||
return ((in_addr << 2) & 0x1fff8) |
|
||||
((in_addr >> 14) & 0x6) |
|
||||
(in_addr & ~0x1fffe);
|
||||
@@ -424,9 +424,9 @@ dword_remap_w(svga_t *svga, uint32_t in_addr)
|
||||
static __inline uint32_t
|
||||
dword_remap_l(svga_t *svga, uint32_t in_addr)
|
||||
{
|
||||
if (svga->packed_chain4)
|
||||
return in_addr;
|
||||
|
||||
if (svga->packed_chain4 || svga->force_old_addr)
|
||||
return in_addr;
|
||||
|
||||
return ((in_addr << 2) & 0xfffc) |
|
||||
((in_addr >> 14) & 0x3) |
|
||||
(in_addr & ~0xffff);
|
||||
@@ -2552,6 +2552,7 @@ s3_out(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
case 0x31:
|
||||
s3->ma_ext = (s3->ma_ext & 0x1c) | ((val & 0x30) >> 4);
|
||||
svga->force_dword_mode = !!(val & 0x08);
|
||||
break;
|
||||
case 0x32:
|
||||
if ((svga->crtc[0x31] & 0x30) && (svga->crtc[0x51] & 0x01) && (val & 0x40))
|
||||
@@ -2971,7 +2972,6 @@ static void s3_recalctimings(svga_t *svga)
|
||||
}
|
||||
|
||||
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
||||
svga->fb_only = 1;
|
||||
switch (svga->bpp) {
|
||||
case 8:
|
||||
svga->render = svga_render_8bpp_highres;
|
||||
@@ -3154,7 +3154,6 @@ static void s3_recalctimings(svga_t *svga)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
svga->fb_only = 0;
|
||||
if (!svga->scrblank && svga->attr_palette_enable) {
|
||||
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
|
||||
if ((svga->crtc[0x31] & 0x08) && ((svga->gdcreg[5] & 0x60) == 0x00)) {
|
||||
@@ -3208,7 +3207,6 @@ static void s3_trio64v_recalctimings(svga_t *svga)
|
||||
svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10));
|
||||
|
||||
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
||||
svga->fb_only = 1;
|
||||
switch (svga->bpp) {
|
||||
case 8:
|
||||
svga->render = svga_render_8bpp_highres;
|
||||
@@ -3229,13 +3227,10 @@ static void s3_trio64v_recalctimings(svga_t *svga)
|
||||
svga->render = svga_render_32bpp_highres;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
svga->fb_only = 0;
|
||||
}
|
||||
}
|
||||
else /*Streams mode*/
|
||||
{
|
||||
svga->fb_only = 1;
|
||||
|
||||
if (s3->streams.buffer_ctrl & 1)
|
||||
svga->ma_latch = s3->streams.pri_fb1 >> 2;
|
||||
else
|
||||
@@ -3379,7 +3374,12 @@ s3_updatemapping(s3_t *s3)
|
||||
|
||||
mem_mapping_set_addr(&s3->linear_mapping, s3->linear_base, s3->linear_size);
|
||||
}
|
||||
if (s3->chip >= S3_TRIO64V)
|
||||
svga->fb_only = 1;
|
||||
} else {
|
||||
if (s3->chip >= S3_TRIO64V)
|
||||
svga->fb_only = 0;
|
||||
|
||||
mem_mapping_disable(&s3->linear_mapping);
|
||||
}
|
||||
|
||||
@@ -7140,6 +7140,8 @@ static void *s3_init(const device_t *info)
|
||||
|
||||
s3->card_type = info->local;
|
||||
|
||||
svga->force_old_addr = 1;
|
||||
|
||||
switch(s3->card_type) {
|
||||
case S3_ORCHID_86C911:
|
||||
case S3_DIAMOND_STEALTH_VRAM:
|
||||
@@ -7401,8 +7403,6 @@ static void *s3_init(const device_t *info)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
svga->packed_chain4 = 1;
|
||||
|
||||
if (s3->pci)
|
||||
s3->card = pci_add_card(PCI_ADD_VIDEO, s3_pci_read, s3_pci_write, s3);
|
||||
|
||||
@@ -7609,73 +7609,124 @@ static void s3_force_redraw(void *p)
|
||||
s3->svga.fullchange = changeframecount;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static const device_config_t s3_orchid_86c911_config[] = {
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 1, "", { 0 },
|
||||
{
|
||||
{ "512 KB", 0 },
|
||||
{ "1 MB", 1 },
|
||||
{ "" }
|
||||
}
|
||||
},
|
||||
{ "", "", -1 }
|
||||
static const device_config_t s3_orchid_86c911_config[] =
|
||||
{
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 1, "", { 0 },
|
||||
{
|
||||
{
|
||||
"512 KB", 0
|
||||
},
|
||||
{
|
||||
"1 MB", 1
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
|
||||
static const device_config_t s3_9fx_config[] = {
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
||||
{
|
||||
{ "1 MB", 1 },
|
||||
{ "2 MB", 2 },
|
||||
/*Trio64 also supports 4 MB, however the Number Nine BIOS does not*/
|
||||
{ "" }
|
||||
}
|
||||
},
|
||||
{ "", "", -1 }
|
||||
static const device_config_t s3_9fx_config[] =
|
||||
{
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
||||
{
|
||||
{
|
||||
"1 MB", 1
|
||||
},
|
||||
{
|
||||
"2 MB", 2
|
||||
},
|
||||
/*Trio64 also supports 4 MB, however the Number Nine BIOS does not*/
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static const device_config_t s3_phoenix_trio32_config[] = {
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
||||
{
|
||||
{ "512 KB", 0 },
|
||||
{ "1 MB", 1 },
|
||||
{ "2 MB", 2 },
|
||||
{ "" }
|
||||
}
|
||||
},
|
||||
{ "", "", -1 }
|
||||
static const device_config_t s3_phoenix_trio32_config[] =
|
||||
{
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
||||
{
|
||||
{
|
||||
"512 KB", 0
|
||||
},
|
||||
{
|
||||
"1 MB", 1
|
||||
},
|
||||
{
|
||||
"2 MB", 2
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
|
||||
static const device_config_t s3_standard_config[] = {
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||
{
|
||||
{ "1 MB", 1 },
|
||||
{ "2 MB", 2 },
|
||||
{ "4 MB", 4 },
|
||||
{ "" }
|
||||
}
|
||||
},
|
||||
{ "", "", -1 }
|
||||
static const device_config_t s3_standard_config[] =
|
||||
{
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||
{
|
||||
{
|
||||
"1 MB", 1
|
||||
},
|
||||
{
|
||||
"2 MB", 2
|
||||
},
|
||||
{
|
||||
"4 MB", 4
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
|
||||
static const device_config_t s3_968_config[] = {
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||
{
|
||||
{ "1 MB", 1 },
|
||||
{ "2 MB", 2 },
|
||||
{ "4 MB", 4 },
|
||||
{ "8 MB", 8 },
|
||||
{ "" }
|
||||
}
|
||||
},
|
||||
{ "", "", -1 }
|
||||
static const device_config_t s3_968_config[] =
|
||||
{
|
||||
{
|
||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||
{
|
||||
{
|
||||
"1 MB", 1
|
||||
},
|
||||
{
|
||||
"2 MB", 2
|
||||
},
|
||||
{
|
||||
"4 MB", 4
|
||||
},
|
||||
{
|
||||
"8 MB", 8
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
const device_t s3_orchid_86c911_isa_device =
|
||||
{
|
||||
@@ -8333,7 +8384,7 @@ const device_t s3_elsa_winner2000_pro_x_964_pci_device =
|
||||
S3_ELSAWIN2KPROX_964,
|
||||
s3_init,
|
||||
s3_close,
|
||||
s3_reset,
|
||||
s3_reset,
|
||||
{ s3_elsa_winner2000_pro_x_964_available },
|
||||
s3_speed_changed,
|
||||
s3_force_redraw,
|
||||
@@ -8348,7 +8399,7 @@ const device_t s3_elsa_winner2000_pro_x_pci_device =
|
||||
S3_ELSAWIN2KPROX,
|
||||
s3_init,
|
||||
s3_close,
|
||||
s3_reset,
|
||||
s3_reset,
|
||||
{ s3_elsa_winner2000_pro_x_available },
|
||||
s3_speed_changed,
|
||||
s3_force_redraw,
|
||||
@@ -8363,7 +8414,7 @@ const device_t s3_trio64v2_dx_pci_device =
|
||||
S3_TRIO64V2_DX,
|
||||
s3_init,
|
||||
s3_close,
|
||||
s3_reset,
|
||||
s3_reset,
|
||||
{ s3_trio64v2_dx_available },
|
||||
s3_speed_changed,
|
||||
s3_force_redraw,
|
||||
@@ -8379,7 +8430,7 @@ const device_t s3_trio64v2_dx_onboard_pci_device =
|
||||
S3_TRIO64V2_DX_ONBOARD,
|
||||
s3_init,
|
||||
s3_close,
|
||||
NULL,
|
||||
NULL,
|
||||
{ NULL },
|
||||
s3_speed_changed,
|
||||
s3_force_redraw,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -179,7 +179,7 @@ svga_out(uint16_t addr, uint8_t val, void *p)
|
||||
svga->chain2_write = !(val & 4);
|
||||
svga->chain4 = val & 8;
|
||||
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) &&
|
||||
!svga->gdcreg[1]) && ((svga->chain4 && svga->packed_chain4) || svga->fb_only) && !(svga->adv_flags & FLAG_ADDR_BY8);
|
||||
!svga->gdcreg[1]) && ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) && !(svga->adv_flags & FLAG_ADDR_BY8);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -264,7 +264,7 @@ svga_out(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
svga->gdcreg[svga->gdcaddr & 15] = val;
|
||||
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) &&
|
||||
!svga->gdcreg[1]) && ((svga->chain4 && svga->packed_chain4) || svga->fb_only);
|
||||
!svga->gdcreg[1]) && ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only);
|
||||
if (((svga->gdcaddr & 15) == 5 && (val ^ o) & 0x70) ||
|
||||
((svga->gdcaddr & 15) == 6 && (val ^ o) & 1))
|
||||
svga_recalctimings(svga);
|
||||
@@ -582,7 +582,8 @@ svga_recalctimings(svga_t *svga)
|
||||
if (svga->dispofftime < TIMER_USEC)
|
||||
svga->dispofftime = TIMER_USEC;
|
||||
|
||||
svga_recalc_remap_func(svga);
|
||||
if (!svga->force_old_addr)
|
||||
svga_recalc_remap_func(svga);
|
||||
|
||||
/* Inform the user interface of any DPMS mode changes. */
|
||||
if (svga->dpms) {
|
||||
@@ -1068,7 +1069,7 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *p)
|
||||
addr <<= 4;
|
||||
else if ((svga->adv_flags & FLAG_ADDR_BY8) && (svga->writemode < 4))
|
||||
addr <<= 3;
|
||||
else if (((svga->chain4 && svga->packed_chain4) || svga->fb_only) && (svga->writemode < 4)) {
|
||||
else if (((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) && (svga->writemode < 4)) {
|
||||
writemask2 = 1 << (addr & 3);
|
||||
addr &= ~3;
|
||||
} else if (svga->chain4 && (svga->writemode < 4)) {
|
||||
@@ -1256,7 +1257,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p)
|
||||
addr <<= 4;
|
||||
else if (svga->adv_flags & FLAG_ADDR_BY8)
|
||||
addr <<= 3;
|
||||
else if ((svga->chain4 && svga->packed_chain4) || svga->fb_only) {
|
||||
else if ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) {
|
||||
addr &= svga->decode_mask;
|
||||
if (svga->translate_address)
|
||||
addr = svga->translate_address(addr, p);
|
||||
@@ -1266,7 +1267,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p)
|
||||
for (i = 0; i < count; i++)
|
||||
svga->latch.b[i] = svga->vram[latch_addr | i];
|
||||
return svga->vram[addr & svga->vram_mask];
|
||||
} else if (svga->chain4) {
|
||||
} else if (svga->chain4 && !svga->force_old_addr) {
|
||||
readplane = addr & 3;
|
||||
addr = ((addr & 0xfffc) << 2) | ((addr & 0x30000) >> 14) | (addr & ~0x3ffff);
|
||||
} else if (svga->chain2_read) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user