mirror of https://github.com/axmolengine/axmol.git
Merge branch 'master' of https://github.com/c4games/engine-x into master
This commit is contained in:
commit
c9408aadad
|
@ -34,7 +34,7 @@ jobs:
|
|||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build_x86 -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -A Win32 -DBUILD_EXTENSION_IMGUIEXT=ON
|
||||
run: cmake -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build_x86 -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -A Win32 -DBUILD_EXTENSION_IMGUIEXT=ON -DLUA_ENGINE=luajit
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
##########################################################################################
|
||||
# The engine-x Customize file classifications. #
|
||||
# Results from files under any classifier will be excluded from LGTM #
|
||||
# statistics. #
|
||||
##########################################################################################
|
||||
|
||||
##########################################################################################
|
||||
# Use the `path_classifiers` block to define changes to the default classification of #
|
||||
# files. #
|
||||
##########################################################################################
|
||||
path_classifiers:
|
||||
test:
|
||||
- tests
|
||||
library:
|
||||
- external
|
||||
|
||||
#########################################################################################
|
||||
# Use the `queries` block to change the default display of query results. #
|
||||
#########################################################################################
|
||||
queries:
|
||||
# Start by hiding the results of all queries.
|
||||
- exclude: "external"
|
||||
|
||||
#########################################################################################
|
||||
# Define changes to the default code extraction process. #
|
||||
# Each block configures the extraction of a single language, and modifies actions in a #
|
||||
# named step. Every named step includes automatic default actions, #
|
||||
# except for the 'prepare' step. The steps are performed in the following sequence: #
|
||||
# prepare #
|
||||
# after_prepare #
|
||||
# configure (C/C++ only) #
|
||||
# before_index #
|
||||
# index #
|
||||
##########################################################################################
|
||||
|
||||
#########################################################################################
|
||||
# Environment variables available to the steps: #
|
||||
#########################################################################################
|
||||
|
||||
# LGTM_SRC
|
||||
# The root of the source tree.
|
||||
# LGTM_WORKSPACE
|
||||
# An existing (initially empty) folder outside the source tree.
|
||||
# Used for temporary download and setup commands.
|
||||
|
||||
#########################################################################################
|
||||
# Use the extraction block to define changes to the default code extraction process #
|
||||
# for one or more languages. The settings for each language are defined in a child #
|
||||
# block, with one or more steps. #
|
||||
#########################################################################################
|
||||
|
||||
extraction:
|
||||
# Define settings for C/C++ analysis
|
||||
#####################################
|
||||
cpp:
|
||||
# Add an `after-prepare` step if you need to run commands after the prepare step.
|
||||
# Each command should be listed on a separate line.
|
||||
# This step is useful for C/C++ analysis where you want to prepare the environment
|
||||
# for the `configure` step without changing the default behavior for that step.
|
||||
after_prepare:
|
||||
- mkdir -p $LGTM_WORKSPACE/latest-gcc-symlinks
|
||||
- ln -s /usr/bin/g++-6 $LGTM_WORKSPACE/latest-gcc-symlinks/g++
|
||||
- ln -s /usr/bin/gcc-6 $LGTM_WORKSPACE/latest-gcc-symlinks/gcc
|
||||
- export PATH=$LGTM_WORKSPACE/latest-gcc-symlinks:$PATH
|
||||
- export GNU_MAKE=make
|
||||
- export GIT=true
|
||||
- export BUILD_TARGET=linux
|
||||
- export TRAVIS_OS_NAME=linux
|
||||
- export TRAVIS_PULL_REQUEST=true
|
||||
# The `configure` step generates build configuration files which the `index` step
|
||||
# then uses to build the codebase.
|
||||
configure:
|
||||
command:
|
||||
- cd $LGTM_SRC
|
||||
- tools/travis-scripts/before-install.sh
|
||||
# The `index` step builds the code and extracts information during the build
|
||||
# process.
|
||||
index:
|
||||
# Override the autobuild process by specifying a list of custom build commands
|
||||
# to use instead.
|
||||
build_command:
|
||||
- cd $LGTM_SRC
|
||||
- tools/travis-scripts/run-script.sh
|
|
@ -87,7 +87,7 @@
|
|||
# cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.mini.cmake "-DCMAKE_OSX_ARCHITECTURES=armv7;arm64"
|
||||
|
||||
# for simulator x86_64
|
||||
# cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.mini.cmake -DCMAKE_OSX_SYSROOT=iphonesimulator
|
||||
# cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.mini.cmake -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||
```
|
||||
4. After cmake generate finish, you can open xcode project at ```build``` folder and run cpp-tests or other test targets.
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
# cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.mini.cmake "-DCMAKE_OSX_ARCHITECTURES=armv7;arm64"
|
||||
|
||||
# for simulator x86_64
|
||||
# cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.mini.cmake -DCMAKE_OSX_SYSROOT=iphonesimulator
|
||||
# cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.mini.cmake -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||
```
|
||||
4. 之后就可以用xcode打开, 选择cpp-tests编译运行
|
||||
|
||||
|
@ -103,3 +103,4 @@
|
|||
### 参考链接
|
||||
* engine-x-3rd: https://github.com/c4games/engine-x-3rd
|
||||
* official v4: https://gitee.com/mirrors/cocos2d-x
|
||||
* Git快速手册: https://github.com/c4games/engine-x/wiki/Git-Guides
|
||||
|
|
|
@ -69,9 +69,6 @@ if (NOT DEFINED CC_FORCE_USE_GLES)
|
|||
set(CC_FORCE_USE_GLES FALSE CACHE INTERNAL "Force use GLES" )
|
||||
endif()
|
||||
|
||||
set(LUA_ENGINE "plainlua" CACHE INTERNAL "The lua core lib, luajit or plainlua")
|
||||
set(LUA_VERSION "5.3.6" CACHE INTERNAL "The plainlua version")
|
||||
|
||||
project(cocos2d_libs)
|
||||
|
||||
include(2d/CMakeLists.txt)
|
||||
|
|
|
@ -199,7 +199,6 @@ void Renderer::init()
|
|||
auto device = backend::Device::getInstance();
|
||||
_commandBuffer = device->newCommandBuffer();
|
||||
// @MTL: the depth stencil flags must same render target and _depthStencilDescriptor
|
||||
// TODO: can use one?
|
||||
_depthStencilDescriptor.depthStencilFlags = TargetBufferFlags::DEPTH_AND_STENCIL;
|
||||
_defaultRT = device->newDefaultRenderTarget(TargetBufferFlags::COLOR | _depthStencilDescriptor.depthStencilFlags);
|
||||
|
||||
|
@ -352,7 +351,6 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
|
|||
//Process Global-Z > 0 Queue
|
||||
//
|
||||
doVisitRenderQueue(queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_POS));
|
||||
|
||||
}
|
||||
|
||||
void Renderer::doVisitRenderQueue(const std::vector<RenderCommand*>& renderCommands)
|
||||
|
|
|
@ -40,6 +40,10 @@ bool StencilDescriptor::operator==(const StencilDescriptor &rhs) const
|
|||
DepthStencilState::~DepthStencilState()
|
||||
{}
|
||||
|
||||
bool DepthStencilState::isEnabled() const {
|
||||
return bitmask::any(_depthStencilInfo.depthStencilFlags, TargetBufferFlags::DEPTH_AND_STENCIL);
|
||||
}
|
||||
|
||||
void DepthStencilState::update(const DepthStencilDescriptor& descriptor) {
|
||||
_depthStencilInfo = descriptor;
|
||||
_isBackFrontStencilEqual = descriptor.backFaceStencil == descriptor.frontFaceStencil;
|
||||
|
|
|
@ -74,7 +74,7 @@ class DepthStencilState : public cocos2d::Ref
|
|||
public:
|
||||
virtual void update(const DepthStencilDescriptor& descriptor);
|
||||
const DepthStencilDescriptor& getDepthStencilInfo()const { return _depthStencilInfo; }
|
||||
bool isEnabled() const { return bitmask::any(_depthStencilInfo.depthStencilFlags, TargetBufferFlags::DEPTH_AND_STENCIL); }
|
||||
bool isEnabled() const;
|
||||
protected:
|
||||
/**
|
||||
* @param descriptor Specifies depth and stencil descriptor.
|
||||
|
|
|
@ -226,6 +226,7 @@ private:
|
|||
dispatch_semaphore_t _frameBoundarySemaphore;
|
||||
const RenderTarget* _currentRenderTarget = nil; // weak ref
|
||||
RenderPassParams _currentRenderPassParams;
|
||||
TargetBufferFlags _currentRenderTargetFlags = TargetBufferFlags::NONE;
|
||||
NSAutoreleasePool* _autoReleasePool = nil;
|
||||
|
||||
std::vector<std::pair<TextureBackend*,std::function<void(const PixelBufferDescriptor&)>>> _captureCallbacks;
|
||||
|
|
|
@ -200,15 +200,17 @@ void CommandBufferMTL::beginFrame()
|
|||
|
||||
id<MTLRenderCommandEncoder> CommandBufferMTL::getRenderCommandEncoder(const RenderTarget* renderTarget, const RenderPassParams& renderPassParams)
|
||||
{
|
||||
if(_mtlRenderEncoder != nil && _currentRenderPassParams == renderPassParams && _currentRenderTarget == renderTarget)
|
||||
if(_mtlRenderEncoder != nil &&
|
||||
_currentRenderPassParams == renderPassParams &&
|
||||
_currentRenderTarget == renderTarget &&
|
||||
_currentRenderTargetFlags == renderTarget->getTargetFlags())
|
||||
{
|
||||
return _mtlRenderEncoder;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentRenderTarget = renderTarget;
|
||||
_currentRenderPassParams = renderPassParams;
|
||||
}
|
||||
|
||||
_currentRenderTarget = renderTarget;
|
||||
_currentRenderPassParams = renderPassParams;
|
||||
_currentRenderTargetFlags = renderTarget->getTargetFlags();
|
||||
|
||||
if(_mtlRenderEncoder != nil)
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
void setBlendState(MTLRenderPipelineColorAttachmentDescriptor*, const BlendDescriptor&);
|
||||
void setShaderModules(const PipelineDescriptor&);
|
||||
void setBlendStateAndFormat(const BlendDescriptor&);
|
||||
void getAttachmentFormat(const RenderTarget* renderTarget, PixelFormat colorAttachmentsFormat[MAX_COLOR_ATTCHMENT], PixelFormat&, PixelFormat&);
|
||||
void chooseAttachmentFormat(const RenderTarget* renderTarget, PixelFormat colorAttachmentsFormat[MAX_COLOR_ATTCHMENT], PixelFormat&, PixelFormat&);
|
||||
|
||||
id<MTLRenderPipelineState> _mtlRenderPipelineState = nil;
|
||||
id<MTLDevice> _mtlDevice = nil;
|
||||
|
|
|
@ -183,7 +183,7 @@ void RenderPipelineMTL::update(const RenderTarget* renderTarget, const PipelineD
|
|||
|
||||
memset(&hashMe, 0, sizeof(hashMe));
|
||||
const auto& blendDescriptor = pipelineDescirptor.blendDescriptor;
|
||||
getAttachmentFormat(renderTarget, _colorAttachmentsFormat, _depthAttachmentFormat, _stencilAttachmentFormat);
|
||||
chooseAttachmentFormat(renderTarget, _colorAttachmentsFormat, _depthAttachmentFormat, _stencilAttachmentFormat);
|
||||
auto program = static_cast<ProgramMTL*>(pipelineDescirptor.programState->getProgram());
|
||||
hashMe.vertexShaderHash = program->getVertexShader()->getHashValue();
|
||||
hashMe.fragmentShaderHash = program->getFragmentShader()->getHashValue();
|
||||
|
@ -292,33 +292,21 @@ void RenderPipelineMTL::setShaderModules(const PipelineDescriptor& descriptor)
|
|||
_mtlRenderPipelineDescriptor.fragmentFunction = fragShaderModule->getMTLFunction();
|
||||
}
|
||||
|
||||
void RenderPipelineMTL::getAttachmentFormat(const RenderTarget* renderTarget,
|
||||
void RenderPipelineMTL::chooseAttachmentFormat(const RenderTarget* renderTarget,
|
||||
PixelFormat colorAttachmentsFormat[MAX_COLOR_ATTCHMENT],
|
||||
PixelFormat& depthFormat,
|
||||
PixelFormat& stencilFormat)
|
||||
{
|
||||
// choose color attachment format
|
||||
auto rtMTL = static_cast<const RenderTargetMTL*>(renderTarget);
|
||||
auto rtflags = rtMTL->getTargetFlags();
|
||||
for(auto i = 0; i < MAX_COLOR_ATTCHMENT; ++i) {
|
||||
if (bitmask::any(rtflags, getMRTColorFlag(i)))
|
||||
{
|
||||
colorAttachmentsFormat[i] = rtMTL->getColorAttachmentPixelFormat(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
colorAttachmentsFormat[i] = PixelFormat::NONE;
|
||||
}
|
||||
colorAttachmentsFormat[i] = bitmask::any(rtflags, getMRTColorFlag(i)) ? rtMTL->getColorAttachmentPixelFormat(i) : PixelFormat::NONE;
|
||||
}
|
||||
|
||||
if (bitmask::any(rtflags, RenderTargetFlag::DEPTH_AND_STENCIL))
|
||||
{
|
||||
depthFormat = rtMTL->getDepthAttachmentPixelFormat();
|
||||
stencilFormat =rtMTL->getStencilAttachmentPixelFormat();
|
||||
}
|
||||
else
|
||||
{
|
||||
depthFormat = stencilFormat = PixelFormat::NONE;
|
||||
}
|
||||
// choose depth and stencil attachment format, match RenderTargetMTL::applyRenderPassAttachments
|
||||
depthFormat = bitmask::any(rtflags, RenderTargetFlag::DEPTH) ? rtMTL->getDepthAttachmentPixelFormat() : PixelFormat::NONE;
|
||||
stencilFormat = bitmask::any(rtflags, RenderTargetFlag::STENCIL) ? rtMTL->getStencilAttachmentPixelFormat() : PixelFormat::NONE;
|
||||
}
|
||||
|
||||
void RenderPipelineMTL::setBlendStateAndFormat(const BlendDescriptor& blendDescriptor)
|
||||
|
|
|
@ -96,25 +96,31 @@ void RenderTargetMTL::applyRenderPassAttachments(const RenderPassParams& params,
|
|||
#endif
|
||||
}
|
||||
|
||||
auto depthAttachment = getDepthAttachment();
|
||||
if(depthAttachment){
|
||||
descriptor.depthAttachment.texture = depthAttachment.texture;
|
||||
descriptor.depthAttachment.level = depthAttachment.level;
|
||||
// descriptor.depthAttachment.slice = depthAttachment.layer;
|
||||
descriptor.depthAttachment.loadAction = getLoadAction(params, TargetBufferFlags::DEPTH);
|
||||
descriptor.depthAttachment.storeAction = getStoreAction(params, TargetBufferFlags::DEPTH);
|
||||
descriptor.depthAttachment.clearDepth = params.clearDepthValue;
|
||||
// Sets descriptor depth and stencil params, should match RenderTargetMTL::chooseAttachmentFormat
|
||||
if(bitmask::any(this->_flags, RenderTargetFlag::DEPTH)) {
|
||||
auto depthAttachment = getDepthAttachment();
|
||||
if(depthAttachment){
|
||||
descriptor.depthAttachment.texture = depthAttachment.texture;
|
||||
descriptor.depthAttachment.level = depthAttachment.level;
|
||||
// descriptor.depthAttachment.slice = depthAttachment.layer;
|
||||
descriptor.depthAttachment.loadAction = getLoadAction(params, TargetBufferFlags::DEPTH);
|
||||
descriptor.depthAttachment.storeAction = getStoreAction(params, TargetBufferFlags::DEPTH);
|
||||
descriptor.depthAttachment.clearDepth = params.clearDepthValue;
|
||||
}
|
||||
}
|
||||
|
||||
auto stencilAttachment = getStencilAttachment();
|
||||
if(stencilAttachment) {
|
||||
descriptor.stencilAttachment.texture = stencilAttachment.texture;
|
||||
descriptor.stencilAttachment.level = depthAttachment.level;
|
||||
// descriptor.stencilAttachment.slice = depthAttachment.layer;
|
||||
descriptor.stencilAttachment.loadAction = getLoadAction(params, TargetBufferFlags::STENCIL);
|
||||
descriptor.stencilAttachment.storeAction = getStoreAction(params, TargetBufferFlags::STENCIL);
|
||||
descriptor.stencilAttachment.clearStencil= params.clearStencilValue;
|
||||
if(bitmask::any(this->_flags, RenderTargetFlag::STENCIL)) {
|
||||
auto stencilAttachment = getStencilAttachment();
|
||||
if(stencilAttachment) {
|
||||
descriptor.stencilAttachment.texture = stencilAttachment.texture;
|
||||
descriptor.stencilAttachment.level = stencilAttachment.level;
|
||||
// descriptor.stencilAttachment.slice = depthAttachment.layer;
|
||||
descriptor.stencilAttachment.loadAction = getLoadAction(params, TargetBufferFlags::STENCIL);
|
||||
descriptor.stencilAttachment.storeAction = getStoreAction(params, TargetBufferFlags::STENCIL);
|
||||
descriptor.stencilAttachment.clearStencil = params.clearStencilValue;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (multisampledDepth) {
|
||||
// We're rendering into our temporary MSAA texture and doing an automatic resolve.
|
||||
|
@ -171,7 +177,7 @@ PixelFormat RenderTargetMTL::getColorAttachmentPixelFormat(int index) const
|
|||
|
||||
PixelFormat RenderTargetMTL::getDepthAttachmentPixelFormat() const
|
||||
{ // FIXME: engine-x only support D24S8
|
||||
if(bitmask::any(_flags, TargetBufferFlags::DEPTH_AND_STENCIL)) {
|
||||
if(bitmask::any(_flags, TargetBufferFlags::DEPTH)) {
|
||||
if(isDefaultRenderTarget() || !_depth)
|
||||
return PixelFormat::D24S8;
|
||||
return _depth.texture->getTextureFormat();
|
||||
|
@ -181,7 +187,7 @@ PixelFormat RenderTargetMTL::getDepthAttachmentPixelFormat() const
|
|||
|
||||
PixelFormat RenderTargetMTL::getStencilAttachmentPixelFormat() const
|
||||
{ // FIXME: engine-x only support D24S8
|
||||
if(bitmask::any(_flags, TargetBufferFlags::DEPTH_AND_STENCIL)) {
|
||||
if(bitmask::any(_flags, TargetBufferFlags::STENCIL)) {
|
||||
if(isDefaultRenderTarget() || !_stencil)
|
||||
return PixelFormat::D24S8;
|
||||
return _stencil.texture->getTextureFormat();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "v86",
|
||||
"version": "v88",
|
||||
"zip_file_size": "107642814",
|
||||
"repo_name": "engine-x-3rd",
|
||||
"repo_parent": "https://github.com/c4games/",
|
||||
|
|
Loading…
Reference in New Issue