Skip to content

Commit

Permalink
🚧 more work on core widgets & system + workflow updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lamarrr committed Oct 24, 2024
1 parent 756eb6e commit 3a8d90b
Show file tree
Hide file tree
Showing 10 changed files with 634 additions and 713 deletions.
51 changes: 36 additions & 15 deletions .github/workflows/clang-ubuntu-22.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on: push

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
build_mode: ["Release", "Debug"]
os: ["ubuntu-24.04"]
vulkan: ["1.3.296.0"]
clang: ["18"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Code
Expand All @@ -20,31 +22,50 @@ jobs:
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/SDKs
${{ github.workspace }}/deps
${{ github.workspace }}/tools
./third_party
key: ${{ matrix.os }}-${{ hashFiles('**/lockfiles') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('vcpkg.json') }}
${{ github.workspace }}/.deps
key: ${{ matrix.os }}-${{ matrix.vulkan }}-${{ hashFiles('**/lockfiles') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('vcpkg.json') }}

- name: Update Apt
run: |
sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
- name: Install Build Tools
run: sudo apt install build-essential ninja-build clang-18 cmake wget libxrandr-dev
run: sudo apt install build-essential ninja-build clang-${{ matrix.clang }} cmake wget libxrandr-dev nasm libstdc++-14-dev

- name: Install Vulkan SDK
run: wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc && sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list http://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list && sudo apt update && sudo apt install vulkan-sdk
if: steps.cache-and-install.outputs.cache-hit != 'true'
run: |
mkdir .deps
cd .deps
wget https://sdk.lunarg.com/sdk/download/${{ matrix.vulkan }}/linux/vulkansdk-linux-x86_64-${{ matrix.vulkan }}.tar.xz
mkdir VulkanSDK
tar -xvf vulkansdk-linux-x86_64-${{ matrix.vulkan }}.tar.xz -C VulkanSDK
rm vulkansdk-linux-x86_64-${{ matrix.vulkan }}.tar.xz
cd VulkanSDK/${{ matrix.vulkan }}
./vulkansdk
- name: Install VCPKG
run: |
git clone --depth=1 https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/tools/vcpkg && cd ${{ github.workspace }}/tools/vcpkg && ./bootstrap-vcpkg.sh -disableMetrics
if: steps.cache-and-install.outputs.cache-hit != 'true'
run: |
git clone --depth=1 https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/.deps/vcpkg
cd ${{ github.workspace }}/.deps/vcpkg
./bootstrap-vcpkg.sh -disableMetrics
- name: Install Dependencies, Configure, and Build Ashura
env:
CC: clang-${{ matrix.clang }}
CXX: clang++-${{ matrix.clang }}
run: |
sudo apt install nasm && mkdir build && cd build && cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_INSTALLED_DIR=${{ github.workspace }}/tools/vcpkg/installed -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -GNinja && ninja
- name: Run Ashura Test
.deps/VulkanSDK/${{ matrix.vulkan }}/setup-env.sh
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.deps/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_INSTALLED_DIR=${{ github.workspace }}/.deps/vcpkg/installed -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -GNinja
ninja
- name: Run Tests
run: |
cd build/ && ./ashura_std_tests && ./ashura_engine_tests
cd build
./ashura_std_tests
./ashura_engine_tests
34 changes: 18 additions & 16 deletions .github/workflows/msvc-windows-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on: push

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
build_mode: ["Release", "Debug"]
os: ["windows-2022"]
vulkan: ["1.3.296.0"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Code
Expand All @@ -20,32 +21,33 @@ jobs:
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/SDKs
${{ github.workspace }}/deps
${{ github.workspace }}/tools
./third_party
key: ${{ matrix.os }}-${{ hashFiles('**/lockfiles') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('vcpkg.json') }}
${{ github.workspace }}/.deps
key: ${{ matrix.os }}-${{ matrix.vulkan }}-${{ hashFiles('**/lockfiles') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('vcpkg.json') }}

- name: Install Vulkan SDK
run: |
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.3.239.0/windows/VulkanSDK-1.3.239.0-Installer.exe" -OutFile "vulkan_installer.exe" && ./vulkan_installer.exe --root ${{ github.workspace }}/SDKs/VulkanSDK/1.3.239.0 --accept-licenses --default-answer --confirm-command install
if: steps.cache-and-install.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/${{ matrix.vulkan }}/windows/VulkanSDK-${{ matrix.vulkan }}-Installer.exe" -OutFile "vulkan_installer.exe"
./vulkan_installer.exe --root ${{ github.workspace }}/.deps/VulkanSDK/${{ matrix.vulkan }} --accept-licenses --default-answer --confirm-command install
- name: Install VCPKG
run: |
git clone --depth=1 https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/tools/vcpkg
cd ${{ github.workspace }}/tools/vcpkg && ./bootstrap-vcpkg.bat -disableMetrics
if: steps.cache-and-install.outputs.cache-hit != 'true'
run: |
git clone --depth=1 https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/.deps/vcpkg
cd ${{ github.workspace }}/.deps/vcpkg
./bootstrap-vcpkg.bat -disableMetrics
- name: Install Dependencies, Configure, and Build Ashura
env:
VULKAN_SDK: ${{ github.workspace }}/SDKs/VulkanSDK/1.3.239.0
VULKAN_SDK: ${{ github.workspace }}/.deps/VulkanSDK/${{ matrix.vulkan }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DVCPKG_HOST_TRIPLET=x64-windows -DVCPKG_INSTALLED_DIR=${{ github.workspace }}/tools/vcpkg/installed
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.deps/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DVCPKG_HOST_TRIPLET=x64-windows -DVCPKG_INSTALLED_DIR=${{ github.workspace }}/.deps/vcpkg/installed
cmake --build . --config ${{ matrix.build_mode }}
- name: Run Ashura Test
- name: Run Tests
run: |
cd build/${{ matrix.build_mode }}/ && ./ashura_std_tests.exe && ./ashura_engine_tests.exe
cd build/${{ matrix.build_mode }}/
./ashura_std_tests.exe
./ashura_engine_tests.exe
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ include(FetchContent)
FetchContent_Declare(
VulkanHeaders
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers.git
GIT_TAG vulkan-sdk-1.3.283.0)
GIT_TAG vulkan-sdk-1.3.296.0)

FetchContent_Declare(
VulkanGLSL
GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git
GIT_TAG vulkan-sdk-1.3.283.0)
GIT_TAG vulkan-sdk-1.3.296.0)

FetchContent_Declare(
SpirvReflect
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Reflect.git
GIT_TAG vulkan-sdk-1.3.283.0)
GIT_TAG vulkan-sdk-1.3.296.0)

FetchContent_Declare(
VulkanUtilityLibraries
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
GIT_TAG vulkan-sdk-1.3.283.0)
GIT_TAG vulkan-sdk-1.3.296.0)

FetchContent_Declare(
VulkanLoader
Expand Down
36 changes: 22 additions & 14 deletions ashura/engine/render_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,37 @@ struct RenderText
}
} inner = {};

void reset()
{
inner.text.reset();
inner.runs.reset();
inner.styles.reset();
inner.fonts.reset();
inner.layout.reset();
}

void uninit()
{
inner.text.uninit();
inner.runs.uninit();
inner.styles.uninit();
inner.fonts.uninit();
inner.layout.uninit();
}

void flush_text()
{
inner.dirty = true;
}

void set_highlights(Span<TextHighlight const> highlight)
void highlight(TextHighlight const &highlight)
{
inner.highlights.clear();
inner.highlights.extend_copy(highlight).unwrap();
inner.highlights.push(highlight).unwrap();
}

void set_highlight(TextHighlight highlight)
void clear_highlights()
{
set_highlights(span({highlight}));
inner.highlights.clear();
}

void set_direction(TextDirection direction)
Expand Down Expand Up @@ -289,15 +306,6 @@ struct RenderText
// [ ] use overlays on intersecting graphemes
// [ ] scaling
}

void reset()
{
inner.text.reset();
inner.runs.reset();
inner.styles.reset();
inner.fonts.reset();
inner.layout.reset();
}
};

} // namespace ash
4 changes: 2 additions & 2 deletions ashura/engine/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ struct ViewLayout
/// The coordinate system used is one in which the center of the screen is (0,
/// 0) and ranges from [-0.5w, +0.5w] on both axes. i.e. top-left is [-0.5w,
/// -0.5h] and bottom-right is [+0.5w, +0.5h].
struct View
struct View : Pin<>
{
/// @param id id of the view if mounted, otherwise U64_MAX
/// @param last_rendered_frame last frame the view was rendered at
Expand Down Expand Up @@ -431,7 +431,7 @@ struct View
/// @return preferred z_index
constexpr virtual i32 z_index(i32 allocated, Span<i32> indices)
{
fill(indices, allocated + 1);
fill(indices, allocated);
return allocated;
}

Expand Down
12 changes: 9 additions & 3 deletions ashura/engine/view_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ struct ViewSystem
}

z_indices[0] = 0;
for (u32 i = 0; i < views.size32(); i++)
u32 const n = views.size32();

for (u32 i = 0; i < n; i++)
{
ViewNode const &node = nodes[i];
z_indices[i] = views[i]->z_index(
Expand All @@ -453,7 +455,7 @@ struct ViewSystem
}

stacking_contexts[0] = 0;
for (u32 i = 0; i < views.size32(); i++)
for (u32 i = 0; i < n; i++)
{
ViewNode const &node = nodes[i];
if (node.parent != U32_MAX)
Expand All @@ -470,7 +472,11 @@ struct ViewSystem
{
return true;
}
return z_indices[a] < z_indices[b];
if (z_indices[a] < z_indices[b])
{
return true;
}
return nodes[a].depth < nodes[b].depth;
});
}

Expand Down
Loading

0 comments on commit 3a8d90b

Please sign in to comment.