Skip to content

Commit

Permalink
Style: Unify formatting, add .editorconfig (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Repiteo authored Jul 28, 2024
1 parent 375cec3 commit b8827a4
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 316 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.{csproj,sln}]
charset = utf-8-bom
end_of_line = crlf

[*.{cs,py}]
indent_style = space

[*.{csproj,yml,yaml}]
indent_size = 2
indent_style = space

[*.md]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# Properly detect languages on Github
web/static/thirdparty/* linguist-vendored

# Normalize EOL for all files that Git considers text files
* text=auto eol=lf
# Except for Visual Studio files
*.sln eol=crlf
*.csproj eol=crlf
32 changes: 31 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,35 @@ mono_crash.*.json
.directory
*~

# IDE-specific ignores
.fleet/
.history/
.idea/
.vs/
.vscode/
*.code-workspace

# Python-specific ignores
__pycache__/
*_cache/
*.pyc
.venv
venv

# Godot Git repository clone (run-benchmarks.sh)
/godot/
godot/

# Output HTML files
web/public/

# Temporary lock file while building
web/.hugo_build.lock

# Generated files
web/content/benchmark/*.md
web/content/graph/*.md
web/data/data.json

# Untracked source files
web/src-data/benchmarks/*.json
web/src-data/benchmarks/*.md
2 changes: 1 addition & 1 deletion Godot Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.3.0-dev.2">
<Project Sdk="Godot.NET.Sdk/4.3.0-dev.2">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
Expand Down
19 changes: 14 additions & 5 deletions Godot Benchmarks.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35027.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Godot Benchmarks", "Godot Benchmarks.csproj", "{A7FD1DC6-AE2B-4F17-B4BA-2FD940E01B47}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
ExportDebug|Any CPU = ExportDebug|Any CPU
ExportRelease|Any CPU = ExportRelease|Any CPU
Debug|Any CPU = Debug|Any CPU
ExportDebug|Any CPU = ExportDebug|Any CPU
ExportRelease|Any CPU = ExportRelease|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7FD1DC6-AE2B-4F17-B4BA-2FD940E01B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -16,4 +19,10 @@ Global
{A7FD1DC6-AE2B-4F17-B4BA-2FD940E01B47}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
{A7FD1DC6-AE2B-4F17-B4BA-2FD940E01B47}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0C32B76F-38AD-4A1A-80F4-46FFBBB4BFB2}
EndGlobalSection
EndGlobal
136 changes: 68 additions & 68 deletions run-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ export DISPLAY=":0"
ARG1="${1:-''}"

if ! command -v git &> /dev/null; then
echo "ERROR: git must be installed and in PATH."
exit 1
echo "ERROR: git must be installed and in PATH."
exit 1
fi

if [[ "$ARG1" == "--help" || "$ARG1" == "-h" ]]; then
echo "Usage: $0 [--skip-build]"
exit
echo "Usage: $0 [--skip-build]"
exit
fi

GODOT_REPO_DIR="$DIR/godot"

if [[ ! -d "$GODOT_REPO_DIR/.git" ]]; then
git clone https://github.com/godotengine/godot.git "$GODOT_REPO_DIR"
git clone https://github.com/godotengine/godot.git "$GODOT_REPO_DIR"
fi

pushd "$GODOT_REPO_DIR"
Expand All @@ -48,64 +48,64 @@ latest_commit="$(git -C "$GODOT_REPO_DIR" rev-parse HEAD)"

pushd /tmp/godot-benchmarks-results/
for result in 2*.md; do
if [[ "${result:11:9}" == "${latest_commit:0:9}" ]]; then
echo "godot-benchmarks: Skipping benchmark run as the latest Godot commit is already present in the results repository."
exit
fi
if [[ "${result:11:9}" == "${latest_commit:0:9}" ]]; then
echo "godot-benchmarks: Skipping benchmark run as the latest Godot commit is already present in the results repository."
exit
fi
done
popd

GODOT_EMPTY_PROJECT_DIR="$DIR/web/godot-empty-project"

if [[ "$ARG1" != "--skip-build" ]]; then
cd "$GODOT_REPO_DIR"

if command -v ccache &> /dev/null; then
# Clear ccache to avoid skewing the build time results.
ccache --clear
fi
touch .gdignore

# Measure clean build times for debug and release builds (in milliseconds).
# Also create a `.gdignore` file to prevent Godot from importing resources
# within the Godot Git clone.
# WARNING: Any untracked and ignored files included in the repository will be removed!
BEGIN="$(date +%s%3N)"
PEAK_MEMORY_BUILD_DEBUG=$( (/usr/bin/time -f "%M" scons platform=linuxbsd target=editor optimize=debug module_mono_enabled=no progress=no debug_symbols=yes -j$(nproc) 2>&1 || true) | tail -1)
END="$(date +%s%3N)"
TIME_TO_BUILD_DEBUG="$((END - BEGIN))"

git clean -qdfx --exclude bin
if command -v ccache &> /dev/null; then
# Clear ccache to avoid skewing the build time results.
ccache --clear
fi
touch .gdignore

BEGIN="$(date +%s%3N)"
PEAK_MEMORY_BUILD_RELEASE=$( (/usr/bin/time -f "%M" scons platform=linuxbsd target=template_release optimize=speed lto=full module_mono_enabled=no progress=no debug_symbols=yes -j$(nproc) 2>&1 || true) | tail -1)
END="$(date +%s%3N)"
TIME_TO_BUILD_RELEASE="$((END - BEGIN))"

# FIXME: C# is disabled because the engine crashes on exit after running benchmarks.
#
# Generate Mono glue for C# build to work.
# echo "Generating .NET glue."
# bin/godot.linuxbsd.editor.x86_64.mono --headless --generate-mono-glue modules/mono/glue
# echo "Building .NET assemblies."
# # https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_with_dotnet.html#nuget-packages
# mkdir -p "$HOME/MyLocalNugetSource"
# # Source may already exist, so allow failure for the command below.
# dotnet nuget add source "$HOME/MyLocalNugetSource" --name MyLocalNugetSource || true
# modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --push-nupkgs-local "$HOME/MyLocalNugetSource"

cd "$DIR"
cd "$GODOT_REPO_DIR"

if command -v ccache &> /dev/null; then
# Clear ccache to avoid skewing the build time results.
ccache --clear
fi
touch .gdignore

# Measure clean build times for debug and release builds (in milliseconds).
# Also create a `.gdignore` file to prevent Godot from importing resources
# within the Godot Git clone.
# WARNING: Any untracked and ignored files included in the repository will be removed!
BEGIN="$(date +%s%3N)"
PEAK_MEMORY_BUILD_DEBUG=$( (/usr/bin/time -f "%M" scons platform=linuxbsd target=editor optimize=debug module_mono_enabled=no progress=no debug_symbols=yes -j$(nproc) 2>&1 || true) | tail -1)
END="$(date +%s%3N)"
TIME_TO_BUILD_DEBUG="$((END - BEGIN))"

git clean -qdfx --exclude bin
if command -v ccache &> /dev/null; then
# Clear ccache to avoid skewing the build time results.
ccache --clear
fi
touch .gdignore

BEGIN="$(date +%s%3N)"
PEAK_MEMORY_BUILD_RELEASE=$( (/usr/bin/time -f "%M" scons platform=linuxbsd target=template_release optimize=speed lto=full module_mono_enabled=no progress=no debug_symbols=yes -j$(nproc) 2>&1 || true) | tail -1)
END="$(date +%s%3N)"
TIME_TO_BUILD_RELEASE="$((END - BEGIN))"

# FIXME: C# is disabled because the engine crashes on exit after running benchmarks.
#
# Generate Mono glue for C# build to work.
# echo "Generating .NET glue."
# bin/godot.linuxbsd.editor.x86_64.mono --headless --generate-mono-glue modules/mono/glue
# echo "Building .NET assemblies."
# # https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_with_dotnet.html#nuget-packages
# mkdir -p "$HOME/MyLocalNugetSource"
# # Source may already exist, so allow failure for the command below.
# dotnet nuget add source "$HOME/MyLocalNugetSource" --name MyLocalNugetSource || true
# modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --push-nupkgs-local "$HOME/MyLocalNugetSource"

cd "$DIR"
else
echo "run-benchmarks: Skipping engine build as requested on the command line."
TIME_TO_BUILD_DEBUG=1
TIME_TO_BUILD_RELEASE=1
PEAK_MEMORY_BUILD_DEBUG=1
PEAK_MEMORY_BUILD_RELEASE=1
echo "run-benchmarks: Skipping engine build as requested on the command line."
TIME_TO_BUILD_DEBUG=1
TIME_TO_BUILD_RELEASE=1
PEAK_MEMORY_BUILD_DEBUG=1
PEAK_MEMORY_BUILD_RELEASE=1
fi

# Path to the Godot debug binary to run. Used for CPU debug benchmarks.
Expand All @@ -128,7 +128,7 @@ $GODOT_DEBUG --audio-driver Dummy --gpu-index 1 --path "$GODOT_EMPTY_PROJECT_DIR
TOTAL=0
for _ in {0..19}; do
BEGIN="$(date +%s%3N)"
echo "Performing benchmark debug startup/shutdown run."
echo "Performing benchmark debug startup/shutdown run."
$GODOT_DEBUG --audio-driver Dummy --gpu-index 1 --path "$GODOT_EMPTY_PROJECT_DIR" --quit || true
END="$(date +%s%3N)"
TOTAL="$((TOTAL + END - BEGIN))"
Expand All @@ -144,7 +144,7 @@ $GODOT_RELEASE --audio-driver Dummy --path "$GODOT_EMPTY_PROJECT_DIR" --quit ||
TOTAL=0
for _ in {0..19}; do
BEGIN="$(date +%s%3N)"
echo "Performing benchmark release startup/shutdown run."
echo "Performing benchmark release startup/shutdown run."
$GODOT_RELEASE --audio-driver Dummy --path "$GODOT_EMPTY_PROJECT_DIR" --quit || true
END="$(date +%s%3N)"
TOTAL="$((TOTAL + END - BEGIN))"
Expand Down Expand Up @@ -199,24 +199,24 @@ BINARY_SIZE_RELEASE="$(stat --printf="%s" "$GODOT_RELEASE")"
echo "Appending extra JSON at the end of the merged JSON."
EXTRA_JSON=$(cat << EOF
"binary_size": {
"debug": $BINARY_SIZE_DEBUG,
"release": $BINARY_SIZE_RELEASE
"debug": $BINARY_SIZE_DEBUG,
"release": $BINARY_SIZE_RELEASE
},
"build_time": {
"debug": $TIME_TO_BUILD_DEBUG,
"release": $TIME_TO_BUILD_RELEASE
"debug": $TIME_TO_BUILD_DEBUG,
"release": $TIME_TO_BUILD_RELEASE
},
"build_peak_memory_usage": {
"debug": $PEAK_MEMORY_BUILD_DEBUG,
"release": $PEAK_MEMORY_BUILD_RELEASE
"debug": $PEAK_MEMORY_BUILD_DEBUG,
"release": $PEAK_MEMORY_BUILD_RELEASE
},
"empty_project_startup_shutdown_time": {
"debug": $TIME_TO_STARTUP_SHUTDOWN_DEBUG,
"release": $TIME_TO_STARTUP_SHUTDOWN_RELEASE
"debug": $TIME_TO_STARTUP_SHUTDOWN_DEBUG,
"release": $TIME_TO_STARTUP_SHUTDOWN_RELEASE
},
"empty_project_startup_shutdown_peak_memory_usage": {
"debug": $PEAK_MEMORY_STARTUP_SHUTDOWN_DEBUG,
"release": $PEAK_MEMORY_STARTUP_SHUTDOWN_RELEASE
"debug": $PEAK_MEMORY_STARTUP_SHUTDOWN_DEBUG,
"release": $PEAK_MEMORY_STARTUP_SHUTDOWN_RELEASE
}
EOF
)
Expand Down
32 changes: 16 additions & 16 deletions server/etc/X11/xorg.conf.d/01-amd.conf
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
Section "ServerLayout"
Identifier "default-layout"
Screen 0 "screen"
Identifier "default-layout"
Screen 0 "screen"
EndSection

Section "Device"
Identifier "amd"
Driver "amdgpu"
BusID "PCI:1:0:0"
Identifier "amd"
Driver "amdgpu"
BusID "PCI:1:0:0"
EndSection

Section "Monitor"
Identifier "monitor"
Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
Option "PreferredMode" "1920x1080_60.00"
Identifier "monitor"
Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
Option "PreferredMode" "1920x1080_60.00"
EndSection

Section "Screen"
Identifier "screen"
Device "amd"
Monitor "monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
Identifier "screen"
Device "amd"
Monitor "monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
1 change: 0 additions & 1 deletion web/.gitattributes

This file was deleted.

14 changes: 0 additions & 14 deletions web/.gitignore

This file was deleted.

Empty file removed web/src-data/benchmarks/.gitkeep
Empty file.
Loading

0 comments on commit b8827a4

Please sign in to comment.