Browse Source

最大值/最小值改为hlsl统计,提高运行速度

luo 1 year ago
parent
commit
1b62a76300

+ 3 - 3
CentralizedControl/PLCConnect.cs

@@ -172,10 +172,10 @@ namespace CentralizedControl
             {
 #if __Test__
                 count++;
-                //temp++;
-                //if (temp > 4000) temp = -4000;
+                temp++;
+                if (temp > 4000) temp = -4000;
                 //return temp;
-                return MathF.Sin(count / 2000f) * 250f + (random.NextSingle() - 0.5f) * 100;
+                return (random.NextSingle() - 0.5f) * 32+52;
 #endif
                 var result = ReadRegisters(addr, (ushort)Unsafe.SizeOf<float>());
                 return Unsafe.As<ushort, float>(ref result[0]);

+ 7 - 4
CentralizedControl/View/OtherConfigView.xaml

@@ -53,16 +53,19 @@
                 VerticalAlignment="Center"
                 FontSize="{StaticResource fontsize}"
                 Text="历史数据长度" />
-            <hc:NumericUpDown
+            <hc:ComboBox
                 Width="{StaticResource controlwidth}"
                 Height="{StaticResource controlheight}"
                 Margin="10,0,0,0"
                 Background="Transparent"
+                Cursor="Hand"
+                DisplayMemberPath="Key"
+                Style="{StaticResource ComboBoxStyle1}"
                 FontSize="{StaticResource fontsize}"
                 Foreground="{StaticResource forecolor}"
-                Maximum="200000"
-                Minimum="10"
-                Value="{Binding MaxHistoyLenght, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
+                ItemsSource="{Binding AllowHistoyLenght, Mode=OneTime}"
+                SelectedValue="{Binding MaxHistoyLenght, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                SelectedValuePath="Value" />
         </StackPanel>
         <StackPanel Height="66" Orientation="Horizontal">
             <Button

+ 7 - 5
CentralizedControl/ViewModel/ShakerControlViewModel.cs

@@ -134,7 +134,9 @@ namespace CentralizedControl.ViewModel
                 content = VeldridContent.CreateContent();
                 content.Content.BackColor = AppResource.AppResource.Default.SystemItemsSelectBackColor.ColorToRGB();
                 lineAxis = content.Content.AddLineAxis();
+                lineAxis.ZoomEnbled = false;
                 lineSeries = content.Content.AddLineSeries();
+                lineSeries.ZoomEnbled = false;
                 legend = content.Content.AddLegend();
                 text = content.Content.AddText(true, true);
                 text.FontSize = 36;
@@ -226,13 +228,13 @@ namespace CentralizedControl.ViewModel
                     }
                 }
                 int count = lineSeries.PlotInfos.Count(x => x.Visibily);
-                if(count>0 && max.X - max.Y>=1E-6)
+                if(count>0 && max.X - max.Y>=1E-5f)
                 {
                     var center = (max.X + max.Y) / 2;
-                    lineAxis.VScale =1/( MathF.Ceiling((max.X - max.Y) / lineAxis.Range.YLenght/1E-6f)*1E-6f);
-                    lineAxis.VOffset = (center / (lineAxis.Range.YLenght/lineAxis.VScale*10) * lineAxis.Rectangle.Height)/lineSeries.VScale;
+                    lineAxis.VScale =1/( MathF.Ceiling((max.X - max.Y) / lineAxis.Range.YLenght/1E-5f)*1E-5f);
+                    lineAxis.VOffset = (center / (lineAxis.Range.YLenght/lineAxis.VScale*10) * lineAxis.Rectangle.Height)/ lineAxis.VScale;
                     lineSeries.VScale = lineAxis.VScale;
-                    lineSeries.VOffset = lineAxis.VOffset/ lineAxis.VScale;
+                    lineSeries.VOffset = -center/(max.X-max.Y)*(lineSeries.Rectangle.Height/content!.Content.Height*2);
                 }
                 lineAxis.TotalCount = lineSeries.TotalCount;
 
@@ -288,7 +290,7 @@ namespace CentralizedControl.ViewModel
         {
             ShakerControlIsOpen = true;
         }
-
+        [AllowNull]
         public ShakerViewModel Shaker { get; init; } 
         [AllowNull]
         public ICommand MaxOrMinCommand { get; init; }

+ 10 - 0
CentralizedControl/ViewModel/SystemConfig/OtherConfigViewModel.cs

@@ -3,6 +3,7 @@ using CentralizedControl.View;
 using HandyControl.Interactivity.Commands;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -15,6 +16,13 @@ namespace CentralizedControl.ViewModel.SystemConfig
         public OtherConfigViewModel()
         {
             Content.ViewModel = this;
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("1k", 1000));
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("2k", 2000));
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("5k", 5000));
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("10k", 10000));
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("20k", 20000));
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("50k", 50000));
+            AllowHistoyLenght.Add(new KeyValuePair<string, int>("100k", 100000));
             GetEvent(SqlConfigViewModel.SQL_CONNECT_EVENTNAME).Subscrip((x, y) =>
             {
                 var val = MainWindowViewModel.Instance.Main.SystemConfig.Sql.FindFirst<OtherInfo>(p => true);
@@ -45,5 +53,7 @@ namespace CentralizedControl.ViewModel.SystemConfig
         public override IView Content { get; } = new View.OtherConfigView();
         public int LoopTime { get => Model.LoopTime; set =>UpdateProperty(ref Model.LoopTime,Math.Clamp(value,1,int.MaxValue)); }
         public int MaxHistoyLenght { get => Model.MaxHistoyLenght; set =>UpdateProperty(ref Model.MaxHistoyLenght,Math.Clamp(value,1,1000000)); }
+
+        public ObservableCollection<KeyValuePair<string,int>> AllowHistoyLenght { get; } = new ObservableCollection<KeyValuePair<string, int>>();
     }
 }

File diff suppressed because it is too large
+ 266 - 0
UpgradeLog.htm


+ 2 - 2
Veldrid.Common/BaseVeldridRender.cs

@@ -49,8 +49,8 @@ namespace Veldrid.Common
             float height = windowheight - (Margin.Top + Margin.Bottom);
             float hscale = width / Range.XLenght * h;
             float vscale = height / Range.YLenght * v;
-            var tran = Matrix4x4.CreateTranslation(hoffset*v, -1 + (height / windowheight - 1)+voffset*v, 0);
-            return Matrix4x4.CreateScale(hscale, vscale, 1, new Vector3(-1, 1, 1)) * tran * Matrix4x4.CreateTranslation(Margin.Left * 2 / windowwidth, Margin.Top * 2 / windowheight, 0) * (!GraphicsDevice.IsClipSpaceYInverted ? _ymirror : Matrix4x4.Identity);
+            var tran = Matrix4x4.CreateTranslation(0, -1 + (height / windowheight - 1), 0);
+            return  Matrix4x4.CreateScale(hscale, vscale, 1, new Vector3(-1, 1, 0)) * tran * Matrix4x4.CreateTranslation(Margin.Left * 2 / windowwidth, Margin.Top * 2 / windowheight, 0) * (!GraphicsDevice.IsClipSpaceYInverted ? _ymirror : Matrix4x4.Identity)*Matrix4x4.CreateTranslation(hoffset, voffset, 0);
         }
         public virtual void Resize()
         {

+ 4 - 4
Veldrid.Common/Plot/DataReViewPlot.cs

@@ -110,14 +110,14 @@ namespace Veldrid.Common.Plot
             CommandList.SetPipeline(pipeline);
             CommandList.SetGraphicsResourceSet(0, dataSet);
             CommandList.SetGraphicsResourceSet(1, infoSet);
-            for(int i=0;i<PlotInfos.Length;i++)
+            info.PlotCount = (uint)PlotInfos.Length;
+            for (uint i=0;i<PlotInfos.Length;i++)
             {
                 if (!PlotInfos[i].Visibily) continue;
                 info.Color = PlotInfos[i].Color;
                 info.Interval = Range.XLenght / TotalCount;
-                info.Start = 0;
                 info.PlotDataLenght = TotalCount;
-                info.PlotIndex = (uint)i;
+                info.PlotIndex = i;
                 CommandList.UpdateBuffer(plotInfoBuffer, 0, info);
                 CommandList.Draw(TotalCount);
             }
@@ -132,7 +132,7 @@ namespace Veldrid.Common.Plot
         struct Info
         {
             public RgbaFloat Color;
-            public float Start;
+            public uint PlotCount;
             public float Interval;
             public uint PlotIndex;
             public uint PlotDataLenght;

+ 48 - 0
Veldrid.Common/Plot/DataReViewPlot.hlsl

@@ -0,0 +1,48 @@
+StructuredBuffer<float> DataBuffer : register(t0);
+RWByteAddressBuffer ResultDataBuffer : register(u0);
+cbuffer InfoBuffer : register(b0)
+{
+    float4 Color;
+    uint PlotCount;
+    float Interval;
+    uint PlotIndex;
+    uint PlotDataLenght;
+}
+void InterlockedMaxFloat(RWByteAddressBuffer buf, uint addr, float value)
+{
+    uint i_val = asuint(value);
+    uint tmp0 = 0;
+    uint tmp1;
+    buf.InterlockedMax(addr, i_val, tmp1);
+}
+void InterlockedMinFloat(RWByteAddressBuffer buf, uint addr, float value)
+{
+    uint i_val = asuint(value);
+    uint tmp1;
+    buf.InterlockedMin(addr, i_val, tmp1);
+}
+void InterlockedCompareExchangeFloat(RWByteAddressBuffer buf, uint addr, float value)
+{
+    uint i_val = asuint(value);
+    uint tmp0 = 0;
+    uint tmp1;
+    buf.InterlockedCompareExchange(addr, tmp0, i_val, tmp1);
+}
+[numthreads(1000, 1, 1)]
+
+void main(uint3 DTid : SV_DispatchThreadID)
+{
+    float value = DataBuffer[DTid.x + PlotIndex * PlotCount];
+    if (DTid.x >= PlotDataLenght)
+    {
+        return;
+    }
+    if (DTid.x == 0)
+    {
+        InterlockedCompareExchangeFloat(ResultDataBuffer, PlotIndex * 8, value);
+        InterlockedCompareExchangeFloat(ResultDataBuffer, PlotIndex * 8 + 4, value);
+        return;
+    }
+    InterlockedMaxFloat(ResultDataBuffer, PlotIndex * 8, value);
+    InterlockedMinFloat(ResultDataBuffer, PlotIndex * 8 + 4, value);
+}

+ 3 - 3
Veldrid.Common/Plot/DataReViewPlot.vert

@@ -11,7 +11,7 @@ layout(set=0,binding=0) readonly buffer DataBuffer
 layout(set=1,binding=0) uniform InfoBuffer
 {
     vec4 Color;
-    float Start;
+    uint PlotCount;
     float Interval;
     uint PlotIndex;
     uint PlotDataLenght;
@@ -24,6 +24,6 @@ layout(set=1,binding=1) uniform ProjView
 void main()
 {
     V_Color = Color;
-    uint index =uint(gl_VertexIndex+PlotIndex*PlotDataLenght);
-    gl_Position = Proj*View*vec4(clamp(Start+gl_VertexIndex*Interval,0,10000),clamp(Datas[index],-5000,5000),0,1);
+    uint index =uint(gl_VertexIndex+PlotIndex*PlotCount);
+    gl_Position = Proj*View*vec4(gl_VertexIndex*Interval,Datas[index],0,1);
 }

+ 78 - 12
Veldrid.Common/Plot/LineSeries.cs

@@ -5,6 +5,7 @@ using System.Linq;
 using System.Net.Http.Headers;
 using System.Numerics;
 using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
 using System.Security.Cryptography;
 using System.Text;
 
@@ -18,6 +19,7 @@ namespace Veldrid.Common.Plot
         public float HOffset { get; set; }
         public float VOffset { get; set; }
         public bool ZoomEnbled { get; set; }
+        private const uint ThreadGroupSizeX = 1000;
         private ProjView projView;
         Pipeline pipeline;
         private PlotInfo plotInfo;
@@ -31,7 +33,15 @@ namespace Veldrid.Common.Plot
         Shader[] shaders;
 
 
-
+        DeviceBuffer resultBuffer;
+        DeviceBuffer cpuBuffer;
+        ResourceLayout computeLayout;
+        ResourceSet computeSet;
+        Pipeline computePipline;
+        ResourceLayout computeLineInfoLayout;
+        ResourceSet computeLineInfoSet;
+        Shader computeShader;
+        CommandList computeCommandList;
         private object locker = new object();
         public LineSeries(VeldridContent content, uint datalen=1000,uint plotcount=4):base(content)
         {
@@ -39,7 +49,6 @@ namespace Veldrid.Common.Plot
             PlotInfos = new SeriesInfo[plotcount];
             Margin = new Padding(40, 10, 10, 20);
         }
-        List<float>[] temp = new List<float>[0];
         internal override void DisposeResources()
         {
             base.DisposeResources();
@@ -52,6 +61,16 @@ namespace Veldrid.Common.Plot
             infoLayout?.Dispose();
             infoSet?.Dispose();
 
+
+            resultBuffer?.Dispose();
+            cpuBuffer?.Dispose();
+            computeLayout?.Dispose();
+            computeSet?.Dispose();
+            computePipline?.Dispose();
+            computeCommandList?.Dispose();
+            computeLineInfoLayout?.Dispose();
+            computeLineInfoSet?.Dispose();
+            computeShader?.Dispose();
         }
         private void CreateDataBuffer()
         {
@@ -66,12 +85,13 @@ namespace Veldrid.Common.Plot
                     Usage = BufferUsage.StructuredBufferReadWrite,
                     StructureByteStride = 4,
                 });
-                temp = Enumerable.Range(0, PlotInfos.Length).Select(x=> new List<float>()).ToArray();
                 dataSet = ResourceFactory.CreateResourceSet(new ResourceSetDescription(dataLayout, dataBuffer));
                 pipeline = CreatePipLine(PrimitiveTopology.LineStrip, new ResourceLayout[] { dataLayout, infoLayout }, new VertexLayoutDescription[0],new[] { shaders[0], shaders[1] });
                 datastartindex = 0;
                 datatotallen = 0;
                 TotalCount = 0;
+                MaxAndMin = new Vector2[PlotInfos.Length];
+                CreateComputeBuffer();
             }
         }
 
@@ -113,12 +133,34 @@ namespace Veldrid.Common.Plot
                 }));
             infoSet = ResourceFactory.CreateResourceSet(new ResourceSetDescription(infoLayout, plotInfoBuffer, projViewBuffer));
 
+            resultBuffer = ResourceFactory.CreateBuffer(new BufferDescription(20 * 4, BufferUsage.StructuredBufferReadWrite, 4));
+            cpuBuffer = ResourceFactory.CreateBuffer(new BufferDescription(resultBuffer.SizeInBytes, BufferUsage.Staging));
+            computeLayout = ResourceFactory.CreateResourceLayout(new ResourceLayoutDescription(
+                new ResourceLayoutElementDescription("DataBuffer", ResourceKind.StructuredBufferReadOnly, ShaderStages.Compute),
+                new ResourceLayoutElementDescription("ResultDataBuffer", ResourceKind.StructuredBufferReadWrite, ShaderStages.Compute)));
+            computeLineInfoLayout = ResourceFactory.CreateResourceLayout(new ResourceLayoutDescription(
+                new ResourceLayoutElementDescription("InfoBuffer", ResourceKind.UniformBuffer, ShaderStages.Compute)));
+            computeLineInfoSet = ResourceFactory.CreateResourceSet(new ResourceSetDescription(computeLineInfoLayout, plotInfoBuffer));
+            ShaderDescription shaderDescription = new ShaderDescription(ShaderStages.Compute, GLSLManger.LoadShader("LineSeries.hlsl"), "main")
+            {
+                Debug = true,
+            };
+            computeShader = ResourceFactory.CreateShader(shaderDescription);
+            computeCommandList = ResourceFactory.CreateCommandList() ;
             CreateDataBuffer();
         }
+
+        private void CreateComputeBuffer()
+        {
+            computeSet?.Dispose();
+            computePipline?.Dispose();
+            computeSet = ResourceFactory.CreateResourceSet(new ResourceSetDescription(computeLayout, dataBuffer, resultBuffer));
+            computePipline = ResourceFactory.CreateComputePipeline(new ComputePipelineDescription(computeShader, new[] { computeLayout, computeLineInfoLayout }, ThreadGroupSizeX, 1, 1));
+        }
         struct PlotInfo
         {
             public RgbaFloat Color;
-            public float Start;
+            public uint PlotIndex;
             public float Interval;
             public uint DataStartIndex;
             public uint PlotDataLenght;
@@ -136,7 +178,7 @@ namespace Veldrid.Common.Plot
         }
         public ulong TotalCount { get; private set; }
         public Vector2[] MaxAndMin { get; private set; } = new Vector2[0];
-        public void AddData(float[] data)
+        public unsafe void AddData(float[] data)
         {
             if (DataLenght == 0 || PlotInfos == null || PlotInfos.Length == 0) return;
             if (data == null|| data.Length!=PlotInfos.Length) return;
@@ -144,26 +186,50 @@ namespace Veldrid.Common.Plot
             for(int i=0;i<data.Length;i++)
             {
                 GraphicsDevice.UpdateBuffer(dataBuffer,(uint)((datastartindex+i*DataLenght)*Unsafe.SizeOf<float>()),ref data[i],(uint)Unsafe.SizeOf<float>());
-                temp[i].Add(data[i]);
-                if (temp[i].Count > DataLenght) temp[i].RemoveAt(0);
+
             }
             datastartindex++;
             datatotallen++;
             if(datatotallen>DataLenght)datatotallen = DataLenght;
             if (datastartindex >= DataLenght) datastartindex = 0;
             MaxAndMin = new Vector2[PlotInfos.Length];
-            for (int i = 0; i < MaxAndMin.Length; i++)
+            //return;
+            if (datatotallen > 0)
+            {
+                computeCommandList.Begin();
+                CalcMaxMin(computeCommandList);                
+                computeCommandList.End();
+                GraphicsDevice.SubmitCommands(computeCommandList);
+                GraphicsDevice.WaitForIdle();
+            }
+        }
+        private unsafe void CalcMaxMin(CommandList command)
+        {
+            MaxAndMin = new Vector2[PlotInfos.Length];
+            plotInfo.DataStartIndex = datatotallen;
+            plotInfo.PlotDataLenght = DataLenght;
+            command.SetPipeline(computePipline);
+            command.SetComputeResourceSet(0, computeSet);
+            command.SetComputeResourceSet(1, computeLineInfoSet);
+            for (uint i = 0; i < PlotInfos.Length; i++)
             {
-                MaxAndMin[i] = new Vector2(temp[i].Max(), temp[i].Min());
+                plotInfo.PlotIndex = i;
+                command.UpdateBuffer(plotInfoBuffer, 0, plotInfo);
+                command.Dispatch((uint)MathF.Ceiling(((float)datatotallen) / ThreadGroupSizeX), 1, 1);
             }
+            command.CopyBuffer(resultBuffer, 0, cpuBuffer, 0, (uint)(MaxAndMin.Length * Unsafe.SizeOf<Vector2>()));
+            var mapped = GraphicsDevice.Map(cpuBuffer, MapMode.ReadWrite);
+            Unsafe.CopyBlock(ref Unsafe.As<Vector2, byte>(ref MaxAndMin[0]), ref Unsafe.AsRef<byte>(mapped.Data.ToPointer()), (uint)(MaxAndMin.Length * Unsafe.SizeOf<Vector2>()));
+            GraphicsDevice.Unmap(cpuBuffer);
         }
-        internal override void DrawData()
+        internal unsafe override void DrawData()
         {
             if (DataLenght == 0 || PlotInfos == null || PlotInfos.Length == 0) return;
             lock (locker)
             {
                 base.DrawData();
                 if (datatotallen == 0) return;
+                //CalcMaxMin(CommandList);
                 projView.Proj = OrthographicMatrix;
                 projView.View = GetLineMatrix(HScale,VScale,0,VOffset);
                 CommandList.SetFramebuffer(MainSwapchainBuffer);
@@ -178,8 +244,8 @@ namespace Veldrid.Common.Plot
 
                     plotInfo.Color = PlotInfos[i].Color;
                     plotInfo.PlotDataLenght = DataLenght;
-                    plotInfo.DataStartIndex = datatotallen == DataLenght ? i * DataLenght + datastartindex : i * DataLenght;
-                    plotInfo.Start = 0;
+                    plotInfo.DataStartIndex = datatotallen == DataLenght ? datastartindex : 0;
+                    plotInfo.PlotIndex = i;
                     CommandList.UpdateBuffer(plotInfoBuffer, 0, plotInfo);
                     CommandList.Draw(datatotallen);
                 }

+ 36 - 8
Veldrid.Common/Plot/LineSeries.hlsl

@@ -1,20 +1,48 @@
 StructuredBuffer<float> DataBuffer : register(t0);
-globallycoherent RWStructuredBuffer<float2> ResultDataBuffer : register(u0);
+RWByteAddressBuffer ResultDataBuffer : register(u0);
 cbuffer InfoBuffer : register(b0)
 {
 	float4 Color;
-	float Start;
+    uint PlotIndex;
 	float Interval;
-	uint PlotIndex;
+    uint DataStartIndex;
 	uint PlotDataLenght;
 }
-
-[numthreads(1, 1, 1)]
+void InterlockedMaxFloat(RWByteAddressBuffer buf, uint addr, float value)
+{
+    uint i_val = asuint(value);
+    uint tmp0 = 0;
+    uint tmp1;
+    buf.InterlockedMax(addr, i_val, tmp1);
+}
+void InterlockedMinFloat(RWByteAddressBuffer buf, uint addr, float value)
+{
+    uint i_val = asuint(value);
+    uint tmp1;
+    buf.InterlockedMin(addr, i_val, tmp1);
+}
+void InterlockedCompareExchangeFloat(RWByteAddressBuffer buf, uint addr, float value)
+{
+    uint i_val = asuint(value);
+    uint tmp0 = 0;
+    uint tmp1;
+    buf.InterlockedCompareExchange(addr, tmp0, i_val, tmp1);
+}
+[numthreads(1000, 1, 1)]
 
 void main(uint3 DTid : SV_DispatchThreadID)
 {
     float value = DataBuffer[DTid.x + PlotIndex * PlotDataLenght];
-    GroupMemoryBarrierWithGroupSync();
-    ResultDataBuffer[PlotIndex] = float2(max(ResultDataBuffer[PlotIndex].x, value), min(ResultDataBuffer[PlotIndex].y, value));
-
+    if (DTid.x >= DataStartIndex-1)
+    {
+        return;
+    }
+    if (DTid.x == 0)
+    {
+        InterlockedCompareExchangeFloat(ResultDataBuffer, PlotIndex * 8, value);
+        InterlockedCompareExchangeFloat(ResultDataBuffer, PlotIndex * 8 + 4, value);
+        return;
+    }
+    InterlockedMaxFloat(ResultDataBuffer, PlotIndex * 8, value);
+    InterlockedMinFloat(ResultDataBuffer, PlotIndex * 8 + 4, value);
 }

+ 4 - 5
Veldrid.Common/Plot/LineSeries.vert

@@ -11,7 +11,7 @@ layout(set=0,binding=0) readonly buffer DataBuffer
 layout(set=1,binding=0) uniform InfoBuffer
 {
     vec4 Color;
-    float Start;
+    uint PlotIndex;
     float Interval;
     uint DataStartIndex;
     uint PlotDataLenght;
@@ -24,7 +24,6 @@ layout(set=1,binding=1) uniform ProjView
 void main()
 {
     V_Color = Color;
-    uint plotIndex = DataStartIndex/PlotDataLenght;
-    uint index =uint(mod(gl_VertexIndex+DataStartIndex,PlotDataLenght)+PlotDataLenght*plotIndex);
-    gl_Position = Proj*View*vec4(clamp(Start+gl_VertexIndex*Interval,0,10000),clamp(Datas[index],-5000,5000),0,1);
-}
+    uint index =(gl_VertexIndex+DataStartIndex)%PlotDataLenght+PlotIndex*PlotDataLenght;
+    gl_Position = Proj*View*vec4(gl_VertexIndex*Interval,Datas[index],0,1);
+} 

+ 2 - 2
Veldrid.Common/ShaderManger.cs

@@ -62,7 +62,7 @@ namespace Veldrid.Common
                     var result = SpirvCompilation.CompileGlslToSpirv(Encoding.UTF8.GetString(description.ShaderBytes), "", stages,
                                     new GlslCompileOptions()
                                     {
-                                        Debug = true
+                                        Debug = false
                                     });
                     description.ShaderBytes = result.SpirvBytes;
                     OtherShader[name] = graphicsDevice.ResourceFactory.CreateFromSpirv(description);
@@ -84,7 +84,7 @@ namespace Veldrid.Common
                                 var result = SpirvCompilation.CompileGlslToSpirv(Encoding.UTF8.GetString(description.ShaderBytes), "", stages,
                                     new GlslCompileOptions()
                                     {
-                                        Debug = true
+                                        Debug = false
                                     });
                                 description.ShaderBytes = result.SpirvBytes;
                                 OtherShader[name] = graphicsDevice.ResourceFactory.CreateFromSpirv(description);

+ 2 - 0
Veldrid.Common/Veldrid.Common.csproj

@@ -13,6 +13,7 @@
     <None Remove="ImageRender\ImageRender.frag" />
     <None Remove="ImageRender\ImageRender.vert" />
     <None Remove="Plot\DataReViewPlot.frag" />
+    <None Remove="Plot\DataReViewPlot.hlsl" />
     <None Remove="Plot\DataReViewPlot.vert" />
     <None Remove="Plot\LineSeries.frag" />
     <None Remove="Plot\LineSeries.hlsl" />
@@ -34,6 +35,7 @@
     <EmbeddedResource Include="Axis\LineAxis.frag" />
     <EmbeddedResource Include="ImageRender\ImageRender.frag" />
     <EmbeddedResource Include="ImageRender\ImageRender.vert" />
+    <EmbeddedResource Include="Plot\DataReViewPlot.hlsl" />
     <EmbeddedResource Include="Plot\LineSeries.hlsl" />
     <EmbeddedResource Include="Plot\DataReViewPlot.frag" />
     <EmbeddedResource Include="Plot\DataReViewPlot.vert" />

+ 2 - 0
Veldrid.Common/VeldridContent.cs

@@ -92,6 +92,8 @@ namespace Veldrid.Common
             renders.ForEach(x => x.Resize());
             text?.Resize();
         }
+        public uint Width => GraphicsManger.Device.SwapchainFramebuffer.Width;
+        public uint Height=>GraphicsManger.Device.SwapchainFramebuffer.Height;
         public void Render(bool runtimeplot = true)
         {
             lock (locker)

+ 1 - 0
Veldrid.Wpf/VeldridView.cs

@@ -294,6 +294,7 @@ namespace Veldrid.Wpf
         // ReSharper disable InconsistentNaming
         public const int WS_CHILD = 0x40000000;
         public const int WS_VISIBLE = 0x10000000;
+        public const int WM_PAINT = 0x0f;
 
         public const int WM_LBUTTONDOWN = 0x0201;
         public const int WM_LBUTTONUP = 0x0202;

Some files were not shown because too many files changed in this diff