From f1b2a02599751f72c2dcf0fbb5c761dfe05dc00f Mon Sep 17 00:00:00 2001 From: coulsonwang Date: Fri, 6 Mar 2020 15:02:54 +0800 Subject: [PATCH] Rename getter (#2243) * rename getter attribute * fix --- .../renderer/core/gfx/GFXBindingLayout.h | 4 +-- native/cocos/renderer/core/gfx/GFXBuffer.h | 16 +++++----- .../renderer/core/gfx/GFXCommandAllocator.h | 2 +- .../renderer/core/gfx/GFXCommandBuffer.h | 10 +++--- native/cocos/renderer/core/gfx/GFXContext.h | 10 +++--- native/cocos/renderer/core/gfx/GFXDevice.h | 28 ++++++++-------- .../cocos/renderer/core/gfx/GFXFramebuffer.h | 8 ++--- .../renderer/core/gfx/GFXInputAssembler.h | 24 +++++++------- .../renderer/core/gfx/GFXPipelineLayout.h | 6 ++-- .../renderer/core/gfx/GFXPipelineState.h | 20 ++++++------ native/cocos/renderer/core/gfx/GFXQueue.h | 4 +-- .../cocos/renderer/core/gfx/GFXRenderPass.h | 8 ++--- native/cocos/renderer/core/gfx/GFXSampler.h | 28 ++++++++-------- native/cocos/renderer/core/gfx/GFXShader.h | 12 +++---- native/cocos/renderer/core/gfx/GFXTexture.h | 24 +++++++------- .../cocos/renderer/core/gfx/GFXTextureView.h | 16 +++++----- native/cocos/renderer/core/gfx/GFXWindow.h | 32 +++++++++---------- .../cocos/renderer/gfx-gles2/GLES2Buffer.cc | 10 +++--- .../renderer/gfx-gles2/GLES2CommandBuffer.cc | 12 +++---- .../cocos/renderer/gfx-gles2/GLES2Context.cc | 8 ++--- .../cocos/renderer/gfx-gles2/GLES2Device.cc | 4 +-- .../renderer/gfx-gles2/GLES2Framebuffer.cc | 2 +- .../renderer/gfx-gles2/GLES2InputAssembler.cc | 4 +-- .../cocos/renderer/gfx-gles2/GLES2Texture.cc | 10 +++--- .../cocos/renderer/gfx-gles3/GLES3Buffer.cc | 10 +++--- .../renderer/gfx-gles3/GLES3CommandBuffer.cc | 8 ++--- .../cocos/renderer/gfx-gles3/GLES3Context.cc | 8 ++--- .../cocos/renderer/gfx-gles3/GLES3Device.cc | 4 +-- .../renderer/gfx-gles3/GLES3Framebuffer.cc | 2 +- .../renderer/gfx-gles3/GLES3InputAssembler.cc | 4 +-- .../cocos/renderer/gfx-gles3/GLES3Texture.cc | 10 +++--- native/cocos/renderer/gfx-metal/MTLBuffer.mm | 10 +++--- .../renderer/gfx-metal/MTLCommandBuffer.mm | 4 +-- .../renderer/gfx-metal/MTLInputAssembler.mm | 4 +-- .../renderer/gfx-metal/MTLPipelineState.mm | 22 ++++++------- native/cocos/renderer/gfx-metal/MTLQueue.mm | 6 ++-- native/cocos/renderer/gfx-metal/MTLTexture.mm | 6 ++-- native/tools/tojs/gfx.ini | 32 +++++++++---------- 38 files changed, 216 insertions(+), 216 deletions(-) diff --git a/native/cocos/renderer/core/gfx/GFXBindingLayout.h b/native/cocos/renderer/core/gfx/GFXBindingLayout.h index f5eb6d3fca..ef67e269db 100755 --- a/native/cocos/renderer/core/gfx/GFXBindingLayout.h +++ b/native/cocos/renderer/core/gfx/GFXBindingLayout.h @@ -19,8 +19,8 @@ class CC_CORE_API GFXBindingLayout : public Object { void bindTextureView(uint binding, GFXTextureView* texView); void bindSampler(uint binding, GFXSampler* sampler); - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE const GFXBindingUnitList& bindingUnits() const { return _bindingUnits; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE const GFXBindingUnitList& getBindingUnits() const { return _bindingUnits; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXBuffer.h b/native/cocos/renderer/core/gfx/GFXBuffer.h index bba57c9973..748157180e 100755 --- a/native/cocos/renderer/core/gfx/GFXBuffer.h +++ b/native/cocos/renderer/core/gfx/GFXBuffer.h @@ -16,14 +16,14 @@ class CC_CORE_API GFXBuffer : public Object { virtual void resize(uint size) = 0; virtual void update(void* buffer, uint offset = 0, uint size = 0) = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXBufferUsage usage() const { return _usage; } - CC_INLINE GFXMemoryUsage memUsage() const { return _memUsage; } - CC_INLINE uint stride() const { return _stride; } - CC_INLINE uint count() const { return _count; } - CC_INLINE uint size() const { return _size; } - CC_INLINE GFXBufferFlags flags() const { return _flags; } - CC_INLINE uint8_t* bufferView() const { return _buffer; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE GFXBufferUsage getUsage() const { return _usage; } + CC_INLINE GFXMemoryUsage getMemUsage() const { return _memUsage; } + CC_INLINE uint getStride() const { return _stride; } + CC_INLINE uint getCount() const { return _count; } + CC_INLINE uint getSize() const { return _size; } + CC_INLINE GFXBufferFlags getFlags() const { return _flags; } + CC_INLINE uint8_t* getBufferView() const { return _buffer; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXCommandAllocator.h b/native/cocos/renderer/core/gfx/GFXCommandAllocator.h index dba6e778bf..0f16476faa 100755 --- a/native/cocos/renderer/core/gfx/GFXCommandAllocator.h +++ b/native/cocos/renderer/core/gfx/GFXCommandAllocator.h @@ -14,7 +14,7 @@ public: virtual bool initialize(const GFXCommandAllocatorInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } + CC_INLINE GFXDevice* getDevice() const { return _device; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h b/native/cocos/renderer/core/gfx/GFXCommandBuffer.h index 1f39e55768..ca5468664c 100755 --- a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h +++ b/native/cocos/renderer/core/gfx/GFXCommandBuffer.h @@ -33,11 +33,11 @@ public: virtual void copyBufferToTexture(GFXBuffer* src, GFXTexture* dst, GFXTextureLayout layout, const GFXBufferTextureCopyList& regions) = 0; virtual void execute(const std::vector& cmd_buffs, uint32_t count) = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXCommandAllocator* allocator() const { return _allocator; } - CC_INLINE GFXCommandBufferType type() const { return _type; } - CC_INLINE uint numDrawCalls() const { return _numDrawCalls; } - CC_INLINE uint numTris() const { return _numTriangles; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE GFXCommandAllocator* getAllocator() const { return _allocator; } + CC_INLINE GFXCommandBufferType getType() const { return _type; } + CC_INLINE uint getNumDrawCalls() const { return _numDrawCalls; } + CC_INLINE uint getNumTris() const { return _numTriangles; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXContext.h b/native/cocos/renderer/core/gfx/GFXContext.h index e783ae6353..05a38bd73b 100755 --- a/native/cocos/renderer/core/gfx/GFXContext.h +++ b/native/cocos/renderer/core/gfx/GFXContext.h @@ -15,11 +15,11 @@ class CC_CORE_API GFXContext : public Object { virtual void destroy() = 0; virtual void present() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXContext* sharedContext() const { return _sharedContext; } - CC_INLINE GFXVsyncMode vsyncMode() const { return _vsyncMode; } - CC_INLINE GFXFormat colorFormat() const { return _colorFmt; } - CC_INLINE GFXFormat detphStencilFormat() const { return _depthStencilFmt; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + 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; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXDevice.h b/native/cocos/renderer/core/gfx/GFXDevice.h index 76f3055768..9c2880fa2a 100755 --- a/native/cocos/renderer/core/gfx/GFXDevice.h +++ b/native/cocos/renderer/core/gfx/GFXDevice.h @@ -32,20 +32,20 @@ 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 gfxAPI() const { return _api; } - CC_INLINE uint width() { return _width; } - CC_INLINE uint height() { return _height; } - CC_INLINE uint nativeWidth() { return _nativeWidth; } - CC_INLINE uint nativeHeight() { return _nativeHeight; } - CC_INLINE GFXMemoryStatus& memoryStatus() { return _memoryStatus; } - CC_INLINE GFXContext* context() const { return _context; } - CC_INLINE GFXWindow* mainWindow() const { return _window; } - CC_INLINE GFXQueue* queue() const { return _queue; } - CC_INLINE GFXCommandAllocator* commandAllocator() const { return _cmdAllocator; } - CC_INLINE const String& renderer() const { return _renderer; } - CC_INLINE const String& vendor() const { return _vendor; } - CC_INLINE uint numDrawCalls() const { return _numDrawCalls; } - CC_INLINE uint numTris() const { return _numTriangles; } + CC_INLINE GFXAPI getAPI() const { return _api; } + CC_INLINE uint getWidth() { return _width; } + CC_INLINE uint getHeight() { return _height; } + CC_INLINE uint getNativeWidth() { return _nativeWidth; } + CC_INLINE uint getNativeHeight() { return _nativeHeight; } + CC_INLINE GFXMemoryStatus& getMemoryStatus() { return _memoryStatus; } + CC_INLINE GFXContext* getContext() const { return _context; } + CC_INLINE GFXWindow* getMainWindow() const { return _window; } + CC_INLINE GFXQueue* getQueue() const { return _queue; } + CC_INLINE GFXCommandAllocator* getCommandAllocator() const { return _cmdAllocator; } + CC_INLINE const String& getRenderer() const { return _renderer; } + CC_INLINE const String& getVendor() const { return _vendor; } + CC_INLINE uint getNumDrawCalls() const { return _numDrawCalls; } + CC_INLINE uint getNumTris() const { return _numTriangles; } CC_INLINE bool hasFeature(GFXFeature feature) const { return _features[static_cast(feature)]; } protected: diff --git a/native/cocos/renderer/core/gfx/GFXFramebuffer.h b/native/cocos/renderer/core/gfx/GFXFramebuffer.h index 3b70ce8aea..7cf66f6e7d 100755 --- a/native/cocos/renderer/core/gfx/GFXFramebuffer.h +++ b/native/cocos/renderer/core/gfx/GFXFramebuffer.h @@ -14,10 +14,10 @@ class CC_CORE_API GFXFramebuffer : public Object { virtual bool initialize(const GFXFramebufferInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXRenderPass* renderPass() const { return _renderPass; } - CC_INLINE const GFXTextureViewList& colorViews() const { return _colorViews; } - CC_INLINE GFXTextureView* depthStencilView() const { return _depthStencilView; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE GFXRenderPass* getRenderPass() const { return _renderPass; } + CC_INLINE const GFXTextureViewList& getColorViews() const { return _colorViews; } + CC_INLINE GFXTextureView* getDepthStencilView() const { return _depthStencilView; } CC_INLINE bool isOffscreen() const { return _isOffscreen; } protected: diff --git a/native/cocos/renderer/core/gfx/GFXInputAssembler.h b/native/cocos/renderer/core/gfx/GFXInputAssembler.h index 2d0e8543f8..1565e451b3 100755 --- a/native/cocos/renderer/core/gfx/GFXInputAssembler.h +++ b/native/cocos/renderer/core/gfx/GFXInputAssembler.h @@ -14,18 +14,18 @@ class CC_CORE_API GFXInputAssembler : public Object { virtual bool initialize(const GFXInputAssemblerInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE const GFXAttributeList& attributes() const { return _attributes; } - CC_INLINE const GFXBufferList& vertexBuffers() const { return _vertexBuffers; } - CC_INLINE GFXBuffer* indexBuffer() const { return _indexBuffer; } - CC_INLINE GFXBuffer* indirectBuffer() const { return _indirectBuffer; } - CC_INLINE uint vertexCount() const { return _vertexCount; } - CC_INLINE uint firstVertex() const { return _firstVertex; } - CC_INLINE uint indexCount() const { return _indexCount; } - CC_INLINE uint firstIndex() const { return _firstIndex; } - CC_INLINE uint vertexOffset() const { return _vertexOffset; } - CC_INLINE uint instanceCount() const { return _instanceCount; } - CC_INLINE uint firstInstance() const { return _firstInstance; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE const GFXAttributeList& getAttributes() const { return _attributes; } + CC_INLINE const GFXBufferList& getVertexBuffers() const { return _vertexBuffers; } + CC_INLINE GFXBuffer* getIndexBuffer() const { return _indexBuffer; } + CC_INLINE GFXBuffer* getIndirectBuffer() const { return _indirectBuffer; } + CC_INLINE uint getVertexCount() const { return _vertexCount; } + CC_INLINE uint getFirstVertex() const { return _firstVertex; } + CC_INLINE uint getIndexCount() const { return _indexCount; } + CC_INLINE uint getFirstIndex() const { return _firstIndex; } + CC_INLINE uint getVertexOffset() const { return _vertexOffset; } + CC_INLINE uint getInstanceCount() const { return _instanceCount; } + CC_INLINE uint getFirstInstance() const { return _firstInstance; } CC_INLINE void setVertexCount(uint count) { _vertexCount = count; } CC_INLINE void setFirstVertex(uint first) { _firstVertex = first; } diff --git a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h b/native/cocos/renderer/core/gfx/GFXPipelineLayout.h index 15fe8bd627..e7476e2fe3 100755 --- a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h +++ b/native/cocos/renderer/core/gfx/GFXPipelineLayout.h @@ -14,9 +14,9 @@ public: virtual bool initialize(const GFXPipelineLayoutInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE const GFXPushConstantRangeList& pushConstantsRanges() const { return _pushConstantsRanges; } - CC_INLINE const GFXBindingLayoutList& layouts() const { return _layouts; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE const GFXPushConstantRangeList& getPushConstantsRanges() const { return _pushConstantsRanges; } + CC_INLINE const GFXBindingLayoutList& getLayouts() const { return _layouts; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXPipelineState.h b/native/cocos/renderer/core/gfx/GFXPipelineState.h index 41ab1ee5ae..b54c110b2a 100755 --- a/native/cocos/renderer/core/gfx/GFXPipelineState.h +++ b/native/cocos/renderer/core/gfx/GFXPipelineState.h @@ -14,16 +14,16 @@ public: virtual bool initialize(const GFXPipelineStateInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXShader* shader() const { return _shader; } - CC_INLINE GFXPrimitiveMode primitive() const { return _primitive; } - CC_INLINE const GFXInputState& inputState() const { return _inputState; } - CC_INLINE const GFXRasterizerState& rasterizerState() const { return _rasterizerState; } - CC_INLINE const GFXDepthStencilState& depthStencilState() const { return _depthStencilState; } - CC_INLINE const GFXBlendState& blendState() const { return _blendState; } - CC_INLINE const GFXDynamicStateList& dynamicStates() const { return _dynamicStates; } - CC_INLINE const GFXPipelineLayout* pipelineLayout() const { return _layout; } - CC_INLINE const GFXRenderPass* renderPass() const { return _renderPass; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE GFXShader* getShader() const { return _shader; } + CC_INLINE GFXPrimitiveMode getPrimitive() const { return _primitive; } + CC_INLINE const GFXInputState& getInputState() const { return _inputState; } + CC_INLINE const GFXRasterizerState& getRasterizerState() const { return _rasterizerState; } + CC_INLINE const GFXDepthStencilState& getDepthStencilState() const { return _depthStencilState; } + CC_INLINE const GFXBlendState& getBlendState() const { return _blendState; } + CC_INLINE const GFXDynamicStateList& getDynamicStates() const { return _dynamicStates; } + CC_INLINE const GFXPipelineLayout* getPipelineLayout() const { return _layout; } + CC_INLINE const GFXRenderPass* getRenderPass() const { return _renderPass; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXQueue.h b/native/cocos/renderer/core/gfx/GFXQueue.h index 2e2455738e..80d200b801 100755 --- a/native/cocos/renderer/core/gfx/GFXQueue.h +++ b/native/cocos/renderer/core/gfx/GFXQueue.h @@ -15,8 +15,8 @@ public: virtual void destroy() = 0; virtual void submit(const std::vector& cmd_buffs) = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXQueueType type() const { return _type; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE GFXQueueType getType() const { return _type; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXRenderPass.h b/native/cocos/renderer/core/gfx/GFXRenderPass.h index 23fd9531c1..06852d9c32 100755 --- a/native/cocos/renderer/core/gfx/GFXRenderPass.h +++ b/native/cocos/renderer/core/gfx/GFXRenderPass.h @@ -14,10 +14,10 @@ class CC_CORE_API GFXRenderPass : public Object { virtual bool initialize(const GFXRenderPassInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE const GFXColorAttachmentList& colorAttachments() const { return _colorAttachments; } - CC_INLINE const GFXDepthStencilAttachment& depthStencilAttachment() const { return _depthStencilAttachment; } - CC_INLINE const GFXSubPassList& subPasses() const { return _subPasses; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE const GFXColorAttachmentList& getColorAttachments() const { return _colorAttachments; } + CC_INLINE const GFXDepthStencilAttachment& getDepthStencilAttachment() const { return _depthStencilAttachment; } + CC_INLINE const GFXSubPassList& getSubPasses() const { return _subPasses; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXSampler.h b/native/cocos/renderer/core/gfx/GFXSampler.h index c3c64cd83e..6ec8201d35 100755 --- a/native/cocos/renderer/core/gfx/GFXSampler.h +++ b/native/cocos/renderer/core/gfx/GFXSampler.h @@ -14,20 +14,20 @@ class CC_CORE_API GFXSampler : public Object { virtual bool initialize(const GFXSamplerInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE const String& name() const { return _name; } - CC_INLINE GFXFilter minFilter() const { return _minFilter; } - CC_INLINE GFXFilter magFilter() const { return _magFilter; } - CC_INLINE GFXFilter mipFilter() const { return _mipFilter; } - CC_INLINE GFXAddress addressU() const { return _addressU; } - CC_INLINE GFXAddress addressV() const { return _addressV; } - CC_INLINE GFXAddress addressW() const { return _addressW; } - CC_INLINE uint maxAnisotropy() const { return _maxAnisotropy; } - CC_INLINE GFXComparisonFunc cmpFunc() const { return _cmpFunc; } - CC_INLINE const GFXColor& borderColor() const { return _borderColor; } - CC_INLINE uint minLOD() const { return _minLOD; } - CC_INLINE uint maxLOD() const { return _maxLOD; } - CC_INLINE float mipLODBias() const { return _mipLODBias; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE const String& getName() const { return _name; } + CC_INLINE GFXFilter getMinFilter() const { return _minFilter; } + CC_INLINE GFXFilter getMagFilter() const { return _magFilter; } + CC_INLINE GFXFilter getMipFilter() const { return _mipFilter; } + CC_INLINE GFXAddress getAddressU() const { return _addressU; } + CC_INLINE GFXAddress getAddressV() const { return _addressV; } + CC_INLINE GFXAddress getAddressW() const { return _addressW; } + CC_INLINE uint getMaxAnisotropy() const { return _maxAnisotropy; } + CC_INLINE GFXComparisonFunc getCmpFunc() const { return _cmpFunc; } + CC_INLINE const GFXColor& getBorderColor() const { return _borderColor; } + CC_INLINE uint getMinLOD() const { return _minLOD; } + CC_INLINE uint getMaxLOD() const { return _maxLOD; } + CC_INLINE float getMipLODBias() const { return _mipLODBias; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXShader.h b/native/cocos/renderer/core/gfx/GFXShader.h index 9084f1219b..9b401229f2 100755 --- a/native/cocos/renderer/core/gfx/GFXShader.h +++ b/native/cocos/renderer/core/gfx/GFXShader.h @@ -14,13 +14,13 @@ class CC_CORE_API GFXShader : public Object { virtual bool initialize(const GFXShaderInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } + CC_INLINE GFXDevice* getDevice() const { return _device; } // Can not rename to `id` as JS code, because `id` is a keyword in objective-c. - CC_INLINE uint hash() const { return _hash; } - CC_INLINE const String& name() const { return _name; } - CC_INLINE const GFXShaderStageList& stages() const { return _stages; } - CC_INLINE const GFXUniformBlockList& blocks() const { return _blocks; } - CC_INLINE const GFXUniformSamplerList& samplers() const { return _samplers; } + CC_INLINE uint getHash() const { return _hash; } + CC_INLINE const String& getName() const { return _name; } + CC_INLINE const GFXShaderStageList& getStages() const { return _stages; } + CC_INLINE const GFXUniformBlockList& getBlocks() const { return _blocks; } + CC_INLINE const GFXUniformSamplerList& getSamplers() const { return _samplers; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXTexture.h b/native/cocos/renderer/core/gfx/GFXTexture.h index 766852bf85..b7382546a2 100755 --- a/native/cocos/renderer/core/gfx/GFXTexture.h +++ b/native/cocos/renderer/core/gfx/GFXTexture.h @@ -15,18 +15,18 @@ class CC_CORE_API GFXTexture : public Object { virtual void destroy() = 0; virtual void resize(uint width, uint height) = 0; - CC_INLINE GFXTextureType type() const { return _type; } - CC_INLINE GFXTextureUsage usage() const { return _usage; } - CC_INLINE GFXFormat format() const { return _format; } - CC_INLINE uint width() const { return _width; } - CC_INLINE uint height() const { return _height; } - CC_INLINE uint depth() const { return _depth; } - CC_INLINE uint arrayLayer() const { return _arrayLayer; } - CC_INLINE uint mipLevel() const { return _mipLevel; } - CC_INLINE uint size() const { return _size; } - CC_INLINE GFXSampleCount samples() const { return _samples; } - CC_INLINE GFXTextureFlags flags() const { return _flags; } - CC_INLINE uint8_t* buffer() const { return _buffer; } + CC_INLINE GFXTextureType getType() const { return _type; } + CC_INLINE GFXTextureUsage getUsage() const { return _usage; } + CC_INLINE GFXFormat getFormat() const { return _format; } + CC_INLINE uint getWidth() const { return _width; } + CC_INLINE uint getHeight() const { return _height; } + CC_INLINE uint getDepth() const { return _depth; } + CC_INLINE uint getArrayLayer() const { return _arrayLayer; } + CC_INLINE uint getMipLevel() const { return _mipLevel; } + CC_INLINE uint getSize() const { return _size; } + CC_INLINE GFXSampleCount getSamples() const { return _samples; } + CC_INLINE GFXTextureFlags getFlags() const { return _flags; } + CC_INLINE uint8_t* getBuffer() const { return _buffer; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXTextureView.h b/native/cocos/renderer/core/gfx/GFXTextureView.h index 98973ed60a..980b1a315f 100755 --- a/native/cocos/renderer/core/gfx/GFXTextureView.h +++ b/native/cocos/renderer/core/gfx/GFXTextureView.h @@ -14,14 +14,14 @@ class CC_CORE_API GFXTextureView : public Object { virtual bool initialize(const GFXTextureViewInfo& info) = 0; virtual void destroy() = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE GFXTexture* texture() const { return _texture; } - CC_INLINE GFXTextureViewType type() const { return _type; } - CC_INLINE GFXFormat format() const { return _format; } - CC_INLINE uint baseLevel() const { return _baseLevel; } - CC_INLINE uint levelCount() const { return _levelCount; } - CC_INLINE uint baseLayer() const { return _baseLayer; } - CC_INLINE uint layerCount() const { return _layerCount; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE GFXTexture* getTexture() const { return _texture; } + CC_INLINE GFXTextureViewType getType() const { return _type; } + CC_INLINE GFXFormat getFormat() const { return _format; } + CC_INLINE uint getBaseLevel() const { return _baseLevel; } + CC_INLINE uint getLevelCount() const { return _levelCount; } + CC_INLINE uint getBaseLayer() const { return _baseLayer; } + CC_INLINE uint getLayerCount() const { return _layerCount; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/core/gfx/GFXWindow.h b/native/cocos/renderer/core/gfx/GFXWindow.h index f513fd3978..7c175fdfd9 100755 --- a/native/cocos/renderer/core/gfx/GFXWindow.h +++ b/native/cocos/renderer/core/gfx/GFXWindow.h @@ -15,23 +15,23 @@ class CC_CORE_API GFXWindow : public Object { virtual void destroy() = 0; virtual void resize(uint width, uint height) = 0; - CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE const String& title() const { return _title; } - CC_INLINE int left() const { return _left; } - CC_INLINE int top() const { return _top; } - CC_INLINE uint width() const { return _width; } - CC_INLINE uint height() const { return _height; } - CC_INLINE uint nativeWidth() const { return _nativeWidth; } - CC_INLINE uint nativeHeight() const { return _nativeHeight; } - CC_INLINE GFXFormat colorFormat() const { return _colorFmt; } - CC_INLINE GFXFormat detphStencilFormat() const { return _depthStencilFmt; } + CC_INLINE GFXDevice* getDevice() const { return _device; } + CC_INLINE const String& getTitle() const { return _title; } + CC_INLINE int getLeft() const { return _left; } + CC_INLINE int getTop() const { return _top; } + CC_INLINE uint getWidth() const { return _width; } + CC_INLINE uint getHeight() const { return _height; } + 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 bool isOffscreen() const { return _isOffscreen; } - CC_INLINE GFXRenderPass* renderPass() const { return _renderPass; } - CC_INLINE GFXTexture* colorTexture() const { return _colorTex; } - CC_INLINE GFXTextureView* colorTexView() const { return _colorTexView; } - CC_INLINE GFXTexture* depthStencilTexture() const { return _depthStencilTex; } - CC_INLINE GFXTextureView* depthStencilTexView() const { return _depthStencilTexView; } - CC_INLINE GFXFramebuffer* framebuffer() const { return _framebuffer; } + CC_INLINE GFXRenderPass* getRenderPass() const { return _renderPass; } + CC_INLINE GFXTexture* getColorTexture() const { return _colorTex; } + CC_INLINE GFXTextureView* getColorTexView() const { return _colorTexView; } + CC_INLINE GFXTexture* getDepthStencilTexture() const { return _depthStencilTex; } + CC_INLINE GFXTextureView* getDepthStencilTexView() const { return _depthStencilTexView; } + CC_INLINE GFXFramebuffer* getFramebuffer() const { return _framebuffer; } protected: GFXDevice* _device = nullptr; diff --git a/native/cocos/renderer/gfx-gles2/GLES2Buffer.cc b/native/cocos/renderer/gfx-gles2/GLES2Buffer.cc index c1f5c569a8..8c1864148a 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Buffer.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2Buffer.cc @@ -22,7 +22,7 @@ bool GLES2Buffer::initialize(const GFXBufferInfo& info) { if ((_flags & GFXBufferFlagBit::BAKUP_BUFFER) && _size > 0) { _buffer = (uint8_t*)CC_MALLOC(_size); - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; } _gpuBuffer = CC_NEW(GLES2GPUBuffer); @@ -37,7 +37,7 @@ bool GLES2Buffer::initialize(const GFXBufferInfo& info) { } GLES2CmdFuncCreateBuffer((GLES2Device*)_device, _gpuBuffer); - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; return true; } @@ -45,14 +45,14 @@ bool GLES2Buffer::initialize(const GFXBufferInfo& info) { void GLES2Buffer::destroy() { if (_gpuBuffer) { GLES2CmdFuncDestroyBuffer((GLES2Device*)_device, _gpuBuffer); - _device->memoryStatus().bufferSize -= _size; + _device->getMemoryStatus().bufferSize -= _size; CC_DELETE(_gpuBuffer); _gpuBuffer = nullptr; } if (_buffer) { CC_FREE(_buffer); - _device->memoryStatus().bufferSize -= _size; + _device->getMemoryStatus().bufferSize -= _size; _buffer = nullptr; } } @@ -63,7 +63,7 @@ void GLES2Buffer::resize(uint size) { _size = size; _count = _size / _stride; - GFXMemoryStatus& status = _device->memoryStatus(); + GFXMemoryStatus& status = _device->getMemoryStatus(); _gpuBuffer->size = _size; _gpuBuffer->count = _count; GLES2CmdFuncResizeBuffer((GLES2Device*)_device, _gpuBuffer); diff --git a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc index 979beef054..76184b66b3 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc @@ -200,19 +200,19 @@ void GLES2CommandBuffer::draw(GFXInputAssembler* ia) { switch (_curGPUPipelineState->glPrimitive) { case GL_TRIANGLES: { - if (ia->indexBuffer() == nullptr) + if (ia->getIndexBuffer() == nullptr) { - _numTriangles += ia->vertexCount() / 3 * std::max(ia->instanceCount(), 1U); + _numTriangles += ia->getVertexCount() / 3 * std::max(ia->getInstanceCount(), 1U); } else { - _numTriangles += ia->indexCount() / 3 * std::max(ia->instanceCount(), 1U); + _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getInstanceCount(), 1U); } break; } case GL_TRIANGLE_STRIP: case GL_TRIANGLE_FAN: { - _numTriangles += (ia->vertexCount() - 2) * std::max(ia->instanceCount(), 1U); + _numTriangles += (ia->getVertexCount() - 2) * std::max(ia->getInstanceCount(), 1U); break; } default: @@ -297,8 +297,8 @@ void GLES2CommandBuffer::execute(const std::vector& cmd_buffs } _cmdPackage->cmds.concat(cmd_buff->_cmdPackage->cmds); - _numDrawCalls += cmd_buff->numDrawCalls(); - _numTriangles += cmd_buff->numTris(); + _numDrawCalls += cmd_buff->getNumDrawCalls(); + _numTriangles += cmd_buff->getNumTris(); } } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Context.cc b/native/cocos/renderer/gfx-gles2/GLES2Context.cc index 314424966d..9e705df044 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Context.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2Context.cc @@ -192,8 +192,8 @@ bool GLES2Context::initialize(const GFXContextInfo &info) { return false; } - uint width = _device->width(); - uint height = _device->height(); + uint width = _device->getWidth(); + uint height = _device->getHeight(); ANativeWindow_setBuffersGeometry((ANativeWindow*)_windowHandle, width, height, n_fmt); #endif @@ -248,8 +248,8 @@ bool GLES2Context::initialize(const GFXContextInfo &info) { _eglDisplay = sharedCtx->egl_display(); _eglConfig = sharedCtx->egl_config(); _eglSharedContext = sharedCtx->egl_shared_ctx(); - _colorFmt = sharedCtx->colorFormat(); - _depthStencilFmt = sharedCtx->detphStencilFormat(); + _colorFmt = sharedCtx->getColorFormat(); + _depthStencilFmt = sharedCtx->getDetphStencilFormat(); EGLint pbuff_attribs[] = { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Device.cc b/native/cocos/renderer/gfx-gles2/GLES2Device.cc index 3fa77a650c..562d06d482 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Device.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2Device.cc @@ -114,8 +114,8 @@ bool GLES2Device::initialize(const GFXDeviceInfo& info) CC_LOG_INFO("COMPRESSED_FORMATS: %s", compressed_fmts.c_str()); GFXWindowInfo window_info; - window_info.colorFmt = _context->colorFormat(); - window_info.depthStencilFmt = _context->detphStencilFormat(); + window_info.colorFmt = _context->getColorFormat(); + window_info.depthStencilFmt = _context->getDetphStencilFormat(); window_info.isOffscreen = false; _window = createWindow(window_info); diff --git a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cc b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cc index 3bf66b2074..4d0cf6dede 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cc @@ -42,7 +42,7 @@ bool GLES2Framebuffer::initialize(const GFXFramebufferInfo &info) { #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) else { - _gpuFBO->glFramebuffer = static_cast(_device->context())->getDefaultFramebuffer(); + _gpuFBO->glFramebuffer = static_cast(_device->getContext())->getDefaultFramebuffer(); } #endif return true; diff --git a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cc b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cc index eec0892ad7..ca0e10ab33 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cc @@ -20,9 +20,9 @@ bool GLES2InputAssembler::initialize(const GFXInputAssemblerInfo &info) { _indirectBuffer = info.indirectBuffer; if (_indexBuffer) { - _indexCount = _indexBuffer->count(); + _indexCount = _indexBuffer->getCount(); } else if (_vertexBuffers.size()) { - _vertexCount = _vertexBuffers[0]->count(); + _vertexCount = _vertexBuffers[0]->getCount(); } _gpuInputAssembler = CC_NEW(GLES2GPUInputAssembler); diff --git a/native/cocos/renderer/gfx-gles2/GLES2Texture.cc b/native/cocos/renderer/gfx-gles2/GLES2Texture.cc index d86da7a25f..e295b0840b 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Texture.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2Texture.cc @@ -27,7 +27,7 @@ bool GLES2Texture::initialize(const GFXTextureInfo &info) { if (_flags & GFXTextureFlags::BAKUP_BUFFER) { _buffer = (uint8_t*)CC_MALLOC(_size); - _device->memoryStatus().textureSize += _size; + _device->getMemoryStatus().textureSize += _size; } _gpuTexture = CC_NEW(GLES2GPUTexture); @@ -78,7 +78,7 @@ bool GLES2Texture::initialize(const GFXTextureInfo &info) { _gpuTexture->isPowerOf2 = math::IsPowerOfTwo(_width) && math::IsPowerOfTwo(_height); GLES2CmdFuncCreateTexture((GLES2Device*)_device, _gpuTexture); - _device->memoryStatus().textureSize += _size; + _device->getMemoryStatus().textureSize += _size; return true; } @@ -86,14 +86,14 @@ bool GLES2Texture::initialize(const GFXTextureInfo &info) { void GLES2Texture::destroy() { if (_gpuTexture) { GLES2CmdFuncDestroyTexture((GLES2Device*)_device, _gpuTexture); - _device->memoryStatus().textureSize -= _size; + _device->getMemoryStatus().textureSize -= _size; CC_DELETE(_gpuTexture); _gpuTexture = nullptr; } if (_buffer) { CC_FREE(_buffer); - _device->memoryStatus().textureSize -= _size; + _device->getMemoryStatus().textureSize -= _size; _buffer = nullptr; } } @@ -106,7 +106,7 @@ void GLES2Texture::resize(uint width, uint height) { _height = height; _size = size; - GFXMemoryStatus& status = _device->memoryStatus(); + GFXMemoryStatus& status = _device->getMemoryStatus(); _gpuTexture->width = _width; _gpuTexture->height = _height; _gpuTexture->size = _size; diff --git a/native/cocos/renderer/gfx-gles3/GLES3Buffer.cc b/native/cocos/renderer/gfx-gles3/GLES3Buffer.cc index 591397a9c2..ad2caf2a92 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Buffer.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3Buffer.cc @@ -22,7 +22,7 @@ bool GLES3Buffer::initialize(const GFXBufferInfo& info) { if ((_flags & GFXBufferFlagBit::BAKUP_BUFFER) && _size > 0) { _buffer = (uint8_t*)CC_MALLOC(_size); - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; } _gpuBuffer = CC_NEW(GLES3GPUBuffer); @@ -37,7 +37,7 @@ bool GLES3Buffer::initialize(const GFXBufferInfo& info) { } GLES3CmdFuncCreateBuffer((GLES3Device*)_device, _gpuBuffer); - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; return true; } @@ -45,14 +45,14 @@ bool GLES3Buffer::initialize(const GFXBufferInfo& info) { void GLES3Buffer::destroy() { if (_gpuBuffer) { GLES3CmdFuncDestroyBuffer((GLES3Device*)_device, _gpuBuffer); - _device->memoryStatus().bufferSize -= _size; + _device->getMemoryStatus().bufferSize -= _size; CC_DELETE(_gpuBuffer); _gpuBuffer = nullptr; } if (_buffer) { CC_FREE(_buffer); - _device->memoryStatus().bufferSize -= _size; + _device->getMemoryStatus().bufferSize -= _size; _buffer = nullptr; } } @@ -63,7 +63,7 @@ void GLES3Buffer::resize(uint size) { _size = size; _count = _size / _stride; - GFXMemoryStatus& status = _device->memoryStatus(); + GFXMemoryStatus& status = _device->getMemoryStatus(); _gpuBuffer->size = _size; _gpuBuffer->count = _count; GLES3CmdFuncResizeBuffer((GLES3Device*)_device, _gpuBuffer); diff --git a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc index 769b3673a6..2fc2f2c602 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc @@ -199,12 +199,12 @@ void GLES3CommandBuffer::draw(GFXInputAssembler* ia) { if(_curGPUPipelineState) { switch (_curGPUPipelineState->glPrimitive) { case GL_TRIANGLES: { - _numTriangles += ia->indexCount() / 3 * std::max(ia->instanceCount(), 1U); + _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getInstanceCount(), 1U); break; } case GL_TRIANGLE_STRIP: case GL_TRIANGLE_FAN: { - _numTriangles += (ia->indexCount() - 2) * std::max(ia->instanceCount(), 1U); + _numTriangles += (ia->getIndexCount() - 2) * std::max(ia->getInstanceCount(), 1U); break; } default: @@ -289,8 +289,8 @@ void GLES3CommandBuffer::execute(const std::vector& cmd_buffs } _cmdPackage->cmds.concat(cmd_buff->_cmdPackage->cmds); - _numDrawCalls += cmd_buff->numDrawCalls(); - _numTriangles += cmd_buff->numTris(); + _numDrawCalls += cmd_buff->getNumDrawCalls(); + _numTriangles += cmd_buff->getNumTris(); } } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Context.cc b/native/cocos/renderer/gfx-gles3/GLES3Context.cc index fe2cf40671..2d8d589eee 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Context.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3Context.cc @@ -192,8 +192,8 @@ bool GLES3Context::initialize(const GFXContextInfo &info) { return false; } - uint width = _device->width(); - uint height = _device->height(); + uint width = _device->getWidth(); + uint height = _device->getHeight(); ANativeWindow_setBuffersGeometry((ANativeWindow*)_windowHandle, width, height, n_fmt); #endif @@ -256,8 +256,8 @@ bool GLES3Context::initialize(const GFXContextInfo &info) { _eglDisplay = sharedCtx->egl_display(); _eglConfig = sharedCtx->egl_config(); _eglSharedContext = sharedCtx->egl_shared_ctx(); - _colorFmt = sharedCtx->colorFormat(); - _depthStencilFmt = sharedCtx->detphStencilFormat(); + _colorFmt = sharedCtx->getColorFormat(); + _depthStencilFmt = sharedCtx->getDetphStencilFormat(); EGLint pbuff_attribs[] = { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.cc b/native/cocos/renderer/gfx-gles3/GLES3Device.cc index 592ce65c1a..33c8043fc7 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.cc @@ -107,8 +107,8 @@ bool GLES3Device::initialize(const GFXDeviceInfo& info) CC_LOG_INFO("COMPRESSED_FORMATS: %s", compressed_fmts.c_str()); GFXWindowInfo window_info; - window_info.colorFmt = _context->colorFormat(); - window_info.depthStencilFmt = _context->detphStencilFormat(); + window_info.colorFmt = _context->getColorFormat(); + window_info.depthStencilFmt = _context->getDetphStencilFormat(); window_info.isOffscreen = false; _window = createWindow(window_info); diff --git a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cc b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cc index 6e48a2a958..fe7cd4a322 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cc @@ -42,7 +42,7 @@ bool GLES3Framebuffer::initialize(const GFXFramebufferInfo &info) { #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) else { - _gpuFBO->glFramebuffer = static_cast(_device->context())->getDefaultFramebuffer(); + _gpuFBO->glFramebuffer = static_cast(_device->getContext())->getDefaultFramebuffer(); } #endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cc b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cc index d09361984e..436fa64a12 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cc @@ -20,9 +20,9 @@ bool GLES3InputAssembler::initialize(const GFXInputAssemblerInfo &info) { _indirectBuffer = info.indirectBuffer; if (_indexBuffer) { - _indexCount = _indexBuffer->count(); + _indexCount = _indexBuffer->getCount(); } else if (_vertexBuffers.size()) { - _vertexCount = _vertexBuffers[0]->count(); + _vertexCount = _vertexBuffers[0]->getCount(); } _gpuInputAssembler = CC_NEW(GLES3GPUInputAssembler); diff --git a/native/cocos/renderer/gfx-gles3/GLES3Texture.cc b/native/cocos/renderer/gfx-gles3/GLES3Texture.cc index 1209bc4946..c6fdccbb8b 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Texture.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3Texture.cc @@ -27,7 +27,7 @@ bool GLES3Texture::initialize(const GFXTextureInfo &info) { if (_flags & GFXTextureFlags::BAKUP_BUFFER) { _buffer = (uint8_t*)CC_MALLOC(_size); - _device->memoryStatus().textureSize += _size; + _device->getMemoryStatus().textureSize += _size; } _gpuTexture = CC_NEW(GLES3GPUTexture); @@ -78,7 +78,7 @@ bool GLES3Texture::initialize(const GFXTextureInfo &info) { _gpuTexture->isPowerOf2 = math::IsPowerOfTwo(_width) && math::IsPowerOfTwo(_height); GLES3CmdFuncCreateTexture((GLES3Device*)_device, _gpuTexture); - _device->memoryStatus().textureSize += _size; + _device->getMemoryStatus().textureSize += _size; return true; } @@ -86,14 +86,14 @@ bool GLES3Texture::initialize(const GFXTextureInfo &info) { void GLES3Texture::destroy() { if (_gpuTexture) { GLES3CmdFuncDestroyTexture((GLES3Device*)_device, _gpuTexture); - _device->memoryStatus().textureSize -= _size; + _device->getMemoryStatus().textureSize -= _size; CC_DELETE(_gpuTexture); _gpuTexture = nullptr; } if (_buffer) { CC_FREE(_buffer); - _device->memoryStatus().textureSize -= _size; + _device->getMemoryStatus().textureSize -= _size; _buffer = nullptr; } } @@ -106,7 +106,7 @@ void GLES3Texture::resize(uint width, uint height) { _height = height; _size = size; - GFXMemoryStatus& status = _device->memoryStatus(); + GFXMemoryStatus& status = _device->getMemoryStatus(); _gpuTexture->width = _width; _gpuTexture->height = _height; _gpuTexture->size = _size; diff --git a/native/cocos/renderer/gfx-metal/MTLBuffer.mm b/native/cocos/renderer/gfx-metal/MTLBuffer.mm index df28a67502..d3b6bf347d 100644 --- a/native/cocos/renderer/gfx-metal/MTLBuffer.mm +++ b/native/cocos/renderer/gfx-metal/MTLBuffer.mm @@ -40,7 +40,7 @@ bool CCMTLBuffer::initialize(const GFXBufferInfo& info) if ((_flags & GFXBufferFlagBit::BAKUP_BUFFER) && _size > 0) { _buffer = (uint8_t*)CC_MALLOC(_size); - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; } switch (info.usage) { @@ -62,7 +62,7 @@ bool CCMTLBuffer::initialize(const GFXBufferInfo& info) CCASSERT(false, "CCMTLBuffer: failed to create memory for transfer buffer."); return false; } - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; break; case GFXBufferUsage::STORAGE: @@ -80,7 +80,7 @@ bool CCMTLBuffer::initialize(const GFXBufferInfo& info) if (!_buffer) CCLOG("CCMTLBuffer: failed to create backup memory."); else - _device->memoryStatus().bufferSize += _size; + _device->getMemoryStatus().bufferSize += _size; } return true; @@ -98,13 +98,13 @@ void CCMTLBuffer::destroy() { CC_FREE(_transferBuffer); _transferBuffer = nullptr; - _device->memoryStatus().bufferSize -= _size; + _device->getMemoryStatus().bufferSize -= _size; } if (_buffer) { CC_FREE(_buffer); - _device->memoryStatus().bufferSize -= _size; + _device->getMemoryStatus().bufferSize -= _size; _buffer = nullptr; } } diff --git a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm index 51273d5096..fe7ed22780 100644 --- a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm +++ b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm @@ -201,10 +201,10 @@ void CCMTLCommandBuffer::draw(GFXInputAssembler* ia) { switch (_currentGPUPipelineState->primitiveType) { case MTLPrimitiveTypeTriangle: - _numTriangles += ia->indexCount() / 3 * std::max(ia->indexCount(), 1U); + _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getIndexCount(), 1U); break; case MTLPrimitiveTypeTriangleStrip: - _numTriangles += (ia->indexCount() - 2) * std::max(ia->instanceCount(), 1U); + _numTriangles += (ia->getIndexCount() - 2) * std::max(ia->getInstanceCount(), 1U); break; default: break; diff --git a/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm b/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm index 89eb52f64b..c6b8007143 100644 --- a/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm +++ b/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm @@ -17,9 +17,9 @@ bool CCMTLInputAssembler::initialize(const GFXInputAssemblerInfo& info) _indirectBuffer = info.indirectBuffer; if (_indexBuffer) - _indexCount = _indexBuffer->count(); + _indexCount = _indexBuffer->getCount(); else if (_vertexBuffers.size()) - _vertexCount = _vertexBuffers[0]->count(); + _vertexCount = _vertexBuffers[0]->getCount(); _GPUInputAssembler = CC_NEW(CCMTLGPUInputAssembler); if (!_GPUInputAssembler) diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineState.mm b/native/cocos/renderer/gfx-metal/MTLPipelineState.mm index e426487535..e895d36e41 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineState.mm +++ b/native/cocos/renderer/gfx-metal/MTLPipelineState.mm @@ -55,7 +55,7 @@ void CCMTLPipelineState::updateBindingBlocks(const GFXBindingLayout* bl) if (!bl) return; - for (const auto& bindingUnit : bl->bindingUnits() ) + for (const auto& bindingUnit : bl->getBindingUnits() ) { for (auto& block : _vertexUniformBlocks) { @@ -250,7 +250,7 @@ void CCMTLPipelineState::setFormats(MTLRenderPipelineDescriptor* descriptor) { int i = 0; MTLPixelFormat mtlPixelFormat; - for (const auto& colorAttachment : _renderPass->colorAttachments()) + for (const auto& colorAttachment : _renderPass->getColorAttachments()) { mtlPixelFormat = mu::toMTLPixelFormat(colorAttachment.format); if (mtlPixelFormat != MTLPixelFormatInvalid) @@ -259,11 +259,11 @@ void CCMTLPipelineState::setFormats(MTLRenderPipelineDescriptor* descriptor) ++i; } - mtlPixelFormat = mu::toMTLPixelFormat(_renderPass->depthStencilAttachment().format); + mtlPixelFormat = mu::toMTLPixelFormat(_renderPass->getDepthStencilAttachment().format); if (mtlPixelFormat != MTLPixelFormatInvalid) descriptor.depthAttachmentPixelFormat = mtlPixelFormat; - mtlPixelFormat = mu::toMTLPixelFormat(_renderPass->depthStencilAttachment().format); + mtlPixelFormat = mu::toMTLPixelFormat(_renderPass->getDepthStencilAttachment().format); if (mtlPixelFormat != MTLPixelFormatInvalid) descriptor.stencilAttachmentPixelFormat = mtlPixelFormat; } @@ -375,7 +375,7 @@ std::tuple CCMTLPipelineState::getBufferBinding(MTLArgument* argument for (MTLStructMember* member in argument.bufferStructType.members) { const char* memberName = [member.name UTF8String]; - for (const auto& block : _shader->blocks() ) + for (const auto& block : _shader->getBlocks() ) { for (const auto& uniform : block.uniforms) { @@ -394,9 +394,9 @@ void CCMTLPipelineState::bindTextureAndSampler(MTLArgument* argument, bool isVer return; const char* argumentName = [argument.name UTF8String]; - for (auto bindingLayout : _layout->layouts() ) + for (auto bindingLayout : _layout->getLayouts() ) { - for (const auto& bindingUnit : bindingLayout->bindingUnits() ) + for (const auto& bindingUnit : bindingLayout->getBindingUnits() ) { if (bindingUnit.sampler) { @@ -418,9 +418,9 @@ bool CCMTLPipelineState::matchSamplerName(const char* argumentName, const std::s void CCMTLPipelineState::bindTexture(MTLArgument* argument, uint originBinding, bool isVertex) { - for (auto bindingLayout : _layout->layouts() ) + for (auto bindingLayout : _layout->getLayouts() ) { - for (const auto& bindingUnit : bindingLayout->bindingUnits() ) + for (const auto& bindingUnit : bindingLayout->getBindingUnits() ) { if (bindingUnit.binding == originBinding) { @@ -447,9 +447,9 @@ void CCMTLPipelineState::bindTexture(MTLArgument* argument, uint originBinding, void CCMTLPipelineState::bindSamplerState(MTLArgument* argument, uint originBinding, bool isVertex) { - for (auto bindingLayout : _layout->layouts() ) + for (auto bindingLayout : _layout->getLayouts() ) { - for (const auto& bindingUnit : bindingLayout->bindingUnits() ) + for (const auto& bindingUnit : bindingLayout->getBindingUnits() ) { if (bindingUnit.sampler && bindingUnit.binding == originBinding) { diff --git a/native/cocos/renderer/gfx-metal/MTLQueue.mm b/native/cocos/renderer/gfx-metal/MTLQueue.mm index 0ce339bcaa..38d60b4218 100644 --- a/native/cocos/renderer/gfx-metal/MTLQueue.mm +++ b/native/cocos/renderer/gfx-metal/MTLQueue.mm @@ -84,7 +84,7 @@ void CCMTLQueue::executeCommands(const CCMTLCommandPackage* commandPackage) if (!cmdBeginRenderPass->frameBuffer->isOffscreen() ) mtlRenderPassDescriptor = mtkView.currentRenderPassDescriptor; else - mtlRenderPassDescriptor = static_cast(cmdBeginRenderPass->frameBuffer->renderPass() )->getMTLRenderPassDescriptor(); + mtlRenderPassDescriptor = static_cast(cmdBeginRenderPass->frameBuffer->getRenderPass() )->getMTLRenderPassDescriptor(); if (cmdBeginRenderPass->clearFlags & GFXClearFlagBit::COLOR) mtlRenderPassDescriptor.colorAttachments[0].clearColor = mu::toMTLClearColor(cmdBeginRenderPass->clearColors[0]); @@ -163,13 +163,13 @@ void CCMTLQueue::executeCommands(const CCMTLCommandPackage* commandPackage) if (gpuInputAssembler->mtlIndexBuffer && cmd->drawInfo.indexCount >= 0) { uint8_t* offset = 0; - offset += cmd->drawInfo.firstIndex * inputAssembler->indexBuffer()->stride(); + offset += cmd->drawInfo.firstIndex * inputAssembler->getIndexBuffer()->getStride(); if (cmd->drawInfo.instanceCount == 0) { [encoder drawIndexedPrimitives:primitiveType indexCount:cmd->drawInfo.indexCount // TODO: remove static_cast<>. - indexType:static_cast(inputAssembler->indexBuffer() )->getIndexType() + indexType:static_cast(inputAssembler->getIndexBuffer() )->getIndexType() indexBuffer:gpuInputAssembler->mtlIndexBuffer indexBufferOffset:0]; } diff --git a/native/cocos/renderer/gfx-metal/MTLTexture.mm b/native/cocos/renderer/gfx-metal/MTLTexture.mm index 4e04dc710c..ad0c29c417 100644 --- a/native/cocos/renderer/gfx-metal/MTLTexture.mm +++ b/native/cocos/renderer/gfx-metal/MTLTexture.mm @@ -59,7 +59,7 @@ bool CCMTLTexture::initialize(const GFXTextureInfo& info) if (_flags & GFXTextureFlags::BAKUP_BUFFER) { _buffer = (uint8_t*)CC_MALLOC(_size); - _device->memoryStatus().textureSize += _size; + _device->getMemoryStatus().textureSize += _size; } _convertedFormat = mu::convertGFXPixelFormat(_format); @@ -90,7 +90,7 @@ bool CCMTLTexture::initialize(const GFXTextureInfo& info) _mtlTexture = [mtlDevice newTextureWithDescriptor:descriptor]; if (_mtlTexture) - _device->memoryStatus().textureSize += _size; + _device->getMemoryStatus().textureSize += _size; return _mtlTexture != nil; } @@ -100,7 +100,7 @@ void CCMTLTexture::destroy() if (_buffer) { CC_FREE(_buffer); - _device->memoryStatus().textureSize -= _size; + _device->getMemoryStatus().textureSize -= _size; _buffer = nullptr; } diff --git a/native/tools/tojs/gfx.ini b/native/tools/tojs/gfx.ini index d1664845d4..e3fe960f5d 100644 --- a/native/tools/tojs/gfx.ini +++ b/native/tools/tojs/gfx.ini @@ -63,22 +63,22 @@ skip = GFXBindingLayout::[GFXBindingLayout], GFXDevice::[copyBuffersToTexture], GFXBlendState::[targets] -getter_setter = GFXDevice::[width/width height/height nativeWidth/nativeWidth nativeHeight/nativeHeight memoryStatus/memoryStatus context/context mainWindow/mainWindow queue/queue commandAllocator/commandAllocator renderer/renderer vendor/vendor numDrawCalls/numDrawCalls numTris/numTris], - GFXWindow::[device/device title/title left/left top/top width/width height/height nativeWidth/nativeWidth nativeHeight/nativeHeight colorFormat/colorFormat isOffscreen/isOffscreen renderPass/renderPass colorTexture/colorTexture colorTexView/colorTexView depthStencilTexture/depthStencilTexture depthStencilTexView/depthStencilTexView framebuffer/framebuffer], - GFXShader::[device/device name/name hash/hash stages/stages blocks/blocks samplers/samplers], - GFXTextureView::[device/device texture/texture type/type format/format baseLevel/baseLevel levelCount/levelCount baseLayer/baseLayer layerCount/layerCount], - GFXTexture::[type/type usage/usage format/format width/width height/height depth/depth arrayLayer/arrayLayer mipLevel/mipLevel size/size samples/samples flags/flags buffer/buffer], - GFXBindingLayout::[device/device bindingUnits/bindingUnits], - GFXQueue::[device/device type/type], - GFXRenderPass::[device/device colorAttachments/colorAttachments depthStencilAttachment/depthStencilAttachment subPasses/subPasses], - GFXPipelineLayout::[device/device], - GFXPipelineState::[device/device shader/shader primitive/primitive inputState/inputState rasterizerState/rasterizerState depthStencilState/depthStencilState blendState/blendState pipelineLayout/pipelineLayout renderPass/renderPass], - GFXInputAssembler::[device/device attributes/attributes vertexBuffers/vertexBuffers indexBuffer/indexBuffer indirectBuffer/indirectBuffer vertexCount/vertexCount firstVertex/firstVertex indexCount/indexCount firstIndex/firstIndex vertexOffset/vertexOffset instanceCount/instanceCount firstInstance/firstInstance], - GFXCommandBuffer::[device/device allocator/allocator type/type numDrawCalls/numDrawCalls numTris/numTris], - GFXContext::[device/device sharedContext/sharedContext vsyncMode/vsyncMode colorFormat/colorFormat depthStencilFormat/depthStencilFormat], - GFXFrameBuffer::[device/device renderPass/renderPass colorViews/colorViews depthStencilView/depthStencilView isOffscreen/isOffscreen], - GFXBuffer::[device/device usage/usage memUsage/memUsage stride/stride count/count size/size flags/flags bufferView/bufferView], - GFXSampler::[device/device name/name minFilter/minFilter magFilter/magFilter mipFilter/mipFilter addressU/addressU addressV/addressV addressW/addressW maxAnisotropy/maxAnisotropy cmpFunc/cmpFunc borderColor/borderColor minLOD/minLOD maxLOD/maxLOD mipLODBias/mipLODBias] +getter_setter = GFXDevice::[width height nativeWidth nativeHeight memoryStatus context mainWindow queue commandAllocator renderer vendor numDrawCalls numTris], + 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], + GFXTexture::[type usage format width height depth arrayLayer mipLevel size samples flags buffer], + GFXBindingLayout::[device bindingUnits], + GFXQueue::[device type], + GFXRenderPass::[device colorAttachments depthStencilAttachment subPasses], + GFXPipelineLayout::[device], + GFXPipelineState::[device shader primitive inputState rasterizerState depthStencilState blendState pipelineLayout renderPass], + GFXInputAssembler::[device attributes vertexBuffers indexBuffer indirectBuffer vertexCount firstVertex indexCount firstIndex vertexOffset instanceCount firstInstance], + GFXCommandBuffer::[device allocator type numDrawCalls numTris], + GFXContext::[device sharedContext/sharedContext vsyncMode colorFormat depthStencilFormat], + GFXFrameBuffer::[device renderPass colorViews depthStencilView isOffscreen/isOffscreen], + GFXBuffer::[device usage memUsage stride count size flags bufferView], + GFXSampler::[device name minFilter magFilter mipFilter addressU addressV addressW maxAnisotropy cmpFunc borderColor minLOD maxLOD mipLODBias] rename_functions =