Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #81

Merged
merged 6 commits into from
Jul 6, 2024
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
4 changes: 2 additions & 2 deletions build_scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ def execbuildscript(filepath):
if with_vr:
add_pragma_module(
name="pr_openvr",
commitSha="54ab920d9ab71c57ce6d2c059187af0c6a99928f",
commitSha="cbcdab952f930b0f57870260b7c9f18038f7a88d",
repositoryUrl="https://github.com/Silverlan/pr_openvr.git"
)

Expand Down Expand Up @@ -1074,7 +1074,7 @@ def download_addon(name,addonName,url,commitId=None):
download_addon("model editor","tool_model_editor","https://github.com/Silverlan/pragma_model_editor.git","56d46dacb398fa7540e794359eaf1081c9df1edd")

if with_vr:
download_addon("VR","virtual_reality","https://github.com/Silverlan/PragmaVR.git","271d264ffcc2373ccfd197c5a1a7aacb557726c3")
download_addon("VR","virtual_reality","https://github.com/Silverlan/PragmaVR.git","a531c84cf56bd121d36eea03c25f8c38eec17872")

if with_pfm:
download_addon("PFM Living Room Demo","pfm_demo_living_room","https://github.com/Silverlan/pfm_demo_living_room.git","4cbecad4a2d6f502b6d9709178883678101f7e2c")
Expand Down
10 changes: 5 additions & 5 deletions core/client/src/util/c_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ void util::rt_screenshot(CGame &game, uint32_t width, uint32_t height, const RtS
// A raytracing screenshot has been requested; We'll have to re-render the scene with raytracing enabled

auto resolution = c_engine->GetRenderResolution();
pragma::rendering::cycles::SceneInfo sceneInfo {};
::pragma::rendering::cycles::SceneInfo sceneInfo {};
sceneInfo.width = width;
sceneInfo.height = height;
sceneInfo.samples = settings.samples;
sceneInfo.hdrOutput = false; //;//(format == pragma::image::ImageOutputFormat::HDR);
pragma::rendering::cycles::RenderImageInfo renderImgInfo {};
::pragma::rendering::cycles::RenderImageInfo renderImgInfo {};
if(pCam) {
renderImgInfo.camPose = pCam->GetEntity().GetPose();
renderImgInfo.farZ = pCam->GetFarZ();
Expand All @@ -78,7 +78,7 @@ void util::rt_screenshot(CGame &game, uint32_t width, uint32_t height, const RtS
sceneInfo.skyAngles = settings.skyAngles;

Con::cout << "Executing raytracer... This may take a few minutes!" << Con::endl;
auto job = pragma::rendering::cycles::render_image(*client, sceneInfo, renderImgInfo);
auto job = ::pragma::rendering::cycles::render_image(*client, sceneInfo, renderImgInfo);
if(job.IsValid()) {
job.SetCompletionHandler([format, quality, toneMapping](util::ParallelWorker<uimg::ImageLayerSet> &worker) {
if(worker.IsSuccessful() == false) {
Expand Down Expand Up @@ -118,12 +118,12 @@ std::optional<std::string> util::screenshot(CGame &game)
std::shared_ptr<prosper::IBuffer> bufScreenshot = nullptr;
{
// Just use the last rendered image
auto *renderer = scene ? dynamic_cast<pragma::CRendererComponent *>(scene->GetRenderer()) : nullptr;
auto *renderer = scene ? dynamic_cast<::pragma::CRendererComponent *>(scene->GetRenderer()) : nullptr;
if(renderer == nullptr) {
Con::cwar << "No scene renderer found!" << Con::endl;
return {};
}
auto rasterC = renderer->GetEntity().GetComponent<pragma::CRasterizationRendererComponent>();
auto rasterC = renderer->GetEntity().GetComponent<::pragma::CRasterizationRendererComponent>();
if(rasterC.expired()) {
Con::cwar << "No rasterization renderer found!" << Con::endl;
return {};
Expand Down
48 changes: 48 additions & 0 deletions github_actions/download_pragma/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Download Pragma
description: 'Download Pragma.'
inputs:
working-directory:
description: 'The location where Pragma resides. If no Pragma installation is found, it will be installed in this location.'
required: true
default: 'pragma'
version:
description: 'The version of Pragma to download.'
required: true
default: 'nightly'
runs:
using: "composite"
steps:
- name: Download Pragma
shell: bash
run: |
if [ -d "${{ inputs.working-directory }}" ]; then
echo "Pragma already exists. Skipping download."
else
repo="Silverlan/pragma"

version="${{ inputs.version }}"

dlUrl="https://github.com/Silverlan/pragma/releases/download/${version}/"
if [ "$RUNNER_OS" == "Linux" ]; then
if [ "$version" == "nightly" ]; then
fileName="pragma-lin64.tar.gz"
else
fileName="pragma-${version}-lin64.tar.gz"
fi
else
if [ "$version" == "nightly" ]; then
fileName="pragma-win64.zip"
else
fileName="pragma-${version}-win64.zip"
fi
fi
dlUrl="${dlUrl}${fileName}"

curl -L "${dlUrl}" -o "${fileName}"
mkdir -p "${{ inputs.working-directory }}"
if [[ $fileName == *.tar.gz ]]; then
tar -xzf ${fileName} -C "${{ inputs.working-directory }}"
else
unzip -q ${fileName} -d "${{ inputs.working-directory }}"
fi
fi
68 changes: 22 additions & 46 deletions github_actions/run_lua/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Run Pragma Lua Script
description: 'Run a Pragma Lua-script.'
inputs:
working-directory:
description: 'The location where Pragma resides. If no Pragma installation is found, it will be installed in this location.'
required: true
default: 'pragma'
lua-code:
description: 'Lua code to execute'
required: true
Expand Down Expand Up @@ -39,45 +43,17 @@ runs:
using: "composite"
steps:
- name: Download Pragma
shell: bash
run: |
if [ -d "pragma" ]; then
echo "Pragma already exists. Skipping download."
else
repo="Silverlan/pragma"

version="${{ inputs.version }}"

dlUrl="https://github.com/Silverlan/pragma/releases/download/${version}/"
if [ "$RUNNER_OS" == "Linux" ]; then
if [ "$version" == "nightly" ]; then
fileName="pragma-lin64.tar.gz"
else
fileName="pragma-${version}-lin64.tar.gz"
fi
else
if [ "$version" == "nightly" ]; then
fileName="pragma-win64.zip"
else
fileName="pragma-${version}-win64.zip"
fi
fi
dlUrl="${dlUrl}${fileName}"

curl -L "${dlUrl}" -o "${fileName}"
mkdir pragma
if [[ $fileName == *.tar.gz ]]; then
tar -xzf ${fileName} -C pragma
else
unzip -q ${fileName} -d pragma
fi
fi
id: download-pragma
uses: Silverlan/pragma/github_actions/download_pragma@main
with:
version: "${{ inputs.version }}"
working-directory: "${{ inputs.working-directory }}"

- name: Generate CI Lua-script
shell: bash
run: |
mkdir -p pragma/lua
scriptFileName="pragma/lua/ci_script.lua"
mkdir -p "${{ inputs.working-directory }}/lua"
scriptFileName="${{ inputs.working-directory }}/lua/ci_script.lua"

cat <<EOF > ${scriptFileName}
local cbOnError = game.add_event_listener("OnLuaError",function(err)
Expand All @@ -101,7 +77,7 @@ runs:
shell: bash
id: run-script
run: |
cd "pragma"
cd "${{ inputs.working-directory }}"
if [ "$RUNNER_OS" == "Linux" ]; then
chmod +x ./pragma
fi
Expand All @@ -127,7 +103,7 @@ runs:
- name: Clean-up
shell: bash
run: |
rm pragma/lua/ci_script.lua
rm "${{ inputs.working-directory }}/lua/ci_script.lua"

- name: Check script execution result
id: handle-result
Expand All @@ -143,14 +119,14 @@ runs:
exit $exit_code
fi

if [ -f "pragma/ci_lua_error.txt" ]; then
CI_LUA_ERROR=$(cat "pragma/ci_lua_error.txt")
if [ -f "${{ inputs.working-directory }}/ci_lua_error.txt" ]; then
CI_LUA_ERROR=$(cat "${{ inputs.working-directory }}/ci_lua_error.txt")
if [ -n "$CI_LUA_ERROR" ]; then
echo "lua-error=$CI_LUA_ERROR" >> $GITHUB_OUTPUT
fi
fi

CI_CONTENTS=$(cat "pragma/ci.txt")
CI_CONTENTS=$(cat "${{ inputs.working-directory }}/ci.txt")
exit_code=$?

if [ $exit_code -ne 0 ]; then
Expand All @@ -167,14 +143,14 @@ runs:
if: ${{ always() && inputs.artifacts-name != '' }}
run: |
mkdir -p artifacts
if [ -f "pragma/log.txt" ]; then
cp pragma/log.txt artifacts/log.txt
if [ -f "${{ inputs.working-directory }}/log.txt" ]; then
cp ${{ inputs.working-directory }}/log.txt artifacts/log.txt
fi
if [ -d "pragma/crashdumps" ]; then
cp -r pragma/crashdumps artifacts/crashdumps
if [ -d "${{ inputs.working-directory }}/crashdumps" ]; then
cp -r ${{ inputs.working-directory }}/crashdumps artifacts/crashdumps
fi
if [ -d "pragma/artifacts" ]; then
cp -rf pragma/artifacts/* artifacts/
if [ -d "${{ inputs.working-directory }}/artifacts" ]; then
cp -rf ${{ inputs.working-directory }}/artifacts/* artifacts/
fi

- name: Upload artifact files
Expand Down
5 changes: 5 additions & 0 deletions github_actions/run_tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Run Pragma Tests
description: 'Run a Pragma Test Lua-script.'
inputs:
working-directory:
description: 'The location where Pragma resides. If no Pragma installation is found, it will be installed in this location.'
required: true
default: 'pragma'
test-scripts:
description: 'The test script(s) to execute.'
required: true
Expand Down Expand Up @@ -40,6 +44,7 @@ runs:
state: "${{ inputs.state }}"
version: "${{ inputs.version }}"
artifacts-name: "${{ inputs.artifacts-name }}"
working-directory: "${{ inputs.working-directory }}"
lua-code: |
include(\"/tests/base.lua\")
local scripts = {
Expand Down
Loading