* Add shader uniform-read unit test
* Add unit test f24 vector formatter
* Add Address Register Offset shader unit test
* Implement float-uniform out-of-bound return value
In the case that the resulting float-uniform index is greater than the 96 slots that it has, a result of `{1,1,1,1}` is to be returned.
* Implement shader relative addressing
Fails on the negative unit tests at the moment but passes all of the
others.
* Fix `MOVA` source register indexing
* Rename `dynapica` TU to `shader`
These unit-tests in particular only actually test
the shader-interpreter and not any of the JITs.
* Conditionally test the shader-jit
In the case that the host supports the shader-jit, the interpreter and the shader-jit will both be tested with the same unit-tests. Allowing for even more coverage.
* Remove weird git submodule
* Initialize catch-2 based unit tests
* Add nihstro submodule
Enabled only during testing to help with assembling shaders in-code.
* Implement `ADD` instruction unit-test
* Add arithmetic/logical instruction unit tests
* Add embedded catch2 submodule
Will use the host catch2 if available.
* Ignore `.cache` folder
* Add `AlberCore` build-target
Separate the AlberCore from its frontends. Allowing two front-ends to interface
with the same core implementation. This also allows for the core to interface
better with unit-testing.
* Modularize SDL/Qt frontend
Separates all QT/SDL build files and options into the frontend-build-target
* Fix optional OpenGL enablement
Software renderer requires OpenGL, so AlberCore requries OpenGL.
The QT frontend currently requires OpenGL due to `ScreenWidget`
* Fix Android build
* Fix LTO linking
* Fix windows build
`LoadLibrary` is a preprocessor that will use either `LoadLibraryW` or
`LoadLibraryA` depending on if `UNICODE` is defined or not.
In this case we are using an ASCII string literal and and can explicitly
specify the usage of `LoadLibraryA` with an ASCII literal.
* Bonk
* Bonk
---------
Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com>
A descriptor is consumed immediately when bound to a command buffer and
cannot be updated after unless we mark the descriptors with
`UPDATE_AFTER_BIND` flags and such.
For now, just flush the writes immediately before binding the
descriptors.
Fixes all of the validation messages regarding invalid command buffers
due to updated/deleted descriptor-sets.
`[32bit loc | 32bit attributes]`
Use `std::map::lower_bound(loc << 32)` to find the first address that matches the key in O(logn) time, finer grained searchs can happen after the fact in O(n) time.
Fixes render-texture cache lookups
By default, a texture sitting somewhere and ignored should be in a shader-read-only state, and transitioned into other layouts in exception to this passive state.
This allows all shaders to be ready to be interpreted by shaders by default.
Fixes a lot of the render-target validation error messages.
We "might" change the default layout for render-targets to shader-read-only and only use attachment-optimal layouts when they are armed for a render-pass. Render-Textures more often need to be ready for shaders than they need to be ready for render-passes.
All color textures need to be sampled due to how we are transposing the image when writing to the render-texture.
Depth-Stencil render-textures need to designate if it wants _either_ depth or stencil when creating an image-view.
Uses the graphics pipeline to both blit and transpose the 3ds-formatted
textures. Does not read from the actual texture just yet since we dont
write to the descriptor just yet. Some other patterns need to line up
before then.
A utility class from a personal project for managing a heap of
descriptors of a particular layout.
Allows the display graphics pipeline to be successfully created,
satisfying its descriptor layout issues.
This will eventually need to move into a cache, but this is introducing
some foundational patterns so that we know how to properly design a
pipeline cache. Currently does not provide a `DescriptorSetLayout`
argument. Causing validation errors. This will be a general-case cache
right from the get-go.
Now there is just one primary command buffer where all work is enqueued
into. At the end of the frame, the next frame's CPU-side fence is waited
on before resetting and beginning its command buffer again for
recording. This command buffer must always be in the RECORDING state.
While we wait on the CPU-side fence for these command buffers, we must
also wait on the GPU-side semaphore to be compliant to validation
layers synchronization. We still get an error on the very first frame
since it will wait for a semaphore that has nothing signaling it.
Rather than allocating new command buffers for each small task, schedule
all work onto the frame's main command buffer to be dispatched at
display-time. Fixes all layout transition and synchronization issues.
Technically we can generate every possible render-pass up-front based on
the possible combinations of ColorFmt and DepthFmt, but we should only
allocate what the game asks for. Save that pattern for pipelines.
This surface is managed by SDL itself, so there is no need to keep it in
a Unique handle for us to delete. Fixes the bug where vulkan crashes
during shutdown.
Instead of operating directly on the swapchain images, we have our own
top/bottom framebuffer images that will be rendered to independent of
having an available swapchain. The images are blitted into the swapchain
images, allowing for resizing too!
Lots of todos, this should probably just be its own self-contained
object to allow the emulator to render "headlessly" regardless of a
swapchain existing or not.
Use a stable_partitioning of the list of devices the driver gave us with
the addition of checking of the physical device supports the
display-surface that SDL gave us as well.
This value is needed for vulkan to properly allocate a surface, and would benefit OpenGL to move more of its initialization code into here rather than in `emulator.cpp`.
Headlessly creates a new vulkan instance, with conditional MacOS
support, and enables the `VK_EXT_debug_utils` instance-extension with a
debug-messenger to hook onto validation layer messages.
A lot of the architecture of the emulator here does not allow for vulkan
to initialize easily since it involves a bit of data to be exchanged
between SDL and Vulkan. This commit just adds the foundational linkage
and library code for vulkan support.
`config` was being consumed much too early before it has a chance to
call `load`. This caused GPU to read weird uninitialized data, and then
`load` called, and then further initialization to occur based on default
data and the data inside of `config.toml`. `EmulatorConfig` needs to be
loaded in first before any sort of initialization happens, by adding a
new constructor so that it can be initialized sooner.
There are still some initialization errors to work through, such as
config not being initialized properly by the time GPU tries to utilize
it too. Also some life-time issues. But manually forcing it to use the
Null backnd successfully works and allows games to be "played"
headlessly.
Rather than declaring a big C++ literal for these strings, they are now
proper `.vert` and `.frag` files that will become embedded into the
application at build-time. It also allows for clang-format to format the
glsl files the same as our C++ code. CMake will also automatically track
and re-embed the file if it detects that the glsl source files have
changed since the last build. Ex, making a change to
`opengl_display.frag` and compiling will automatically recompile and
link the resource-target that it is associated with.
Allows the OpenGL backend to be fully disabled, continuing a modular
pattern of having multiple possible rendering backends. Also defines the
`ENABLE_OPENGL` preprocessor in the case of conditional source-file
changes depending on the rendering backend.
Rather than having the entire implementation within `emulator.cpp`,
causing incremental builds to be much slower, give it its own
translation unit `stb_image_write.c`.