generated from ange-yaghi/visualcpp_template
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL build #37
Open
bobsayshilol
wants to merge
85
commits into
ange-yaghi:master
Choose a base branch
from
bobsayshilol:sdl-build
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
SDL build #37
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Requires moving to c++17
This allows subclasses to be enabled-disabled at compile-time simply by if the ysRegisterSubclass instantiation is linked in.
This is probably a horrible idea, my original plan was to replace all uses of _s functions with std::string where possible. But they are everywhere in the codebase. and we need to do this port in smaller steps. So this is the more sane solution in the short term. Ideally we will remove these later
Does microsoft have a specialization for when the desitnation is a fixed size buffer? Or is this a bug?
Lets not reinvent the wheel, it will be faster and less error prone to use c++'s built in buffering and padding. And I needed to get rid of some _s functions anyway. Also, despite using the safe functions, this code still had a potential buffer overrun.
From memory, microsoft leave a non-std:: version of these lying around as a landmine for cross-platform compatibility.
I think these are leftover, we will see if this causes any errors down the line
Arguably, it should be Hidden. But the existing behavour of the Win32 Windowing system is Visable, and lets keep that for now
Can show a window
Also use size_t's and add a template for the "no size provided" calls.
This is basically a copy of the Windows impl, but with some of the extensions that aren't required removed.
Also remove Windows.h since the headers include them anyway if they're required on your platform.
I'm not sure what's going on on other platforms, but having this here causes the compiler to always pick this rather than waiting on the linker to pick the externally implemented ones.
This needs some cleanup
Spotted by GCC because that last argument isn't a pointer so it shouldn't have been NULL.
These are Windows GL methods that don't need to exist on other platforms
Forgot to add this on first pass of the SDL context
Not sure how I missed this before...
The size must be a multiple of the alignment and the alignment must be a power of 2, so static assert on the alignment and round up the size if necessary.
delete isn't able to deduce the type of the object it's destroying since it's the caller that runs the destructor. So we need to make sure that types are as expected before calling the delete.
This bug was probably caused by me when I added the GL flag, oops...
ASAN picks up that we're indexing out-of-bounds if the button is Undefined, so don't do that since it's not going to be a valid character for the input buffer.
Without this we can get use-after-frees when quitting.
The programs try to access the destroyed shaders as part of their destruction, so move it that to before the shaders are destroyed. tbh I'm not sure there should be a dependency here and destruction could happen in any order.
This is by far the largest leak, but it only happens once AFAICT. Also move some allocations to after a return statement that would also cause a leak.
Most of the large leaks are now dealt with.
These are handled by the templates now.
Hopefully all are obvious why they're necessary.
This will come in useful in the following commit.
This way we get the same behaviour on all platforms, and RAII is just nice to have.
Without this the register's constructor is never called.
The order of static ctors is undefined so we don't want this to nuke any that have already registered (seen on Windows).
GCC complains that ysVector has special attributes that would be ignored if used as a template (since ysVector is just a float), so wrap it in a config-like struct to tell the allocation what to do.
GL and Vulkan need to have their windows configured in a special way in order for them to be useable, so that info is required up-front. Also add a commented out version of what's required for Metal.
Also remove unused member.
Also add the missing ones.
"There's nothing more permanent than a temporary fix"
How are you managing to build this on Mac? There is a typo here, and SDL includes on Mac don't use a subdirectory. |
This doesn't include all of the changes I made for Mac, where I fixed that
typo and added a bunch of other stuff, including a borderline working metal
driver. I will see about basing my code off of this to where it can all
live together
…On Sat, Oct 15, 2022, 10:16 Benjamin Schubert ***@***.***> wrote:
How are you managing to build this on Mac? There is a typo here
<https://github.com/ange-yaghi/delta-studio/blob/56baac47f2cdd9c25e1eff20cb17822440bd7941/CMakeLists.txt#L355>,
and SDL includes on Mac don't use a subdirectory.
—
Reply to this email directly, view it on GitHub
<#37 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGY2UDEYK53MWUDTUDORQA3WDK4FRANCNFSM6AAAAAARF34EDA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ah ok so the description needs to be corrected |
This is noted on cppreference, so it's not a good abstraction.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR gets
delta-studio
building onboth Linux and MacEdit: just Linux (though Mac doesn't run due to lack of GL support). Windows was tested and still builds and runs (for me).Main changes include:
The work couldn't have been done without the help of @phire, @space55, @rhysperry111, and @jakelstr, as well as others on the discord server.
Note: this is a rebased #34 with additional stuff and is intended to replace it.