mirror of https://github.com/axmolengine/axmol.git
Fix ci
This commit is contained in:
parent
7f77a5e9f4
commit
e84982f86d
|
@ -175,6 +175,8 @@ public:
|
|||
*/
|
||||
virtual void endFrame() override;
|
||||
|
||||
void endEncoding();
|
||||
|
||||
/**
|
||||
* Fixed-function state
|
||||
* @param lineWidth Specifies the width of rasterized lines.
|
||||
|
@ -196,6 +198,10 @@ public:
|
|||
* @param callback A callback to deal with pixel data read.
|
||||
*/
|
||||
virtual void readPixels(RenderTarget* rt, std::function<void(const PixelBufferDescriptor&)> callback) override;
|
||||
|
||||
id<MTLRenderCommandEncoder> getRenderCommandEncoder() const { return _mtlRenderEncoder; }
|
||||
|
||||
id<MTLCommandBuffer> getMTLCommandBuffer() const { return _mtlCommandBuffer; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
@ -347,6 +347,15 @@ void CommandBufferMTL::endFrame()
|
|||
[_autoReleasePool drain];
|
||||
}
|
||||
|
||||
void CommandBufferMTL::endEncoding()
|
||||
{
|
||||
if (_mtlRenderEncoder) {
|
||||
[_mtlRenderEncoder endEncoding];
|
||||
[_mtlRenderEncoder release];
|
||||
}
|
||||
_mtlRenderEncoder = nil;
|
||||
}
|
||||
|
||||
void CommandBufferMTL::flush()
|
||||
{
|
||||
if (_mtlCommandBuffer)
|
||||
|
|
|
@ -58,6 +58,10 @@ struct UtilsMTL
|
|||
static void updateDefaultColorAttachmentTexture(id<MTLTexture> texture);
|
||||
static void resizeDefaultAttachmentTexture(std::size_t width, std::size_t height);
|
||||
|
||||
static MTLPixelFormat getDefaultColorAttachmentPixelFormat();
|
||||
|
||||
static MTLPixelFormat getDefaultDepthStencilAttachmentPixelFormat();
|
||||
|
||||
/**
|
||||
* Get the default combined depth and stencil texture.
|
||||
* @return The default combined depth and stencil texture.
|
||||
|
|
|
@ -122,6 +122,16 @@ void UtilsMTL::initGPUTextureFormats()
|
|||
info.fmt = getSupportedDepthStencilFormat();
|
||||
}
|
||||
|
||||
MTLPixelFormat UtilsMTL::getDefaultColorAttachmentPixelFormat()
|
||||
{
|
||||
return MTLPixelFormatBGRA8Unorm;
|
||||
}
|
||||
|
||||
MTLPixelFormat UtilsMTL::getDefaultDepthStencilAttachmentPixelFormat()
|
||||
{
|
||||
return getSupportedDepthStencilFormat();
|
||||
}
|
||||
|
||||
id<MTLTexture> UtilsMTL::getDefaultDepthStencilTexture()
|
||||
{
|
||||
if (!_defaultDepthStencilAttachmentTexture)
|
||||
|
|
|
@ -99,8 +99,10 @@ if (APPLE)
|
|||
set_target_properties (LLGI PROPERTIES FOLDER Extensions/Effekseer)
|
||||
endif()
|
||||
|
||||
add_subdirectory(EffekseerRendererGL)
|
||||
set_target_properties (EffekseerRendererGL PROPERTIES FOLDER Extensions/Effekseer)
|
||||
if (NOT APPLE)
|
||||
add_subdirectory(EffekseerRendererGL)
|
||||
set_target_properties (EffekseerRendererGL PROPERTIES FOLDER Extensions/Effekseer)
|
||||
endif()
|
||||
|
||||
add_subdirectory(EffekseerForCocos2d-x)
|
||||
|
||||
|
|
|
@ -33,10 +33,12 @@ if (APPLE)
|
|||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PUBLIC EffekseerRendererMetal
|
||||
PUBLIC EffekseerRendererGL)
|
||||
# PUBLIC EffekseerRendererGL
|
||||
)
|
||||
|
||||
add_dependencies(${PROJECT_NAME} EffekseerRendererMetal)
|
||||
add_dependencies(${PROJECT_NAME} EffekseerRendererGL)
|
||||
|
||||
# add_dependencies(${PROJECT_NAME} EffekseerRendererGL)
|
||||
else()
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC ../EffekseerRendererGL/)
|
||||
|
|
|
@ -20,11 +20,13 @@ void SetMTLObjectsFromCocos2d(Effekseer::RefPtr<EffekseerRenderer::CommandList>
|
|||
auto bufferM = static_cast<cocos2d::backend::CommandBufferMTL*>(buffer);
|
||||
|
||||
// use render pass descriptor from Cocos and add depth test
|
||||
auto descriptor = renderer->getRenderPassDescriptor();
|
||||
descriptor.depthTestEnabled = true;
|
||||
// auto descriptor = d->getRenderPassDescriptor();
|
||||
// ax::backend::RenderPassDescriptor descriptor;
|
||||
// descriptor.flags.clear = true;
|
||||
// using axmol render pass
|
||||
auto target = renderer->getRenderTarget();
|
||||
bufferM->beginRenderPass(target, descriptor);
|
||||
|
||||
renderer->beginRenderPass();
|
||||
auto v = renderer->getViewport();
|
||||
// important for ensuring znear and zfar are in sync with Cocos
|
||||
bufferM->setViewport(v.x, v.y, v.w, v.h);
|
||||
|
@ -84,7 +86,8 @@ bool DistortingCallbackMetal::OnDistorting(EffekseerRenderer::Renderer* renderer
|
|||
textureInternal_ = EffekseerRendererMetal::CreateTexture(renderer->GetGraphicsDevice(), texture);
|
||||
}
|
||||
|
||||
auto commandBuffer = static_cast<cocos2d::backend::CommandBufferMTL*>(cocos2d::Director::getInstance()->getCommandBuffer());
|
||||
auto rendererAX = cocos2d::Director::getInstance()->getRenderer();
|
||||
auto commandBuffer = static_cast<cocos2d::backend::CommandBufferMTL*>(rendererAX->getCommandBuffer());
|
||||
commandBuffer->endEncoding();
|
||||
|
||||
EffekseerRendererMetal::EndCommandList(commandList_);
|
||||
|
@ -172,7 +175,7 @@ void UpdateTextureData(::Effekseer::TextureRef textureData, cocos2d::Texture2D*
|
|||
auto textureMTL = static_cast<cocos2d::backend::TextureMTL*>(texture->getBackendTexture());
|
||||
auto device = EffekseerGraphicsDevice::create().DownCast<::EffekseerRendererLLGI::Backend::GraphicsDevice>();
|
||||
|
||||
auto backend = device->CreateTexture(reinterpret_cast<uint64_t>(textureMTL->getMTLTexture()), []() -> void {});
|
||||
auto backend = device->CreateTexture(textureMTL->getHandler(), []() -> void {});
|
||||
textureData->SetBackend(backend);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue