Skip to content
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

MSVC: reenable avnd plugin #1648

Merged
merged 4 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/libossia
1 change: 0 additions & 1 deletion ci/win32msvc.build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ cmake %SCORE_DIR% ^
-DOSSIA_SDK=c:\ossia-sdk-msvc ^
-DCMAKE_INSTALL_PREFIX=install ^
-DCMAKE_UNITY_BUILD=1 ^
-DSCORE_DISABLED_PLUGINS=score-plugin-avnd ^
-DSCORE_DEPLOYMENT_BUILD=1

cmake --build . --config Debug
Expand Down
12 changes: 7 additions & 5 deletions src/plugins/score-plugin-avnd/AvndProcesses/Alphanum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct alphanum_compare
@param r NULL-terminated C-style string
@return negative if l<r, 0 if l equals r, positive if l>r
*/
static constexpr int impl(std::string_view ll, std::string_view rr) noexcept
static constexpr int impl(const std::string_view ll, const std::string_view rr) noexcept
{
enum mode_t
{
Expand All @@ -55,13 +55,15 @@ struct alphanum_compare
= STRING;

const char* l = ll.data();
const char* ll_end = ll.data() + ll.size();
const char* r = rr.data();
while(l != ll.end() && r != rr.end() && *l && *r)
const char* rr_end = rr.data() + rr.size();
while(l != ll_end && r != rr_end && *l && *r)
{
if(mode == STRING)
{
char l_char{}, r_char{};
while((l != ll.end() && r != rr.end()) && (l_char = *l) && (r_char = *r))
while((l != ll_end && r != rr_end) && (l_char = *l) && (r_char = *r))
{
// check if this are digit characters
const bool l_digit = alphanum_isdigit(l_char),
Expand Down Expand Up @@ -92,7 +94,7 @@ struct alphanum_compare
{
// get the left number
unsigned long l_int = 0;
while(l != ll.end() && *l && alphanum_isdigit(*l))
while(l != ll_end && *l && alphanum_isdigit(*l))
{
// TODO: this can overflow
l_int = l_int * 10 + *l - '0';
Expand All @@ -101,7 +103,7 @@ struct alphanum_compare

// get the right number
unsigned long r_int = 0;
while(r != rr.end() && *r && alphanum_isdigit(*r))
while(r != rr_end && *r && alphanum_isdigit(*r))
{
// TODO: this can overflow
r_int = r_int * 10 + *r - '0';
Expand Down
198 changes: 97 additions & 101 deletions src/plugins/score-plugin-avnd/Crousti/GpuUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
namespace gpp::qrhi
{
template <typename F>
requires requires { F::format(); }
constexpr QRhiTexture::Format textureFormat()
{
constexpr std::string_view fmt = F::format();

if(fmt == "rgba" || fmt == "rgba8")
return QRhiTexture::RGBA8;
else if(fmt == "bgra" || fmt == "bgra8")
return QRhiTexture::BGRA8;
else if(fmt == "r8")
return QRhiTexture::R8;
if constexpr(requires { std::string_view{F::format()}; })
{
constexpr std::string_view fmt = F::format();

if(fmt == "rgba" || fmt == "rgba8")
return QRhiTexture::RGBA8;
else if(fmt == "bgra" || fmt == "bgra8")
return QRhiTexture::BGRA8;
else if(fmt == "r8")
return QRhiTexture::R8;
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
else if(fmt == "rg8")
return QRhiTexture::RG8;
Expand Down Expand Up @@ -125,107 +126,102 @@ constexpr QRhiTexture::Format textureFormat()
return QRhiTexture::ASTC_12x12;
else
return QRhiTexture::RGBA8;
}

template <typename F>
requires std::is_enum_v<typename F::format>
constexpr QRhiTexture::Format textureFormat()
{
if constexpr(
requires { F::RGBA; } || requires { F::RGBA8; })
return QRhiTexture::RGBA8;
else if constexpr(
requires { F::BGRA; } || requires { F::BGRA8; })
return QRhiTexture::BGRA8;
else if constexpr(
requires { F::R8; } || requires { F::GRAYSCALE; })
return QRhiTexture::R8;
}
else if constexpr(std::is_enum_v<typename F::format>)
{
if constexpr(requires { F::RGBA; } || requires { F::RGBA8; })
return QRhiTexture::RGBA8;
else if constexpr(requires { F::BGRA; } || requires { F::BGRA8; })
return QRhiTexture::BGRA8;
else if constexpr(requires { F::R8; } || requires { F::GRAYSCALE; })
return QRhiTexture::R8;
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
else if constexpr(requires { F::RG8; })
return QRhiTexture::RG8;
else if constexpr(requires { F::RG8; })
return QRhiTexture::RG8;
#endif
else if constexpr(requires { F::R16; })
return QRhiTexture::R16;
else if constexpr(requires { F::R16; })
return QRhiTexture::R16;
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
else if constexpr(requires { F::RG16; })
return QRhiTexture::RG16;
else if constexpr(requires { F::RG16; })
return QRhiTexture::RG16;
#endif
else if constexpr(requires { F::RED_OR_ALPHA8; })
return QRhiTexture::RED_OR_ALPHA8;
else if constexpr(requires { F::RGBA16F; })
return QRhiTexture::RGBA16F;
else if constexpr(requires { F::RGBA32F; })
return QRhiTexture::RGBA32F;
else if constexpr(requires { F::R16F; })
return QRhiTexture::R16F;
else if constexpr(requires { F::R32F; })
return QRhiTexture::R32F;
else if constexpr(requires { F::RED_OR_ALPHA8; })
return QRhiTexture::RED_OR_ALPHA8;
else if constexpr(requires { F::RGBA16F; })
return QRhiTexture::RGBA16F;
else if constexpr(requires { F::RGBA32F; })
return QRhiTexture::RGBA32F;
else if constexpr(requires { F::R16F; })
return QRhiTexture::R16F;
else if constexpr(requires { F::R32F; })
return QRhiTexture::R32F;
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
else if constexpr(requires { F::RGB10A2; })
return QRhiTexture::RGB10A2;
else if constexpr(requires { F::RGB10A2; })
return QRhiTexture::RGB10A2;
#endif
else if constexpr(requires { F::D16; })
return QRhiTexture::D16;
else if constexpr(requires { F::D16; })
return QRhiTexture::D16;

#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
else if constexpr(requires { F::D24; })
return QRhiTexture::D24;
else if constexpr(requires { F::D24S8; })
return QRhiTexture::D24S8;
else if constexpr(requires { F::D24; })
return QRhiTexture::D24;
else if constexpr(requires { F::D24S8; })
return QRhiTexture::D24S8;
#endif
else if constexpr(requires { F::D32F; })
return QRhiTexture::D32F;

else if constexpr(requires { F::BC1; })
return QRhiTexture::BC1;
else if constexpr(requires { F::BC2; })
return QRhiTexture::BC2;
else if constexpr(requires { F::BC3; })
return QRhiTexture::BC3;
else if constexpr(requires { F::BC4; })
return QRhiTexture::BC4;
else if constexpr(requires { F::BC5; })
return QRhiTexture::BC5;
else if constexpr(requires { F::BC6H; })
return QRhiTexture::BC6H;
else if constexpr(requires { F::BC7; })
return QRhiTexture::BC7;
else if(requires { F::ETC2_RGB8; })
return QRhiTexture::ETC2_RGB8;
else if(requires { F::ETC2_RGB8A1; })
return QRhiTexture::ETC2_RGB8A1;
else if(requires { F::ETC2_RGB8A8; })
return QRhiTexture::ETC2_RGBA8;
else if(requires { F::ASTC_4X4; })
return QRhiTexture::ASTC_4x4;
else if(requires { F::ASTC_5X4; })
return QRhiTexture::ASTC_5x4;
else if(requires { F::ASTC_5X5; })
return QRhiTexture::ASTC_5x5;
else if(requires { F::ASTC_6X5; })
return QRhiTexture::ASTC_6x5;
else if(requires { F::ASTC_6X6; })
return QRhiTexture::ASTC_6x6;
else if(requires { F::ASTC_8X5; })
return QRhiTexture::ASTC_8x5;
else if(requires { F::ASTC_8X6; })
return QRhiTexture::ASTC_8x6;
else if(requires { F::ASTC_8X8; })
return QRhiTexture::ASTC_8x8;
else if(requires { F::ASTC_10X5; })
return QRhiTexture::ASTC_10x5;
else if(requires { F::ASTC_10X6; })
return QRhiTexture::ASTC_10x6;
else if(requires { F::ASTC_10X8; })
return QRhiTexture::ASTC_10x8;
else if(requires { F::ASTC_10X10; })
return QRhiTexture::ASTC_10x10;
else if(requires { F::ASTC_12X10; })
return QRhiTexture::ASTC_12x10;
else if(requires { F::ASTC_12X12; })
return QRhiTexture::ASTC_12x12;
else
return QRhiTexture::RGBA8;
else if constexpr(requires { F::D32F; })
return QRhiTexture::D32F;

else if constexpr(requires { F::BC1; })
return QRhiTexture::BC1;
else if constexpr(requires { F::BC2; })
return QRhiTexture::BC2;
else if constexpr(requires { F::BC3; })
return QRhiTexture::BC3;
else if constexpr(requires { F::BC4; })
return QRhiTexture::BC4;
else if constexpr(requires { F::BC5; })
return QRhiTexture::BC5;
else if constexpr(requires { F::BC6H; })
return QRhiTexture::BC6H;
else if constexpr(requires { F::BC7; })
return QRhiTexture::BC7;
else if(requires { F::ETC2_RGB8; })
return QRhiTexture::ETC2_RGB8;
else if(requires { F::ETC2_RGB8A1; })
return QRhiTexture::ETC2_RGB8A1;
else if(requires { F::ETC2_RGB8A8; })
return QRhiTexture::ETC2_RGBA8;
else if(requires { F::ASTC_4X4; })
return QRhiTexture::ASTC_4x4;
else if(requires { F::ASTC_5X4; })
return QRhiTexture::ASTC_5x4;
else if(requires { F::ASTC_5X5; })
return QRhiTexture::ASTC_5x5;
else if(requires { F::ASTC_6X5; })
return QRhiTexture::ASTC_6x5;
else if(requires { F::ASTC_6X6; })
return QRhiTexture::ASTC_6x6;
else if(requires { F::ASTC_8X5; })
return QRhiTexture::ASTC_8x5;
else if(requires { F::ASTC_8X6; })
return QRhiTexture::ASTC_8x6;
else if(requires { F::ASTC_8X8; })
return QRhiTexture::ASTC_8x8;
else if(requires { F::ASTC_10X5; })
return QRhiTexture::ASTC_10x5;
else if(requires { F::ASTC_10X6; })
return QRhiTexture::ASTC_10x6;
else if(requires { F::ASTC_10X8; })
return QRhiTexture::ASTC_10x8;
else if(requires { F::ASTC_10X10; })
return QRhiTexture::ASTC_10x10;
else if(requires { F::ASTC_12X10; })
return QRhiTexture::ASTC_12x10;
else if(requires { F::ASTC_12X12; })
return QRhiTexture::ASTC_12x12;
else
return QRhiTexture::RGBA8;
}
}

struct DefaultPipeline
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/score-plugin-threedim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ endif()
# threedim addon
add_library(
score_plugin_threedim
Threedim/ModelDisplay/ModelDisplayNode.hpp
Threedim/ModelDisplay/ModelDisplayNode.cpp

Threedim/TinyObj.hpp
Threedim/TinyObj.cpp
Expand All @@ -79,8 +81,6 @@ add_library(
Threedim/Noise.hpp
Threedim/Noise.cpp

Threedim/ModelDisplay/ModelDisplayNode.hpp
Threedim/ModelDisplay/ModelDisplayNode.cpp
Threedim/ModelDisplay/Executor.hpp
Threedim/ModelDisplay/Executor.cpp
Threedim/ModelDisplay/Metadata.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,33 @@
#include <QFont>
#include <QPen>

// clang-format off
#if defined(_MSC_VER)
#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#if !defined(NOMINMAX)
#define NOMINMAX
#endif
#if !defined(UNICODE)
#define UNICODE 1
#endif
#if !defined(_UNICODE)
#define _UNICODE 1
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <inaddr.h>
#include <in6addr.h>
#include <mswsock.h>
#endif

#if defined(near)
#undef near
#undef far
#endif
// clang-format on

namespace score::gfx
{
Expand Down
Loading