deMemcpy(ptr, data, size);
- flushMappedMemoryRange(vkd, device, memory, 0, size);
+ flushMappedMemoryRange(vkd, device, memory, 0, VK_WHOLE_SIZE);
vkd.unmapMemory(device, memory);
}
{
void* const ptr = vk::mapMemory(vkd, device, memory, 0, size, 0);
- invalidateMappedMemoryRange(vkd, device, memory, 0, size);
+ invalidateMappedMemoryRange(vkd, device, memory, 0, VK_WHOLE_SIZE);
if (deMemCmp(ptr, data, size) != 0)
TCU_FAIL("Memory contents don't match");
// Read results, render reference, compare
{
const tcu::TextureFormat tcuFormat = vk::mapVkFormat(colorFormat);
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType
- DE_NULL, // pNext
- readImageBufferMemory->getMemory(), // memory
- 0, // offset
- imageSizeBytes, // size
- };
const tcu::ConstPixelBufferAccess resultAccess (tcuFormat, renderSize.x(), renderSize.y(), 1, readImageBufferMemory->getHostPtr());
- VK_CHECK(vk.invalidateMappedMemoryRanges(vkDevice, 1u, &range));
+ invalidateAlloc(vk, vkDevice, *readImageBufferMemory);
{
tcu::TextureLevel refImage (tcuFormat, renderSize.x(), renderSize.y());
// Read results, render reference, compare
{
const tcu::TextureFormat tcuFormat = vk::mapVkFormat(colorFormat);
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType
- &dummyExtStruct, // pNext
- readImageBufferMemory->getMemory(), // memory
- 0, // offset
- imageSizeBytes, // size
- };
const tcu::ConstPixelBufferAccess resultAccess (tcuFormat, renderSize.x(), renderSize.y(), 1, readImageBufferMemory->getHostPtr());
- VK_CHECK(vk.invalidateMappedMemoryRanges(vkDevice, 1u, &range));
+ invalidateAlloc(vk, vkDevice, *readImageBufferMemory);
{
tcu::TextureLevel refImage (tcuFormat, renderSize.x(), renderSize.y());
// Read results, render reference, compare
{
const tcu::TextureFormat tcuFormat = vk::mapVkFormat(colorFormat);
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType
- DE_NULL, // pNext
- readImageBufferMemory->getMemory(), // memory
- 0, // offset
- imageSizeBytes, // size
- };
const tcu::ConstPixelBufferAccess resultAccess (tcuFormat, renderSize.x(), renderSize.y(), 1, readImageBufferMemory->getHostPtr());
- VK_CHECK(vk.invalidateMappedMemoryRanges(vkDevice, 1u, &range));
+ invalidateAlloc(vk, vkDevice, *readImageBufferMemory);
{
tcu::TextureLevel refImage (tcuFormat, renderSize.x(), renderSize.y());
sbtBuffer = de::MovePtr<BufferWithMemory>(new BufferWithMemory(
vk, device, allocator, makeBufferCreateInfo(DE_NULL, rayTracingProperties.shaderGroupHandleSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_RAY_TRACING_BIT_NV, 0), MemoryRequirement::HostVisible));
deUint32 *ptr = (deUint32 *)sbtBuffer->getAllocation().getHostPtr();
- invalidateMappedMemoryRange(vk, device, sbtBuffer->getAllocation().getMemory(), sbtBuffer->getAllocation().getOffset(), rayTracingProperties.shaderGroupHandleSize);
+ invalidateAlloc(vk, device, sbtBuffer->getAllocation());
vk.getRayTracingShaderGroupHandlesNV(device, *pipeline, 0, 1, rayTracingProperties.shaderGroupHandleSize, ptr);
}
submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
deUint32 *ptr = (deUint32 *)copyBuffer->getAllocation().getHostPtr();
- invalidateMappedMemoryRange(vk, device, copyBuffer->getAllocation().getMemory(), copyBuffer->getAllocation().getOffset(), DIM*DIM*sizeof(deUint32));
+ invalidateAlloc(vk, device, copyBuffer->getAllocation());
qpTestResult res = QP_TEST_RESULT_PASS;
}
}
- flushMappedMemoryRange(vk, device, m_buffer->getAllocation().getMemory(), m_buffer->getAllocation().getOffset(), VK_WHOLE_SIZE);
+ flushAlloc(vk, device, m_buffer->getAllocation());
}
}
void BufferDescriptor::invalidate (Context& context)
{
const DeviceInterface& vk = context.getDeviceInterface();
- const VkDevice device = context.getDevice();
+ const VkDevice device = context.getDevice();
- invalidateMappedMemoryRange(vk, device, m_buffer->getAllocation().getMemory(), m_buffer->getAllocation().getOffset(), m_bufferSize);
+ invalidateAlloc(vk, device, m_buffer->getAllocation());
}
// Returns the buffer data as a vector
DE_UNREF(pipelineType);
const DeviceInterface& vk = context.getDeviceInterface();
- const VkDevice device = context.getDevice();
+ const VkDevice device = context.getDevice();
const VkFormat format = VK_FORMAT_R32_SFLOAT;
// Create samplers
{
const InstanceInterface& vki = context.getInstanceInterface();
const DeviceInterface& vk = context.getDeviceInterface();
- const VkDevice device = context.getDevice();
+ const VkDevice device = context.getDevice();
const VkQueue queue = context.getUniversalQueue();
const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
const VkPhysicalDeviceLimits limits = getPhysicalDeviceProperties(vki, physicalDevice).limits;
const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
- Allocator& allocator = context.getDefaultAllocator();
+ Allocator& allocator = context.getDefaultAllocator();
tcu::TestLog& log = context.getTestContext().getLog();
const Unique<VkCommandPool> commandPool (createCommandPool(vk, device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex));
const Unique<VkCommandBuffer> commandBuffer (allocateCommandBuffer(vk, device, *commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
}
// Flush modified memory.
- flushMappedMemoryRange(vk, device, buffer->getAllocation().getMemory(), buffer->getAllocation().getOffset(), VK_WHOLE_SIZE);
+ flushAlloc(vk, device, buffer->getAllocation());
// Push constants are used for dynamic indexing. PushConstant[i] = i.
const VkPushConstantRange pushConstRange =
vk, device, allocator, makeBufferCreateInfo(rayTracingProperties.shaderGroupHandleSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_RAY_TRACING_BIT_NV), MemoryRequirement::HostVisible));
deUint32 *ptr = (deUint32 *)sbtBuffer->getAllocation().getHostPtr();
- invalidateMappedMemoryRange(vk, device, sbtBuffer->getAllocation().getMemory(), sbtBuffer->getAllocation().getOffset(), rayTracingProperties.shaderGroupHandleSize);
+ invalidateAlloc(vk, device, sbtBuffer->getAllocation());
vk.getRayTracingShaderGroupHandlesNV(device, *pipeline, 0, 1, rayTracingProperties.shaderGroupHandleSize, ptr);
}
submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
deUint32 *ptr = (deUint32 *)copyBuffer->getAllocation().getHostPtr();
- invalidateMappedMemoryRange(vk, device, copyBuffer->getAllocation().getMemory(), copyBuffer->getAllocation().getOffset(), DIM*DIM*sizeof(deUint32));
+ invalidateAlloc(vk, device, copyBuffer->getAllocation());
qpTestResult res = QP_TEST_RESULT_PASS;
void fillColor (const tcu::Vec4&) const { }
void invalidate (void) const
{
- const VkDeviceSize bufferSize = calcTexSize(getFormat(), getWidth(), getHeight(), getDepth());
- vk::invalidateMappedMemoryRange(m_interface, m_device, (*m_allocation)->getMemory(), (*m_allocation)->getOffset(), bufferSize);
+ invalidateAlloc(m_interface, m_device, **m_allocation);
}
};
{
const size_t nonCoherentAtomSize (static_cast<size_t>(ctx.getDeviceProperties().limits.nonCoherentAtomSize));
const VkDeviceSize roundedSize (deAlignSize(static_cast<size_t>(desiredSize), nonCoherentAtomSize));
- Allocator& allocator (ctx.getDefaultAllocator());
+ Allocator& allocator (ctx.getDefaultAllocator());
VkDevice device (ctx.getDevice());
const DeviceInterface& interface (ctx.getDeviceInterface());
// Verify results
{
const Allocation alloc = m_colorBuffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+ invalidateAlloc(vk, device, alloc);
const tcu::ConstPixelBufferAccess resultImage (mapVkFormat(colorFormat), m_renderSize.x(), m_renderSize.y(), 1u, alloc.getHostPtr());
const tcu::TextureLevel referenceImage = generateReferenceImage(mapVkFormat(colorFormat), m_renderSize, m_params.testMode, m_clearColor,
// Verify layers.
{
const Allocation alloc = colorBuffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+ invalidateAlloc(vk, device, alloc);
deUint8* resultMem = reinterpret_cast<deUint8*>(alloc.getHostPtr());
for (int i = 0; i < numLayers; i++)
// Verify layers.
{
const Allocation alloc = colorBuffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+ invalidateAlloc(vk, device, alloc);
deUint8* resultMem = reinterpret_cast<deUint8*>(alloc.getHostPtr());
for (int i = 0; i < numLayers; i++) {
// Log image
{
const Allocation alloc = colorBuffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+ invalidateAlloc(vk, device, alloc);
const tcu::ConstPixelBufferAccess resultImage (mapVkFormat(colorFormat), renderSize.x(), renderSize.y(), 1u, alloc.getHostPtr());
const tcu::TextureLevel referenceImage = generateReferenceImage(mapVkFormat(colorFormat), renderSize, clearColor, cells, colors);
// Log image
{
const Allocation alloc = colorBuffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, alloc.getMemory(), 0ull, colorBufferSize);
+ invalidateAlloc(vk, device, alloc);
const tcu::ConstPixelBufferAccess resultImage (mapVkFormat(colorFormat), renderSize.x(), renderSize.y(), 1u, alloc.getHostPtr());
const tcu::TextureLevel referenceImage = generateReferenceImage(mapVkFormat(colorFormat), renderSize, clearColor, cells, colors);
{
// Log the result image.
const Allocation& colorBufferAlloc = colorBuffer.getAllocation();
- invalidateMappedMemoryRange(vk, device, colorBufferAlloc.getMemory(), colorBufferAlloc.getOffset(), colorBufferSizeBytes);
+ invalidateAlloc(vk, device, colorBufferAlloc);
const tcu::ConstPixelBufferAccess imagePixelAccess(mapVkFormat(colorFormat), resolution.x(), resolution.y(), 1, colorBufferAlloc.getHostPtr());
if (!compareWithFileImage(m_context, imagePixelAccess, m_name))
endCommandBuffer(vk, *cmdBuffer);
submitCommandsAndWait(vk, device, queue, *cmdBuffer);
- invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
+ invalidateAlloc(vk, device, *colorBufferAlloc);
if (!verifyResults(context.getTestContext().getLog(), params, colorFormat, colorBufferAlloc->getHostPtr()))
return tcu::TestStatus::fail("Rendered images are incorrect");
endCommandBuffer(vk, *cmdBuffer);
submitCommandsAndWait(vk, device, queue, *cmdBuffer);
- invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
- invalidateMappedMemoryRange(vk, device, depthBufferAlloc->getMemory(), depthBufferAlloc->getOffset(), depthBufferSize);
- invalidateMappedMemoryRange(vk, device, stencilBufferAlloc->getMemory(), stencilBufferAlloc->getOffset(), stencilBufferSize);
+ invalidateAlloc(vk, device, *colorBufferAlloc);
+ invalidateAlloc(vk, device, *depthBufferAlloc);
+ invalidateAlloc(vk, device, *stencilBufferAlloc);
if (!verifyResults(context.getTestContext().getLog(), params, colorFormat, colorBufferAlloc->getHostPtr()))
result += " Color";
endCommandBuffer(vk, *cmdBuffer);
submitCommandsAndWait(vk, device, queue, *cmdBuffer);
- invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
+ invalidateAlloc(vk, device, *colorBufferAlloc);
if (!verifyResults(context.getTestContext().getLog(), params, colorFormat, colorBufferAlloc->getHostPtr()))
return tcu::TestStatus::fail("Rendered images are incorrect");
// Retrieve data from buffer to host memory
const Allocation& allocation = m_buffer->getAllocation();
- invalidateMappedMemoryRange(deviceInterface, device, allocation.getMemory(), allocation.getOffset(), bufferSizeInBytes);
+ invalidateAlloc(deviceInterface, device, allocation);
const tcu::UVec3 computeGridSize = getShaderGridSize(m_imageType, m_imageSize);
tcu::ConstPixelBufferAccess resultPixelBuffer(m_format, computeGridSize.x(), computeGridSize.y(), computeGridSize.z(), allocation.getHostPtr());
void* const mapPtr = m_vertexBufferAllocation->getHostPtr();
deMemcpy(mapPtr, triangleData, sizeof(triangleData));
- flushMappedMemoryRange(m_vkd, m_device, m_vertexBufferAllocation->getMemory(), m_vertexBufferAllocation->getOffset(), sizeof(triangleData));
+ flushAlloc(m_vkd, m_device, *m_vertexBufferAllocation);
return buffer;
}
const vk::DeviceInterface& vkd = context.getContext().getDeviceInterface();
const vk::VkDevice device = context.getContext().getDevice();
- vk::invalidateMappedMemoryRange(vkd, device, m_memory, 0, m_size);
+ vk::invalidateMappedMemoryRange(vkd, device, m_memory, 0, VK_WHOLE_SIZE);
}
private:
const vk::DeviceInterface& vkd = context.getContext().getDeviceInterface();
const vk::VkDevice device = context.getContext().getDevice();
- vk::flushMappedMemoryRange(vkd, device, m_memory, 0, m_size);
+ vk::flushMappedMemoryRange(vkd, device, m_memory, 0, VK_WHOLE_SIZE);
}
private:
void* const ptr = mapMemory(vkd, device, *m_memory, m_bufferSize);
bool isOk = true;
- vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+ vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
{
const deUint8* const data = (const deUint8*)ptr;
data[ndx] = rng.getUint8();
}
- vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+ vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
vkd.unmapMemory(device, *m_memory);
}
}
{
void* const ptr = mapMemory(vkd, device, *memory, 4 * m_imageWidth * m_imageHeight);
- vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, 4 * m_imageWidth * m_imageHeight);
+ invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
{
const deUint8* const data = (const deUint8*)ptr;
data[ndx] = rng.getUint8();
}
- vk::flushMappedMemoryRange(vkd, device, *memory, 0, 4 * m_imageWidth * m_imageHeight);
+ vk::flushMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
vkd.unmapMemory(device, *memory);
}
const ConstPixelBufferAccess referenceImage (context.getReferenceImage().getAccess());
const ConstPixelBufferAccess resultImage (TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_imageWidth, m_imageHeight, 1, ptr);
- vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+ vk::invalidateMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
if (!tcu::intThresholdCompare(context.getLog(), (de::toString(commandIndex) + ":" + getName()).c_str(), (de::toString(commandIndex) + ":" + getName()).c_str(), referenceImage, resultImage, UVec4(0), tcu::COMPARE_LOG_ON_ERROR))
resultCollector.fail(de::toString(commandIndex) + ":" + getName() + " Image comparison failed");
data[ndx] = rng.getUint8();
}
- vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, m_bufferSize);
+ vk::flushMappedMemoryRange(vkd, device, *m_memory, 0, VK_WHOLE_SIZE);
vkd.unmapMemory(device, *m_memory);
}
}
data[ndx] = rng.getUint8();
}
- vk::flushMappedMemoryRange(vkd, device, *memory, 0, 4 * m_imageWidth * m_imageHeight);
+ vk::flushMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
vkd.unmapMemory(device, *memory);
}
{
void* const ptr = mapMemory(vkd, device, *memory, 4 * m_imageWidth * m_imageHeight);
- vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, 4 * m_imageWidth * m_imageHeight);
+ vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
{
const deUint8* const data = (const deUint8*)ptr;
data[ndx] = rng.getUint8();
}
- vk::flushMappedMemoryRange(vkd, device, *memory, 0, 4 * m_srcImageWidth * m_srcImageHeight);
+ vk::flushMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
vkd.unmapMemory(device, *memory);
}
{
void* const ptr = mapMemory(vkd, device, *memory, 4 * m_dstImageWidth * m_dstImageHeight);
- vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, 4 * m_dstImageWidth * m_dstImageHeight);
+ vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
if (m_scale == BLIT_SCALE_10)
{
{
void* const ptr = mapMemory(vkd, device, *memory, 4 * m_targetWidth * m_targetHeight);
- vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, 4 * m_targetWidth * m_targetHeight);
+ vk::invalidateMappedMemoryRange(vkd, device, *memory, 0, VK_WHOLE_SIZE);
{
const deUint8* const data = (const deUint8*)ptr;
tcu::TestLog& log = m_context.getTestContext().getLog();
deUint32 *ptr = (deUint32 *)copyBuffer->getAllocation().getHostPtr();
- invalidateMappedMemoryRange(vk, device, copyBuffer->getAllocation().getMemory(), copyBuffer->getAllocation().getOffset(), bufferSizes[2]);
+ invalidateAlloc(vk, device, copyBuffer->getAllocation());
qpTestResult res = QP_TEST_RESULT_PASS;
deUint32 numErrors = 0;
VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *m_vertexCoordBuffer, m_vertexCoordAlloc->getMemory(), m_vertexCoordAlloc->getOffset()));
deMemcpy(m_vertexCoordAlloc->getHostPtr(), m_vertexCoord.data(), static_cast<size_t>(dataSize));
- flushMappedMemoryRange(*m_device, *m_logicalDevice, m_vertexCoordAlloc->getMemory(), m_vertexCoordAlloc->getOffset(), static_cast<size_t>(bufferDataSize));
+ flushAlloc(*m_device, *m_logicalDevice, *m_vertexCoordAlloc);
}
// Upload vertex colors
VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *m_vertexColorBuffer, m_vertexColorAlloc->getMemory(), m_vertexColorAlloc->getOffset()));
deMemcpy(m_vertexColorAlloc->getHostPtr(), m_vertexColor.data(), static_cast<size_t>(dataSize));
- flushMappedMemoryRange(*m_device, *m_logicalDevice, m_vertexColorAlloc->getMemory(), m_vertexColorAlloc->getOffset(), static_cast<size_t>(bufferDataSize));
+ flushAlloc(*m_device, *m_logicalDevice, *m_vertexColorAlloc);
}
// Upload vertex indices
// Init host buffer data
VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *m_vertexIndicesBuffer, m_vertexIndicesAllocation->getMemory(), m_vertexIndicesAllocation->getOffset()));
deMemcpy(m_vertexIndicesAllocation->getHostPtr(), m_vertexIndices.data(), static_cast<size_t>(dataSize));
- flushMappedMemoryRange(*m_device, *m_logicalDevice, m_vertexIndicesAllocation->getMemory(), m_vertexIndicesAllocation->getOffset(), static_cast<size_t>(bufferDataSize));
+ flushAlloc(*m_device, *m_logicalDevice, *m_vertexIndicesAllocation);
}
else
DE_ASSERT(m_vertexIndices.empty());
VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
deMemset(bufferAlloc->getHostPtr(), 0, static_cast<size_t>(pixelDataSize));
- flushMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+ flushAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
}
const VkBufferMemoryBarrier bufferBarrier =
submitCommandsAndWait(*m_device, *m_logicalDevice, m_queue, *m_cmdBuffer);
// Read buffer data
- invalidateMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+ invalidateAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
tcu::copy(dst, tcu::ConstPixelBufferAccess(dst.getFormat(), dst.getSize(), bufferAlloc->getHostPtr()));
}
// Write buffer data
deMemcpy(bufferAlloc->getHostPtr(), data->getLevel(0).getDataPtr(), bufferSize);
- flushMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), bufferSize);
+ flushAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
beginCommandBuffer(*m_device, *m_cmdBuffer);
deMemcpy(allocationBuffer->getHostPtr(), drawCommandsDataPtr, static_cast<size_t>(dataSize));
- flushMappedMemoryRange(*m_device, *m_logicalDevice, allocationBuffer->getMemory(), allocationBuffer->getOffset(), static_cast<size_t>(bufferDataSize));
+ flushAlloc(*m_device, *m_logicalDevice, *allocationBuffer);
indirectBuffers[subpassNdx] = (BufferSP(new Unique<VkBuffer>(indirectBuffer)));
indirectAllocations[subpassNdx] = (AllocationSP(new UniquePtr<Allocation>(allocationBuffer)));
}
VK_CHECK(m_device->bindBufferMemory(*m_logicalDevice, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
deMemset(bufferAlloc->getHostPtr(), 0xCC, static_cast<size_t>(pixelDataSize));
- flushMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+ flushAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
}
const VkBufferMemoryBarrier bufferBarrier =
submitCommandsAndWait(*m_device, *m_logicalDevice, m_queue, *m_cmdBuffer);
// Read buffer data
- invalidateMappedMemoryRange(*m_device, *m_logicalDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize);
+ invalidateAlloc(*m_device, *m_logicalDevice, *bufferAlloc);
if (m_depthTest)
{
// Set the reference uniform data
{
deMemcpy(refUniform->getAllocation().getHostPtr(), getReferenceDataSrc(), refDataSize);
- vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refDataSize);
+ flushAlloc(vk, device, refUniform->getAllocation());
}
const deUint32 helperBufferSize = (deUint32)(2 * sizeof(deUint32));
// Set the reference uniform data
{
deMemcpy(refUniform->getAllocation().getHostPtr(), &refData, refUniformSize);
- vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+ flushAlloc(vk, device, refUniform->getAllocation());
}
const deUint32 helperBufferSize = (deUint32)(2 * sizeof(deUint32));
deMemcpy(vertexBuffer->getAllocation().getHostPtr(), positions, positionDataSize);
deMemcpy(reinterpret_cast<deUint8*>(vertexBuffer->getAllocation().getHostPtr()) + positionDataSize, texCoord.data(), textureCoordDataSize);
- vk::flushMappedMemoryRange(vk, device, vertexBuffer->getAllocation().getMemory(), vertexBuffer->getAllocation().getOffset(), vertexBufferSize);
+ vk::flushAlloc(vk, device, vertexBuffer->getAllocation());
}
// Create pipeline
// Set the test input uniform data
{
deMemcpy(testUniform->getAllocation().getHostPtr(), &m_testInput, testUniformSize);
- vk::flushMappedMemoryRange(vk, device, testUniform->getAllocation().getMemory(), testUniform->getAllocation().getOffset(), testUniformSize);
+ vk::flushAlloc(vk, device, testUniform->getAllocation());
}
const deUint32 testBufferSize = sizeof(ValidationDataStorage<T>);
de::MovePtr<vk::BufferWithMemory> testBuffer (makeBuffer(ctx,
// Set the test input uniform data
{
deMemcpy(testUniform->getAllocation().getHostPtr(), &m_testInput, testUniformSize);
- vk::flushMappedMemoryRange(vk, device, testUniform->getAllocation().getMemory(), testUniform->getAllocation().getOffset(), testUniformSize);
+ vk::flushAlloc(vk, device, testUniform->getAllocation());
}
const deUint32 testBufferSize = sizeof(ValidationDataStorage<T>);
tcu::copy(destAccess, access);
- vk::flushMappedMemoryRange(vk, device, stagingBuffer->getAllocation().getMemory(), stagingBuffer->getAllocation().getOffset(), stagingBufferSize);
+ flushAlloc(vk, device, stagingBuffer->getAllocation());
}
const vk::VkImageSubresourceRange subresourceRange =
DE_STATIC_ASSERT(sizeof(vertices) == sizeof(float)*4*3);
deMemcpy(m_vertexBuffer->getAllocation().getHostPtr(), &vertices[0], sizeof(vertices));
- vk::flushMappedMemoryRange(m_vkd, context.getDevice(), m_vertexBuffer->getAllocation().getMemory(), m_vertexBuffer->getAllocation().getOffset(), sizeof(vertices));
+ flushAlloc(m_vkd, context.getDevice(), m_vertexBuffer->getAllocation());
}
}
bufferBarriers.push_back(bufferBarrier);
deMemcpy(buffer->getAllocation().getHostPtr(), imageData.getPlanePtr(planeNdx), imageData.getPlaneSize(planeNdx));
- flushMappedMemoryRange(vk, device, buffer->getAllocation().getMemory(), buffer->getAllocation().getOffset(), (deUint32)imageData.getPlaneSize(planeNdx));
+ flushAlloc(vk, device, buffer->getAllocation());
stagingBuffers.push_back(de::SharedPtr<de::MovePtr<vk::BufferWithMemory> >(new de::MovePtr<vk::BufferWithMemory>(buffer.release())));
}
// Set the reference uniform data
{
deMemcpy(refUniform->getAllocation().getHostPtr(), &refData[0], refUniformSize);
- vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+ flushAlloc(vk, device, refUniform->getAllocation());
}
const deUint32 helperBufferSize = (deUint32)(2 * sizeof(deUint32));
// Set the reference uniform data
{
deMemcpy(refUniform->getAllocation().getHostPtr(), &referenceData[0], refUniformSize);
- vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+ flushAlloc(vk, device, refUniform->getAllocation());
}
// Update descriptor set
vk::MemoryRequirement::HostVisible);
deMemcpy(vertexBuffer->getAllocation().getHostPtr(), &posCoords[0], bufferSize);
- vk::flushMappedMemoryRange(vk, device, vertexBuffer->getAllocation().getMemory(), vertexBuffer->getAllocation().getOffset(), bufferSize);
+ flushAlloc(vk, device, vertexBuffer->getAllocation());
}
const vk::Unique<vk::VkPipeline> pipeline (makeGraphicsPipeline(vk,
tcu::Vec4 *ptr = reinterpret_cast<tcu::Vec4*>(m_vertexBuffer->getBoundMemory().getHostPtr());
deMemcpy(ptr, &vertices[0], kBufferSize);
- flushMappedMemoryRange(vkd, device, m_vertexBuffer->getBoundMemory().getMemory(), m_vertexBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
+ flushAlloc(vkd, device, m_vertexBuffer->getBoundMemory());
}
}
const std::vector<deUint8> data((size_t)bufferSize, 0u);
const Allocation& allocation = m_buffer->getBoundMemory();
void* allocationData = allocation.getHostPtr();
- invalidateMappedMemoryRange(vkd, device, allocation.getMemory(), allocation.getOffset(), bufferSize);
+ invalidateAlloc(vkd, device, allocation);
deMemcpy(allocationData, &data[0], (size_t)bufferSize);
const VkBufferMemoryBarrier barrier =
const std::vector<deUint8> data ((size_t)bufferSizeBytes, 0u);
const Allocation& allocation = buffer->getBoundMemory();
void* allocationData = allocation.getHostPtr();
- invalidateMappedMemoryRange(vk, device, allocation.getMemory(), allocation.getOffset(), bufferSizeBytes);
+ invalidateAlloc(vk, device, allocation);
deMemcpy(allocationData, &data[0], (size_t)bufferSizeBytes);
}
// Validate the results
const Allocation& bufferAllocation = buffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, bufferAllocation.getMemory(), bufferAllocation.getOffset(), bufferSizeBytes);
+ invalidateAlloc(vk, device, bufferAllocation);
if (m_parameters[0].resetType == RESET_TYPE_NORMAL)
{
const de::SharedPtr<Buffer> buffer,
const VkDeviceSize bufferSizeBytes);
virtual tcu::TestStatus checkResult (const de::SharedPtr<Buffer> buffer,
- const VkDeviceSize bufferSizeBytes,
const VkQueryPool queryPool);
};
// Wait for completion
submitCommandsAndWait(vk, device, queue, *primaryCmdBuffer);
- return checkResult(buffer, bufferSizeBytes, *queryPool);
+ return checkResult(buffer, *queryPool);
}
-tcu::TestStatus ComputeInvocationsSecondaryTestInstance::checkResult (const de::SharedPtr<Buffer> buffer, const VkDeviceSize bufferSizeBytes, const VkQueryPool queryPool)
+tcu::TestStatus ComputeInvocationsSecondaryTestInstance::checkResult (const de::SharedPtr<Buffer> buffer, const VkQueryPool queryPool)
{
const DeviceInterface& vk = m_context.getDeviceInterface();
const VkDevice device = m_context.getDevice();
{
// Validate the results
const Allocation& bufferAllocation = buffer->getBoundMemory();
- invalidateMappedMemoryRange(vk, device, bufferAllocation.getMemory(), bufferAllocation.getOffset(), bufferSizeBytes);
+ invalidateAlloc(vk, device, bufferAllocation);
const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
deUint32 minSize = ~0u;
for(size_t parametersNdx = 0; parametersNdx < m_parameters.size(); ++parametersNdx)
// Wait for completion
submitCommandsAndWait(vk, device, queue, *primaryCmdBuffer);
- return checkResult(buffer, bufferSizeBytes, *queryPool);
+ return checkResult(buffer, *queryPool);
}
class GraphicBasicTestInstance : public StatisticQueryTestInstance
deMemcpy(inputBufferAlloc->getHostPtr(), &referenceData[0], m_bufferSize);
- flushMappedMemoryRange(deviceInterface, getDevice(), inputBufferAlloc->getMemory(), inputBufferAlloc->getOffset(), m_bufferSize);
+ flushAlloc(deviceInterface, getDevice(), *inputBufferAlloc);
// Create output buffer
const VkBufferCreateInfo outputBufferCreateInfo = makeBufferCreateInfo(m_bufferSize, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
// Copy data to memory.
{
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- resourceMemory->getMemory(), // VkDeviceMemory mem;
- 0, // VkDeviceSize offset;
- VK_WHOLE_SIZE, // VkDeviceSize size;
- };
-
vector<deUint8> resourceBytes;
resource.getBytes(resourceBytes);
deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
- VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+ flushAlloc(vk, device, *resourceMemory);
}
inResourceMemories.push_back(AllocationSp(resourceMemory.release()));
// Copy data to memory.
{
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- resourceMemory->getMemory(), // VkDeviceMemory mem;
- 0, // VkDeviceSize offset;
- VK_WHOLE_SIZE, // VkDeviceSize size;
- };
-
vector<deUint8> resourceBytes;
resource.getBytes(resourceBytes);
deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
- VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+ flushAlloc(vk, device, *resourceMemory);
}
Move<VkImage> resourceImage = createImageForResource(vk, device, resource, instance.resources.inputFormat, queueFamilyIndex);
VK_CHECK(vk.bindBufferMemory(device, *resourceBuffer, resourceMemory->getMemory(), resourceMemory->getOffset()));
// Fill memory with all ones.
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- resourceMemory->getMemory(), // VkDeviceMemory mem;
- 0, // VkDeviceSize offset;
- VK_WHOLE_SIZE, // VkDeviceSize size;
- };
-
resource.getBytes(resourceBytes);
deMemset((deUint8*)resourceMemory->getHostPtr(), 0xff, resourceBytes.size());
- VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+ flushAlloc(vk, device, *resourceMemory);
outResourceMemories.push_back(AllocationSp(resourceMemory.release()));
outResourceBuffers.push_back(BufferHandleSp(new BufferHandleUp(resourceBuffer)));
deMemcpy(vertexInputMemory->getHostPtr(), data.data(), data.size());
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- vertexInputMemory->getMemory(), // VkDeviceMemory mem;
- 0, // VkDeviceSize offset;
- VK_WHOLE_SIZE, // VkDeviceSize size;
- };
-
- VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
+ flushAlloc(vk, device, *vertexInputMemory);
}
// Submit & wait for completion
context.getTestContext().getLog() << TestLog::Image("Result", "Result", pixelBuffer);
if (needInterface)
- {
- const VkDeviceSize fragOutputImgSize = (VkDeviceSize)(instance.interfaces.getOutputType().getNumBytes() * renderSize.x() * renderSize.y());
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- fragOutputMemory->getMemory(), // VkDeviceMemory mem;
- 0, // VkDeviceSize offset;
- fragOutputImgSize, // VkDeviceSize size;
- };
-
- VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1u, &range));
- }
-
- { // Make sure all output resources are ready.
- for (deUint32 outputNdx = 0; outputNdx < numOutResources; ++outputNdx)
- {
- const VkMappedMemoryRange range =
- {
- VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- outResourceMemories[outputNdx]->getMemory(), // VkDeviceMemory mem;
- 0, // VkDeviceSize offset;
- VK_WHOLE_SIZE, // VkDeviceSize size;
- };
+ invalidateAlloc(vk, device, *fragOutputMemory);
- VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1u, &range));
- }
- }
+ // Make sure all output resources are ready.
+ for (deUint32 outputNdx = 0; outputNdx < numOutResources; ++outputNdx)
+ invalidateAlloc(vk, device, *outResourceMemories[outputNdx]);
const RGBA threshold(1, 1, 1, 1);
const int refCount = 1;
int resCount = 0;
- invalidateMappedMemoryRange(vk, device, acBufferAlloc->getMemory(), acBufferAlloc->getOffset(), acBufferSize);
+ invalidateAlloc(vk, device, *acBufferAlloc);
resCount = *((const int*)acBufferAlloc->getHostPtr());
for (size_t allocNdx = 0; allocNdx < m_uniformAllocs.size(); allocNdx++)
{
vk::Allocation *alloc = m_uniformAllocs[allocNdx].get();
- invalidateMappedMemoryRange(vk, device, alloc->getMemory(), alloc->getOffset(), VK_WHOLE_SIZE);
+ invalidateAlloc(vk, device, *alloc);
}
// Validate result
const DeviceInterface& vk = m_context.getDeviceInterface();
const VkDevice device = m_context.getDevice();
- invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), VK_WHOLE_SIZE);
+ invalidateAlloc(vk, device, *bufAlloc);
const deUint32 numPoints = static_cast<deUint32>(bufBytes / sizeof(deUint32));
const deUint32* tfData = (deUint32*)bufAlloc->getHostPtr();
const DeviceInterface& vk = m_context.getDeviceInterface();
const VkDevice device = m_context.getDevice();
- invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), VK_WHOLE_SIZE);
+ invalidateAlloc(vk, device, *bufAlloc);
const deUint32 numPoints = static_cast<deUint32>(bufBytes / sizeof(deUint32));
const deUint32 vertexPerPrimitive = m_tParameters.vertexPerPrimitive;
const DeviceInterface& vk = m_context.getDeviceInterface();
const VkDevice device = m_context.getDevice();
- invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), VK_WHOLE_SIZE);
+ invalidateAlloc(vk, device, *bufAlloc);
const deUint32 numPoints = static_cast<deUint32>(bufBytes / sizeof(float));
const deUint8* tfDataBytes = (deUint8*)bufAlloc->getHostPtr();
const DeviceInterface& vk = m_context.getDeviceInterface();
const VkDevice device = m_context.getDevice();
- invalidateMappedMemoryRange(vk, device, bufAlloc->getMemory(), bufAlloc->getOffset(), bufBytes);
+ invalidateAlloc(vk, device, *bufAlloc);
const deUint32 numPoints = static_cast<deUint32>(bufBytes / sizeof(deUint32));
const float* tfData = (float*)bufAlloc->getHostPtr();
{
const ConstPixelBufferAccess imgAccess (TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), RENDER_WIDTH, RENDER_HEIGHT, 1, m_readImageMem[0]->getHostPtr());
- invalidateMappedMemoryRange(vkd, device, m_readImageMem[0]->getMemory(), m_readImageMem[0]->getOffset(), (vk::VkDeviceSize)(RENDER_WIDTH*RENDER_HEIGHT*4));
+ invalidateAlloc(vkd, device, *m_readImageMem[0]);
if (!checkResultImage(imgAccess))
{
DE_FATAL("Unknown data type");
}
- invalidateMappedMemoryRange(vkd, device, m_readImageMem[outNdx]->getMemory(), m_readImageMem[outNdx]->getOffset(), (vk::VkDeviceSize)(RENDER_WIDTH * RENDER_HEIGHT * tcu::getPixelSize(vk::mapVkFormat(m_rtFormat))));
+ invalidateAlloc(vkd, device, *m_readImageMem[outNdx]);
if (!checkResultImageWithReference(imgAccess, reference))
{