Browse Source

OcclusionBuffer, View: fix threadIndex type

1vanK 3 years ago
parent
commit
fd3cb15235

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

@@ -11084,8 +11084,8 @@ template <class T> void RegisterMembers_OcclusionBuffer(asIScriptEngine* engine,
     // void OcclusionBuffer::Clear()
     engine->RegisterObjectMethod(className, "void Clear()", AS_METHODPR(T, Clear, (), void), AS_CALL_THISCALL);
 
-    // void OcclusionBuffer::DrawBatch(const OcclusionBatch& batch, unsigned threadIndex)
-    engine->RegisterObjectMethod(className, "void DrawBatch(const OcclusionBatch&in, uint)", AS_METHODPR(T, DrawBatch, (const OcclusionBatch&, unsigned), void), AS_CALL_THISCALL);
+    // void OcclusionBuffer::DrawBatch(const OcclusionBatch& batch, i32 threadIndex)
+    engine->RegisterObjectMethod(className, "void DrawBatch(const OcclusionBatch&in, int)", AS_METHODPR(T, DrawBatch, (const OcclusionBatch&, i32), void), AS_CALL_THISCALL);
 
     // void OcclusionBuffer::DrawTriangles()
     engine->RegisterObjectMethod(className, "void DrawTriangles()", AS_METHODPR(T, DrawTriangles, (), void), AS_CALL_THISCALL);

+ 12 - 4
Source/Urho3D/Graphics/OcclusionBuffer.cpp

@@ -442,8 +442,10 @@ unsigned OcclusionBuffer::GetUseTimer()
 }
 
 
-void OcclusionBuffer::DrawBatch(const OcclusionBatch& batch, unsigned threadIndex)
+void OcclusionBuffer::DrawBatch(const OcclusionBatch& batch, i32 threadIndex)
 {
+    assert(threadIndex >= 0);
+
     // If buffer not yet used, clear it
     if (threadIndex > 0 && !buffers_[threadIndex].used_)
     {
@@ -567,8 +569,10 @@ void OcclusionBuffer::CalculateViewport()
     projOffsetScaleY_ = projection_.m11_ * scaleY_;
 }
 
-void OcclusionBuffer::DrawTriangle(Vector4* vertices, unsigned threadIndex)
+void OcclusionBuffer::DrawTriangle(Vector4* vertices, i32 threadIndex)
 {
+    assert(threadIndex >= 0);
+
     ClipMaskFlags clipMask{};
     ClipMaskFlags andClipMask{};
     bool drawOk = false;
@@ -793,8 +797,10 @@ struct Edge
     int invZStep_;
 };
 
-void OcclusionBuffer::DrawTriangle2D(const Vector3* vertices, bool clockwise, unsigned threadIndex)
+void OcclusionBuffer::DrawTriangle2D(const Vector3* vertices, bool clockwise, i32 threadIndex)
 {
+    assert(threadIndex >= 0);
+
     int top, middle, bottom;
     bool middleIsRight;
 
@@ -1006,8 +1012,10 @@ void OcclusionBuffer::MergeBuffers()
     }
 }
 
-void OcclusionBuffer::ClearBuffer(unsigned threadIndex)
+void OcclusionBuffer::ClearBuffer(i32 threadIndex)
 {
+    assert(threadIndex >= 0);
+
     if (threadIndex >= buffers_.Size())
         return;
 

+ 4 - 4
Source/Urho3D/Graphics/OcclusionBuffer.h

@@ -136,7 +136,7 @@ public:
     unsigned GetUseTimer();
 
     /// Draw a batch. Called internally.
-    void DrawBatch(const OcclusionBatch& batch, unsigned threadIndex);
+    void DrawBatch(const OcclusionBatch& batch, i32 threadIndex);
 
 private:
     /// Apply modelview transform to vertex.
@@ -150,13 +150,13 @@ private:
     /// Calculate viewport transform.
     void CalculateViewport();
     /// Draw a triangle.
-    void DrawTriangle(Vector4* vertices, unsigned threadIndex);
+    void DrawTriangle(Vector4* vertices, i32 threadIndex);
     /// Clip vertices against a plane.
     void ClipVertices(const Vector4& plane, Vector4* vertices, bool* triangles, unsigned& numTriangles);
     /// Draw a clipped triangle.
-    void DrawTriangle2D(const Vector3* vertices, bool clockwise, unsigned threadIndex);
+    void DrawTriangle2D(const Vector3* vertices, bool clockwise, i32 threadIndex);
     /// Clear a thread work buffer.
-    void ClearBuffer(unsigned threadIndex);
+    void ClearBuffer(i32 threadIndex);
     /// Merge thread work buffers into the first buffer.
     void MergeBuffers();
 

+ 2 - 1
Source/Urho3D/Graphics/View.cpp

@@ -2270,8 +2270,9 @@ void View::DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occlu
     buffer->BuildDepthHierarchy();
 }
 
-void View::ProcessLight(LightQueryResult& query, unsigned threadIndex)
+void View::ProcessLight(LightQueryResult& query, i32 threadIndex)
 {
+    assert(threadIndex >= 0);
     Light* light = query.light_;
     LightType type = light->GetLightType();
     unsigned lightMask = light->GetLightMask();

+ 1 - 1
Source/Urho3D/Graphics/View.h

@@ -215,7 +215,7 @@ private:
     /// Draw occluders to occlusion buffer.
     void DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occluders);
     /// Query for lit geometries and shadow casters for a light.
-    void ProcessLight(LightQueryResult& query, unsigned threadIndex);
+    void ProcessLight(LightQueryResult& query, i32 threadIndex);
     /// Process shadow casters' visibilities and build their combined view- or projection-space bounding box.
     void ProcessShadowCasters(LightQueryResult& query, const Vector<Drawable*>& drawables, unsigned splitIndex);
     /// Set up initial shadow camera view(s).