Update rendering architecture and resource management
Added a new `Ref<T>` struct for reference semantics. Added the `RenderGraph` system for managing rendering passes. Added the `RenderTexture` class for encapsulating GPU resources. Added `GraphicsBuffer` class for effective GPU resource management. Changed `CommandList` methods from public to internal for visibility control. Changed `IRenderPass` interface from internal to public for accessibility. Changed `GetData<T>()` in `ComponentObject.cs` to return `CompRef<T>`. Changed `GetComponent<T>()` in `EntityManager.cs` to return `CompRef<T>`. Changed `GetSingleton<T>()` in `World.cs` to use `CompRef<T>`. Changed `IQueryTypeParameter` to use `CompRef<T>` for consistency. Changed `QueryItem<T0>` and related structs to use `CompRef<T>`. Changed `Material` class to support bindless textures. Changed `Shader` class to support bindless rendering. Changed `Mesh` class to support bindless vertex and index buffer access. Updated documentation to reflect the new bindless rendering architecture.
This commit is contained in:
@@ -22,9 +22,10 @@ public readonly struct QueryItem<T0>
|
||||
public ref T0 Component0 => ref _pool0.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0)
|
||||
{
|
||||
entity = _entity;
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
@@ -49,10 +50,12 @@ public readonly struct QueryItem<T0, T1>
|
||||
public ref T1 Component1 => ref _pool1.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,10 +82,13 @@ public readonly struct QueryItem<T0, T1, T2>
|
||||
public ref T2 Component2 => ref _pool2.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1, out Ref<T2> c2)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1, out CompRef<T2> c2)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));c2 = new (ref _pool2.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
c2 = new (ref _pool2.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,10 +118,14 @@ public readonly struct QueryItem<T0, T1, T2, T3>
|
||||
public ref T3 Component3 => ref _pool3.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1, out Ref<T2> c2, out Ref<T3> c3)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1, out CompRef<T2> c2, out CompRef<T3> c3)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));c2 = new (ref _pool2.GetRef(_entity));c3 = new (ref _pool3.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
c2 = new (ref _pool2.GetRef(_entity));
|
||||
c3 = new (ref _pool3.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,10 +158,15 @@ public readonly struct QueryItem<T0, T1, T2, T3, T4>
|
||||
public ref T4 Component4 => ref _pool4.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1, out Ref<T2> c2, out Ref<T3> c3, out Ref<T4> c4)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1, out CompRef<T2> c2, out CompRef<T3> c3, out CompRef<T4> c4)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));c2 = new (ref _pool2.GetRef(_entity));c3 = new (ref _pool3.GetRef(_entity));c4 = new (ref _pool4.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
c2 = new (ref _pool2.GetRef(_entity));
|
||||
c3 = new (ref _pool3.GetRef(_entity));
|
||||
c4 = new (ref _pool4.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,10 +202,16 @@ public readonly struct QueryItem<T0, T1, T2, T3, T4, T5>
|
||||
public ref T5 Component5 => ref _pool5.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1, out Ref<T2> c2, out Ref<T3> c3, out Ref<T4> c4, out Ref<T5> c5)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1, out CompRef<T2> c2, out CompRef<T3> c3, out CompRef<T4> c4, out CompRef<T5> c5)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));c2 = new (ref _pool2.GetRef(_entity));c3 = new (ref _pool3.GetRef(_entity));c4 = new (ref _pool4.GetRef(_entity));c5 = new (ref _pool5.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
c2 = new (ref _pool2.GetRef(_entity));
|
||||
c3 = new (ref _pool3.GetRef(_entity));
|
||||
c4 = new (ref _pool4.GetRef(_entity));
|
||||
c5 = new (ref _pool5.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,10 +250,17 @@ public readonly struct QueryItem<T0, T1, T2, T3, T4, T5, T6>
|
||||
public ref T6 Component6 => ref _pool6.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1, out Ref<T2> c2, out Ref<T3> c3, out Ref<T4> c4, out Ref<T5> c5, out Ref<T6> c6)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1, out CompRef<T2> c2, out CompRef<T3> c3, out CompRef<T4> c4, out CompRef<T5> c5, out CompRef<T6> c6)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));c2 = new (ref _pool2.GetRef(_entity));c3 = new (ref _pool3.GetRef(_entity));c4 = new (ref _pool4.GetRef(_entity));c5 = new (ref _pool5.GetRef(_entity));c6 = new (ref _pool6.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
c2 = new (ref _pool2.GetRef(_entity));
|
||||
c3 = new (ref _pool3.GetRef(_entity));
|
||||
c4 = new (ref _pool4.GetRef(_entity));
|
||||
c5 = new (ref _pool5.GetRef(_entity));
|
||||
c6 = new (ref _pool6.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +302,18 @@ public readonly struct QueryItem<T0, T1, T2, T3, T4, T5, T6, T7>
|
||||
public ref T7 Component7 => ref _pool7.GetRef(_entity);
|
||||
|
||||
// Deconstruct into tuple-like values
|
||||
public void Deconstruct(out Entity entity, out Ref<T0> c0, out Ref<T1> c1, out Ref<T2> c2, out Ref<T3> c3, out Ref<T4> c4, out Ref<T5> c5, out Ref<T6> c6, out Ref<T7> c7)
|
||||
public void Deconstruct(out Entity entity, out CompRef<T0> c0, out CompRef<T1> c1, out CompRef<T2> c2, out CompRef<T3> c3, out CompRef<T4> c4, out CompRef<T5> c5, out CompRef<T6> c6, out CompRef<T7> c7)
|
||||
{
|
||||
entity = _entity;
|
||||
c0 = new (ref _pool0.GetRef(_entity));c1 = new (ref _pool1.GetRef(_entity));c2 = new (ref _pool2.GetRef(_entity));c3 = new (ref _pool3.GetRef(_entity));c4 = new (ref _pool4.GetRef(_entity));c5 = new (ref _pool5.GetRef(_entity));c6 = new (ref _pool6.GetRef(_entity));c7 = new (ref _pool7.GetRef(_entity));
|
||||
|
||||
c0 = new (ref _pool0.GetRef(_entity));
|
||||
c1 = new (ref _pool1.GetRef(_entity));
|
||||
c2 = new (ref _pool2.GetRef(_entity));
|
||||
c3 = new (ref _pool3.GetRef(_entity));
|
||||
c4 = new (ref _pool4.GetRef(_entity));
|
||||
c5 = new (ref _pool5.GetRef(_entity));
|
||||
c6 = new (ref _pool6.GetRef(_entity));
|
||||
c7 = new (ref _pool7.GetRef(_entity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,16 +20,10 @@ var deconstructParams = Enumerable.Range(0, arity)
|
||||
.Select(i => {
|
||||
var name = $"c{i}";
|
||||
return arity == 1
|
||||
? $"out Ref<T0> {name}"
|
||||
: $"out Ref<T{i}> {name}";
|
||||
? $"out CompRef<T0> {name}"
|
||||
: $"out CompRef<T{i}> {name}";
|
||||
})
|
||||
.Aggregate((a, b) => a + ", " + b);
|
||||
var deconstructAssigns = Enumerable.Range(0, arity)
|
||||
.Select(i => {
|
||||
var name = $"c{i}";
|
||||
return $"{name} = new (ref _pool{i}.GetRef(_entity));";
|
||||
})
|
||||
.Aggregate((a, b) => a + b);
|
||||
#>
|
||||
public readonly struct QueryItem<<#= generics #>>
|
||||
<#= restrictions #>
|
||||
@@ -57,7 +51,10 @@ public readonly struct QueryItem<<#= generics #>>
|
||||
public void Deconstruct(out Entity entity, <#= deconstructParams #>)
|
||||
{
|
||||
entity = _entity;
|
||||
<#= deconstructAssigns #>
|
||||
|
||||
<# for (int i = 0; i < arity; i++){ #>
|
||||
c<#= i #> = new (ref _pool<#= i #>.GetRef(_entity));
|
||||
<# } #>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user