diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index fdd6b770f..38c6928e3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. mac/linux/windows] - - Version [e.g. 1.4.1] + - Version [e.g. 1.4.2] **Additional context** Add any other context about the problem here. diff --git a/CMakeLists.txt b/CMakeLists.txt index 813ea2484..82a6e50b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10.0) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version") -project(Griddly VERSION 1.4.1) +project(Griddly VERSION 1.4.2) set(BINARY ${CMAKE_PROJECT_NAME}) @@ -106,16 +106,11 @@ endif() if(NOT WASM) message(STATUS "Compiling shaders...") find_package(Vulkan REQUIRED FATAL_ERROR) - set(VULKAN_SHADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Griddly/Core/Observers/Vulkan/resources/shaders) if(MSVC) - execute_process ( COMMAND ${VULKAN_SHADER_DIR}/compile_shaders.bat - WORKING_DIRECTORY ${VULKAN_SHADER_DIR} - RESULT_VARIABLE rv) + execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE rv) else() - execute_process ( COMMAND bash ${VULKAN_SHADER_DIR}/compile_shaders.sh - WORKING_DIRECTORY ${VULKAN_SHADER_DIR} - RESULT_VARIABLE rv) + execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE rv) endif() endif() diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 23e2e7893..a0bdbb032 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -90,6 +90,10 @@ jobs: PythonVersion: 3.9 PyBin: cp39-cp39 PLAT: manylinux2014_x86_64 + ManyLinux_p310: + PythonVersion: 3.10 + PyBin: cp310-cp310 + PLAT: manylinux2014_x86_64 steps: - task: InstallSSHKey@0 inputs: @@ -208,6 +212,8 @@ jobs: PythonVersion: 3.8 Windows_p39: PythonVersion: 3.9 + Windows_p310: + PythonVersion: 3.10 steps: - task: InstallSSHKey@0 inputs: @@ -332,6 +338,8 @@ jobs: PythonVersion: 3.8 MacOS_p39: PythonVersion: 3.9 + MacOS_p310: + PythonVersion: 3.10 steps: - task: InstallSSHKey@0 inputs: diff --git a/bindings/python.cpp b/bindings/python.cpp index 552e6eae2..61852c8ee 100644 --- a/bindings/python.cpp +++ b/bindings/python.cpp @@ -12,7 +12,7 @@ namespace griddly { PYBIND11_MODULE(python_griddly, m) { m.doc() = "Griddly python bindings"; - m.attr("version") = "1.4.1"; + m.attr("version") = "1.4.2"; #ifndef NDEBUG spdlog::set_level(spdlog::level::debug); diff --git a/compile_shaders.bat b/compile_shaders.bat new file mode 100644 index 000000000..02d8de237 --- /dev/null +++ b/compile_shaders.bat @@ -0,0 +1,12 @@ +cd /D "%~dp0" + +CALL :compile_shaders_in_dir .\resources\shaders +CALL :compile_shaders_in_dir .\tests\resources\observer\block\shaders\global_lighting +CALL :compile_shaders_in_dir .\tests\resources\observer\isometric\shaders\lighting +CALL :compile_shaders_in_dir .\tests\resources\observer\sprite\shaders\health_bars + +EXIT /B 0 + +:compile_shaders_in_dir +glslc %~1\triangle-textured.frag -o %~1\triangle-textured.frag.spv +glslc %~1\triangle-textured.vert -o %~1\triangle-textured.vert.spv diff --git a/compile_shaders.sh b/compile_shaders.sh new file mode 100755 index 000000000..fb90e5c2d --- /dev/null +++ b/compile_shaders.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +compile_shaders_in_dir () { + glslc $1/triangle-textured.frag -o $1/triangle-textured.frag.spv + glslc $1/triangle-textured.vert -o $1/triangle-textured.vert.spv +} + +compile_shaders_in_dir ./resources/shaders +compile_shaders_in_dir ./tests/resources/observer/block/shaders/global_lighting +compile_shaders_in_dir ./tests/resources/observer/isometric/shaders/lighting +compile_shaders_in_dir ./tests/resources/observer/sprite/shaders/health_bars diff --git a/docs/conf.py b/docs/conf.py index 60699a437..7fbc3b0b3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ author = 'Chris Bamford' # The full version, including alpha/beta/rc tags -release = '1.4.1' +release = '1.4.2' # -- General configuration --------------------------------------------------- diff --git a/js/griddlyjs-app/package-lock.json b/js/griddlyjs-app/package-lock.json index d78890f0f..b5259829f 100644 --- a/js/griddlyjs-app/package-lock.json +++ b/js/griddlyjs-app/package-lock.json @@ -1,12 +1,12 @@ { "name": "griddlyjs-app", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "griddlyjs-app", - "version": "1.4.1", + "version": "1.4.2", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/free-brands-svg-icons": "^6.1.1", diff --git a/js/griddlyjs-app/package.json b/js/griddlyjs-app/package.json index cff1b6332..c0c6b715c 100644 --- a/js/griddlyjs-app/package.json +++ b/js/griddlyjs-app/package.json @@ -1,6 +1,6 @@ { "name": "griddlyjs-app", - "version": "1.4.1", + "version": "1.4.2", "private": true, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.1.1", diff --git a/python/setup.py b/python/setup.py index 7ec70e5ec..33c42984f 100644 --- a/python/setup.py +++ b/python/setup.py @@ -71,7 +71,7 @@ def griddly_package_data(config='Debug'): setup( name='griddly', - version="1.4.1", + version="1.4.2", author_email="chrisbam4d@gmail.com", description="Griddly Python Libraries", long_description=long_description, diff --git a/src/Griddly/Core/Observers/Vulkan/resources/shaders/triangle-textured.frag b/resources/shaders/triangle-textured.frag similarity index 100% rename from src/Griddly/Core/Observers/Vulkan/resources/shaders/triangle-textured.frag rename to resources/shaders/triangle-textured.frag diff --git a/src/Griddly/Core/Observers/Vulkan/resources/shaders/triangle-textured.vert b/resources/shaders/triangle-textured.vert similarity index 100% rename from src/Griddly/Core/Observers/Vulkan/resources/shaders/triangle-textured.vert rename to resources/shaders/triangle-textured.vert diff --git a/src/Griddly/Core/Observers/SpriteObserver.cpp b/src/Griddly/Core/Observers/SpriteObserver.cpp index 46c9a7fdf..104a5c3b5 100644 --- a/src/Griddly/Core/Observers/SpriteObserver.cpp +++ b/src/Griddly/Core/Observers/SpriteObserver.cpp @@ -38,7 +38,7 @@ vk::SpriteData SpriteObserver::loadImage(std::string imageFilename) { stbi_uc* pixels = stbi_load(absoluteFilePath.c_str(), &width, &height, &channels, STBI_rgb_alpha); if (!pixels) { - throw std::runtime_error(fmt::format("Failed to load texture image {0}.", imageFilename)); + throw std::runtime_error(fmt::format("Failed to load texture image {0}.", absoluteFilePath)); } int outputWidth = config_.tileSize.x; diff --git a/src/Griddly/Core/Observers/Vulkan/VulkanDevice.cpp b/src/Griddly/Core/Observers/Vulkan/VulkanDevice.cpp index a25e641a2..a31a2d1b9 100644 --- a/src/Griddly/Core/Observers/Vulkan/VulkanDevice.cpp +++ b/src/Griddly/Core/Observers/Vulkan/VulkanDevice.cpp @@ -1203,4 +1203,4 @@ uint8_t* VulkanDevice::renderFrame() { return imageRGBA_; } -} // namespace vk \ No newline at end of file +} // namespace vk diff --git a/src/Griddly/Core/Observers/Vulkan/resources/shaders/compile_shaders.bat b/src/Griddly/Core/Observers/Vulkan/resources/shaders/compile_shaders.bat deleted file mode 100644 index bdf29ab5c..000000000 --- a/src/Griddly/Core/Observers/Vulkan/resources/shaders/compile_shaders.bat +++ /dev/null @@ -1,6 +0,0 @@ -set SHADER_OUTPUT_DIR=..\..\..\..\..\..\..\resources\shaders - -if not exist "%SHADER_OUTPUT_DIR%" (mkdir %SHADER_OUTPUT_DIR%) - -glslc triangle-textured.frag -o %SHADER_OUTPUT_DIR%\triangle-textured.frag.spv -glslc triangle-textured.vert -o %SHADER_OUTPUT_DIR%\triangle-textured.vert.spv \ No newline at end of file diff --git a/src/Griddly/Core/Observers/Vulkan/resources/shaders/compile_shaders.sh b/src/Griddly/Core/Observers/Vulkan/resources/shaders/compile_shaders.sh deleted file mode 100755 index d1a2acd92..000000000 --- a/src/Griddly/Core/Observers/Vulkan/resources/shaders/compile_shaders.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SHADER_OUTPUT_DIR=../../../../../../../resources/shaders - -if [ ! -d $SHADER_OUTPUT_DIR ]; then - mkdir -p $SHADER_OUTPUT_DIR; -fi - -glslc triangle-textured.frag -o $SHADER_OUTPUT_DIR/triangle-textured.frag.spv -glslc triangle-textured.vert -o $SHADER_OUTPUT_DIR/triangle-textured.vert.spv \ No newline at end of file diff --git a/tests/resources/observer/block/shaders/global_lighting/compile_shaders.sh b/tests/resources/observer/block/shaders/global_lighting/compile_shaders.sh deleted file mode 100755 index 924df3f31..000000000 --- a/tests/resources/observer/block/shaders/global_lighting/compile_shaders.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SHADER_OUTPUT_DIR=. - -if [ ! -d $SHADER_OUTPUT_DIR ]; then - mkdir -p $SHADER_OUTPUT_DIR; -fi - -glslc triangle-textured.frag -o $SHADER_OUTPUT_DIR/triangle-textured.frag.spv -glslc triangle-textured.vert -o $SHADER_OUTPUT_DIR/triangle-textured.vert.spv \ No newline at end of file diff --git a/tests/resources/observer/isometric/shaders/lighting/compile_shaders.sh b/tests/resources/observer/isometric/shaders/lighting/compile_shaders.sh deleted file mode 100755 index 924df3f31..000000000 --- a/tests/resources/observer/isometric/shaders/lighting/compile_shaders.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SHADER_OUTPUT_DIR=. - -if [ ! -d $SHADER_OUTPUT_DIR ]; then - mkdir -p $SHADER_OUTPUT_DIR; -fi - -glslc triangle-textured.frag -o $SHADER_OUTPUT_DIR/triangle-textured.frag.spv -glslc triangle-textured.vert -o $SHADER_OUTPUT_DIR/triangle-textured.vert.spv \ No newline at end of file diff --git a/tests/resources/observer/sprite/shaders/health_bars/compile_shaders.sh b/tests/resources/observer/sprite/shaders/health_bars/compile_shaders.sh deleted file mode 100755 index 924df3f31..000000000 --- a/tests/resources/observer/sprite/shaders/health_bars/compile_shaders.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -SHADER_OUTPUT_DIR=. - -if [ ! -d $SHADER_OUTPUT_DIR ]; then - mkdir -p $SHADER_OUTPUT_DIR; -fi - -glslc triangle-textured.frag -o $SHADER_OUTPUT_DIR/triangle-textured.frag.spv -glslc triangle-textured.vert -o $SHADER_OUTPUT_DIR/triangle-textured.vert.spv \ No newline at end of file diff --git a/tests/src/Griddly/Core/Observers/BlockObserverTest.cpp b/tests/src/Griddly/Core/Observers/BlockObserverTest.cpp index 9d2df6e54..adc716007 100644 --- a/tests/src/Griddly/Core/Observers/BlockObserverTest.cpp +++ b/tests/src/Griddly/Core/Observers/BlockObserverTest.cpp @@ -501,7 +501,7 @@ TEST(BlockObserverTest, global_variable_lighting) { {}, }; - config.resourceConfig = {"resources/images", "tests/resources/observer/block/shaders/global_lighting"}; + config.resourceConfig = {"resources/games", "resources/images", "tests/resources/observer/block/shaders/global_lighting"}; runBlockObserverTest(config, Direction::LEFT, {3, 100, 100}, {1, 4, 4 * 100}, "tests/resources/observer/block/global_variable_lighting.png"); } @@ -542,7 +542,7 @@ TEST(BlockObserverTest, reset) { BlockObserverConfig observerConfig; observerConfig.tileSize = glm::ivec2(20, 20); - observerConfig.resourceConfig = {"resources/images", "resources/shaders"}; + observerConfig.resourceConfig = {"resources/games", "resources/images", "resources/shaders"}; observerConfig.shaderVariableConfig = ShaderVariableConfig(); observerConfig.blockDefinitions = getMockBlockDefinitions(); diff --git a/tests/src/Griddly/Core/Observers/IsometricSpriteObserverTest.cpp b/tests/src/Griddly/Core/Observers/IsometricSpriteObserverTest.cpp index f84d7d6c6..389a76fc6 100644 --- a/tests/src/Griddly/Core/Observers/IsometricSpriteObserverTest.cpp +++ b/tests/src/Griddly/Core/Observers/IsometricSpriteObserverTest.cpp @@ -76,7 +76,7 @@ void runIsometricSpriteObserverRTSTest(IsometricSpriteObserverConfig observerCon observerConfig.isoTileDepth = 4; observerConfig.highlightPlayers = true; - observerConfig.resourceConfig = {"resources/images", "resources/shaders"}; + observerConfig.resourceConfig = {"resources/games", "resources/images", "resources/shaders"}; observerConfig.shaderVariableConfig = ShaderVariableConfig(); observerConfig.spriteDefinitions = getMockRTSIsometricSpriteDefinitions(); @@ -477,7 +477,7 @@ TEST(IsometricSpriteObserverTest, object_variable_fragment_lighting) { {"light"}, }; - config.resourceConfig = {"resources/images", "tests/resources/observer/isometric/shaders/lighting"}; + config.resourceConfig = {"resources/games", "resources/images", "tests/resources/observer/isometric/shaders/lighting"}; runIsometricSpriteObserverTest(config, Direction::LEFT, {3, 160, 128}, {1, 4, 4 * 160}, "tests/resources/observer/isometric/object_variable_fragment_lighting.png"); } @@ -520,7 +520,7 @@ TEST(IsometricSpriteObserverTest, reset) { observerConfig.isoTileHeight = 16; observerConfig.isoTileDepth = 4; - observerConfig.resourceConfig = {"resources/images", "resources/shaders"}; + observerConfig.resourceConfig = {"resources/games", "resources/images", "resources/shaders"}; observerConfig.shaderVariableConfig = ShaderVariableConfig(); observerConfig.spriteDefinitions = getMockIsometricSpriteDefinitions(); diff --git a/tests/src/Griddly/Core/Observers/SpriteObserverTest.cpp b/tests/src/Griddly/Core/Observers/SpriteObserverTest.cpp index 8b181e553..9bd86385a 100644 --- a/tests/src/Griddly/Core/Observers/SpriteObserverTest.cpp +++ b/tests/src/Griddly/Core/Observers/SpriteObserverTest.cpp @@ -88,7 +88,7 @@ void runSpriteObserverRTSTest(SpriteObserverConfig observerConfig, observerConfig.tileSize = glm::ivec2(50, 50); observerConfig.highlightPlayers = true; - observerConfig.resourceConfig = {"resources/images", "resources/shaders"}; + observerConfig.resourceConfig = {"resources/games", "resources/images", "resources/shaders"}; observerConfig.shaderVariableConfig = ShaderVariableConfig(); observerConfig.spriteDefinitions = getMockRTSSpriteDefinitions(); @@ -503,7 +503,7 @@ TEST(SpriteObserverTest, object_variable_health_bars) { {"health", "max_health"}, }; - config.resourceConfig = {"resources/images", "tests/resources/observer/sprite/shaders/health_bars"}; + config.resourceConfig = {"resources/games", "resources/images", "tests/resources/observer/sprite/shaders/health_bars"}; runSpriteObserverTest(config, Direction::LEFT, {3, 120, 120}, {1, 4, 4 * 100}, "tests/resources/observer/sprite/object_variable_health_bars.png"); } diff --git a/tests/src/Griddly/Core/Observers/VulkanObserverTest.hpp b/tests/src/Griddly/Core/Observers/VulkanObserverTest.hpp index 97cb0d414..1d4e3088f 100644 --- a/tests/src/Griddly/Core/Observers/VulkanObserverTest.hpp +++ b/tests/src/Griddly/Core/Observers/VulkanObserverTest.hpp @@ -38,7 +38,10 @@ MATCHER_P3(ObservationResultMatcher, shape, strides, imageData, "") { for (int c = 0; c < 4; c++) { uint8_t srcImageBit = *(arg + y * strides[1] * shape[1] + x * strides[1] + c); uint8_t dstImageBit = *(imageData + y * strides[2] + x * strides[1] + c * strides[0]); - if (srcImageBit != dstImageBit) { + + // Tolerate error of 1 bit in the src and dst images as rendering + // deviates a little on different devices. + if (!(dstImageBit - 1 <= srcImageBit && srcImageBit <= dstImageBit + 1)) { spdlog::debug("source x: {0} y: {1} c: {2} ({3} != {4})", x, y, c, srcImageBit, dstImageBit); return false; @@ -49,4 +52,4 @@ MATCHER_P3(ObservationResultMatcher, shape, strides, imageData, "") { return true; } -} // namespace griddly \ No newline at end of file +} // namespace griddly