(b0f5305f2) Unstable v0.9.10.0
This commit is contained in:
+14
-3
@@ -8,8 +8,18 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
{
|
||||
public sealed partial class SamplerStateCollection
|
||||
{
|
||||
private int _d3dMaxDirty;
|
||||
private int _d3dDirty;
|
||||
|
||||
partial void CalculateMaxDirty()
|
||||
{
|
||||
_d3dMaxDirty = 0;
|
||||
for (var i = 0; i < _actualSamplers.Length; i++)
|
||||
{
|
||||
_d3dMaxDirty |= 1 << i;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlatformSetSamplerState(int index)
|
||||
{
|
||||
_d3dDirty |= 1 << index;
|
||||
@@ -17,12 +27,12 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
|
||||
private void PlatformClear()
|
||||
{
|
||||
_d3dDirty = int.MaxValue;
|
||||
_d3dDirty = _d3dMaxDirty;
|
||||
}
|
||||
|
||||
private void PlatformDirty()
|
||||
{
|
||||
_d3dDirty = int.MaxValue;
|
||||
_d3dDirty = _d3dMaxDirty;
|
||||
}
|
||||
|
||||
internal void PlatformSetSamplers(GraphicsDevice device)
|
||||
@@ -60,7 +70,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
break;
|
||||
}
|
||||
|
||||
_d3dDirty = 0;
|
||||
if (_d3dDirty != 0) { throw new System.Exception($"SamplerStateCollection still dirty ({_d3dDirty})"); }
|
||||
//_d3dDirty = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -23,6 +23,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
private readonly SamplerState[] _actualSamplers;
|
||||
private readonly bool _applyToVertexStage;
|
||||
|
||||
partial void CalculateMaxDirty();
|
||||
|
||||
internal SamplerStateCollection(GraphicsDevice device, int maxSamplers, bool applyToVertexStage)
|
||||
{
|
||||
_graphicsDevice = device;
|
||||
@@ -38,7 +40,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
_actualSamplers = new SamplerState[maxSamplers];
|
||||
_applyToVertexStage = applyToVertexStage;
|
||||
|
||||
Clear();
|
||||
CalculateMaxDirty();
|
||||
Clear();
|
||||
}
|
||||
|
||||
public SamplerState this [int index]
|
||||
|
||||
+7
-4
@@ -16,13 +16,15 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
return;
|
||||
|
||||
if (_applyToVertexStage)
|
||||
ClearTargets(targets, device._d3dContext.VertexShader);
|
||||
ClearTargets(targets, device, device._d3dContext.VertexShader);
|
||||
else
|
||||
ClearTargets(targets, device._d3dContext.PixelShader);
|
||||
ClearTargets(targets, device, device._d3dContext.PixelShader);
|
||||
}
|
||||
|
||||
private void ClearTargets(RenderTargetBinding[] targets, SharpDX.Direct3D11.CommonShaderStage shaderStage)
|
||||
private void ClearTargets(RenderTargetBinding[] targets, GraphicsDevice device, SharpDX.Direct3D11.CommonShaderStage shaderStage)
|
||||
{
|
||||
PlatformSetTextures(device);
|
||||
|
||||
// NOTE: We make the assumption here that the caller has
|
||||
// locked the d3dContext for us to use.
|
||||
|
||||
@@ -92,7 +94,8 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
break;
|
||||
}
|
||||
|
||||
_dirty = 0;
|
||||
if (_dirty != 0) { throw new System.Exception($"TextureCollection still dirty ({_dirty})"); }
|
||||
//_dirty = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,18 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
private readonly Texture[] _textures;
|
||||
private readonly bool _applyToVertexStage;
|
||||
private int _dirty;
|
||||
private int _dirtyMax;
|
||||
|
||||
internal TextureCollection(GraphicsDevice graphicsDevice, int maxTextures, bool applyToVertexStage)
|
||||
{
|
||||
_graphicsDevice = graphicsDevice;
|
||||
_textures = new Texture[maxTextures];
|
||||
_applyToVertexStage = applyToVertexStage;
|
||||
_dirty = int.MaxValue;
|
||||
for (int i=0;i<maxTextures;i++)
|
||||
{
|
||||
_dirtyMax |= 1 << i;
|
||||
}
|
||||
_dirty = _dirtyMax;
|
||||
PlatformInit();
|
||||
}
|
||||
|
||||
@@ -47,7 +52,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
_textures[i] = null;
|
||||
|
||||
PlatformClear();
|
||||
_dirty = int.MaxValue;
|
||||
_dirty = _dirtyMax;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,7 +60,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
/// </summary>
|
||||
internal void Dirty()
|
||||
{
|
||||
_dirty = int.MaxValue;
|
||||
_dirty = _dirtyMax;
|
||||
}
|
||||
|
||||
internal void SetTextures(GraphicsDevice device)
|
||||
|
||||
Reference in New Issue
Block a user