Sfoglia il codice sorgente

Renderer: unsigned to signed

1vanK 3 anni fa
parent
commit
e97c71bdaa

+ 41 - 41
Source/Urho3D/AngelScript/Generated_Members.h

@@ -11428,41 +11428,41 @@ template <class T> void RegisterMembers_Renderer(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "float GetMobileShadowBiasMul() const", AS_METHODPR(T, GetMobileShadowBiasMul, () const, float), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "float get_mobileShadowBiasMul() const", AS_METHODPR(T, GetMobileShadowBiasMul, () const, float), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumBatches() const
-    engine->RegisterObjectMethod(className, "uint GetNumBatches() const", AS_METHODPR(T, GetNumBatches, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numBatches() const", AS_METHODPR(T, GetNumBatches, () const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumBatches() const
+    engine->RegisterObjectMethod(className, "int GetNumBatches() const", AS_METHODPR(T, GetNumBatches, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numBatches() const", AS_METHODPR(T, GetNumBatches, () const, i32), AS_CALL_THISCALL);
 
     // int Renderer::GetNumExtraInstancingBufferElements() const
     engine->RegisterObjectMethod(className, "int GetNumExtraInstancingBufferElements() const", AS_METHODPR(T, GetNumExtraInstancingBufferElements, () const, int), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "int get_numExtraInstancingBufferElements() const", AS_METHODPR(T, GetNumExtraInstancingBufferElements, () const, int), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumGeometries(bool allViews = false) const
-    engine->RegisterObjectMethod(className, "uint GetNumGeometries(bool = false) const", AS_METHODPR(T, GetNumGeometries, (bool) const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numGeometries(bool = false) const", AS_METHODPR(T, GetNumGeometries, (bool) const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumGeometries(bool allViews = false) const
+    engine->RegisterObjectMethod(className, "int GetNumGeometries(bool = false) const", AS_METHODPR(T, GetNumGeometries, (bool) const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numGeometries(bool = false) const", AS_METHODPR(T, GetNumGeometries, (bool) const, i32), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumLights(bool allViews = false) const
-    engine->RegisterObjectMethod(className, "uint GetNumLights(bool = false) const", AS_METHODPR(T, GetNumLights, (bool) const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numLights(bool = false) const", AS_METHODPR(T, GetNumLights, (bool) const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumLights(bool allViews = false) const
+    engine->RegisterObjectMethod(className, "int GetNumLights(bool = false) const", AS_METHODPR(T, GetNumLights, (bool) const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numLights(bool = false) const", AS_METHODPR(T, GetNumLights, (bool) const, i32), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumOccluders(bool allViews = false) const
-    engine->RegisterObjectMethod(className, "uint GetNumOccluders(bool = false) const", AS_METHODPR(T, GetNumOccluders, (bool) const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numOccluders(bool = false) const", AS_METHODPR(T, GetNumOccluders, (bool) const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumOccluders(bool allViews = false) const
+    engine->RegisterObjectMethod(className, "int GetNumOccluders(bool = false) const", AS_METHODPR(T, GetNumOccluders, (bool) const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numOccluders(bool = false) const", AS_METHODPR(T, GetNumOccluders, (bool) const, i32), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumPrimitives() const
-    engine->RegisterObjectMethod(className, "uint GetNumPrimitives() const", AS_METHODPR(T, GetNumPrimitives, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numPrimitives() const", AS_METHODPR(T, GetNumPrimitives, () const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumPrimitives() const
+    engine->RegisterObjectMethod(className, "int GetNumPrimitives() const", AS_METHODPR(T, GetNumPrimitives, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numPrimitives() const", AS_METHODPR(T, GetNumPrimitives, () const, i32), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumShadowMaps(bool allViews = false) const
-    engine->RegisterObjectMethod(className, "uint GetNumShadowMaps(bool = false) const", AS_METHODPR(T, GetNumShadowMaps, (bool) const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numShadowMaps(bool = false) const", AS_METHODPR(T, GetNumShadowMaps, (bool) const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumShadowMaps(bool allViews = false) const
+    engine->RegisterObjectMethod(className, "int GetNumShadowMaps(bool = false) const", AS_METHODPR(T, GetNumShadowMaps, (bool) const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numShadowMaps(bool = false) const", AS_METHODPR(T, GetNumShadowMaps, (bool) const, i32), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumViewports() const
-    engine->RegisterObjectMethod(className, "uint GetNumViewports() const", AS_METHODPR(T, GetNumViewports, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numViewports() const", AS_METHODPR(T, GetNumViewports, () const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumViewports() const
+    engine->RegisterObjectMethod(className, "int GetNumViewports() const", AS_METHODPR(T, GetNumViewports, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numViewports() const", AS_METHODPR(T, GetNumViewports, () const, i32), AS_CALL_THISCALL);
 
-    // unsigned Renderer::GetNumViews() const
-    engine->RegisterObjectMethod(className, "uint GetNumViews() const", AS_METHODPR(T, GetNumViews, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numViews() const", AS_METHODPR(T, GetNumViews, () const, unsigned), AS_CALL_THISCALL);
+    // i32 Renderer::GetNumViews() const
+    engine->RegisterObjectMethod(className, "int GetNumViews() const", AS_METHODPR(T, GetNumViews, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numViews() const", AS_METHODPR(T, GetNumViews, () const, i32), AS_CALL_THISCALL);
 
     // float Renderer::GetOccluderSizeThreshold() const
     engine->RegisterObjectMethod(className, "float GetOccluderSizeThreshold() const", AS_METHODPR(T, GetOccluderSizeThreshold, () const, float), AS_CALL_THISCALL);
@@ -11485,14 +11485,14 @@ template <class T> void RegisterMembers_Renderer(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "bool GetReuseShadowMaps() const", AS_METHODPR(T, GetReuseShadowMaps, () const, bool), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_reuseShadowMaps() const", AS_METHODPR(T, GetReuseShadowMaps, () const, bool), AS_CALL_THISCALL);
 
-    // Texture* Renderer::GetScreenBuffer(int width, int height, unsigned format, int multiSample, bool autoResolve, bool cubemap, bool filtered, bool srgb, unsigned persistentKey = 0)
-    engine->RegisterObjectMethod(className, "Texture@+ GetScreenBuffer(int, int, uint, int, bool, bool, bool, bool, uint = 0)", AS_METHODPR(T, GetScreenBuffer, (int, int, unsigned, int, bool, bool, bool, bool, unsigned), Texture*), AS_CALL_THISCALL);
+    // Texture* Renderer::GetScreenBuffer(int width, int height, unsigned format, int multiSample, bool autoResolve, bool cubemap, bool filtered, bool srgb, hash32 persistentKey = 0)
+    engine->RegisterObjectMethod(className, "Texture@+ GetScreenBuffer(int, int, uint, int, bool, bool, bool, bool, hash32 = 0)", AS_METHODPR(T, GetScreenBuffer, (int, int, unsigned, int, bool, bool, bool, bool, hash32), Texture*), AS_CALL_THISCALL);
 
     // Camera* Renderer::GetShadowCamera()
     engine->RegisterObjectMethod(className, "Camera@+ GetShadowCamera()", AS_METHODPR(T, GetShadowCamera, (), Camera*), AS_CALL_THISCALL);
 
-    // Texture2D* Renderer::GetShadowMap(Light* light, Camera* camera, unsigned viewWidth, unsigned viewHeight)
-    engine->RegisterObjectMethod(className, "Texture2D@+ GetShadowMap(Light@+, Camera@+, uint, uint)", AS_METHODPR(T, GetShadowMap, (Light*, Camera*, unsigned, unsigned), Texture2D*), AS_CALL_THISCALL);
+    // Texture2D* Renderer::GetShadowMap(Light* light, Camera* camera, i32 viewWidth, i32 viewHeight)
+    engine->RegisterObjectMethod(className, "Texture2D@+ GetShadowMap(Light@+, Camera@+, int, int)", AS_METHODPR(T, GetShadowMap, (Light*, Camera*, i32, i32), Texture2D*), AS_CALL_THISCALL);
 
     // int Renderer::GetShadowMapSize() const
     engine->RegisterObjectMethod(className, "int GetShadowMapSize() const", AS_METHODPR(T, GetShadowMapSize, () const, int), AS_CALL_THISCALL);
@@ -11526,12 +11526,12 @@ template <class T> void RegisterMembers_Renderer(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "bool GetThreadedOcclusion() const", AS_METHODPR(T, GetThreadedOcclusion, () const, bool), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_threadedOcclusion() const", AS_METHODPR(T, GetThreadedOcclusion, () const, bool), AS_CALL_THISCALL);
 
-    // Viewport* Renderer::GetViewport(unsigned index) const
-    engine->RegisterObjectMethod(className, "Viewport@+ GetViewport(uint) const", AS_METHODPR(T, GetViewport, (unsigned) const, Viewport*), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "Viewport@+ get_viewports(uint) const", AS_METHODPR(T, GetViewport, (unsigned) const, Viewport*), AS_CALL_THISCALL);
+    // Viewport* Renderer::GetViewport(i32 index) const
+    engine->RegisterObjectMethod(className, "Viewport@+ GetViewport(int) const", AS_METHODPR(T, GetViewport, (i32) const, Viewport*), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "Viewport@+ get_viewports(int) const", AS_METHODPR(T, GetViewport, (i32) const, Viewport*), AS_CALL_THISCALL);
 
-    // Viewport* Renderer::GetViewportForScene(Scene* scene, unsigned index) const
-    engine->RegisterObjectMethod(className, "Viewport@+ GetViewportForScene(Scene@+, uint) const", AS_METHODPR(T, GetViewportForScene, (Scene*, unsigned) const, Viewport*), AS_CALL_THISCALL);
+    // Viewport* Renderer::GetViewportForScene(Scene* scene, i32 index) const
+    engine->RegisterObjectMethod(className, "Viewport@+ GetViewportForScene(Scene@+, int) const", AS_METHODPR(T, GetViewportForScene, (Scene*, i32) const, Viewport*), AS_CALL_THISCALL);
 
     // int Renderer::GetVSMMultiSample() const
     engine->RegisterObjectMethod(className, "int GetVSMMultiSample() const", AS_METHODPR(T, GetVSMMultiSample, () const, int), AS_CALL_THISCALL);
@@ -11559,8 +11559,8 @@ template <class T> void RegisterMembers_Renderer(asIScriptEngine* engine, const
     // void Renderer::Render()
     engine->RegisterObjectMethod(className, "void Render()", AS_METHODPR(T, Render, (), void), AS_CALL_THISCALL);
 
-    // bool Renderer::ResizeInstancingBuffer(unsigned numInstances)
-    engine->RegisterObjectMethod(className, "bool ResizeInstancingBuffer(uint)", AS_METHODPR(T, ResizeInstancingBuffer, (unsigned), bool), AS_CALL_THISCALL);
+    // bool Renderer::ResizeInstancingBuffer(i32 numInstances)
+    engine->RegisterObjectMethod(className, "bool ResizeInstancingBuffer(int)", AS_METHODPR(T, ResizeInstancingBuffer, (i32), bool), AS_CALL_THISCALL);
 
     // void Renderer::SetBatchShaders(Batch& batch, Technique* tech, bool allowShadows, const BatchQueue& queue)
     engine->RegisterObjectMethod(className, "void SetBatchShaders(Batch&, Technique@+, bool, const BatchQueue&in)", AS_METHODPR(T, SetBatchShaders, (Batch&, Technique*, bool, const BatchQueue&), void), AS_CALL_THISCALL);
@@ -11630,9 +11630,9 @@ template <class T> void RegisterMembers_Renderer(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "void SetNumExtraInstancingBufferElements(int)", AS_METHODPR(T, SetNumExtraInstancingBufferElements, (int), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_numExtraInstancingBufferElements(int)", AS_METHODPR(T, SetNumExtraInstancingBufferElements, (int), void), AS_CALL_THISCALL);
 
-    // void Renderer::SetNumViewports(unsigned num)
-    engine->RegisterObjectMethod(className, "void SetNumViewports(uint)", AS_METHODPR(T, SetNumViewports, (unsigned), void), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void set_numViewports(uint)", AS_METHODPR(T, SetNumViewports, (unsigned), void), AS_CALL_THISCALL);
+    // void Renderer::SetNumViewports(i32 num)
+    engine->RegisterObjectMethod(className, "void SetNumViewports(int)", AS_METHODPR(T, SetNumViewports, (i32), void), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void set_numViewports(int)", AS_METHODPR(T, SetNumViewports, (i32), void), AS_CALL_THISCALL);
 
     // void Renderer::SetOccluderSizeThreshold(float screenSize)
     engine->RegisterObjectMethod(className, "void SetOccluderSizeThreshold(float)", AS_METHODPR(T, SetOccluderSizeThreshold, (float), void), AS_CALL_THISCALL);
@@ -11678,9 +11678,9 @@ template <class T> void RegisterMembers_Renderer(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "void SetThreadedOcclusion(bool)", AS_METHODPR(T, SetThreadedOcclusion, (bool), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_threadedOcclusion(bool)", AS_METHODPR(T, SetThreadedOcclusion, (bool), void), AS_CALL_THISCALL);
 
-    // void Renderer::SetViewport(unsigned index, Viewport* viewport)
-    engine->RegisterObjectMethod(className, "void SetViewport(uint, Viewport@+)", AS_METHODPR(T, SetViewport, (unsigned, Viewport*), void), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void set_viewports(uint, Viewport@+)", AS_METHODPR(T, SetViewport, (unsigned, Viewport*), void), AS_CALL_THISCALL);
+    // void Renderer::SetViewport(i32 index, Viewport* viewport)
+    engine->RegisterObjectMethod(className, "void SetViewport(int, Viewport@+)", AS_METHODPR(T, SetViewport, (i32, Viewport*), void), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void set_viewports(int, Viewport@+)", AS_METHODPR(T, SetViewport, (i32, Viewport*), void), AS_CALL_THISCALL);
 
     // void Renderer::SetVSMMultiSample(int multiSample)
     engine->RegisterObjectMethod(className, "void SetVSMMultiSample(int)", AS_METHODPR(T, SetVSMMultiSample, (int), void), AS_CALL_THISCALL);

+ 36 - 23
Source/Urho3D/Graphics/Renderer.cpp

@@ -254,13 +254,16 @@ Renderer::Renderer(Context* context) :
 
 Renderer::~Renderer() = default;
 
-void Renderer::SetNumViewports(unsigned num)
+void Renderer::SetNumViewports(i32 num)
 {
+    assert(num >= 0);
     viewports_.Resize(num);
 }
 
-void Renderer::SetViewport(unsigned index, Viewport* viewport)
+void Renderer::SetViewport(i32 index, Viewport* viewport)
 {
+    assert(index >= 0);
+
     if (index >= viewports_.Size())
         viewports_.Resize(index + 1);
 
@@ -511,13 +514,16 @@ void Renderer::ApplyShadowMapFilter(View* view, Texture2D* shadowMap, float blur
         (shadowMapFilterInstance_->*shadowMapFilter_)(view, shadowMap, blurScale);
 }
 
-Viewport* Renderer::GetViewport(unsigned index) const
+Viewport* Renderer::GetViewport(i32 index) const
 {
+    assert(index >= 0);
     return index < viewports_.Size() ? viewports_[index] : nullptr;
 }
 
-Viewport* Renderer::GetViewportForScene(Scene* scene, unsigned index) const
+Viewport* Renderer::GetViewportForScene(Scene* scene, i32 index) const
 {
+    assert(index >= 0);
+
     for (unsigned i = 0; i < viewports_.Size(); ++i)
     {
         Viewport* viewport = viewports_[i];
@@ -547,10 +553,10 @@ Technique* Renderer::GetDefaultTechnique() const
     return defaultTechnique_;
 }
 
-unsigned Renderer::GetNumGeometries(bool allViews) const
+i32 Renderer::GetNumGeometries(bool allViews) const
 {
-    unsigned numGeometries = 0;
-    unsigned lastView = allViews ? views_.Size() : 1;
+    i32 numGeometries = 0;
+    i32 lastView = allViews ? views_.Size() : 1;
 
     for (unsigned i = 0; i < lastView; ++i)
     {
@@ -565,10 +571,10 @@ unsigned Renderer::GetNumGeometries(bool allViews) const
     return numGeometries;
 }
 
-unsigned Renderer::GetNumLights(bool allViews) const
+i32 Renderer::GetNumLights(bool allViews) const
 {
-    unsigned numLights = 0;
-    unsigned lastView = allViews ? views_.Size() : 1;
+    i32 numLights = 0;
+    i32 lastView = allViews ? views_.Size() : 1;
 
     for (unsigned i = 0; i < lastView; ++i)
     {
@@ -582,10 +588,10 @@ unsigned Renderer::GetNumLights(bool allViews) const
     return numLights;
 }
 
-unsigned Renderer::GetNumShadowMaps(bool allViews) const
+i32 Renderer::GetNumShadowMaps(bool allViews) const
 {
-    unsigned numShadowMaps = 0;
-    unsigned lastView = allViews ? views_.Size() : 1;
+    i32 numShadowMaps = 0;
+    i32 lastView = allViews ? views_.Size() : 1;
 
     for (unsigned i = 0; i < lastView; ++i)
     {
@@ -604,10 +610,10 @@ unsigned Renderer::GetNumShadowMaps(bool allViews) const
     return numShadowMaps;
 }
 
-unsigned Renderer::GetNumOccluders(bool allViews) const
+i32 Renderer::GetNumOccluders(bool allViews) const
 {
-    unsigned numOccluders = 0;
-    unsigned lastView = allViews ? views_.Size() : 1;
+    i32 numOccluders = 0;
+    i32 lastView = allViews ? views_.Size() : 1;
 
     for (unsigned i = 0; i < lastView; ++i)
     {
@@ -813,8 +819,11 @@ Geometry* Renderer::GetQuadGeometry()
     return dirLightGeometry_;
 }
 
-Texture2D* Renderer::GetShadowMap(Light* light, Camera* camera, unsigned viewWidth, unsigned viewHeight)
+Texture2D* Renderer::GetShadowMap(Light* light, Camera* camera, i32 viewWidth, i32 viewHeight)
 {
+    assert(viewWidth > 0);
+    assert(viewHeight > 0);
+
     LightType type = light->GetLightType();
     const FocusParameters& parameters = light->GetShadowFocus();
     float size = (float)shadowMapSize_ * light->GetShadowResolution();
@@ -977,7 +986,7 @@ Texture2D* Renderer::GetShadowMap(Light* light, Camera* camera, unsigned viewWid
 }
 
 Texture* Renderer::GetScreenBuffer(int width, int height, unsigned format, int multiSample, bool autoResolve, bool cubemap, bool filtered, bool srgb,
-    unsigned persistentKey)
+    hash32 persistentKey)
 {
     bool depthStencil = (format == Graphics::GetDepthStencilFormat()) || (format == Graphics::GetReadableDepthFormat());
     if (depthStencil)
@@ -1326,16 +1335,18 @@ void Renderer::SetCullMode(CullMode mode, Camera* camera)
     graphics_->SetCullMode(mode);
 }
 
-bool Renderer::ResizeInstancingBuffer(unsigned numInstances)
+bool Renderer::ResizeInstancingBuffer(i32 numInstances)
 {
+    assert(numInstances >= 0);
+
     if (!instancingBuffer_ || !dynamicInstancing_)
         return false;
 
-    unsigned oldSize = instancingBuffer_->GetVertexCount();
+    i32 oldSize = instancingBuffer_->GetVertexCount();
     if (numInstances <= oldSize)
         return true;
 
-    unsigned newSize = INSTANCING_BUFFER_DEFAULT_SIZE;
+    i32 newSize = INSTANCING_BUFFER_DEFAULT_SIZE;
     while (newSize < numInstances)
         newSize <<= 1;
 
@@ -1455,8 +1466,10 @@ const Rect& Renderer::GetLightScissor(Light* light, Camera* camera)
     }
 }
 
-void Renderer::UpdateQueuedViewport(unsigned index)
+void Renderer::UpdateQueuedViewport(i32 index)
 {
+    assert(index >= 0);
+
     WeakPtr<RenderSurface>& renderTarget = queuedViewports_[index].first_;
     WeakPtr<Viewport>& viewport = queuedViewports_[index].second_;
 
@@ -1554,7 +1567,7 @@ void Renderer::ResetShadowMapAllocations()
 
 void Renderer::ResetScreenBufferAllocations()
 {
-    for (HashMap<hash64, unsigned>::Iterator i = screenBufferAllocations_.Begin(); i != screenBufferAllocations_.End(); ++i)
+    for (HashMap<hash64, i32>::Iterator i = screenBufferAllocations_.Begin(); i != screenBufferAllocations_.End(); ++i)
         i->second_ = 0;
 }
 

+ 21 - 21
Source/Urho3D/Graphics/Renderer.h

@@ -167,10 +167,10 @@ public:
 
     /// Set number of backbuffer viewports to render.
     /// @property
-    void SetNumViewports(unsigned num);
+    void SetNumViewports(i32 num);
     /// Set a backbuffer viewport.
     /// @property{set_viewports}
-    void SetViewport(unsigned index, Viewport* viewport);
+    void SetViewport(i32 index, Viewport* viewport);
     /// Set default renderpath.
     /// @property
     void SetDefaultRenderPath(RenderPath* renderPath);
@@ -264,13 +264,13 @@ public:
 
     /// Return number of backbuffer viewports.
     /// @property
-    unsigned GetNumViewports() const { return viewports_.Size(); }
+    i32 GetNumViewports() const { return viewports_.Size(); }
 
     /// Return backbuffer viewport by index.
     /// @property{get_viewports}
-    Viewport* GetViewport(unsigned index) const;
+    Viewport* GetViewport(i32 index) const;
     /// Return nth backbuffer viewport associated to a scene. Index 0 returns the first.
-    Viewport* GetViewportForScene(Scene* scene, unsigned index) const;
+    Viewport* GetViewportForScene(Scene* scene, i32 index) const;
     /// Return default renderpath.
     /// @property
     RenderPath* GetDefaultRenderPath() const;
@@ -380,28 +380,28 @@ public:
 
     /// Return number of views rendered.
     /// @property
-    unsigned GetNumViews() const { return views_.Size(); }
+    i32 GetNumViews() const { return views_.Size(); }
 
     /// Return number of primitives rendered.
     /// @property
-    unsigned GetNumPrimitives() const { return numPrimitives_; }
+    i32 GetNumPrimitives() const { return numPrimitives_; }
 
     /// Return number of batches rendered.
     /// @property
-    unsigned GetNumBatches() const { return numBatches_; }
+    i32 GetNumBatches() const { return numBatches_; }
 
     /// Return number of geometries rendered.
     /// @property
-    unsigned GetNumGeometries(bool allViews = false) const;
+    i32 GetNumGeometries(bool allViews = false) const;
     /// Return number of lights rendered.
     /// @property
-    unsigned GetNumLights(bool allViews = false) const;
+    i32 GetNumLights(bool allViews = false) const;
     /// Return number of shadow maps rendered.
     /// @property
-    unsigned GetNumShadowMaps(bool allViews = false) const;
+    i32 GetNumShadowMaps(bool allViews = false) const;
     /// Return number of occluders rendered.
     /// @property
-    unsigned GetNumOccluders(bool allViews = false) const;
+    i32 GetNumOccluders(bool allViews = false) const;
 
     /// Return the default zone.
     /// @property
@@ -447,10 +447,10 @@ public:
     /// Return quad geometry used in postprocessing.
     Geometry* GetQuadGeometry();
     /// Allocate a shadow map. If shadow map reuse is disabled, a different map is returned each time.
-    Texture2D* GetShadowMap(Light* light, Camera* camera, unsigned viewWidth, unsigned viewHeight);
+    Texture2D* GetShadowMap(Light* light, Camera* camera, i32 viewWidth, i32 viewHeight);
     /// Allocate a rendertarget or depth-stencil texture for deferred rendering or postprocessing. Should only be called during actual rendering, not before.
     Texture* GetScreenBuffer
-        (int width, int height, unsigned format, int multiSample, bool autoResolve, bool cubemap, bool filtered, bool srgb, unsigned persistentKey = 0);
+        (int width, int height, unsigned format, int multiSample, bool autoResolve, bool cubemap, bool filtered, bool srgb, hash32 persistentKey = 0);
     /// Allocate a depth-stencil surface that does not need to be readable. Should only be called during actual rendering, not before.
     RenderSurface* GetDepthStencil(int width, int height, int multiSample, bool autoResolve);
     /// Allocate an occlusion buffer.
@@ -469,7 +469,7 @@ public:
     /// Set cull mode while taking possible projection flipping into account.
     void SetCullMode(CullMode mode, Camera* camera);
     /// Ensure sufficient size of the instancing vertex buffer. Return true if successful.
-    bool ResizeInstancingBuffer(unsigned numInstances);
+    bool ResizeInstancingBuffer(i32 numInstances);
     /// Optimize a light by scissor rectangle.
     void OptimizeLightByScissor(Light* light, Camera* camera);
     /// Optimize a light by marking it to the stencil buffer and setting a stencil test.
@@ -498,7 +498,7 @@ private:
     /// Create point light shadow indirection texture data.
     void SetIndirectionTextureData();
     /// Update a queued viewport for rendering.
-    void UpdateQueuedViewport(unsigned index);
+    void UpdateQueuedViewport(i32 index);
     /// Prepare for rendering of a new view.
     void PrepareViewRender();
     /// Remove unused occlusion and screen buffers.
@@ -563,7 +563,7 @@ private:
     /// Screen buffers by resolution and format.
     HashMap<hash64, Vector<SharedPtr<Texture>>> screenBuffers_;
     /// Current screen buffer allocations by resolution and format.
-    HashMap<hash64, unsigned> screenBufferAllocations_;
+    HashMap<hash64, i32> screenBufferAllocations_;
     /// Cache for light scissor queries.
     HashMap<Pair<Light*, Camera*>, Rect> lightScissorCache_;
     /// Backbuffer viewports.
@@ -621,13 +621,13 @@ private:
     /// Mobile platform shadow normal offset multiplier.
     float mobileNormalOffsetMul_{1.0f};
     /// Number of occlusion buffers in use.
-    unsigned numOcclusionBuffers_{};
+    i32 numOcclusionBuffers_{};
     /// Number of temporary shadow cameras in use.
-    unsigned numShadowCameras_{};
+    i32 numShadowCameras_{};
     /// Number of primitives (3D geometry only).
-    unsigned numPrimitives_{};
+    i32 numPrimitives_{};
     /// Number of batches (3D geometry only).
-    unsigned numBatches_{};
+    i32 numBatches_{};
     /// Frame number on which shaders last changed.
     i32 shadersChangedFrameNumber_{NINDEX};
     /// Current stencil value for light optimization.