Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ jobs:
matrix:
include:
- platform: x64
os: windows-2022
os: windows-latest
triplet: x64-windows
runs-on: ${{ matrix.os }}
env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache
VCPKG_BINARY_SOURCES: 'clear;files,${{ github.workspace }}/vcpkg-cache,readwrite'
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}-release
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}-release
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed/
Expand All @@ -22,7 +24,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
submodules: "recursive"

Expand All @@ -33,22 +35,32 @@ jobs:
$short=$(git rev-parse --short HEAD)
(Get-Content $file -Raw) -replace '(#define\s+CFG_VERSION_NUM\s+"[^"]*)(")', "`$1-$short`$2" | Set-Content $file

- name: run-vcpkg
uses: lukka/run-vcpkg@v11
- name: Prepare cache directory
shell: powershell
run: "mkdir -Force ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"

- name: Cache vcpkg dependencies
uses: actions/cache@v6
with:
vcpkgJsonGlob: "./vcpkg.json"
runVcpkgInstall: true
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}-${{ github.run_id }}
restore-keys: |
vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}-
vcpkg-${{ runner.os }}-

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Bootstrap vcpkg
shell: powershell
run: |
.\vcpkg\bootstrap-vcpkg.bat

- name: Obtain and run CMake
uses: threeal/cmake-action@v1.3.0
uses: threeal/cmake-action@v2.1.0
with:
source-dir: "."
build-dir: "build"
generator: "Visual Studio 17 2022"
options: CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake CMAKE_INSTALL_PREFIX="${{ env.INST_DIR }}" VCPKG_TARGET_TRIPLET="${{ env.VCPKG_TARGET_TRIPLET }}"
generator: "Visual Studio 18 2026"
options: CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake CMAKE_INSTALL_PREFIX=${{ env.INST_DIR }} VCPKG_INSTALLED_DIR=${{ env.VCPKG_INSTALLED_DIR }} VCPKG_TARGET_TRIPLET=${{ env.VCPKG_TARGET_TRIPLET }}
run-build: false

- name: Build DLL
run: "cmake --build build --config Release -t INSTALL"
Expand All @@ -62,27 +74,27 @@ jobs:
} else { Write-Host "DLL not found" }

- name: Archive DLL
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: SimpleGraphic-${{ matrix.triplet }}.dll
path: "${{ env.INST_DIR }}/SimpleGraphic.dll"

- name: Archive DLL symbols
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: SimpleGraphic-${{ matrix.triplet }}.pdb
path: "${{ github.workspace }}/build/Release/SimpleGraphic.pdb"

- name: Archive dependency DLLs
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: SimpleGraphic-${{ matrix.triplet }}-deps.dll
path: |
${{ env.INST_DIR }}/*.dll
!${{ env.INST_DIR }}/SimpleGraphic.dll

- name: Archive dependency DLL symbols
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: SimpleGraphic-${{ matrix.triplet }}-deps.pdb
path: |
Expand All @@ -99,7 +111,7 @@ jobs:

- name: Notify PathOfBuilding repo
if: ${{ github.event_name == 'release' }}
uses: peter-evans/repository-dispatch@v3
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.WIRES77_PAT }}
repository: ${{ github.repository_owner }}/PathOfBuilding
Expand All @@ -108,7 +120,7 @@ jobs:

- name: Notify PathOfBuilding-PoE2 repo
if: ${{ github.event_name == 'release' }}
uses: peter-evans/repository-dispatch@v3
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.WIRES77_PAT }}
repository: ${{ github.repository_owner }}/PathOfBuilding-PoE2
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "dep/imgui"]
path = dep/imgui
url = https://github.com/ocornut/imgui.git
[submodule "dep/glm"]
path = dep/glm
url = https://github.com/g-truc/glm.git
[submodule "libs/luautf8"]
path = libs/luautf8
url = https://github.com/starwing/luautf8.git
Expand Down
70 changes: 42 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@ include(${PROJECT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)

set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
include(InstallRequiredSystemLibraries)
add_subdirectory(dep/glm)

find_package(unofficial-angle CONFIG REQUIRED)
find_package(CMakeRC CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
find_package(gli CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(LuaJIT REQUIRED)
find_package(Microsoft.GSL CONFIG REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(re2 CONFIG REQUIRED)
find_package(sol2 CONFIG REQUIRED)
find_package(Threads REQUIRED)
find_package(zstd REQUIRED)
find_package(ZLIB REQUIRED)
find_package(WebP)

set(SIMPLEGRAPHIC_SOURCES
"config.h"
Expand Down Expand Up @@ -76,61 +92,58 @@ set(SIMPLEGRAPHIC_SOURCES
"ui_subscript.h"
)

set (SIMPLEGRAPHIC_PLATFORM_SOURCES)
add_library(SimpleGraphic SHARED
${SIMPLEGRAPHIC_SOURCES}
)

cmrc_add_resource_library(SimpleGraphic-Assets ALIAS SimpleGraphic::Assets NAMESPACE SimpleGraphic)

cmrc_add_resources(SimpleGraphic-Assets
"assets/gles/display_render_target.frag"
"assets/gles/display_render_target.vert"
"assets/gles/tinted_texture.frag"
"assets/gles/tinted_texture.vert"
)

if (APPLE)
set (SIMPLEGRAPHIC_PLATFORM_SOURCES
target_sources(SimpleGraphic PRIVATE
"engine/system/win/sys_macos.mm"
)
endif()

if (WIN32)
set (SIMPLEGRAPHIC_PLATFORM_SOURCES
target_sources(SimpleGraphic PRIVATE
"engine/system/win/sys_console.cpp"
"SimpleGraphic.rc"
)
else()
list (APPEND SIMPLEGRAPHIC_PLATFORM_SOURCES
target_sources(SimpleGraphic PRIVATE
"engine/system/win/sys_console_unix.cpp"
)
endif()

add_library(SimpleGraphic SHARED
${SIMPLEGRAPHIC_SOURCES}
${SIMPLEGRAPHIC_PLATFORM_SOURCES}
)
target_compile_definitions(SimpleGraphic
PRIVATE
"UNICODE"
"_CRT_SECURE_NO_DEPRECATE"
"_CRT_SECURE_NO_WARNINGS"
"_SCL_SECURE_NO_DEPRECATE"
"_SCL_SECURE_NO_WARNINGS"
"GLFW_INCLUDE_NONE"
"GL_SILENCE_DEPRECATION"
"GLFW_INCLUDE_NONE"
"GLM_ENABLE_EXPERIMENTAL"
"NOMINMAX"
"SIMPLEGRAPHIC_EXPORTS"
"UNICODE"
)

target_compile_options(SimpleGraphic PRIVATE "$<$<CXX_COMPILER_ID:MSVC>:/MP>")

target_include_directories(SimpleGraphic
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/engine"
)

find_package(unofficial-angle CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
find_package(gli CONFIG REQUIRED)
find_package(LuaJIT REQUIRED)
find_package(Microsoft.GSL CONFIG REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(re2 CONFIG REQUIRED)
find_package(sol2 CONFIG REQUIRED)
find_package(Threads REQUIRED)
find_package(zstd REQUIRED)
find_package(ZLIB REQUIRED)
find_package(WebP)

add_library(cmp_core STATIC
dep/compressonator/cmp_core/source/cmp_core.cpp
dep/compressonator/cmp_core/source/cmp_core.h
Expand Down Expand Up @@ -237,6 +250,7 @@ target_link_libraries(SimpleGraphic
LuaJIT::LuaJIT
Microsoft.GSL::GSL
re2::re2
SimpleGraphic::Assets
Threads::Threads
WebP::webpdecoder
ZLIB::ZLIB
Expand All @@ -252,7 +266,7 @@ if (WIN32)
if (NOT VCPKG_TARGET_TRIPLET MATCHES "-release")
find_file(LuaJIT_DLL_DEBUG NAMES "lua51.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "debug/bin" REQUIRED NO_DEFAULT_PATH)
find_file(ZLIB_DLL_DEBUG NAMES "zlibd1.dll"
find_file(ZLIB_DLL_DEBUG NAMES "zd.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "debug/bin" REQUIRED NO_DEFAULT_PATH)

install(FILES
Expand All @@ -265,7 +279,7 @@ if (WIN32)

find_file(LuaJIT_DLL_RELEASE NAMES "lua51.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "bin" REQUIRED NO_DEFAULT_PATH)
find_file(ZLIB_DLL_RELEASE NAMES "zlib1.dll"
find_file(ZLIB_DLL_RELEASE NAMES "z.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "bin" REQUIRED NO_DEFAULT_PATH)

install(FILES
Expand Down
13 changes: 13 additions & 0 deletions assets/gles/display_render_target.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#version 300 es
precision mediump float;

uniform highp sampler2D s_tex;

in vec2 v_texcoord;

out vec4 f_fragColor;

void main(void) {
vec3 color = texture(s_tex, v_texcoord).rgb;
f_fragColor = vec4(color, 1.0);
}
10 changes: 10 additions & 0 deletions assets/gles/display_render_target.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 300 es
in vec4 a_position;
in vec2 a_texcoord;

out vec2 v_texcoord;

void main(void) {
gl_Position = a_position;
v_texcoord = a_texcoord;
}
18 changes: 18 additions & 0 deletions assets/gles/tinted_texture.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#version 300 es
precision mediump float;

uniform highp sampler2DArray s_tex[{SG_TEXTURE_COUNT}];

in vec2 v_screenPos;
in vec2 v_texcoord;
in vec4 v_tint;
in vec2 v_texId;

out vec4 f_fragColor;

void main(void)
{{
vec4 color;
{SG_TEXTURE_SWITCH}
f_fragColor = color * v_tint;
}}
28 changes: 28 additions & 0 deletions assets/gles/tinted_texture.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#version 300 es

uniform vec2 u_screenSize;

in vec2 a_vertex;
in vec2 a_texcoord;
in vec4 a_tint;
in vec2 a_texId;

out vec2 v_screenPos;
out vec2 v_texcoord;
out vec4 v_tint;
out vec2 v_texId;

vec2 SceneToNdc(vec2 scenePos) {
vec2 unitPos = scenePos / u_screenSize;
return mix(vec2(-1.0, 1.0), vec2(1.0, -1.0), unitPos);
}

void main(void)
{
v_texcoord = a_texcoord;
v_tint = a_tint;
v_texId = a_texId;
vec2 pos = SceneToNdc(a_vertex);
v_screenPos = pos;
gl_Position = vec4(pos, 0, 1);
}
1 change: 0 additions & 1 deletion dep/glm
Submodule glm deleted from 47585f
2 changes: 1 addition & 1 deletion dep/imgui
Submodule imgui updated 217 files
1 change: 1 addition & 0 deletions engine/core/core_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "core_config.h"

#include <fmt/core.h>
#include <fmt/format.h>

// =======================
// core_IConfig Interface
Expand Down
13 changes: 3 additions & 10 deletions engine/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//

#include <glm/vec2.hpp>
#include <glm/gtc/type_ptr.hpp>

// =======
// Classes
Expand Down Expand Up @@ -44,13 +45,6 @@ enum r_texFlag_e {
TF_ASYNC = 0x08, // Load asynchronously
};

// Blend modes
enum r_blendMode_e {
RB_ALPHA,
RB_PRE_ALPHA,
RB_ADDITIVE
};

// Shader handle
class r_shaderHnd_c {
friend class r_renderer_c;
Expand Down Expand Up @@ -93,12 +87,11 @@ class r_IRenderer {
virtual void SetDrawSubLayer(int subLayer) = 0;
virtual int GetDrawLayer() = 0;
virtual void SetViewport(int x = 0, int y = 0, int width = 0, int height = 0) = 0;
virtual void SetBlendMode(int mode) = 0;
virtual void DrawColor(const col4_t col = NULL) = 0;
virtual void DrawColor(dword col) = 0;
virtual void GetDrawColor(col4_t color) = 0;
virtual void DrawImage(r_shaderHnd_c* hnd, glm::vec2 pos, glm::vec2 extent, glm::vec2 uv1 = { 0, 0 }, glm::vec2 uv2 = { 1, 1 }, int stackLayer = 0, std::optional<int> maskLayer = {}) = 0;
virtual void DrawImageQuad(r_shaderHnd_c* hnd, glm::vec2 p0, glm::vec2 p1, glm::vec2 p2, glm::vec2 p3, glm::vec2 uv0 = { 0, 0 }, glm::vec2 uv1 = { 1, 0 }, glm::vec2 uv2 = { 1, 1 }, glm::vec2 uv3 = { 0, 1 }, int stackLayer = 0, std::optional<int> maskLayer = {}) = 0;
virtual void DrawImage(r_shaderHnd_c* hnd, glm::vec2 pos, glm::vec2 extent, glm::vec2 uv1 = { 0, 0 }, glm::vec2 uv2 = { 1, 1 }, int stackLayer = 0) = 0;
virtual void DrawImageQuad(r_shaderHnd_c* hnd, glm::vec2 p0, glm::vec2 p1, glm::vec2 p2, glm::vec2 p3, glm::vec2 uv0 = { 0, 0 }, glm::vec2 uv1 = { 1, 0 }, glm::vec2 uv2 = { 1, 1 }, glm::vec2 uv3 = { 0, 1 }, int stackLayer = 0) = 0;
virtual void DrawString(float x, float y, int align, int height, const col4_t col, int font, const char* str) = 0;
virtual void DrawStringFormat(float x, float y, int align, int height, const col4_t col, int font, const char* fmt, ...) = 0;
virtual int DrawStringWidth(int height, int font, const char* str) = 0;
Expand Down
Loading
Loading