Skip to content

Commit

Permalink
Initial GITS commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsgh committed Apr 6, 2023
0 parents commit 708440d
Show file tree
Hide file tree
Showing 465 changed files with 241,985 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BasedOnStyle: LLVM
SortIncludes: false
PointerAlignment: Left
AlignConsecutiveMacros: true
SpaceAroundPointerQualifiers: Before
AlwaysBreakTemplateDeclarations: Yes
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: true
PackConstructorInitializers: NextLine
InsertBraces: true
ColumnLimit: 100
ReflowComments: false
AllowShortFunctionsOnASingleLine: Empty
PenaltyReturnTypeOnItsOwnLine: 999
19 changes: 19 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
Checks: -*,
modernize-deprecated-headers,
google-readability-namespace-comments,
modernize-use-nullptr,
clang-diagnostic-unused-but-set-variable,
modernize-pass-by-value,
modernize-loop-convert,
modernize-raw-string-literal,
clang-diagnostic-tautological-pointer-compare,
clang-diagnostic-unused-command-line-argument,
clang-diagnostic-unused-variable,
clang-diagnostic-switch,
clang-diagnostic-null-arithmetic,
clang-diagnostic-delete-non-abstract-non-virtual-dtor,
WarningsAsErrors: '*'
HeaderFilterRegex: '(?!third_party)'
AnalyzeTemporaryDtors: false
FormatStyle: file
37 changes: 37 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file contains settings for code editors.
# See https://EditorConfig.org for details.

# ===================== begin_copyright_notice ============================
#
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
# ===================== end_copyright_notice ==============================


# It's the main EditorConfig file for GITS.
root = true

# C++
[*.{c,cpp,h,hpp}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

# Python
[*.py]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

# External code
[third_party/**]
indent_style = unset
indent_size = unset
trim_trailing_whitespace = unset
insert_final_newline = unset
max_line_length = unset
44 changes: 44 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Commit everything as LF, but on Windows checkout with CRLF.
* text=auto

# Git tries to detect if a file is a text file, but we can tell it
# explicitly which files are text and which binaries.
# Cygwin (?) man files
*.3x text
*.bat text eol=crlf
*.c text
*.cc text
*.cpp text
*.h text
*.hpp text
*.htm text
*.html text
# implementation file - basically a C++ header
*.ipp text
# installer settings
*.iss text
*.lua text
*.mak text
*.md text
*.pl text
*.py text
*.sh text
*.sln text eol=crlf
*.txt text
*.vcproj text eol=crlf
*.vcxproj text eol=crlf
AUTHORS text
CHANGES text
INSTALL text
LICENSE text
NEWS text
README text
TODO text

*.ico binary
*.jpg binary
*.pdf binary
*.png binary
*.pyc binary
*.so binary

98 changes: 98 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
### General rules

# Visual Studio files
*.vcproj.*
[dD]ebug/
[rR]elease/
*.vcxproj.user
*.ncb
*.suo
*.opensdf
*.sdf
*.db
*.opendb
*.dat
ipch/
.vs/
.vscode/

# Remains of Git merge conflicts
*.orig

# Eclipse metadata?
*.metadata*

# TeX and related files
*.aux
*.idx
*.log
*.out
*.pdf
*.dvi
*synctex.gz*
*.toc

# Backup files
*~
*.bak

# Vim swap files (we are being conservative, they can have more names)
[._]*.sw[mnop]

# Python bytecode files
*.pyc

# Python - Rope project directory (for Vim's python-mode)
.ropeproject/

# Klocwork (static code analysis tool)
.klocwork


### GITS-specific rules

# General
build/
third_party/*
!third_party/patch

# GITS config
recorder/gits_config.txt

# OpenGL
common/include/glIDswitch.h
common/include/glIDs.h
OpenGL/common/glFunctions.cpp
OpenGL/common/include/glDrivers.h
OpenGL/common/include/glFunctions.h
OpenGL/recorder/include/openglRecorderWrapperAuto.h
OpenGL/recorder/include/openglRecorderWrapperIfaceAuto.h
OpenGL/recorder/openglRecorderWrapperAuto.cpp
/OpenGL/GLIPlugin/gitsPluginPrePostAuto.cpp
/OpenGL/GLIPlugin/GLIPlugin32.def
/OpenGL/GLIPlugin/GLIPlugin64.def
/OpenGL/GLIPlugin/include/gitsPluginPrePostAuto.h

# Vulkan
Vulkan/common/include/vulkanArgumentsAuto.h
Vulkan/common/include/vulkanDriversAuto.inl
Vulkan/common/include/vulkanFunctions.h
Vulkan/common/include/vulkanHeader.h
Vulkan/common/include/vulkanIDs.h
Vulkan/common/include/vulkanIDswitch.h
Vulkan/common/include/vulkanLogAuto.inl
Vulkan/common/include/vulkanLuaEnums.h
Vulkan/common/include/vulkanStructStorageAuto.h
Vulkan/common/include/vulkanTracer.h
Vulkan/common/vulkanArgumentsAuto.cpp
Vulkan/common/vulkanLogAuto.cpp
Vulkan/common/vulkanFunctions.cpp
Vulkan/common/vulkanStructStorageAuto.cpp
Vulkan/layer/VkLayer_vulkan_GITS_recorder.json
Vulkan/layer/vkLayer.def
Vulkan/interceptor/vkPlugin.def
Vulkan/interceptor/vulkanPrePostAuto.cpp
Vulkan/recorder/include/vulkanRecorderWrapperAuto.h
Vulkan/recorder/include/vulkanRecorderWrapperIfaceAuto.h
Vulkan/recorder/vulkanRecorderWrapperAuto.cpp
CCodeFiles/src/include/vulkanCCodeArgumentsAuto.h
11 changes: 11 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a gitignore-like file for tools other than Git, for example grep-like
# tools like ack, ag (The Silver Searcher) or rg (ripgrep).

# Non-GITS code
third_party/

# Build artifacts
# (In case tool doesn't use .gitignore - e.g. because user told it so.)
build/
Debug/
Release/
66 changes: 66 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Building GITS

## Prerequisites

You will need:
- [Git](https://git-scm.com/)
- A C++ compiler (MSVC on Windows, GCC on Linux; Clang support is planned)
- A build system (Make, Visual Studio, Ninja, etc.)
- [CMake](https://cmake.org/)
- [Python 3](https://www.python.org/)
- [Mako](https://www.makotemplates.org/) (a Python template library, `pip install Mako`)

### Linux

On Linux you will also need:
- wget
- libx11 development headers (`libx11-dev` on Ubuntu)
- libx11-xcb development headers (`libx11-xcb-dev` on Ubuntu)
- libwayland development headers (`libwayland-dev` on Ubuntu)
- OpenGL development headers (`libgl-dev` on Ubuntu)

## Building

### Clone the repo

```bash
git clone https://github.com/intel/gits
cd gits
```

### Generate a project and build it

Examples are provided below. You might need to adjust them. (E.g., 64- vs 32-bit, unusual Python locations, different build systems like Ninja...)

Windows 64-bit example:
```batch
mkdir Release\x64
cd Release\x64
cmake -A x64 ..\..\
cmake --build . --config Release
```

Linux 64-bit example:
```bash
mkdir -p Release/x64
cd Release/x64
cmake -DARCH=-m64 ../../
# The `-j` option without an argument sets the number of threads automatically.
# You can also set it manually, e.g., `-j8` for 8 threads.
# Lower thread counts decrease RAM usage, which can help with OOM errors.
cmake --build . --config Release -j
```

Expect some warnings, we still haven't fixed them yet; it's a known issue.

## Post-build steps

### Install

This will install GITS into the folder indicated by the install prefix we set during building. (`dist` in the example.)
```bash
cmake --install . --config Release --prefix dist
```
Installing in this case means copying files into their destinations and setting paths in config. If you move the install folder somewhere else, you will need to manually adjust paths in config files.

On Windows, it's recommended for the install path to be relatively short (e.g., `C:\Users\username\Code\gits\Release\x64\dist`) to avoid problems with building CCode projects, which are created inside the GITS install folder. Building Boost (which is used by CCode) produces very long paths, which may exceed the default path length limit of Windows, failing the build.
94 changes: 94 additions & 0 deletions CCodeFiles/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# ===================== begin_copyright_notice ============================
#
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
# ===================== end_copyright_notice ==============================

project(gits)
cmake_minimum_required(VERSION 3.13)
find_package(Python3 COMPONENTS Interpreter)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(CMAKE_CXX_STANDARD 14)

if(MSVC)
add_compile_options(/MP /bigobj /W3 /wd4005 /wd4065 /wd4100 /wd4480 /wd4481 /wd4482 /wd4503 /wd4505 /wd4611 /wd4702 /wd4800 /wd4838 /wd4996 /wd4267 /wd4067 /wd4312 /wd4722 /wd4018 /wd4305)
add_compile_options("/MT$<$<CONFIG:Debug>:d>")
add_definitions(-DNOMINMAX -DBOOST_ALL_NO_LIB -D_CRT_SECURE_NO_WARNINGS)
elseif(UNIX)
add_definitions(-Wall -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-write-strings -Wno-format -fno-strict-aliasing -fPIC)
endif()

add_definitions(-DBUILD_FOR_CCODE)

if(EMPTY_BUILD)
add_definitions(-D_EMPTY_BUILD)
endif()

include_directories(CCodeProject CCodeSource/StreamFiles CCodeSource/include CCodeSource/imports)

include(custom_functions)

include(import_boost)
include(import_zlib)
include(import_libpng)
include(import_xxhash)
include(import_clheaders)
include(import_murmurhash)

FILE(GLOB CCodeProject_SOURCES
${PROJECT_SOURCE_DIR}/CCodeSource/StreamFiles/*.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/bit_range.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/config.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/exception.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/getopt.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/gits.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/glEnumStrings.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/log.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/mapped_file.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/message_pump.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/openclDrivers.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/l0DriversInit.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/l0Drivers.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/l0Log.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/openglDrivers.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/openglTools.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/openglCommon.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/pfattribs.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/resource_manager.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/texture_converter.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/timer.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/tools_lite.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/tools.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/windowContextState.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/windowing.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/dynamic_linker.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/stateDynamic.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/stateObjects.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/vkWindowing.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/vulkanDrivers.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/vulkanLog.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/vulkanLogAuto.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/vulkanTools.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/keyEvents.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/vulkanTools_lite.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/main.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/helper.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/helperGL.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/helperCL.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/helperL0.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/helperVk.cpp
${PROJECT_SOURCE_DIR}/CCodeSource/mapping.cpp
)

add_executable(CCodeProject ${CCodeProject_SOURCES})
if(MSVC)
target_link_options(CCodeProject PUBLIC /STACK:100000000 /HEAP:100000000 /ignore:4006)
set(LIBS OpenGL32 SetupAPI zlib png xxhash murmurhash Boost::filesystem Boost::thread)
elseif(UNIX)
set(LIBS GL X11 xcb X11-xcb wayland-client wayland-egl dl png pthread z xxhash murmurhash Boost::filesystem Boost::thread)
set_target_properties(CCodeProject PROPERTIES LINK_FLAGS -pie)
endif()
target_link_libraries(CCodeProject ${LIBS})
Loading

0 comments on commit 708440d

Please sign in to comment.