use GLES3 on iOS (#2316)

* use GLES3 on iOS

* add GLSL300 version define

Co-authored-by: coulsonwang <coulsonwang@126.com>
This commit is contained in:
minggo
2020-03-24 14:35:04 +08:00
committed by GitHub
parent ad4c0dd5c1
commit dd1054d45d
24 changed files with 1021 additions and 695 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -19,7 +19,7 @@ class CC_CORE_API GFXContext : public Object {
CC_INLINE GFXContext* getSharedContext() const { return _sharedContext; }
CC_INLINE GFXVsyncMode getVsyncMode() const { return _vsyncMode; }
CC_INLINE GFXFormat getColorFormat() const { return _colorFmt; }
CC_INLINE GFXFormat getDetphStencilFormat() const { return _depthStencilFmt; }
CC_INLINE GFXFormat getDepthStencilFormat() const { return _depthStencilFmt; }
protected:
GFXDevice* _device = nullptr;
+11 -1
View File
@@ -1,6 +1,6 @@
#include "CoreStd.h"
#include "GFXDevice.h"
#include "GFXContext.h"
NS_CC_BEGIN
GFXDevice::GFXDevice()
@@ -11,4 +11,14 @@ GFXDevice::GFXDevice()
GFXDevice::~GFXDevice() {
}
GFXFormat GFXDevice::getColorFormat() const
{
return _context->getColorFormat();
}
GFXFormat GFXDevice::getDepthStencilFormat() const
{
return _context->getDepthStencilFormat();
}
NS_CC_END
+36 -4
View File
@@ -32,7 +32,8 @@ class CC_CORE_API GFXDevice : public Object {
virtual GFXPipelineLayout* createPipelineLayout(const GFXPipelineLayoutInfo& info) = 0;
virtual void copyBuffersToTexture(const GFXDataArray& buffers, GFXTexture* dst, const GFXBufferTextureCopyList& regions) = 0;
CC_INLINE GFXAPI getAPI() const { return _api; }
CC_INLINE GFXAPI getGfxAPI() const { return _gfxAPI; }
CC_INLINE const String& getDeviceName() const { return _deviceName; }
CC_INLINE uint getWidth() { return _width; }
CC_INLINE uint getHeight() { return _height; }
CC_INLINE uint getNativeWidth() { return _nativeWidth; }
@@ -47,11 +48,28 @@ class CC_CORE_API GFXDevice : public Object {
CC_INLINE uint getNumDrawCalls() const { return _numDrawCalls; }
CC_INLINE uint getNumInstances() const { return _numInstances; }
CC_INLINE uint getNumTris() const { return _numTriangles; }
CC_INLINE int getMaxVertexAttributes() const { return _maxVertexAttributes; }
CC_INLINE int getMaxVertexUniformVectors() const { return _maxVertexUniformVectors; }
CC_INLINE int getMaxFragmentUniformVectors() const { return _maxFragmentUniformVectors; }
CC_INLINE int getMaxTextureUnits() const { return _maxTextureUnits; }
CC_INLINE int getMaxVertexTextureUnits() const { return _maxVertexTextureUnits; }
CC_INLINE int getMaxUniformBufferBindings() const { return _maxUniformBufferBindings; }
CC_INLINE int getMaxUniformBlockSize() const { return _maxUniformBlockSize; }
CC_INLINE int getMaxTextureSize() const { return _maxTextureSize; }
CC_INLINE int getMaxCubeMapTextureSize() const { return _maxCubeMapTextureSize; }
CC_INLINE int getDepthBits() const { return _depthBits; }
CC_INLINE int getStencilBits() const { return _stencilBits; }
CC_INLINE uint getShaderIdGen() { return _shaderIdGen++; }
CC_INLINE bool getReverseCW() const { return _reverseCW; }
GFXFormat getColorFormat() const;
GFXFormat getDepthStencilFormat() const;
CC_INLINE bool hasFeature(GFXFeature feature) const { return _features[static_cast<uint8_t>(feature)]; }
CC_INLINE void defineMacro(const String& macro, const String& value) { _macros[macro] = value; }
CC_INLINE void setReverseCW(bool reverseCW) { _reverseCW = reverseCW; }
protected:
GFXAPI _api = GFXAPI::UNKNOWN;
String _device_name;
GFXAPI _gfxAPI = GFXAPI::UNKNOWN;
String _deviceName;
String _renderer;
String _vendor;
String _version;
@@ -69,6 +87,20 @@ class CC_CORE_API GFXDevice : public Object {
uint _numDrawCalls = 0;
uint _numInstances = 0;
uint _numTriangles = 0;
int _maxVertexAttributes = -1;
int _maxVertexUniformVectors = -1;
int _maxFragmentUniformVectors = -1;
int _maxTextureUnits = -1;
int _maxVertexTextureUnits = -1;
int _maxUniformBufferBindings = GFX_MAX_BUFFER_BINDINGS;
int _maxUniformBlockSize = -1;
int _maxTextureSize = -1;
int _maxCubeMapTextureSize = -1;
int _depthBits = -1;
int _stencilBits = -1;
bool _reverseCW = false;
uint _shaderIdGen = 0;
std::unordered_map<String, String> _macros;
};
NS_CC_END
+1 -1
View File
@@ -24,7 +24,7 @@ class CC_CORE_API GFXWindow : public GFXObject {
CC_INLINE uint getNativeWidth() const { return _nativeWidth; }
CC_INLINE uint getNativeHeight() const { return _nativeHeight; }
CC_INLINE GFXFormat getColorFormat() const { return _colorFmt; }
CC_INLINE GFXFormat getDetphStencilFormat() const { return _depthStencilFmt; }
CC_INLINE GFXFormat getDepthStencilFormat() const { return _depthStencilFmt; }
CC_INLINE bool isOffscreen() const { return _isOffscreen; }
CC_INLINE GFXRenderPass* getRenderPass() const { return _renderPass; }
CC_INLINE GFXTexture* getColorTexture() const { return _colorTex; }
@@ -249,7 +249,7 @@ bool GLES2Context::initialize(const GFXContextInfo &info) {
_eglConfig = sharedCtx->egl_config();
_eglSharedContext = sharedCtx->egl_shared_ctx();
_colorFmt = sharedCtx->getColorFormat();
_depthStencilFmt = sharedCtx->getDetphStencilFormat();
_depthStencilFmt = sharedCtx->getDepthStencilFormat();
EGLint pbuff_attribs[] =
{
+14 -2
View File
@@ -31,7 +31,8 @@ GLES2Device::~GLES2Device()
bool GLES2Device::initialize(const GFXDeviceInfo& info)
{
_api = GFXAPI::GLES2;
_gfxAPI = GFXAPI::GLES2;
_deviceName = "GLES2";
_width = info.width;
_height = info.height;
_nativeWidth = info.nativeWidth;
@@ -115,7 +116,7 @@ bool GLES2Device::initialize(const GFXDeviceInfo& info)
GFXWindowInfo window_info;
window_info.colorFmt = _context->getColorFormat();
window_info.depthStencilFmt = _context->getDetphStencilFormat();
window_info.depthStencilFmt = _context->getDepthStencilFormat();
window_info.isOffscreen = false;
_window = createWindow(window_info);
@@ -125,6 +126,17 @@ bool GLES2Device::initialize(const GFXDeviceInfo& info)
GFXCommandAllocatorInfo cmd_alloc_info;
_cmdAllocator = createCommandAllocator(cmd_alloc_info);
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &_maxVertexAttributes);
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &_maxVertexUniformVectors);
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &_maxFragmentUniformVectors);
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &_maxTextureUnits);
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &_maxVertexTextureUnits);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_maxTextureSize);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &_maxCubeMapTextureSize);
glGetIntegerv(GL_DEPTH_BITS, &_depthBits);
glGetIntegerv(GL_STENCIL_BITS, &_stencilBits);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &_maxCubeMapTextureSize);
return true;
}
@@ -643,8 +643,7 @@ void GLES3CmdFuncUpdateBuffer(GLES3Device* device, GLES3GPUBuffer* gpuBuffer, vo
}
memcpy((uint8_t*)gpuBuffer->indirects.data() + offset, buffer, size);
}
else if (gpuBuffer->usage & GFXBufferUsageBit::TRANSFER_SRC ||
gpuBuffer->usage & GFXBufferUsageBit::TRANSFER_DST)
else if (gpuBuffer->usage & GFXBufferUsageBit::TRANSFER_SRC)
{
memcpy((uint8_t*)gpuBuffer->buffer + offset, buffer, size);
}
@@ -937,8 +936,9 @@ void GLES3CmdFuncCreateShader(GLES3Device* device, GLES3GPUShader* gpuShader) {
}
gpu_stage.glShader = glCreateShader(gl_shader_type);
const char* shader_src = gpu_stage.source.c_str();
glShaderSource(gpu_stage.glShader, 1, (const GLchar**)&shader_src, nullptr);
String shaderSource = "#version 300 es\n" + gpu_stage.source;
const char* source = shaderSource.c_str();
glShaderSource(gpu_stage.glShader, 1, (const GLchar**)&source, nullptr);
glCompileShader(gpu_stage.glShader);
glGetShaderiv(gpu_stage.glShader, GL_COMPILE_STATUS, &status);
@@ -257,7 +257,7 @@ bool GLES3Context::initialize(const GFXContextInfo &info) {
_eglConfig = sharedCtx->egl_config();
_eglSharedContext = sharedCtx->egl_shared_ctx();
_colorFmt = sharedCtx->getColorFormat();
_depthStencilFmt = sharedCtx->getDetphStencilFormat();
_depthStencilFmt = sharedCtx->getDepthStencilFormat();
EGLint pbuff_attribs[] =
{
+14 -2
View File
@@ -30,7 +30,8 @@ GLES3Device::~GLES3Device()
bool GLES3Device::initialize(const GFXDeviceInfo& info)
{
_api = GFXAPI::GLES3;
_gfxAPI = GFXAPI::GLES3;
_deviceName = "GLES3";
_width = info.width;
_height = info.height;
_nativeWidth = info.nativeWidth;
@@ -108,7 +109,7 @@ bool GLES3Device::initialize(const GFXDeviceInfo& info)
GFXWindowInfo window_info;
window_info.colorFmt = _context->getColorFormat();
window_info.depthStencilFmt = _context->getDetphStencilFormat();
window_info.depthStencilFmt = _context->getDepthStencilFormat();
window_info.isOffscreen = false;
_window = createWindow(window_info);
@@ -119,6 +120,17 @@ bool GLES3Device::initialize(const GFXDeviceInfo& info)
GFXCommandAllocatorInfo cmd_alloc_info;
_cmdAllocator = createCommandAllocator(cmd_alloc_info);
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &_maxVertexAttributes);
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &_maxVertexUniformVectors);
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &_maxFragmentUniformVectors);
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &_maxTextureUnits);
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &_maxVertexTextureUnits);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_maxTextureSize);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &_maxCubeMapTextureSize);
glGetIntegerv(GL_DEPTH_BITS, &_depthBits);
glGetIntegerv(GL_STENCIL_BITS, &_stencilBits);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &_maxCubeMapTextureSize);
return true;
}
@@ -150,6 +150,7 @@ void GLES3Window::resize(uint width, uint height) {
_framebuffer->destroy();
GFXFramebufferInfo fboInfo;
fboInfo.isOffscreen = _isOffscreen;
fboInfo.renderPass = _renderPass;
fboInfo.colorViews.push_back(_colorTexView);
fboInfo.depthStencilView = _depthStencilTexView;
+9 -30
View File
@@ -55,40 +55,18 @@ static CFURLRef g_es3BundleURL;
static int open_libgl(void)
{
CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework");
NSString *sysVersion = [UIDevice currentDevice].systemVersion;
NSArray *sysVersionComponents = [sysVersion componentsSeparatedByString:@"."];
//BOOL isSimulator = ([[UIDevice currentDevice].model rangeOfString:@"Simulator"].location != NSNotFound);
#if TARGET_IPHONE_SIMULATOR
bool isSimulator = true;
CFStringRef frameworkPath = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework");
#else
bool isSimulator = false;
CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework");
#endif
if(isSimulator)
{
// Ask where Xcode is installed
std::string xcodePath = "/Applications/Xcode.app/Contents/Developer\n";
// The result contains an end line character. Remove it.
size_t pos = xcodePath.find("\n");
xcodePath.erase(pos);
char tempPath[PATH_MAX];
sprintf(tempPath,
"%s/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.%s.sdk/System/Library/Frameworks/OpenGLES.framework",
xcodePath.c_str(),
[[sysVersionComponents objectAtIndex:0] cStringUsingEncoding:NSUTF8StringEncoding],
[[sysVersionComponents objectAtIndex:1] cStringUsingEncoding:NSUTF8StringEncoding]);
frameworkPath = CFStringCreateWithCString(kCFAllocatorDefault, tempPath, kCFStringEncodingUTF8);
}
g_es3BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
frameworkPath,
kCFURLPOSIXPathStyle, true);
frameworkPath,
kCFURLPOSIXPathStyle, true);
CFRelease(frameworkPath);
g_es3Bundle = CFBundleCreate(kCFAllocatorDefault, g_es3BundleURL);
return (g_es3Bundle != NULL);
@@ -158,7 +136,8 @@ int gles3wInit(void)
{
if (!open_libgl())
{
return 0;
NSLog(@"Failed to open libgl");
return 0;
}
load_procs();
+2 -1
View File
@@ -26,7 +26,8 @@ CCMTLDevice::~CCMTLDevice() {}
bool CCMTLDevice::initialize(const GFXDeviceInfo& info)
{
_api = GFXAPI::METAL;
_gfxAPI = GFXAPI::METAL;
_deviceName = "Metal";
_width = info.width;
_height = info.height;
_nativeWidth = info.nativeWidth;
@@ -1,7 +1,7 @@
#include "scripting/js-bindings/auto/jsb_gfx_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "renderer/gfx-gles2/GFXGLES2.h"
#include "renderer/core/Core.h"
#ifndef JSB_ALLOC
#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__)
@@ -17661,151 +17661,6 @@ bool js_register_gfx_GFXQueue(se::Object* obj)
return true;
}
se::Object* __jsb_cocos2d_GLES2Device_proto = nullptr;
se::Class* __jsb_cocos2d_GLES2Device_class = nullptr;
static bool js_gfx_GLES2Device_checkExtension(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_checkExtension : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
cocos2d::String arg0;
arg0 = args[0].toStringForce().c_str();
SE_PRECONDITION2(ok, false, "js_gfx_GLES2Device_checkExtension : Error processing arguments");
bool result = cobj->checkExtension(arg0);
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gfx_GLES2Device_checkExtension : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_checkExtension)
static bool js_gfx_GLES2Device_useInstancedArrays(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_useInstancedArrays : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useInstancedArrays();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gfx_GLES2Device_useInstancedArrays : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_useInstancedArrays)
static bool js_gfx_GLES2Device_useVAO(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_useVAO : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useVAO();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gfx_GLES2Device_useVAO : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_useVAO)
static bool js_gfx_GLES2Device_useDrawInstanced(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_useDrawInstanced : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useDrawInstanced();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gfx_GLES2Device_useDrawInstanced : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_useDrawInstanced)
static bool js_gfx_GLES2Device_useDiscardFramebuffer(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_useDiscardFramebuffer : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useDiscardFramebuffer();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gfx_GLES2Device_useDiscardFramebuffer : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_useDiscardFramebuffer)
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_GLES2Device_finalize)
static bool js_gfx_GLES2Device_constructor(se::State& s)
{
cocos2d::GLES2Device* cobj = JSB_ALLOC(cocos2d::GLES2Device);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
return true;
}
SE_BIND_CTOR(js_gfx_GLES2Device_constructor, __jsb_cocos2d_GLES2Device_class, js_cocos2d_GLES2Device_finalize)
extern se::Object* __jsb_cocos2d_GFXDevice_proto;
static bool js_cocos2d_GLES2Device_finalize(se::State& s)
{
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::GLES2Device)", s.nativeThisObject());
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject());
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cocos2d_GLES2Device_finalize)
bool js_register_gfx_GLES2Device(se::Object* obj)
{
auto cls = se::Class::create("GLES2Device", obj, __jsb_cocos2d_GFXDevice_proto, _SE(js_gfx_GLES2Device_constructor));
cls->defineFunction("checkExtension", _SE(js_gfx_GLES2Device_checkExtension));
cls->defineFunction("useInstancedArrays", _SE(js_gfx_GLES2Device_useInstancedArrays));
cls->defineFunction("useVAO", _SE(js_gfx_GLES2Device_useVAO));
cls->defineFunction("useDrawInstanced", _SE(js_gfx_GLES2Device_useDrawInstanced));
cls->defineFunction("useDiscardFramebuffer", _SE(js_gfx_GLES2Device_useDiscardFramebuffer));
cls->defineFinalizeFunction(_SE(js_cocos2d_GLES2Device_finalize));
cls->install();
JSBClassType::registerClass<cocos2d::GLES2Device>(cls);
__jsb_cocos2d_GLES2Device_proto = cls->getProto();
__jsb_cocos2d_GLES2Device_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_gfx(se::Object* obj)
{
// Get the ns
@@ -17857,7 +17712,6 @@ bool register_all_gfx(se::Object* obj)
js_register_gfx_GFXCommandBuffer(ns);
js_register_gfx_GFXColorAttachment(ns);
js_register_gfx_GFXCommandBufferInfo(ns);
js_register_gfx_GLES2Device(ns);
js_register_gfx_GFXBindingLayout(ns);
js_register_gfx_GFXTexture(ns);
js_register_gfx_GFXQueue(ns);
@@ -474,15 +474,3 @@ SE_DECLARE_FUNC(js_gfx_GFXQueue_initialize);
SE_DECLARE_FUNC(js_gfx_GFXQueue_destroy);
SE_DECLARE_FUNC(js_gfx_GFXQueue_GFXQueue);
extern se::Object* __jsb_cocos2d_GLES2Device_proto;
extern se::Class* __jsb_cocos2d_GLES2Device_class;
bool js_register_cocos2d_GLES2Device(se::Object* obj);
bool register_all_gfx(se::Object* obj);
SE_DECLARE_FUNC(js_gfx_GLES2Device_checkExtension);
SE_DECLARE_FUNC(js_gfx_GLES2Device_useInstancedArrays);
SE_DECLARE_FUNC(js_gfx_GLES2Device_useVAO);
SE_DECLARE_FUNC(js_gfx_GLES2Device_useDrawInstanced);
SE_DECLARE_FUNC(js_gfx_GLES2Device_useDiscardFramebuffer);
SE_DECLARE_FUNC(js_gfx_GLES2Device_GLES2Device);
@@ -0,0 +1,173 @@
#include "scripting/js-bindings/auto/jsb_gles2_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "renderer/gfx-gles2/GFXGLES2.h"
#ifndef JSB_ALLOC
#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__)
#endif
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cocos2d_GLES2Device_proto = nullptr;
se::Class* __jsb_cocos2d_GLES2Device_class = nullptr;
static bool js_gles2_GLES2Device_checkExtension(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_checkExtension : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
cocos2d::String arg0;
arg0 = args[0].toStringForce().c_str();
SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_checkExtension : Error processing arguments");
bool result = cobj->checkExtension(arg0);
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_checkExtension : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_gles2_GLES2Device_checkExtension)
static bool js_gles2_GLES2Device_useInstancedArrays(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_useInstancedArrays : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useInstancedArrays();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_useInstancedArrays : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gles2_GLES2Device_useInstancedArrays)
static bool js_gles2_GLES2Device_useVAO(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_useVAO : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useVAO();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_useVAO : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gles2_GLES2Device_useVAO)
static bool js_gles2_GLES2Device_useDrawInstanced(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_useDrawInstanced : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useDrawInstanced();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_useDrawInstanced : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gles2_GLES2Device_useDrawInstanced)
static bool js_gles2_GLES2Device_useDiscardFramebuffer(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_useDiscardFramebuffer : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useDiscardFramebuffer();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_useDiscardFramebuffer : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gles2_GLES2Device_useDiscardFramebuffer)
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_GLES2Device_finalize)
static bool js_gles2_GLES2Device_constructor(se::State& s)
{
cocos2d::GLES2Device* cobj = JSB_ALLOC(cocos2d::GLES2Device);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
return true;
}
SE_BIND_CTOR(js_gles2_GLES2Device_constructor, __jsb_cocos2d_GLES2Device_class, js_cocos2d_GLES2Device_finalize)
extern se::Object* __jsb_cocos2d_GFXDevice_proto;
static bool js_cocos2d_GLES2Device_finalize(se::State& s)
{
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::GLES2Device)", s.nativeThisObject());
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject());
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cocos2d_GLES2Device_finalize)
bool js_register_gles2_GLES2Device(se::Object* obj)
{
auto cls = se::Class::create("GLES2Device", obj, __jsb_cocos2d_GFXDevice_proto, _SE(js_gles2_GLES2Device_constructor));
cls->defineFunction("checkExtension", _SE(js_gles2_GLES2Device_checkExtension));
cls->defineFunction("useInstancedArrays", _SE(js_gles2_GLES2Device_useInstancedArrays));
cls->defineFunction("useVAO", _SE(js_gles2_GLES2Device_useVAO));
cls->defineFunction("useDrawInstanced", _SE(js_gles2_GLES2Device_useDrawInstanced));
cls->defineFunction("useDiscardFramebuffer", _SE(js_gles2_GLES2Device_useDiscardFramebuffer));
cls->defineFinalizeFunction(_SE(js_cocos2d_GLES2Device_finalize));
cls->install();
JSBClassType::registerClass<cocos2d::GLES2Device>(cls);
__jsb_cocos2d_GLES2Device_proto = cls->getProto();
__jsb_cocos2d_GLES2Device_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_gles2(se::Object* obj)
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("gfx", &nsVal))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
obj->setProperty("gfx", nsVal);
}
se::Object* ns = nsVal.toObject();
js_register_gles2_GLES2Device(ns);
return true;
}
@@ -0,0 +1,17 @@
#pragma once
#include "base/ccConfig.h"
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
extern se::Object* __jsb_cocos2d_GLES2Device_proto;
extern se::Class* __jsb_cocos2d_GLES2Device_class;
bool js_register_cocos2d_GLES2Device(se::Object* obj);
bool register_all_gles2(se::Object* obj);
SE_DECLARE_FUNC(js_gles2_GLES2Device_checkExtension);
SE_DECLARE_FUNC(js_gles2_GLES2Device_useInstancedArrays);
SE_DECLARE_FUNC(js_gles2_GLES2Device_useVAO);
SE_DECLARE_FUNC(js_gles2_GLES2Device_useDrawInstanced);
SE_DECLARE_FUNC(js_gles2_GLES2Device_useDiscardFramebuffer);
SE_DECLARE_FUNC(js_gles2_GLES2Device_GLES2Device);
@@ -0,0 +1,116 @@
#include "scripting/js-bindings/auto/jsb_gles3_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "renderer/gfx-gles3/GFXGLES3.h"
#ifndef JSB_ALLOC
#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__)
#endif
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cocos2d_GLES3Device_proto = nullptr;
se::Class* __jsb_cocos2d_GLES3Device_class = nullptr;
static bool js_gles3_GLES3Device_checkExtension(se::State& s)
{
cocos2d::GLES3Device* cobj = (cocos2d::GLES3Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles3_GLES3Device_checkExtension : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
cocos2d::String arg0;
arg0 = args[0].toStringForce().c_str();
SE_PRECONDITION2(ok, false, "js_gles3_GLES3Device_checkExtension : Error processing arguments");
bool result = cobj->checkExtension(arg0);
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles3_GLES3Device_checkExtension : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_gles3_GLES3Device_checkExtension)
static bool js_gles3_GLES3Device_useVAO(se::State& s)
{
cocos2d::GLES3Device* cobj = (cocos2d::GLES3Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gles3_GLES3Device_useVAO : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
bool result = cobj->useVAO();
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_gles3_GLES3Device_useVAO : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gles3_GLES3Device_useVAO)
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_GLES3Device_finalize)
static bool js_gles3_GLES3Device_constructor(se::State& s)
{
cocos2d::GLES3Device* cobj = JSB_ALLOC(cocos2d::GLES3Device);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
return true;
}
SE_BIND_CTOR(js_gles3_GLES3Device_constructor, __jsb_cocos2d_GLES3Device_class, js_cocos2d_GLES3Device_finalize)
extern se::Object* __jsb_cocos2d_GFXDevice_proto;
static bool js_cocos2d_GLES3Device_finalize(se::State& s)
{
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::GLES3Device)", s.nativeThisObject());
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject());
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
cocos2d::GLES3Device* cobj = (cocos2d::GLES3Device*)s.nativeThisObject();
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cocos2d_GLES3Device_finalize)
bool js_register_gles3_GLES3Device(se::Object* obj)
{
auto cls = se::Class::create("GLES3Device", obj, __jsb_cocos2d_GFXDevice_proto, _SE(js_gles3_GLES3Device_constructor));
cls->defineFunction("checkExtension", _SE(js_gles3_GLES3Device_checkExtension));
cls->defineFunction("useVAO", _SE(js_gles3_GLES3Device_useVAO));
cls->defineFinalizeFunction(_SE(js_cocos2d_GLES3Device_finalize));
cls->install();
JSBClassType::registerClass<cocos2d::GLES3Device>(cls);
__jsb_cocos2d_GLES3Device_proto = cls->getProto();
__jsb_cocos2d_GLES3Device_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_gles3(se::Object* obj)
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("gfx", &nsVal))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
obj->setProperty("gfx", nsVal);
}
se::Object* ns = nsVal.toObject();
js_register_gles3_GLES3Device(ns);
return true;
}
@@ -0,0 +1,14 @@
#pragma once
#include "base/ccConfig.h"
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
extern se::Object* __jsb_cocos2d_GLES3Device_proto;
extern se::Class* __jsb_cocos2d_GLES3Device_class;
bool js_register_cocos2d_GLES3Device(se::Object* obj);
bool register_all_gles3(se::Object* obj);
SE_DECLARE_FUNC(js_gles3_GLES3Device_checkExtension);
SE_DECLARE_FUNC(js_gles3_GLES3Device_useVAO);
SE_DECLARE_FUNC(js_gles3_GLES3Device_GLES3Device);
@@ -3,7 +3,27 @@
#include "scripting/js-bindings/manual/jsb_global.h"
#include "scripting/js-bindings/jswrapper/SeApi.h"
#include "scripting/js-bindings/auto/jsb_gfx_auto.hpp"
#include "platform/CCPlatformConfig.h"
// iOS only support GLES3
#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS)
#define USE_GLES3
#elif (CC_PLATFORM == CC_PLATFORM_MAC_OSX)
#define USE_GLES2
#else
#define USE_GLES2
#define USE_GLES3
#endif
#ifdef USE_GLES2
#include "scripting/js-bindings/auto/jsb_gles2_auto.hpp"
#include "renderer/gfx-gles2/GFXGLES2.h"
#endif
#ifdef USE_GLES3
#include "scripting/js-bindings/auto/jsb_gles3_auto.hpp"
#include "renderer/gfx-gles3/GFXGLES3.h"
#endif
#include <fstream>
#include <sstream>
@@ -15,10 +35,8 @@
#define GFX_INVALID_BINDING ((uint8_t)-1)
#define GFX_INVALID_HANDLE ((uint)-1)
static bool js_gfx_GLES2Device_copyBuffersToTexture(se::State& s)
bool js_GFXDevice_copyBuffersToTexture(se::State& s, cocos2d::GFXDevice* cobj)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_copyBuffersToTexture : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
@@ -33,7 +51,7 @@ static bool js_gfx_GLES2Device_copyBuffersToTexture(se::State& s)
uint32_t length = 0;
dataObj->getArrayLength(&length);
arg0.datas.resize(length);
se::Value value;
for (uint32_t i = 0; i < length; ++i)
{
@@ -66,15 +84,13 @@ static bool js_gfx_GLES2Device_copyBuffersToTexture(se::State& s)
cobj->copyBuffersToTexture(arg0, arg1, arg2);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_copyBuffersToTexture)
static bool js_gfx_GLES2Device_copyTexImagesToTexture(se::State& s)
bool js_GFXDevice_copyTexImagesToTexture(se::State& s, cocos2d::GFXDevice* cobj)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_copyBuffersToTexture : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
@@ -89,7 +105,7 @@ static bool js_gfx_GLES2Device_copyTexImagesToTexture(se::State& s)
uint32_t length = 0;
dataObj->getArrayLength(&length);
arg0.datas.resize(length);
se::Value value;
for (uint32_t i = 0; i < length; ++i)
{
@@ -115,7 +131,42 @@ static bool js_gfx_GLES2Device_copyTexImagesToTexture(se::State& s)
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
return false;
}
SE_BIND_FUNC(js_gfx_GLES2Device_copyTexImagesToTexture)
#ifdef USE_GLES2
static bool js_gfx_GLES2Device_copyBuffersToTexture(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_copyBuffersToTexture : Invalid Native Object");
return js_GFXDevice_copyBuffersToTexture(s, cobj);
}
SE_BIND_FUNC(js_gfx_GLES2Device_copyBuffersToTexture)
static bool js_gfx_GLES2Device_copyTexImagesToTexture(se::State& s)
{
cocos2d::GLES2Device* cobj = (cocos2d::GLES2Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES2Device_copyBuffersToTexture : Invalid Native Object");
return js_GFXDevice_copyTexImagesToTexture(s, cobj);
}
SE_BIND_FUNC(js_gfx_GLES2Device_copyTexImagesToTexture);
#endif // USE_GLES2
#ifdef USE_GLES3
static bool js_gfx_GLES3Device_copyBuffersToTexture(se::State& s)
{
cocos2d::GLES3Device* cobj = (cocos2d::GLES3Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES3Device_copyBuffersToTexture : Invalid Native Object");
return js_GFXDevice_copyBuffersToTexture(s, cobj);
}
SE_BIND_FUNC(js_gfx_GLES3Device_copyBuffersToTexture)
static bool js_gfx_GLES3Device_copyTexImagesToTexture(se::State& s)
{
cocos2d::GLES3Device* cobj = (cocos2d::GLES3Device*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_gfx_GLES3Device_copyBuffersToTexture : Invalid Native Object");
return js_GFXDevice_copyTexImagesToTexture(s, cobj);
}
SE_BIND_FUNC(js_gfx_GLES3Device_copyTexImagesToTexture);
#endif
static bool js_gfx_GFXBuffer_update(se::State& s)
{
@@ -646,10 +697,7 @@ static bool js_gfx_GFXInputAssembler_extractDrawInfo(se::State& s)
SE_BIND_FUNC(js_gfx_GFXInputAssembler_extractDrawInfo)
bool register_all_gfx_manual(se::Object* obj)
{
__jsb_cocos2d_GLES2Device_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_GLES2Device_copyBuffersToTexture));
__jsb_cocos2d_GLES2Device_proto->defineFunction("copyTexImagesToTexture", _SE(js_gfx_GLES2Device_copyTexImagesToTexture));
{
__jsb_cocos2d_GFXBuffer_proto->defineFunction("update", _SE(js_gfx_GFXBuffer_update));
__jsb_cocos2d_GFXPipelineLayout_proto->defineProperty("layouts", _SE(js_gfx_GFXPipelineLayout_get_layouts), nullptr);
@@ -661,5 +709,18 @@ bool register_all_gfx_manual(se::Object* obj)
__jsb_cocos2d_GFXInputAssembler_proto->defineFunction("extractDrawInfo", _SE(js_gfx_GFXInputAssembler_extractDrawInfo));
js_register_gfx_GFXSubPass(obj);
#ifdef USE_GLES2
register_all_gles2(obj);
__jsb_cocos2d_GLES2Device_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_GLES2Device_copyBuffersToTexture));
__jsb_cocos2d_GLES2Device_proto->defineFunction("copyTexImagesToTexture", _SE(js_gfx_GLES2Device_copyTexImagesToTexture));
#endif // USE_GLES2
#ifdef USE_GLES3
register_all_gles3(obj);
__jsb_cocos2d_GLES3Device_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_GLES3Device_copyBuffersToTexture));
__jsb_cocos2d_GLES3Device_proto->defineFunction("copyTexImagesToTexture", _SE(js_gfx_GLES3Device_copyTexImagesToTexture));
#endif // USE_GLES2
return true;
}
+2
View File
@@ -151,6 +151,8 @@ def main():
'cocos2dx_extension.ini' : ('cocos2dx_extension', 'jsb_cocos2dx_extension_auto'),
'cocos2dx_network.ini' : ('cocos2dx_network', 'jsb_cocos2dx_network_auto'),
'gfx.ini': ('gfx', 'jsb_gfx_auto'),
'gles2.ini': ('gles2', 'jsb_gles2_auto'),
'gles3.ini': ('gles3', 'jsb_gles3_auto'),
}
target = 'spidermonkey'
generator_py = '%s/generator.py' % cxx_generator_root
+4 -6
View File
@@ -16,7 +16,7 @@ android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILIT
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-gles2 -I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core-I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source
cocos_flags = -DANDROID
cxxgenerator_headers =
@@ -25,14 +25,14 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/renderer/gfx-gles2/GFXGLES2.h
headers = %(cocosdir)s/cocos/renderer/core/Core.h
replace_headers =
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu.*$".
classes = GFXObject GFXDevice GFXBindingLayout GFXBuffer GFXCommandBuffer GFXFramebuffer GFXInputAssembler GFXPipelineLayout GFXPipelineState GFXQueue GFXRenderPass GFXSampler GFXShader GFXTexture GFXTextureView GFXWindow GFXAPI GFXFeature GFXFormat GFXFormatType GFXType GFXBufferUsageBit GFXBufferFlagBit GFXBufferAccessBit GFXMemoryUsageBit GFXTextureType GFXTextureUsageBit GFXTextureFlagBit GFXSampleCount GFXTextureViewType GFXFilter GFXAddress GFXComparisonFunc GFXStencilOp GFXBlendFactor GFXBlendOp GFXColorMask GFXShaderType GFXLoadOp GFXStoreOp GFXTextureLayout GFXPipelineBindPoint GFXPrimitiveMode GFXPolygonMode GFXShadeModel GFXCullMode GFXDynamicState GFXStencilFace GFXBindingType GFXQueueType GFXCommandBufferType GFXClearFlagBit GFXVsyncMode GFXOffset GFXRect GFXExtent GFXTextureSubres GFXTextureCopy GFXBufferTextureCopy GFXViewport GFXColor GFXDeviceInfo GFXWindowInfo GFXContextInfo GFXBufferInfo GFXDrawInfo GFXIndirectBuffer GFXTextureInfo GFXTextureViewInfo GFXSamplerInfo GFXShaderMacro GFXUniform GFXUniformBlock GFXUniformSampler GFXShaderStage GFXShaderInfo GFXAttribute GFXInputAssemblerInfo GFXColorAttachment GFXDepthStencilAttachment GFXRenderPassInfo GFXFramebufferInfo GFXBinding GFXBindingLayoutInfo GFXBindingUnit GFXPushConstantRange GFXPipelineLayoutInfo GFXInputState GFXRasterizerState GFXDepthStencilState GFXBlendTarget GFXBlendState GFXPipelineStateInfo GFXCommandAllocator GFXCommandAllocatorInfo GFXCommandBufferInfo GFXQueueInfo GFXFormatInfo GFXObjectType GFXStatus GFXMemoryStatus GLES2Device GLES2Window
classes = GFXObject GFXDevice GFXBindingLayout GFXBuffer GFXCommandBuffer GFXFramebuffer GFXInputAssembler GFXPipelineLayout GFXPipelineState GFXQueue GFXRenderPass GFXSampler GFXShader GFXTexture GFXTextureView GFXWindow GFXAPI GFXFeature GFXFormat GFXFormatType GFXType GFXBufferUsageBit GFXBufferFlagBit GFXBufferAccessBit GFXMemoryUsageBit GFXTextureType GFXTextureUsageBit GFXTextureFlagBit GFXSampleCount GFXTextureViewType GFXFilter GFXAddress GFXComparisonFunc GFXStencilOp GFXBlendFactor GFXBlendOp GFXColorMask GFXShaderType GFXLoadOp GFXStoreOp GFXTextureLayout GFXPipelineBindPoint GFXPrimitiveMode GFXPolygonMode GFXShadeModel GFXCullMode GFXDynamicState GFXStencilFace GFXBindingType GFXQueueType GFXCommandBufferType GFXClearFlagBit GFXVsyncMode GFXOffset GFXRect GFXExtent GFXTextureSubres GFXTextureCopy GFXBufferTextureCopy GFXViewport GFXColor GFXDeviceInfo GFXWindowInfo GFXContextInfo GFXBufferInfo GFXDrawInfo GFXIndirectBuffer GFXTextureInfo GFXTextureViewInfo GFXSamplerInfo GFXShaderMacro GFXUniform GFXUniformBlock GFXUniformSampler GFXShaderStage GFXShaderInfo GFXAttribute GFXInputAssemblerInfo GFXColorAttachment GFXDepthStencilAttachment GFXRenderPassInfo GFXFramebufferInfo GFXBinding GFXBindingLayoutInfo GFXBindingUnit GFXPushConstantRange GFXPipelineLayoutInfo GFXInputState GFXRasterizerState GFXDepthStencilState GFXBlendTarget GFXBlendState GFXPipelineStateInfo GFXCommandAllocator GFXCommandAllocatorInfo GFXCommandBufferInfo GFXQueueInfo GFXFormatInfo GFXObjectType GFXStatus GFXMemoryStatus
classes_need_extend =
@@ -59,11 +59,10 @@ skip = GFXBindingLayout::[GFXBindingLayout],
GFXTextureView::[GFXTextureView],
GFXWindow::[GFXWindow],
CCMTLCommandAllocator::[clearCommands],
GLES2Device::[copyBuffersToTexture],
GFXDevice::[copyBuffersToTexture],
GFXBlendState::[targets]
getter_setter = GFXDevice::[width height nativeWidth nativeHeight memoryStatus context mainWindow queue commandAllocator renderer vendor numDrawCalls numTris],
getter_setter = GFXDevice::[gfxAPI deviceName width height nativeWidth nativeHeight memoryStatus context mainWindow queue commandAllocator renderer vendor numDrawCalls numTris maxVertexAttributes maxVertexUniformVectors maxFragmentUniformVectors maxTextureUnits maxVertexTextureUnits maxUniformBufferBindings maxUniformBlockSize maxTextureSize maxCubeMapTextureSize depthBits stencilBits reverseCW shaderIdGen],
GFXWindow::[device title left top width height nativeWidth nativeHeight colorFormat isOffscreen/isOffscreen renderPass colorTexture colorTexView depthStencilTexture depthStencilTexView framebuffer],
GFXShader::[device name hash stages blocks samplers],
GFXTextureView::[device texture type format baseLevel levelCount baseLayer layerCount],
@@ -96,7 +95,6 @@ base_classes_to_skip = Ref Clonable Object
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = GFXDevice
persistent_classes =
+70
View File
@@ -0,0 +1,70 @@
[gles2]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = gles2
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = gfx
macro_judgement =
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-gles2 -I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/renderer/gfx-gles2/GFXGLES2.h
replace_headers =
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu.*$".
classes = GLES2Device GLES2Window
classes_need_extend =
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = GLES2Device::[copyBuffersToTexture]
getter_setter =
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref Clonable Object
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = GFXDevice
persistent_classes =
classes_owned_by_cpp =
+70
View File
@@ -0,0 +1,70 @@
[gles3]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = gles3
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = gfx
macro_judgement =
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-gles3 -I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/renderer/gfx-gles3/GFXGLES3.h
replace_headers =
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu.*$".
classes = GLES3Device GLES3Window
classes_need_extend =
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = GLES2Device::[copyBuffersToTexture]
getter_setter =
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref Clonable Object
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = GFXDevice
persistent_classes =
classes_owned_by_cpp =