Skip to content

Commit

Permalink
Fix for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
durswd committed Feb 26, 2021
1 parent b55e707 commit 4d73b11
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Dev/Cpp/Test/Backend/RenderPassTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "../Window/RenderingWindowGL.h"
#include "Effekseer.h"
#include <EffekseerRendererGL.h>
#include <Effekseer\Utils\Effekseer.CustomAllocator.h>

struct SimpleVertex
{
Expand Down Expand Up @@ -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);
}
};

Expand Down
16 changes: 6 additions & 10 deletions Dev/Cpp/Test/Runtime/EffectPlatformMetal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,27 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> 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)
{
}

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;
}
Expand Down
8 changes: 4 additions & 4 deletions Dev/Cpp/Test/Runtime/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ 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);
resourceManager->UnloadTexture(texture2);

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();
}
Expand Down
2 changes: 1 addition & 1 deletion Dev/Cpp/Test/TestHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 4d73b11

Please sign in to comment.