Start of asset handles

This commit is contained in:
Simon Lübeß
2023-03-13 20:35:30 +01:00
parent ad14c9f6ed
commit c22d122921
10 changed files with 370 additions and 60 deletions
+15 -2
View File
@@ -134,7 +134,20 @@ public class Effect : Asset
BufferVariableCollection _variables ~ delete _;
typealias TextureEntry = (TextureViewBinding BoundTexture, ShaderTextureCollection.ResourceEntry* VsSlot, ShaderTextureCollection.ResourceEntry* PsSlot);
public struct TextureEntry
{
public TextureViewBinding BoundTexture;
public ShaderTextureCollection.ResourceEntry* VsSlot;
public ShaderTextureCollection.ResourceEntry* PsSlot;
public this(TextureViewBinding boundTexture, ShaderTextureCollection.ResourceEntry* vsSlot, ShaderTextureCollection.ResourceEntry* psSlot)
{
BoundTexture = boundTexture;
VsSlot = vsSlot;
PsSlot = psSlot;
}
}
Dictionary<String, TextureEntry> _textures ~ delete _;
public Dictionary<String, TextureEntry> Textures => _textures;
@@ -725,7 +738,7 @@ public class Effect : Asset
// Get existing entry or create new
if(!_textures.TryGetValue(shaderEntry.Name, out entry))
{
entry = (shaderEntry.BoundTexture, null, null);
entry = .(shaderEntry.BoundTexture, null, null);
entry.BoundTexture.AddRef();
}
+1
View File
@@ -2,6 +2,7 @@ using GlitchyEngine.Math;
using GlitchyEngine.World;
using System.Collections;
using System;
using GlitchyEngine.Content;
namespace GlitchyEngine.Renderer
{