Skip to content

Commit

Permalink
Add temporary cvar to disable close color wrapping (for 2ship) (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjoecox authored May 24, 2024
1 parent 493f1c0 commit 6b8a8d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmake/cvars.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(CVAR_VSYNC_ENABLED "gVsyncEnabled" CACHE STRING "")
set(CVAR_Z_FIGHTING_MODE "gZFightingMode" CACHE STRING "")
set(CVAR_DISABLE_CLOSE_COLOR_WRAP "gDisableCloseColorWrap" CACHE STRING "")
set(CVAR_NEW_FILE_DROPPED "gNewFileDropped" CACHE STRING "")
set(CVAR_DROPPED_FILE "gDroppedFile" CACHE STRING "")
set(CVAR_INTERNAL_RESOLUTION "gInternalResolution" CACHE STRING "")
Expand All @@ -24,6 +25,7 @@ set(CVAR_PREFIX_ADVANCED_RESOLUTION "gAdvancedResolution" CACHE STRING "")
add_compile_definitions(
CVAR_VSYNC_ENABLED="${CVAR_VSYNC_ENABLED}"
CVAR_Z_FIGHTING_MODE="${CVAR_Z_FIGHTING_MODE}"
CVAR_DISABLE_CLOSE_COLOR_WRAP="${CVAR_DISABLE_CLOSE_COLOR_WRAP}"
CVAR_NEW_FILE_DROPPED="${CVAR_NEW_FILE_DROPPED}"
CVAR_DROPPED_FILE="${CVAR_DROPPED_FILE}"
CVAR_INTERNAL_RESOLUTION="${CVAR_INTERNAL_RESOLUTION}"
Expand Down
3 changes: 2 additions & 1 deletion src/graphic/Fast3D/gfx_direct3d_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "gfx_direct3d_common.h"
#include "gfx_cc.h"
#include <public/bridge/consolevariablebridge.h>

static void append_str(char* buf, size_t* len, const char* str) {
while (*str != '\0')
Expand Down Expand Up @@ -401,7 +402,7 @@ void gfx_direct3d_common_build_shader(char buf[8192], size_t& len, size_t& num_f
}
append_line(buf, &len, ";");

if (c == 0) {
if (c == 0 && !CVarGetInteger(CVAR_DISABLE_CLOSE_COLOR_WRAP, 0)) {
append_str(buf, &len, "texel.rgb = WRAP(texel.rgb, -1.01, 1.01);");
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/graphic/Fast3D/gfx_metal_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifdef __APPLE__

#include <Metal/Metal.hpp>
#include <public/bridge/consolevariablebridge.h>

#include "gfx_metal_shader.h"

Expand Down Expand Up @@ -395,7 +396,7 @@ MTL::VertexDescriptor* gfx_metal_build_shader(char buf[8192], size_t& num_floats
}
append_line(buf, &len, ";");

if (c == 0) {
if (c == 0 && !CVarGetInteger(CVAR_DISABLE_CLOSE_COLOR_WRAP, 0)) {
append_str(buf, &len, "texel.xyz = WRAP(texel.xyz, -1.01, 1.01);");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/graphic/Fast3D/gfx_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
}
append_line(fs_buf, &fs_len, ";");

if (c == 0) {
if (c == 0 && !CVarGetInteger(CVAR_DISABLE_CLOSE_COLOR_WRAP, 0)) {
append_str(fs_buf, &fs_len, "texel.rgb = WRAP(texel.rgb, -1.01, 1.01);");
}
}
Expand Down

0 comments on commit 6b8a8d8

Please sign in to comment.