From 4d73b11de50c10e6c44213613cffc85b03f432f9 Mon Sep 17 00:00:00 2001 From: durswd Date: Fri, 26 Feb 2021 23:29:34 +0900 Subject: [PATCH] Fix for Mac --- Dev/Cpp/Test/Backend/RenderPassTest.cpp | 4 ++-- Dev/Cpp/Test/Runtime/EffectPlatformMetal.mm | 16 ++++++---------- Dev/Cpp/Test/Runtime/ResourceManager.cpp | 8 ++++---- Dev/Cpp/Test/TestHelper.cpp | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Dev/Cpp/Test/Backend/RenderPassTest.cpp b/Dev/Cpp/Test/Backend/RenderPassTest.cpp index de0fb9ec7c..0986189573 100644 --- a/Dev/Cpp/Test/Backend/RenderPassTest.cpp +++ b/Dev/Cpp/Test/Backend/RenderPassTest.cpp @@ -2,7 +2,6 @@ #include "../Window/RenderingWindowGL.h" #include "Effekseer.h" #include -#include struct SimpleVertex { @@ -103,7 +102,8 @@ class ShiftBuffer Effekseer::Backend::DepthTextureParameter depthTexParam; depthTexParam.Size = texParam.Size; - renderPass = graphicsDevice->CreateRenderPass(textures, graphicsDevice->CreateDepthTexture(depthTexParam)); + auto depthTex = graphicsDevice->CreateDepthTexture(depthTexParam); + renderPass = graphicsDevice->CreateRenderPass(textures, depthTex); } }; diff --git a/Dev/Cpp/Test/Runtime/EffectPlatformMetal.mm b/Dev/Cpp/Test/Runtime/EffectPlatformMetal.mm index 539bb9da42..2b2340749a 100644 --- a/Dev/Cpp/Test/Runtime/EffectPlatformMetal.mm +++ b/Dev/Cpp/Test/Runtime/EffectPlatformMetal.mm @@ -132,8 +132,8 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d txt [[textur class DistortingCallbackMetal : public EffekseerRenderer::DistortingCallback { EffectPlatformMetal* platform_ = nullptr; - Effekseer::TextureData* textureData_ = nullptr; - + Effekseer::Backend::TextureRef texture_ = nullptr; + public: DistortingCallbackMetal(EffectPlatformMetal* platform) : platform_(platform) { @@ -141,22 +141,18 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d txt [[textur virtual ~DistortingCallbackMetal() { - - if (textureData_ != nullptr) - { - EffekseerRendererMetal::DeleteTextureData(textureData_); - } + texture_.Reset(); } bool OnDistorting(EffekseerRenderer::Renderer* renderer) override { - if (textureData_ == nullptr) + if (texture_ == nullptr) { auto tex = (LLGI::TextureMetal*)(platform_->GetCheckedTexture()); - textureData_ = EffekseerRendererMetal::CreateTextureData(renderer->GetGraphicsDevice(), tex->GetImpl()->texture); + texture_ = EffekseerRendererMetal::CreateTexture(renderer->GetGraphicsDevice(), tex->GetImpl()->texture); } - renderer->SetBackgroundTexture(textureData_); + renderer->SetBackground(texture_); return true; } diff --git a/Dev/Cpp/Test/Runtime/ResourceManager.cpp b/Dev/Cpp/Test/Runtime/ResourceManager.cpp index a77c01da27..0e83a732aa 100644 --- a/Dev/Cpp/Test/Runtime/ResourceManager.cpp +++ b/Dev/Cpp/Test/Runtime/ResourceManager.cpp @@ -26,12 +26,12 @@ void ResourceManager_Basic() auto texture1 = resourceManager->LoadTexture(u"Test", Effekseer::TextureType::Color); if (texture1 == nullptr) { - throw std::exception("Failed."); + throw std::string("Failed."); } auto texture2 = resourceManager->LoadTexture(u"Test", Effekseer::TextureType::Color); if (texture1 != texture2) { - throw std::exception("Failed."); + throw std::string("Failed."); } resourceManager->UnloadTexture(texture1); @@ -39,12 +39,12 @@ void ResourceManager_Basic() if (texture1->GetRef() != 2) { - throw std::exception("Failed."); + throw std::string("Failed."); } texture2.Reset(); if (texture1->GetRef() != 1) { - throw std::exception("Failed."); + throw std::string("Failed."); } texture1.Reset(); } diff --git a/Dev/Cpp/Test/TestHelper.cpp b/Dev/Cpp/Test/TestHelper.cpp index c97e150439..db077ebfbe 100644 --- a/Dev/Cpp/Test/TestHelper.cpp +++ b/Dev/Cpp/Test/TestHelper.cpp @@ -58,7 +58,7 @@ std::u16string GetDirectoryPathAsU16(const char* path) return std::u16string((const char16_t*)w.c_str()); #else char16_t dst[512]; - Effekseer::ConvertUtf8ToUtf16((int16_t*)dst, 512, (const int8_t*)p.c_str()); + Effekseer::ConvertUtf8ToUtf16(dst, 512, p.c_str()); return std::u16string(dst); #endif }