From b9376280aa018a24c6a80686c6ef5269670f534d Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 3 May 2022 20:26:45 -0400 Subject: [PATCH] aurora: Windows compile & D3D12 fixes --- aurora/lib/gfx/gx.hpp | 12 +++++++++--- aurora/lib/gfx/gx_shader.cpp | 7 +++---- aurora/lib/gpu.cpp | 8 ++++++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/aurora/lib/gfx/gx.hpp b/aurora/lib/gfx/gx.hpp index 2ea744a11..4ce516de0 100644 --- a/aurora/lib/gfx/gx.hpp +++ b/aurora/lib/gfx/gx.hpp @@ -33,7 +33,9 @@ struct TevOp { GX::TevScale scale = GX::TevScale::CS_SCALE_1; GX::TevRegID outReg = GX::TevRegID::TEVPREV; bool clamp = true; - u32 _pad : 24 = 0; + u8 _p1 = 0; + u8 _p2 = 0; + u8 _p3 = 0; bool operator==(const TevOp&) const = default; }; static_assert(std::has_unique_object_representations_v); @@ -69,7 +71,9 @@ struct ColorChannelConfig { GX::ColorSrc matSrc = GX::SRC_REG; GX::ColorSrc ambSrc = GX::SRC_REG; bool lightingEnabled = false; - u32 _pad : 24 = 0; + u8 _p1 = 0; + u8 _p2 = 0; + u8 _p3 = 0; bool operator==(const ColorChannelConfig&) const = default; }; static_assert(std::has_unique_object_representations_v); @@ -88,7 +92,9 @@ struct TcgConfig { GX::TexMtx mtx = GX::IDENTITY; GX::PTTexMtx postMtx = GX::PTIDENTITY; bool normalize = false; - u32 _pad : 24 = 0; + u8 _p1 = 0; + u8 _p2 = 0; + u8 _p3 = 0; bool operator==(const TcgConfig&) const = default; }; static_assert(std::has_unique_object_representations_v); diff --git a/aurora/lib/gfx/gx_shader.cpp b/aurora/lib/gfx/gx_shader.cpp index fff7d627f..bf5d4390b 100644 --- a/aurora/lib/gfx/gx_shader.cpp +++ b/aurora/lib/gfx/gx_shader.cpp @@ -688,10 +688,9 @@ wgpu::ShaderModule build_shader(const ShaderConfig& config, const ShaderInfo& in } else if (attr >= GX::VA_TEX0 && attr <= GX::VA_TEX7) { arrType = "vec2"; } - uniformBindings += fmt::format( - "\n@group(0) @binding({})" - "\nvar v_arr_{}: array<{}>;", - uniBindingIdx++, attrName, arrType); + uniformBindings += fmt::format(FMT_STRING("\n@group(0) @binding({})" + "\nvar v_arr_{}: array<{}>;"), + uniBindingIdx++, attrName, arrType); } ++currAttrIdx; } diff --git a/aurora/lib/gpu.cpp b/aurora/lib/gpu.cpp index 28b4df91a..80e03f49e 100644 --- a/aurora/lib/gpu.cpp +++ b/aurora/lib/gpu.cpp @@ -150,8 +150,12 @@ void initialize(SDL_Window* window) { .limits = { // Use "best" supported alignments - .minUniformBufferOffsetAlignment = supportedLimits.limits.minUniformBufferOffsetAlignment, - .minStorageBufferOffsetAlignment = supportedLimits.limits.minStorageBufferOffsetAlignment, + .minUniformBufferOffsetAlignment = supportedLimits.limits.minUniformBufferOffsetAlignment == 0 + ? WGPU_LIMIT_U32_UNDEFINED + : supportedLimits.limits.minUniformBufferOffsetAlignment, + .minStorageBufferOffsetAlignment = supportedLimits.limits.minStorageBufferOffsetAlignment == 0 + ? WGPU_LIMIT_U32_UNDEFINED + : supportedLimits.limits.minStorageBufferOffsetAlignment, }, }; const std::array requiredFeatures{