Skip to content

Commit

Permalink
sokol: Update sokol-gfx and sokol-shdc, also regen shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed May 11, 2024
1 parent e49ab39 commit bb7c88b
Show file tree
Hide file tree
Showing 8 changed files with 2,646 additions and 2,742 deletions.
26 changes: 13 additions & 13 deletions Source/Render/sokol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OPTION(OPTION_PROCESS_SHADERS "Re-Process game shaders" OFF)
#Include Sokol
FetchContent_Declare(sokol
GIT_REPOSITORY https://github.com/floooh/sokol
GIT_TAG "7f7cd64c6d9d1d4ed08d88a3879b1d69841bf0a4"
GIT_TAG "67339198b75a7d04da3676db2b56514bf363d4b1"
GIT_SHALLOW OFF
)
FetchContent_MakeAvailable(sokol)
Expand All @@ -13,14 +13,14 @@ IF (OPTION_PROCESS_SHADERS)
#Download precompiled sokol-shdc
FetchContent_Declare(sokol-tools-bin
GIT_REPOSITORY https://github.com/floooh/sokol-tools-bin
GIT_TAG "5b8d524b7faef9d479a48549b3f83511c83e92f0"
GIT_TAG "9a54e8ea68807733d82f4b169a8752a8fcad2040"
GIT_SHALLOW OFF
)
FetchContent_MakeAvailable(sokol-tools-bin)

if(NOT DEFINED ENV{PERIMETER_SHADER_LANG})
#Use all GLSL dialects, HLSL for D3d and WebGPU
set(PERIMETER_SHADER_LANG "glsl330:glsl300es:hlsl5:wgsl")
set(PERIMETER_SHADER_LANG "glsl410:glsl300es:hlsl5:wgsl")
#Metal for Apple platforms
set(PERIMETER_SHADER_LANG "${PERIMETER_SHADER_LANG}:metal_macos:metal_ios:metal_sim")
endif()
Expand Down Expand Up @@ -71,9 +71,9 @@ if (MACOS)
endif ()
#Required for compiling some glue as Obj-C
set(RenderSokol_SokolImpl sokol/SokolImpl.mm)
if(OPTION_SOKOL_API MATCHES "GLCORE33")
message("Sokol API: OpenGL Core 3.3")
add_definitions(-DSOKOL_GLCORE33)
if(OPTION_SOKOL_API MATCHES "GLCORE")
message("Sokol API: OpenGL Core")
add_definitions(-DSOKOL_GLCORE)
set(SOKOL_GL ON)
set(RenderSokol_LINK_LIBS "-framework OpenGL")
elseif(OPTION_SOKOL_API MATCHES "METAL")
Expand All @@ -94,25 +94,25 @@ elseif(PERIMETER_WINDOWS)
message("Sokol API: DirectX 11")
add_definitions(-DSOKOL_D3D11)
set(RenderSokol_LINK_LIBS d3d11)
elseif(OPTION_SOKOL_API MATCHES "GLCORE33")
message("Sokol API: OpenGL Core 3.3")
add_definitions(-DSOKOL_GLCORE33)
elseif(OPTION_SOKOL_API MATCHES "GLCORE")
message("Sokol API: OpenGL Core")
add_definitions(-DSOKOL_GLCORE)
set(SOKOL_GL ON)
set(RenderSokol_LINK_LIBS opengl32)
else()
message(SEND_ERROR "Unknown Sokol API selected: ${OPTION_SOKOL_API}")
endif()
else()
if(NOT OPTION_SOKOL_API)
set(OPTION_SOKOL_API "GLCORE33")
set(OPTION_SOKOL_API "GLCORE")
endif ()
if(OPTION_SOKOL_API MATCHES "GLES3")
message("Sokol API: OpenGLES 3.0")
add_definitions(-DSOKOL_GLES3)
set(SOKOL_GL ON)
elseif(OPTION_SOKOL_API MATCHES "GLCORE33")
message("Sokol API: OpenGL Core 3.3")
add_definitions(-DSOKOL_GLCORE33)
elseif(OPTION_SOKOL_API MATCHES "GLCORE")
message("Sokol API: OpenGL Core")
add_definitions(-DSOKOL_GLCORE)
set(SOKOL_GL ON)
elseif(OPTION_SOKOL_API MATCHES "D3D11")
message("Sokol API: D3D11")
Expand Down
6 changes: 3 additions & 3 deletions Source/Render/sokol/SokolRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
//*/

#ifdef SOKOL_GLCORE33
//Use OpenGL 3.3 Core
sokol_backend = "OpenGL Core 3.3";
#ifdef SOKOL_GLCORE
//Use OpenGL Core
sokol_backend = "OpenGL Core";

SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, "opengl", SDL_HINT_OVERRIDE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
Expand Down
2 changes: 1 addition & 1 deletion Source/Render/sokol/SokolRender.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PERIMETER_SOKOLRENDER_H
#define PERIMETER_SOKOLRENDER_H

#if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3)
#if defined(SOKOL_GLCORE) || defined(SOKOL_GLES3)
#define SOKOL_GL (1)
#endif

Expand Down
1 change: 1 addition & 0 deletions Source/Render/sokol/SokolShaders.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This file implements shaders structs
#include <cstring>
#include <sokol_gfx.h>
#include "xmath.h"
#include "SokolShaders.h"
Expand Down
Loading

0 comments on commit bb7c88b

Please sign in to comment.