More fixes for building with vs2019/msvc (#1500)

* Update Froxelizer.h

Fix this error when building with msvc from vs2019
error C2926:  'filament::details::Froxelizer::FroxelEntry::<unnamed-tag>::offset': a default member initializer is not allowed for a member of an anonymous struct within a union

* Fix some compilation issues with vs2019/msvc

Program.cpp:
1>C:\greg\github\filament\filament\backend\src\Program.cpp(28,42): error C2610:  'filament::backend::Program::Program(void) noexcept': is not a special member function or comparison operator which can be defaulted
1>C:\greg\github\filament\filament\backend\src\Program.cpp(28,42): message :  exception specification does not match the implicitly declared specification.

GLUtils.h: __PRETTY_FUNCTION__ macro is clang specific. Use MSVC equivalent

Color.h: fix warning

* #1493 - inline constructor in definition as requested by @romainguy

* #1493  "move this #define inside the #else below" as requested

* #1493 revert last change which causes compilation failures on other platforms.

provide empty implementation of Program::Program() in Program.cpp

* More fixes for building with vs2019/msvc

* #1500 use consistent macro definition syntax (@bejado)

* #1500 simplify DEBUG_COMMAND macro as requested by @pixelflinger

* #1500 use `{ 0 }` which is accepted by Visual Studio  (` = 0 ` is not accepted)

* #1500 remove incorrect UTILS_RESTRICT alltogether
This commit is contained in:
Gregory Popovitch
2019-08-09 19:38:31 -04:00
committed by Romain Guy
parent 52a8f50539
commit 772af1e897
7 changed files with 13 additions and 11 deletions

View File

@@ -205,12 +205,12 @@ public:
// ------------------------------------------------------------------------------------------------
#ifdef NDEBUG
#define DEBUG_COMMAND(methodName, params...)
#if defined(NDEBUG)
#define DEBUG_COMMAND(methodName, ...)
#else
// For now, simply pass the method name down as a string and throw away the parameters.
// This is good enough for certain debugging needs and we can improve this later.
#define DEBUG_COMMAND(methodName, params...) mDriver->debugCommand(#methodName)
#define DEBUG_COMMAND(methodName, ...) mDriver->debugCommand(#methodName)
#endif
class CommandStream {

View File

@@ -475,8 +475,8 @@ private:
} pack;
struct {
vec4gli scissor = 0;
vec4gli viewport = 0;
vec4gli scissor { 0 };
vec4gli viewport { 0 };
} window;
struct {

View File

@@ -764,7 +764,7 @@ static float2 DFV(float NoV, float linearRoughness, size_t numSamples) {
r.y += v * Fc;
}
}
return r * (4.0 / numSamples);
return r * (4.0f / numSamples);
}
static float2 DFV_Multiscatter(float NoV, float linearRoughness, size_t numSamples) {
@@ -809,7 +809,7 @@ static float2 DFV_Multiscatter(float NoV, float linearRoughness, size_t numSampl
r.y += v;
}
}
return r * (4.0 / numSamples);
return r * (4.0f / numSamples);
}
static float UTILS_UNUSED DFV_LazanyiTerm(float NoV, float linearRoughness, size_t numSamples) {

View File

@@ -15,6 +15,8 @@
*/
// Empty symbol used to suppress warnings on Darwin
__attribute__((visibility("hidden")))
#if __has_attribute(visibility)
__attribute__((visibility("hidden")))
#endif
void e() {
}

View File

@@ -166,7 +166,7 @@ public:
template<typename CVQualifiedSOAPointer>
class Iterator {
friend class StructureOfArraysBase;
CVQualifiedSOAPointer UTILS_RESTRICT soa;
CVQualifiedSOAPointer soa; // don't use restrict, can have aliases if multiple iterators are created
size_t index;
Iterator(CVQualifiedSOAPointer soa, size_t index) : soa(soa), index(index) {}

View File

@@ -677,7 +677,7 @@ void FilamentApp::Window::configureCamerasForWindow() {
FilamentApp::CView::CView(Renderer& renderer, std::string name)
: engine(*renderer.getEngine()), mName(name) {
view = engine.createView();
view->setClearColor({ 0 });
view->setClearColor(LinearColorA{ 0 });
view->setName(name.c_str());
}

View File

@@ -46,7 +46,7 @@ IcoSphere::Index IcoSphere::vertex_for_edge(
std::swap(key.first, key.second);
}
auto inserted = lookup.insert({ key, vertices.size() });
auto inserted = lookup.insert({ key, (Lookup::mapped_type)vertices.size() });
if (inserted.second) {
auto edge0 = vertices[first];
auto edge1 = vertices[second];