---
# System prepended metadata

title: Untitled

---

## Constraint

- Avoid using 64-bit integer
- Little endian only
- No inline assembly
- No C++ exception **
See https://emscripten.org/docs/porting/guidelines/portability_guidelines.html

** Instead, use assert, std::optional\<E\> or Tempeh::Util::Result<T,E>
** Some links that explains why we should not use C++ exception:
- https://stackoverflow.com/questions/16784601/does-try-catch-block-decrease-performance
- https://stackoverflow.com/questions/13835817/are-exceptions-in-c-really-slow
- https://www.gamedev.net/forums/topic/689321-performance-with-using-exceptions-in-c-game-programming/5345647/
- https://dzone.com/articles/some-useful-facts-to-know-when-using-c-exceptions

## Building

https://chromium.googlesource.com/external/github.com/google/crc32c/+/refs/tags/1.0.5/CMakeLists.txt#18

## Input

[2:44 PM, 1/26/2022] Andra Antariksa: https://github.com/TheCherno/Hazel/tree/master/Hazel/src/Hazel/Events
[2:48 PM, 1/26/2022] Andra Antariksa: https://github.com/turanszkij/WickedEngine/blob/master/WickedEngine/wiInput.h
[2:49 PM, 1/26/2022] Andra Antariksa: https://refactoring.guru/design-patterns/observer/cpp/example

## Game Loop Structure

https://gameprogrammingpatterns.com/game-loop.html
https://docs.unity3d.com/Manual/ExecutionOrder.html
http://gafferongames.com/game-physics/fix-your-timestep/

## File

https://github.com/apetrone/simplefilewatcher

## Editor

![](https://i.imgur.com/X4y6JxM.png)
![](https://i.imgur.com/grTxlw5.png)


## Renderer Backend

### Resource for Vulkan

https://gpuopen.com/learn/porting-detroit-1/
https://gpuopen.com/learn/porting-detroit-2/
https://gpuopen.com/learn/porting-detroit-3/

### Shader Packing Layouts:
Every APIs has different rules for packing variables in `struct`.

https://github.com/microsoft/DirectXShaderCompiler/blob/master/docs/SPIR-V.rst#id68

### Shader Resource Limits:
(Based on Direct3D 11 & OpenGL ES 3.1)
| Resource Type | Max. | Note |
| -------- | -------- | ---- |
| Texture & Sampler | 16 | Combined resource |
| Storage Texture | 4 | - |
| Uniform Buffer | 12 | - |
| Storage Buffer | 4 | - |

### Texture Format Specification:
`[color_components]_[color_depths]_[data_type]`
`[RGBA]{1,4}_((4|8|16|32)+_){1,4}(Uint|Unorm|Float)`

- Color components must be a combination of R, G, B, and A letters.
- R, G, B, and A letters represents Red, Green, Blue and Alpha channel respectively.
- There must be at least 1 color component with maximum of 4 color components.
- Color depth must be 4, 8, 16, or 32
- Each color depths must be delimited by '_' (underscore)

Example:
- `RGBA_8_8_8_8_Uint`
- `BGRA_8_8_8_8_Srgb`
- `RGBA_32_32_32_32_Float`

### Vertex Format Specification:
`[data_type][precision]_[num_components]`
`(Uint|Int|Float)(8|16|32)_[1-4]`

### GPU Command Submission Design:

We need a way to streamline the GPU command submission. Traditionally, graphics APIs like OpenGL and D3D11 use immediate context  to send GPU commands:

```cpp
ID3D11DeviceContext* imm;
imm->OMSetRenderTargets(...);
imm->IASetVertexBuffers(...);
imm->IASetIndexBuffer(...);
imm->DrawIndexed(...);
...
```

Under the hood, those commands could be sent lazily or immediately depending on the driver implementation.

This method might seem convenient in the first place, but unfortunately this method has a problem that is the command can only be sent sequentially. So, if we're trying to break our rendering work into multiple parallel workloads, we can't do that.

And probably we might also want to reuse the commands, but unfortunately this method also won't allow us to do that.

Enter the **Command List** or **Command Buffer**, I will call this Command list.

**Command List** stores commands to be sent to the GPU. However, commands will not be sent and executed right away to the GPU, they will stay there until the application wants to send and execute them to the GPU. This means, the application can use the command list and execute them multiple times.

#### Goals:
- Fast and robust command submission.
- Allows reuse of commands.
- Allows grouping of GPU works.
- Easy command validation=.

#### Writing commands:
*work in progress*

#### Vulkan Implementation:
*work in progress*

#### OpenGL Implementation:
*work in progress*

#### WebGPU Implementation:
*work in progress*

## Feedback from game programmer

- Ruler
- Easy to change grid
- Make less button
- Godot node
