Remove 24-bit PBO format. It's actually useless.

This commit is contained in:
Brandon Wright 2018-10-27 15:33:55 -05:00
parent dc3dd8e709
commit 94c2c4c460
5 changed files with 18 additions and 67 deletions

View File

@ -596,7 +596,8 @@ Snes9xConfig::set_option (const char *name, const char *value)
{
#ifdef USE_OPENGL
pbo_format = atoi (value);
pbo_format = CLAMP (pbo_format, 0, 2);
if (pbo_format != 32)
pbo_format = 16;
#endif
}
else if (!strcasecmp (name, "npot_textures"))

View File

@ -115,7 +115,7 @@ S9xOpenGLDisplayDriver::update (int width, int height, int yoffset)
if (using_pbos)
{
if (config->pbo_format == PBO_FMT_16)
if (config->pbo_format == 16)
{
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
@ -147,42 +147,7 @@ S9xOpenGLDisplayDriver::update (int width, int height, int yoffset)
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
}
else if (config->pbo_format == PBO_FMT_24)
{
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
glBufferData (GL_PIXEL_UNPACK_BUFFER,
width * height * 3,
NULL,
GL_STREAM_DRAW);
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
/* Pixel swizzling in software */
S9xSetEndianess (ENDIAN_SWAPPED);
S9xConvert (final_buffer,
pboMemory,
final_pitch,
width * 3,
width,
height,
24);
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
glTexSubImage2D (GL_TEXTURE_2D,
0,
0,
0,
width,
height,
GL_RGB,
GL_UNSIGNED_BYTE,
BUFFER_OFFSET (0));
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
}
else /* PBO_FMT_32 */
else /* 32-bit color */
{
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
glBufferData (GL_PIXEL_UNPACK_BUFFER,
@ -211,7 +176,7 @@ S9xOpenGLDisplayDriver::update (int width, int height, int yoffset)
width,
height,
GL_BGRA,
PBO_BGRA_NATIVE_ORDER,
GL_UNSIGNED_BYTE,
BUFFER_OFFSET (0));
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
@ -322,16 +287,16 @@ S9xOpenGLDisplayDriver::update_texture_size (int width, int height)
{
glBindTexture (GL_TEXTURE_2D, texmap);
if (using_pbos)
if (using_pbos && config->pbo_format == 32)
{
glTexImage2D (GL_TEXTURE_2D,
0,
config->pbo_format == PBO_FMT_16 ? GL_RGB565 : 4,
4,
width,
height,
0,
PBO_GET_FORMAT (config->pbo_format),
PBO_GET_PACKING (config->pbo_format),
GL_BGRA,
GL_UNSIGNED_BYTE,
NULL);
}
else
@ -592,12 +557,12 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
glBindTexture (GL_TEXTURE_2D, texmap);
glTexImage2D (GL_TEXTURE_2D,
0,
config->pbo_format == PBO_FMT_16 ? GL_RGB565 : 4,
config->pbo_format == 16 ? GL_RGB565 : 4,
texture_width,
texture_height,
0,
PBO_GET_FORMAT (config->pbo_format),
PBO_GET_PACKING (config->pbo_format),
config->pbo_format == 16 ? GL_RGB : GL_BGRA,
config->pbo_format == 16 ? GL_UNSIGNED_SHORT_5_6_5 : GL_UNSIGNED_BYTE,
NULL);
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);

View File

@ -16,22 +16,8 @@
#include "shaders/glsl.h"
#define PBO_FMT_16 0
#define PBO_FMT_24 1
#define PBO_FMT_32 2
#define BUFFER_OFFSET(i) ((char *) NULL + (i))
#ifdef __BIG_ENDIAN__
/* We have to reverse the bytes on MSB systems. This can be slow */
/* GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367 */
#define PBO_BGRA_NATIVE_ORDER 0x8367
#else
#define PBO_BGRA_NATIVE_ORDER GL_UNSIGNED_BYTE
#endif
#define PBO_GET_FORMAT(x) (((x) == PBO_FMT_32) ? GL_BGRA : GL_RGB)
#define PBO_GET_PACKING(x) (((x) == PBO_FMT_16) ? GL_UNSIGNED_SHORT_5_6_5 : (((x) == PBO_FMT_24) ? GL_UNSIGNED_BYTE : PBO_BGRA_NATIVE_ORDER))
class S9xOpenGLDisplayDriver : public S9xDisplayDriver
{
public:

View File

@ -771,7 +771,7 @@ Snes9xPreferences::move_settings_to_dialog (void)
set_check ("sync_to_vblank", config->sync_to_vblank);
set_check ("sync_every_frame", config->sync_every_frame);
set_check ("use_pbos", config->use_pbos);
set_combo ("pixel_format", config->pbo_format);
set_combo ("pixel_format", config->pbo_format == 16 ? 0 : 1);
set_check ("npot_textures", config->npot_textures);
set_check ("use_shaders", config->use_shaders);
set_entry_text ("fragment_shader", config->fragment_shader);
@ -914,10 +914,12 @@ Snes9xPreferences::get_settings_from_dialog (void)
#endif
#ifdef USE_OPENGL
int pbo_format = get_combo ("pixel_format") == 1 ? 32 : 16;
if (config->sync_to_vblank != get_check ("sync_to_vblank") ||
config->npot_textures != get_check ("npot_textures") ||
config->use_pbos != get_check ("use_pbos") ||
config->pbo_format != get_combo ("pixel_format") ||
config->pbo_format != pbo_format ||
config->use_shaders != get_check ("use_shaders") ||
get_check ("use_shaders"))
{
@ -932,7 +934,7 @@ Snes9xPreferences::get_settings_from_dialog (void)
strncpy (config->fragment_shader, get_entry_text ("fragment_shader"), PATH_MAX);
config->pbo_format = get_combo ("pixel_format");
config->pbo_format = pbo_format;
#endif
char safety_sram_directory [PATH_MAX];

View File

@ -1131,10 +1131,7 @@
</columns>
<data>
<row>
<col id="0" translatable="yes">16-bit (GL_BGRA)</col>
</row>
<row>
<col id="0" translatable="yes">24-bit (GL_RGB)</col>
<col id="0" translatable="yes">16-bit (GL_RGB)</col>
</row>
<row>
<col id="0" translatable="yes">32-bit (GL_BGRA)</col>