Jelajahi Sumber

Renamed ShaderProgram to ShaderVariation.

Lasse Öörni 14 tahun lalu
induk
melakukan
7da01092b6

+ 3 - 3
Engine/Graphics/Batch.cpp

@@ -30,7 +30,7 @@
 #include "Material.h"
 #include "Renderer.h"
 #include "Profiler.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "Sort.h"
 #include "Technique.h"
 #include "Texture2D.h"
@@ -407,8 +407,8 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* buffer) const
     {
         // Switch to the instancing vertex shader
         // The indexing is different in the forward lit passes
-        Vector<SharedPtr<ShaderProgram> >& vertexShaders = pass_->GetVertexShaders();
-        Vector<SharedPtr<ShaderProgram> >& pixelShaders = pass_->GetPixelShaders();
+        Vector<SharedPtr<ShaderVariation> >& vertexShaders = pass_->GetVertexShaders();
+        Vector<SharedPtr<ShaderVariation> >& pixelShaders = pass_->GetPixelShaders();
         PassType type = pass_->GetType();
         if ((type != PASS_LITBASE) && (type != PASS_LIGHT))
             batch.vertexShader_ = vertexShaders[vertexShaderIndex_ + GEOM_INSTANCED];

+ 5 - 5
Engine/Graphics/Batch.h

@@ -35,7 +35,7 @@ class Light;
 class Material;
 class Pass;
 class Matrix3x4;
-class ShaderProgram;
+class ShaderVariation;
 class VertexBuffer;
 
 /// Description of a 3D geometry draw call
@@ -68,9 +68,9 @@ struct Batch
     /// Material pass
     Pass* pass_;
     /// Vertex shader
-    ShaderProgram* vertexShader_;
+    ShaderVariation* vertexShader_;
     /// Pixel shader
-    ShaderProgram* pixelShader_;
+    ShaderVariation* pixelShader_;
     /// Camera
     Camera* camera_;
     /// Light that affects the geometry, if any
@@ -142,9 +142,9 @@ struct BatchGroup
     /// Material pass
     Pass* pass_;
     /// Vertex shader
-    ShaderProgram* vertexShader_;
+    ShaderVariation* vertexShader_;
     /// Pixel shader
-    ShaderProgram* pixelShader_;
+    ShaderVariation* pixelShader_;
     /// Camera
     Camera* camera_;
     /// Light that affects the geometry, if any

+ 1 - 1
Engine/Graphics/DebugRenderer.cpp

@@ -33,7 +33,7 @@
 #include "Profiler.h"
 #include "Renderer.h"
 #include "ResourceCache.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 
 #include "DebugNew.h"
 

+ 2 - 2
Engine/Graphics/Graphics.cpp

@@ -40,7 +40,7 @@
 #include "ParticleEmitter.h"
 #include "Profiler.h"
 #include "Shader.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "Skybox.h"
 #include "Technique.h"
 #include "Texture2D.h"
@@ -907,7 +907,7 @@ void Graphics::SetIndexBuffer(IndexBuffer* buffer)
     }
 }
 
-void Graphics::SetShaders(ShaderProgram* vs, ShaderProgram* ps)
+void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
 {
     if (vs != vertexShader_)
     {

+ 7 - 7
Engine/Graphics/Graphics.h

@@ -36,7 +36,7 @@ class Matrix3x4;
 class GPUObject;
 class GraphicsImpl;
 class RenderSurface;
-class ShaderProgram;
+class ShaderVariation;
 class Texture;
 class Texture2D;
 class TextureCube;
@@ -99,7 +99,7 @@ public:
     /// Set index buffer
     void SetIndexBuffer(IndexBuffer* buffer);
     /// Set shaders
-    void SetShaders(ShaderProgram* vs, ShaderProgram* ps);
+    void SetShaders(ShaderVariation* vs, ShaderVariation* ps);
     /// Set vertex shader bool parameter
     void SetVertexShaderParameter(ShaderParameter param, const bool* data, unsigned count);
     /// Set vertex shader float constants
@@ -140,7 +140,7 @@ public:
     void SetPixelShaderParameter(ShaderParameter param, const Vector4& vector);
     /// Set pixel shader 4x3 matrix constant
     void SetPixelShaderParameter(ShaderParameter param, const Matrix3x4& matrix);
-    /// Set shader parameter source. Called by ShaderProgram
+    /// Set shader parameter source. Called by ShaderVariation
     void SetShaderParameterSource(ShaderParameter param, const void* source) { lastShaderParameterSources_[param] = source; }
     /// Map shader parameter to a constant register. Called by Shader
     void SetShaderRegister(ShaderParameter param, unsigned index) { shaderRegisters_[param] = index; }
@@ -274,9 +274,9 @@ public:
     /// Return vertex declaration
     VertexDeclaration* GetVertexDeclaration() const { return vertexDeclaration_; }
     /// Return vertex shader
-    ShaderProgram* GetVertexShader() const { return vertexShader_; }
+    ShaderVariation* GetVertexShader() const { return vertexShader_; }
     /// Return pixel shader
-    ShaderProgram* GetPixelShader() const { return pixelShader_; }
+    ShaderVariation* GetPixelShader() const { return pixelShader_; }
     /// Return shader parameter index by name
     ShaderParameter GetShaderParameter(const String& name);
     /// Return texture unit index by name
@@ -487,9 +487,9 @@ private:
     /// Vertex declaration in use
     VertexDeclaration* vertexDeclaration_;
     /// Vertex shader in use
-    ShaderProgram* vertexShader_;
+    ShaderVariation* vertexShader_;
     /// Pixel shader in use
-    ShaderProgram* pixelShader_;
+    ShaderVariation* pixelShader_;
     /// Shader parameter mappings
     Map<String, ShaderParameter> shaderParameters_;
     /// Shader constant register mappings

+ 9 - 9
Engine/Graphics/Renderer.cpp

@@ -41,7 +41,7 @@
 #include "ResourceCache.h"
 #include "Scene.h"
 #include "Shader.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "Technique.h"
 #include "Texture2D.h"
 #include "TextureCube.h"
@@ -439,12 +439,12 @@ const Viewport& Renderer::GetViewport(unsigned index) const
     return index < viewports_.Size() ? viewports_[index] : noViewport;
 }
 
-ShaderProgram* Renderer::GetVertexShader(const String& name, bool checkExists) const
+ShaderVariation* Renderer::GetVertexShader(const String& name, bool checkExists) const
 {
     return GetShader(name, vsFormat_, checkExists);
 }
 
-ShaderProgram* Renderer::GetPixelShader(const String& name, bool checkExists) const
+ShaderVariation* Renderer::GetPixelShader(const String& name, bool checkExists) const
 {
     return GetShader(name, psFormat_, checkExists);
 }
@@ -827,7 +827,7 @@ void Renderer::ResetShadowMapUseCount()
         shadowMapUseCount_[i] = 0;
 }
 
-ShaderProgram* Renderer::GetShader(const String& name, const String& extension, bool checkExists) const
+ShaderVariation* Renderer::GetShader(const String& name, const String& extension, bool checkExists) const
 {
     String shaderName = shaderPath_;
     String variationName;
@@ -859,8 +859,8 @@ void Renderer::SetBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     batch.pass_ = pass;
     
     // Check if shaders are unloaded or need reloading
-    Vector<SharedPtr<ShaderProgram> >& vertexShaders = pass->GetVertexShaders();
-    Vector<SharedPtr<ShaderProgram> >& pixelShaders = pass->GetPixelShaders();
+    Vector<SharedPtr<ShaderVariation> >& vertexShaders = pass->GetVertexShaders();
+    Vector<SharedPtr<ShaderVariation> >& pixelShaders = pass->GetPixelShaders();
     if ((!vertexShaders.Size()) || (!pixelShaders.Size()) || (technique->GetShadersLoadedFrameNumber() !=
         shadersChangedFrameNumber_))
     {
@@ -1086,8 +1086,8 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
     
     unsigned hwShadows = graphics_->GetHardwareShadowSupport() ? 1 : 0;
     
-    Vector<SharedPtr<ShaderProgram> >& vertexShaders = i->second_.GetVertexShaders();
-    Vector<SharedPtr<ShaderProgram> >& pixelShaders = i->second_.GetPixelShaders();
+    Vector<SharedPtr<ShaderVariation> >& vertexShaders = i->second_.GetVertexShaders();
+    Vector<SharedPtr<ShaderVariation> >& pixelShaders = i->second_.GetPixelShaders();
     
     // Forget all the old shaders
     vertexShaders.Clear();
@@ -1446,7 +1446,7 @@ void Renderer::SetupLightBatch(Batch& batch)
     }
 }
 
-void Renderer::DrawFullScreenQuad(Camera& camera, ShaderProgram* vs, ShaderProgram* ps, bool nearQuad)
+void Renderer::DrawFullScreenQuad(Camera& camera, ShaderVariation* vs, ShaderVariation* ps, bool nearQuad)
 {
     graphics_->ClearTransformSources();
     

+ 8 - 8
Engine/Graphics/Renderer.h

@@ -239,9 +239,9 @@ public:
     /// Return the default spotlight attenuation texture
     Texture2D* GetDefaultLightSpot() const { return defaultLightSpot; }
     /// Return a vertex shader by name
-    ShaderProgram* GetVertexShader(const String& name, bool checkExists = false) const;
+    ShaderVariation* GetVertexShader(const String& name, bool checkExists = false) const;
     /// Return a pixel shader by name
-    ShaderProgram* GetPixelShader(const String& name, bool checkExists = false) const;
+    ShaderVariation* GetPixelShader(const String& name, bool checkExists = false) const;
     /// Return the frame update parameters
     const FrameInfo& GetFrameInfo() { return frame_; }
     
@@ -268,7 +268,7 @@ private:
     /// Reset shadow map use count
     void ResetShadowMapUseCount();
     /// Get a shader program
-    ShaderProgram* GetShader(const String& name, const String& extension, bool checkExists) const;
+    ShaderVariation* GetShader(const String& name, const String& extension, bool checkExists) const;
     /// Choose shaders for a batch
     void SetBatchShaders(Batch& batch, Technique* technique, Pass* pass, bool allowShadows = true);
     /// Choose light volume shaders for a batch
@@ -302,7 +302,7 @@ private:
     /// Set up a light volume rendering batch
     void SetupLightBatch(Batch& batch);
     /// Draw a full screen quad (either near or far)
-    void DrawFullScreenQuad(Camera& camera, ShaderProgram* vs, ShaderProgram* ps, bool nearQuad);
+    void DrawFullScreenQuad(Camera& camera, ShaderVariation* vs, ShaderVariation* ps, bool nearQuad);
     /// Handle screen mode event
     void HandleScreenMode(StringHash eventType, VariantMap& eventData);
     /// Handle render update event
@@ -335,13 +335,13 @@ private:
     /// Shadow map use count if reusing is disabled. Is reset for each view
     unsigned shadowMapUseCount_[NUM_SHADOWMAP_RESOLUTIONS];
     /// Stencil rendering vertex shader
-    SharedPtr<ShaderProgram> stencilVS_;
+    SharedPtr<ShaderVariation> stencilVS_;
     /// Stencil rendering pixel shader
-    SharedPtr<ShaderProgram> stencilPS_;
+    SharedPtr<ShaderVariation> stencilPS_;
     /// Light vertex shaders
-    Vector<SharedPtr<ShaderProgram> > lightVS_;
+    Vector<SharedPtr<ShaderVariation> > lightVS_;
     /// Light pixel shaders
-    Vector<SharedPtr<ShaderProgram> > lightPS_;
+    Vector<SharedPtr<ShaderVariation> > lightPS_;
     /// Reusable shadow cameras
     Vector<SharedPtr<Camera> > shadowCameraStore_;
     /// Reusable split lights

+ 7 - 7
Engine/Graphics/Shader.cpp

@@ -29,7 +29,7 @@
 #include "Log.h"
 #include "Profiler.h"
 #include "Shader.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 
 /// Shader parameter structure for loading
 struct Parameter
@@ -115,7 +115,7 @@ bool Shader::Load(Deserializer& source)
     unsigned numVariations = source.ReadUInt();
     for (unsigned i = 0; i < numVariations; ++i)
     {
-        SharedPtr<ShaderProgram> variation(new ShaderProgram(this, shaderType_, isSM3_));
+        SharedPtr<ShaderVariation> variation(new ShaderVariation(this, shaderType_, isSM3_));
         variation->SetName(source.ReadString());
         
         // Fill the parameter & texture unit use information
@@ -157,22 +157,22 @@ bool Shader::Load(Deserializer& source)
     return true;
 }
 
-ShaderProgram* Shader::GetVariation(const String& name)
+ShaderVariation* Shader::GetVariation(const String& name)
 {
     return GetVariation(StringHash(name));
 }
 
-ShaderProgram* Shader::GetVariation(StringHash nameHash)
+ShaderVariation* Shader::GetVariation(StringHash nameHash)
 {
-    Map<StringHash, SharedPtr<ShaderProgram> >::Iterator i = variations_.Find(nameHash);
+    Map<StringHash, SharedPtr<ShaderVariation> >::Iterator i = variations_.Find(nameHash);
     if (i == variations_.End())
         return 0;
-    ShaderProgram* variation = i->second_;
+    ShaderVariation* variation = i->second_;
     
     // Create shader object now if not yet created. If fails, remove the variation
     if (!variation->GetGPUObject())
     {
-        PROFILE(CreateShaderProgram);
+        PROFILE(CreateShaderVariation);
         bool success = variation->Create();
         if (!success)
         {

+ 4 - 4
Engine/Graphics/Shader.h

@@ -25,7 +25,7 @@
 
 #include "Resource.h"
 
-class ShaderProgram;
+class ShaderVariation;
 
 /// Shader resource consisting of several shader variations
 class Shader : public Resource
@@ -44,9 +44,9 @@ public:
     virtual bool Load(Deserializer& source);
     
     /// Get a named variation. Return null if not found or could not be created
-    ShaderProgram* GetVariation(const String& name);
+    ShaderVariation* GetVariation(const String& name);
     /// Get a named variation. Return null if not found or could not be created
-    ShaderProgram* GetVariation(StringHash nameHash);
+    ShaderVariation* GetVariation(StringHash nameHash);
     /// Release (unload) all variations
     void ReleaseAll();
     
@@ -63,5 +63,5 @@ private:
     /// Shader Model 3 flag
     bool isSM3_;
     /// Shader variations. Will be in an unloaded state until requested
-    Map<StringHash, SharedPtr<ShaderProgram> > variations_;
+    Map<StringHash, SharedPtr<ShaderVariation> > variations_;
 };

+ 13 - 13
Engine/Graphics/ShaderProgram.cpp → Engine/Graphics/ShaderVariation.cpp

@@ -25,15 +25,15 @@
 #include "Graphics.h"
 #include "GraphicsImpl.h"
 #include "Shader.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 
 #include <ctype.h>
 
 #include "DebugNew.h"
 
-OBJECTTYPESTATIC(ShaderProgram);
+OBJECTTYPESTATIC(ShaderVariation);
 
-ShaderProgram::ShaderProgram(Shader* shader, ShaderType type, bool isSM3) :
+ShaderVariation::ShaderVariation(Shader* shader, ShaderType type, bool isSM3) :
     GPUObject(shader->GetSubsystem<Graphics>()),
     shader_(shader),
     shaderType_(type),
@@ -42,12 +42,12 @@ ShaderProgram::ShaderProgram(Shader* shader, ShaderType type, bool isSM3) :
     ClearParameters();
 }
 
-ShaderProgram::~ShaderProgram()
+ShaderVariation::~ShaderVariation()
 {
     Release();
 }
 
-bool ShaderProgram::Create()
+bool ShaderVariation::Create()
 {
     Release();
     
@@ -73,7 +73,7 @@ bool ShaderProgram::Create()
     return true;
 }
 
-void ShaderProgram::Release()
+void ShaderVariation::Release()
 {
     if (object_)
     {
@@ -99,12 +99,12 @@ void ShaderProgram::Release()
     }
 }
 
-void ShaderProgram::SetName(const String& name)
+void ShaderVariation::SetName(const String& name)
 {
     name_ = name;
 }
 
-void ShaderProgram::SetByteCode(const SharedArrayPtr<unsigned char>& byteCode)
+void ShaderVariation::SetByteCode(const SharedArrayPtr<unsigned char>& byteCode)
 {
     byteCode_ = byteCode;
     
@@ -113,17 +113,17 @@ void ShaderProgram::SetByteCode(const SharedArrayPtr<unsigned char>& byteCode)
         Create();
 }
 
-void ShaderProgram::SetUseParameter(ShaderParameter param, bool enable)
+void ShaderVariation::SetUseParameter(ShaderParameter param, bool enable)
 {
     useParameter_[param] = enable;
 }
 
-void ShaderProgram::SetUseTextureUnit(TextureUnit unit, bool enable)
+void ShaderVariation::SetUseTextureUnit(TextureUnit unit, bool enable)
 {
     useTextureUnit_[unit] = enable;
 }
 
-void ShaderProgram::ClearParameters()
+void ShaderVariation::ClearParameters()
 {
     for (unsigned i = 0; i < MAX_SHADER_PARAMETERS; ++i)
         useParameter_[i] = false;
@@ -131,7 +131,7 @@ void ShaderProgram::ClearParameters()
         useTextureUnit_[i] = false;
 }
 
-bool ShaderProgram::NeedParameterUpdate(ShaderParameter parameter, const void* source)
+bool ShaderVariation::NeedParameterUpdate(ShaderParameter parameter, const void* source)
 {
     if ((useParameter_[parameter]) && (graphics_) && (graphics_->GetShaderParameterSource(parameter) != source))
     {
@@ -141,7 +141,7 @@ bool ShaderProgram::NeedParameterUpdate(ShaderParameter parameter, const void* s
     return false;
 }
 
-Shader* ShaderProgram::GetShader() const
+Shader* ShaderVariation::GetShader() const
 {
     return shader_;
 }

+ 4 - 4
Engine/Graphics/ShaderProgram.h → Engine/Graphics/ShaderVariation.h

@@ -59,15 +59,15 @@
 class Shader;
 
 /// Shader program on the GPU
-class ShaderProgram : public RefCounted, public GPUObject
+class ShaderVariation : public RefCounted, public GPUObject
 {
-    OBJECT(ShaderProgram);
+    OBJECT(ShaderVariation);
     
 public:
     /// Construct
-    ShaderProgram(Shader* shader, ShaderType type, bool isSM3);
+    ShaderVariation(Shader* shader, ShaderType type, bool isSM3);
     /// Destruct
-    virtual ~ShaderProgram();
+    virtual ~ShaderVariation();
     
     /// Create the shader program. Return true if successful
     bool Create();

+ 1 - 1
Engine/Graphics/Technique.cpp

@@ -27,7 +27,7 @@
 #include "Technique.h"
 #include "Profiler.h"
 #include "ResourceCache.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "StringUtils.h"
 #include "XMLFile.h"
 

+ 5 - 5
Engine/Graphics/Technique.h

@@ -26,7 +26,7 @@
 #include "GraphicsDefs.h"
 #include "Resource.h"
 
-class ShaderProgram;
+class ShaderVariation;
 
 /// Material rendering pass, which defines shaders and render state
 class Pass
@@ -73,9 +73,9 @@ public:
     /// Return pixel shader name
     const String& GetPixelShaderName() const { return pixelShaderName_; }
     /// Return vertex shaders
-    Vector<SharedPtr<ShaderProgram> >& GetVertexShaders() { return vertexShaders_; }
+    Vector<SharedPtr<ShaderVariation> >& GetVertexShaders() { return vertexShaders_; }
     /// Return pixel shaders
-    Vector<SharedPtr<ShaderProgram> >& GetPixelShaders() { return pixelShaders_; }
+    Vector<SharedPtr<ShaderVariation> >& GetPixelShaders() { return pixelShaders_; }
     
 private:
     /// Pass type
@@ -95,9 +95,9 @@ private:
     /// Pixel shader name
     String pixelShaderName_;
     /// Vertex shaders
-    Vector<SharedPtr<ShaderProgram> > vertexShaders_;
+    Vector<SharedPtr<ShaderVariation> > vertexShaders_;
     /// Pixel shaders
-    Vector<SharedPtr<ShaderProgram> > pixelShaders_;
+    Vector<SharedPtr<ShaderVariation> > pixelShaders_;
 };
 
 /// Material technique. Consists of several passes

+ 1 - 1
Engine/Graphics/View.cpp

@@ -35,7 +35,7 @@
 #include "Renderer.h"
 #include "Profiler.h"
 #include "Scene.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "Technique.h"
 #include "Texture2D.h"
 #include "TextureCube.h"

+ 3 - 3
Engine/UI/UI.cpp

@@ -40,7 +40,7 @@
 #include "ResourceCache.h"
 #include "ScrollBar.h"
 #include "Shader.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "Slider.h"
 #include "Text.h"
 #include "Texture2D.h"
@@ -254,8 +254,8 @@ void UI::Render()
     graphics_->SetVertexShaderParameter(VSP_VIEWPROJ, projection);
     graphics_->SetPixelShaderParameter(PSP_MATDIFFCOLOR, Color(1.0f, 1.0f, 1.0f, 1.0f));
     
-    ShaderProgram* ps = 0;
-    ShaderProgram* vs = 0;
+    ShaderVariation* ps = 0;
+    ShaderVariation* vs = 0;
     
     unsigned alphaFormat = Graphics::GetAlphaFormat();
     

+ 5 - 5
Engine/UI/UI.h

@@ -114,15 +114,15 @@ private:
     /// Resource cache
     WeakPtr<ResourceCache> cache_;
     /// Vertex shader for no texture
-    SharedPtr<ShaderProgram> noTextureVS_;
+    SharedPtr<ShaderVariation> noTextureVS_;
     /// Vertex shader for diffuse texture
-    SharedPtr<ShaderProgram> diffTextureVS_;
+    SharedPtr<ShaderVariation> diffTextureVS_;
     /// Pixel shader for no texture
-    SharedPtr<ShaderProgram> noTexturePS_;
+    SharedPtr<ShaderVariation> noTexturePS_;
     /// Pixel shader for diffuse texture
-    SharedPtr<ShaderProgram> diffTexturePS_;
+    SharedPtr<ShaderVariation> diffTexturePS_;
     /// Pixel shader for alpha texture
-    SharedPtr<ShaderProgram> alphaTexturePS_;
+    SharedPtr<ShaderVariation> alphaTexturePS_;
     /// UI root element
     SharedPtr<UIElement> rootElement_;
     /// Cursor

+ 2 - 2
Engine/UI/UIBatch.cpp

@@ -23,7 +23,7 @@
 
 #include "Precompiled.h"
 #include "Graphics.h"
-#include "ShaderProgram.h"
+#include "ShaderVariation.h"
 #include "Texture.h"
 #include "UIElement.h"
 
@@ -165,7 +165,7 @@ bool UIBatch::Merge(const UIBatch& batch)
     return true;
 }
 
-void UIBatch::Draw(Graphics* graphics, ShaderProgram* vs, ShaderProgram* ps) const
+void UIBatch::Draw(Graphics* graphics, ShaderVariation* vs, ShaderVariation* ps) const
 {
     if ((!quads_) || (!quadCount_))
         return;

+ 2 - 2
Engine/UI/UIBatch.h

@@ -29,7 +29,7 @@
 
 class PixelShader;
 class Graphics;
-class ShaderProgram;
+class ShaderVariation;
 class Texture;
 class UIElement;
 
@@ -86,7 +86,7 @@ public:
     /// Merge with another batch
     bool Merge(const UIBatch& batch);
     /// Draw
-    void Draw(Graphics* graphics, ShaderProgram* vs, ShaderProgram* ps) const;
+    void Draw(Graphics* graphics, ShaderVariation* vs, ShaderVariation* ps) const;
     
     /// Add or merge a batch
     static void AddOrMerge(const UIBatch& batch, PODVector<UIBatch>& batches);