public Cmd_CopyBuffer(SoftwareBuffer srcBuffer, SoftwareBuffer dstBuffer, int regionCount, VkBufferCopy[] pRegions) { this.srcBuffer = srcBuffer; this.dstBuffer = dstBuffer; this.regionCount = regionCount; this.pRegions = pRegions; }
private Expression GetReadUniformBufferExpression(FieldInfo fieldInfo, int binding, int set) { string debugFieldName = string.Format("{0}.{1}", fieldInfo.DeclaringType.Name, fieldInfo.Name); Type returnType = fieldInfo.FieldType; var bufferInfo = m_context.m_DescriptorSets[set].m_BufferInfo[binding]; if (bufferInfo.buffer == null) { DebugMsg(string.Format("ERROR: no buffer bound to uniform set={0} binding={1} for field {2}", set, binding, debugFieldName)); return(null); } SoftwareBuffer softwareBuffer = (SoftwareBuffer)bufferInfo.buffer; if (softwareBuffer.m_deviceMemory == null) { DebugMsg(string.Format("ERROR: no memory bound to buffer on uniform set={0} binding={1} for field {2}", set, binding, debugFieldName)); return(null); } SoftwareDeviceMemory mem = softwareBuffer.m_deviceMemory; byte[] memory = mem.m_bytes; int offset = bufferInfo.offset + softwareBuffer.m_memoryOffset; int size = Marshal.SizeOf(returnType); return(IntrospectionUtil.GetGenericMethodCallExpression( this, nameof(ReadUniform), new Type[] { returnType }, Expression.Constant(memory), Expression.Constant(offset), Expression.Constant(size))); }
public Cmd_CopyBufferToImage(SoftwareBuffer srcBuffer, SoftwareImage dstImage, VkImageLayout dstImageLayout, int regionCount, VkBufferImageCopy[] pRegions) { this.m_srcBuffer = srcBuffer; this.m_dstImage = dstImage; this.m_dstImageLayout = dstImageLayout; this.m_regionCount = regionCount; this.m_pRegions = pRegions; }
private T ReadUniform <T>(int binding, int set) where T : struct { var layout = m_context.m_CommandBuffer.m_context.m_DescriptorSets[set].m_Bindings[binding]; var bufferInfo = m_context.m_CommandBuffer.m_context.m_DescriptorSets[set].m_BufferInfo[binding]; SoftwareBuffer softwareBuffer = (SoftwareBuffer)bufferInfo.buffer; SoftwareDeviceMemory mem = softwareBuffer.m_deviceMemory; int startIndex = bufferInfo.offset + softwareBuffer.m_memoryOffset; T ret = new T(); MemoryCopyHelper.ReadStructure(mem.m_bytes, startIndex, ref ret); return(ret); }
public bool TryGetCachedBuffer(string key, int vertexCount, int indexCount, out SoftwareBuffer result) { lock (_BufferCache) if (!_BufferCache.TryGetValue(key, out result)) { return(false); } if ((result.Vertices.Count < vertexCount) || (result.Indices.Count < indexCount)) { result = null; return(false); } return(true); }
public void SetCachedBuffer(string key, SoftwareBuffer buffer) { lock (_BufferCache) // FIXME: We could leak an old one here _BufferCache[key] = buffer; }
public Cmd_BindIndexBuffer(SoftwareBuffer buffer, int offset, VkIndexType indexType) { this.buffer = buffer; this.offset = offset; this.indexType = indexType; }
public void SetCachedBuffer(string key, SoftwareBuffer buffer) { lock (_BufferCache) _BufferCache.Add(key, buffer); }