public void Resize(IUavBindable buffer, int newElements, int newByteStride = -1, IntPtr?newData = null) { MyRenderProxy.Assert(newElements > 0); MyRenderProxy.Assert(newByteStride > 0 || newByteStride == -1); var uavBuffer = buffer as MyUavBuffer; ResizeInternal(uavBuffer, newElements, newByteStride, newData, b => b.UavType = uavBuffer.UavType); }
// IMPORTANT: This method can be called only once per frame. If it is not, it will stall CPU for quite long time // Helper function to read atomic UAV counters back onto the CPU. // The method reads in the current frame the value from the previous frame private static int ReadCounter(IUavBindable uav) { int count = 0; if (VRage.MyCompilationSymbols.DX11Debug) { // Copy the UAV counter to a staging resource RC.CopyStructureCount(m_debugCounterBuffers[m_debugCounterBuffersIndex], 0, uav); m_debugCounterBuffersIndex = m_debugCounterBuffersIndex == 1 ? 0 : 1; var mapping = MyMapping.MapRead(m_debugCounterBuffers[m_debugCounterBuffersIndex]); mapping.ReadAndPosition(ref count); mapping.Unmap(); } return(count); }
internal void SetUav(int slot, IUavBindable uavBindable) { UnorderedAccessView uav = null; if (uavBindable != null) { uav = uavBindable.Uav; } if (uav == m_uavs[slot]) { return; } m_uavs[slot] = uav; m_deviceContext.ComputeShader.SetUnorderedAccessView(slot, uav); m_statistics.SetUavs++; }
// IMPORTANT: This method can be called only once per frame. If it is not, it will stall CPU for quite long time // Helper function to read atomic UAV counters back onto the CPU. // The method reads in the current frame the value from the previous frame private static int ReadCounter(IUavBindable uav) { int count = 0; if (VRage.MyCompilationSymbols.DX11Debug) { // Copy the UAV counter to a staging resource RC.CopyStructureCount(m_debugCounterBuffers[m_debugCounterBuffersIndex], 0, uav); m_debugCounterBuffersIndex = m_debugCounterBuffersIndex == 1 ? 0 : 1; var mapping = MyMapping.MapRead(m_debugCounterBuffers[m_debugCounterBuffersIndex]); mapping.ReadAndPosition(ref count); mapping.Unmap(); } return count; }
internal void SetUav(int slot, IUavBindable uavBindable, int uavInitialCount) { UnorderedAccessView uav = null; if (uavBindable != null) uav = uavBindable.Uav; if (uav == m_uavs[slot] && uavInitialCount == m_uavsInitialCount[slot]) return; m_uavs[slot] = uav; m_uavsInitialCount[slot] = uavInitialCount; m_deviceContext.ComputeShader.SetUnorderedAccessView(slot, uav, uavInitialCount); m_statistics.SetUavs++; }
internal void CopyStructureCount(IBuffer dstBufferRef, int dstAlignedByteOffset, IUavBindable srcViewRef) { m_deviceContext.CopyStructureCount(dstBufferRef.Buffer, dstAlignedByteOffset, srcViewRef.Uav); CheckErrors(); }
internal void ClearUav(IUavBindable uav, RawInt4 values) { m_deviceContext.ClearUnorderedAccessView(uav.Uav, values); CheckErrors(); }
public void Resize(IUavBindable buffer, int newElements, int newByteStride = -1, IntPtr?newData = null) { var uavBuffer = buffer as MyUavBuffer; ResizeInternal(uavBuffer, newElements, newByteStride, newData, b => b.UavType = uavBuffer.UavType); }