Metal support RC0 released

@yinjimmy fixed in PR 20183

Sorry I’m not sure what you mean, does that mean v4 currently can’t be made without macos catalina?
How do I create a project if the cmake script doesn’t run?

it means you can’t run on simulator if you are using catalina… everything else works on lower version of macos

Ok, but my issue wasn’t running in simulator, I posted logs of cmake not working in building the project.

What’s the command line you used? You should refer to cmake/README.md or you should use cocos command to run(except iOS).

@R101 1. As for creating Program, there are two points, one is for creating build-in Program, we recommend using the following ways since it more efficient:

ProgramState::ProgramState(ProgramType type)
{
    _program = backend::ProgramCache::getInstance()->newBuiltinProgram(type);
    CCASSERT(_program, "Not built-in program type, please use ProgramState(const std::string& vertexShader, const std::string& fragmentShader) instead.");
    CC_SAFE_RETAIN(_program);

    init();
}

backend::Program* ProgramCache::newBuiltinProgram(ProgramType type)
{
    const auto& iter = ProgramCache::_cachedPrograms.find(type);
    if (ProgramCache::_cachedPrograms.end() != iter)
        return iter->second;
    return nullptr;
}

the other is for creating user-defined Program, I think it’s a good way to pass in a user-define ID as well as with the shader sources, since it can avoid hashing the shader sources.

  1. ProgramState is designed for unshareable, each ProgramState contains its own texture and uniform data. If we create the ProgramState from a Program directly, the texture and uniform maybe override.

That is perfectly fine for predefined shader scripts, but for large user-defined scripts the current implementation seems limited. It would be great if the hash value is returned in some way so that we can use it to look up the cache to check if a Program already exists, and it would avoid calling std::hash again on the scripts.

I am aware that ProgramState is not shareable, but I don’t understand your point regarding Program. As far as I understand, Program can be used to create new instances of ProgramState; isn’t that how it is supposed to work?

sure, I will fix it later.

Got it, I misunderstood what you meant before, will fix it later.

I was using the guide at https://docs.cocos2d-x.org/cocos2d-x/v4/en/installation/CMake-Guide.html
I’ve updated to Catalina today and run it again, only experiencing a different error in missing CMakeLists for /external (which I resolved by running download/deps)

It may be worth updating the documentation to state:

  • macos Catalina is needed
  • downloading dependencies is needed in a new clone of the project

No, it is not needed.

Yep, it is needed as before. We will add documents about how to run tests and how to create and run a new project.

Anyway, it worked. (4.0RC0).

But, there are some problems,cocostudio3.1 .

(Iphone ccs3.1) wtf, Some pictures disappear. disappear. disappear.
(Android ccs3.1) is all right.
(Mac ccs3.1) is all right.

The Iphone is very hot,but Android phone No fever. why…just HelloWorld.!!
I think Iphone can fry eggs.

Look at the minor issue please:

_samplerDescriptor is not updated inside the function. Does it needed at all?

@18180920700 i think it may be an issue of ccs, and ccs is not maintained for a long time, i have not idea how to fix it.

@coulsonwang please take a look.

BTW…

macOS HS 10.13.6
cocos2dx 4.0rc0
cocostudio 3.1

I solved it:

  • Compress PNG Images
  • Remove Text Metadata From PNG Files

It seems to be caused by Xcode.
btw, What editors do you recommend?

@solan yep, the _samplerDescriptor is not used, removed in this PR.

1 Like

There are still many problems. Spine! Spine! Spine!

@18180920700 Spine is not supported right now.

So bad!!, really bad…

hope to see that as soon as possible.

@18180920700 Attached is my cocos2d-x spine runtime that works with v4. I merged the changes with a relatively recent version of the cocos2dx-spine runtime code. It also has additional custom code to make it work with both v3 and v4 (although it may not compile with v3 yet).

I did notice an issue though with v4, where it’s using an extra draw call for certain models, and I’m not entirely sure why, whether it’s a bug in Cocos2d-x v4rc0 or in the cocos2d-x v4 spine runtime.

cocos2dx-spine-v4.zip (31.3 KB)

4 Likes