Skip to content

Commit

Permalink
Add DEVILUTIONX_DISPLAY_TEXTURE_FORMAT
Browse files Browse the repository at this point in the history
Some platforms, such as PS2, can benefit from a different texture
format. Makes the texture format a CMake setting.
  • Loading branch information
glebm committed Sep 2, 2023
1 parent 2644ec7 commit c2ad6da
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMake/Definitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ foreach(
REMAP_KEYBOARD_KEYS
DEVILUTIONX_DEFAULT_RESAMPLER
STREAM_ALL_AUDIO_MIN_FILE_SIZE
DEVILUTIONX_DISPLAY_TEXTURE_FORMAT
)
if(DEFINED ${def_name} AND NOT ${def_name} STREQUAL "")
list(APPEND DEVILUTIONX_DEFINITIONS ${def_name}=${${def_name}})
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ option(MACOSX_STANDALONE_APP_BUNDLE "Generate a portable app bundle to use on ot
cmake_dependent_option(DISABLE_TCP "Disable TCP multiplayer option" OFF "NOT NONET" ON)
cmake_dependent_option(DISABLE_ZERO_TIER "Disable ZeroTier multiplayer option" OFF "NOT NONET" ON)

# Graphics options
if(NOT USE_SDL1)
set(DEVILUTIONX_DISPLAY_TEXTURE_FORMAT "SDL_PIXELFORMAT_RGB888" CACHE STRING "Texture format for DevilutionX textures when using the GPU renderer")
mark_as_advanced(DEVILUTIONX_DISPLAY_TEXTURE_FORMAT)
endif()

# Sound options
option(NOSOUND "Disable sound support" OFF)
option(DEVILUTIONX_RESAMPLER_SPEEX "Build with Speex resampler" ON)
Expand Down
2 changes: 1 addition & 1 deletion Source/storm/storm_svid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ bool SVidPlayBegin(const char *filename, int flags)
if (renderer != nullptr) {
int renderWidth = static_cast<int>(SVidWidth);
int renderHeight = static_cast<int>(SVidHeight);
texture = SDLWrap::CreateTexture(renderer, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, renderWidth, renderHeight);
texture = SDLWrap::CreateTexture(renderer, DEVILUTIONX_DISPLAY_TEXTURE_FORMAT, SDL_TEXTUREACCESS_STREAMING, renderWidth, renderHeight);
if (SDL_RenderSetLogicalSize(renderer, renderWidth, renderHeight) <= -1) {
ErrSdl();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/utils/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void ReinitializeTexture()
auto quality = StrCat(static_cast<int>(*sgOptions.Graphics.scaleQuality));
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, quality.c_str());

texture = SDLWrap::CreateTexture(renderer, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, gnScreenWidth, gnScreenHeight);
texture = SDLWrap::CreateTexture(renderer, DEVILUTIONX_DISPLAY_TEXTURE_FORMAT, SDL_TEXTUREACCESS_STREAMING, gnScreenWidth, gnScreenHeight);
}

void ReinitializeIntegerScale()
Expand Down

0 comments on commit c2ad6da

Please sign in to comment.