-
Notifications
You must be signed in to change notification settings - Fork 84
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
Linux and GCC support #3
base: master
Are you sure you want to change the base?
Conversation
I don't have time to try it on Windows again, did you try it ? I just had a quick look at the changes and at the code quality of this repo in general. I would suggest that a cleanup occur before this PR is applied, so the change is a bit clearer, and maybe travis is also added so we can ensure Cross platform compatibility at least at build time. |
please, add |
Done in the latest commit on my fork |
@Zakhrov I've updated a bit your branch with further fixes. Now Cauldron compiles on Windows and Linux, but there is a big amount of work to get it into the working state. |
I still had problems resolving <DirectXMath.h> It seems to be working now that I passed in a relative include path. I still have to see if the glTFSample compiles |
Maintainer here, just to set some expectations, the plan is to not support linux officially (maybe for now) but I still pay attention to all your comments and suggestions, so from now on I will try to be more GCC friendly :) |
OK thanks for letting us know. Will close the PR for now |
get rid of SAL.h
For the sake of cross-references: this fixes #1 |
I've updated the code to Cauldron V1.4.1 and fixed the build errors with GCC. There is still a lot of work to be done before its actually usable though. TODO
Some doubts
|
Mouse/Keyboard handling for the ImGui should be implemented too. Looks like it is worth to outsource Mouse/Keyboard and Window handling to something like SDL2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: I'm not affiliated with AMD in any way, I just wanted to give some feedback to hope that this could move forward.
I have some specific comments, but, overall, I believe a PR like this is completely unmergeable. It's not even review-able. I'm going to echo @YvanDaSilva here, but it's just waaaaay to big, with waaaay to many changes unrelated to the specific purpose.
- Whitespace changes: Either leave as is or fix in it's own PR.
- nullptr modernization: Either leave as is or fix in it's own PR.
- UINT8 -> uint8_t etc.: Either leave (just introduce define flags for them on linux if necessary) or replace in it's own PR.
- Fix case errors with filenames (without linux changes) as much as possible in separate PR
and so on (probably splitting up the remaining
then the rest of the interesting fixes can be added gradually, preferably in a few distinct PRs working ones way up to a fully working build.
I would create a new branch, cherry pick the changes from here and open up PRs comparable to the steps above (or according to whatever format AMD prefers) to break this down
Then, possibly rebase what is left of this PR on that.
Again: I don't speak for anyone else but myself here.
strcpy(includeName, pRootDir); | ||
strncat(includeName, pName, pch - pName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsafe functions here is a bad idea.
#include <algorithm> | ||
#include <mutex> | ||
#else | ||
// ... handle this for other compilers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this duplicated code is standard and must be the same across each platform, no need to group them all under each ifdefs.
@@ -359,7 +359,7 @@ namespace CAULDRON_VK | |||
for (int i = 1; i < m_mipCount; i++) | |||
{ | |||
char buf[32]; | |||
sprintf_s<32>(buf, "weight %i", i); | |||
sprintf(buf, "weight %i", i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsafe
#include "Base/UploadHeap.h" | ||
#include "Base/Helper.h" | ||
#include "Base/Texture.h" | ||
#include "base/DynamicBufferRing.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the many many many changes like this. Wouldn't it be better to rename the directory?
VkXlibSurfaceCreateInfoKHR createInfo = {}; | ||
createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; | ||
createInfo.pNext = NULL; | ||
createInfo.dpy = NULL; | ||
res = vkCreateXlibSurfaceKHR(m_instance, &createInfo, NULL, &m_surface); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
if(MSVC) | ||
add_compile_options(/MP) | ||
else() | ||
add_compile_options(-M) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent
set(shader_compiler_src | ||
"base/ShaderCompiler.cpp" | ||
"base/ShaderCompiler.h" | ||
"base/ShaderCompilerCache.cpp" | ||
"base/ShaderCompilerCache.h" | ||
"base/DXCHelper.cpp" | ||
"base/DXCHelper.h" | ||
) | ||
else() | ||
set(shader_compiler_src | ||
"base/ShaderCompiler.cpp" | ||
"base/ShaderCompiler.h" | ||
"base/ShaderCompilerCache.cpp" | ||
"base/ShaderCompilerCache.h" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nicer to just have the platform specific parts separated out sharing the common sources
if(MSVC)
list(APPEND shader_compiler_src
"base/DXCHelper.cpp"
"base/DXCHelper.h"
)
endif()
@@ -146,6 +146,5 @@ math::Vector4 GetElementVector(json::object_t &root, const char *path, math::Vec | |||
return GetVector(root[path].get<json::array_t>()); | |||
} | |||
else | |||
return default; | |||
return default_value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be right, the function arguments haven't changed, only the return statements have gotten the replacement default
-> default_value
|
||
if (keyDown['W']) | ||
#ifdef _WIN32 | ||
if (keyDown['W']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation mismatch
@@ -121,8 +134,6 @@ void Trace(const char* pFormat, ...) | |||
// | |||
bool ReadFile(const char *name, char **data, size_t *size, bool isbinary) | |||
{ | |||
FILE *file; | |||
|
|||
//Open file | |||
if (fopen_s(&file, name, isbinary ? "rb" : "r") != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unintentional? file
will be undefined below here, this can't be right.
set(CMAKE_GENERATOR_PLATFORM x64) | ||
add_compile_options(/MP) | ||
else() | ||
add_compile_options(-M) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this hide all compile error
I have cleaned up the Vulkan backend to get it to compile on Linux with GCC 9.1 and replaced the DirectXMath library with GLM. The code compiles successfully and creates the static libraries but I haven't been able to run the glTFSample project