bufferSize // VkDeviceSize size;
};
- const VkImageAspectFlags aspect = getAspectFlags(imageAccess.getFormat());
+ const VkImageAspectFlags formatAspect = getAspectFlags(mapVkFormat(parms.format));
+ const bool skipPreImageBarrier = formatAspect == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) &&
+ getAspectFlags(imageAccess.getFormat()) == VK_IMAGE_ASPECT_STENCIL_BIT;
const VkImageMemoryBarrier preImageBarrier =
{
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType;
VK_QUEUE_FAMILY_IGNORED, // deUint32 dstQueueFamilyIndex;
image, // VkImage image;
{ // VkImageSubresourceRange subresourceRange;
- aspect, // VkImageAspectFlags aspect;
+ formatAspect, // VkImageAspectFlags aspect;
0u, // deUint32 baseMipLevel;
1u, // deUint32 mipLevels;
0u, // deUint32 baseArraySlice;
VK_QUEUE_FAMILY_IGNORED, // deUint32 dstQueueFamilyIndex;
image, // VkImage image;
{ // VkImageSubresourceRange subresourceRange;
- aspect, // VkImageAspectFlags aspect;
+ formatAspect, // VkImageAspectFlags aspect;
0u, // deUint32 baseMipLevel;
1u, // deUint32 mipLevels;
0u, // deUint32 baseArraySlice;
};
VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
- vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &preBufferBarrier, 1, &preImageBarrier);
+ vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL,
+ 1, &preBufferBarrier, (skipPreImageBarrier ? 0 : 1), (skipPreImageBarrier ? DE_NULL : &preImageBarrier));
vk.cmdCopyBufferToImage(*m_cmdBuffer, *buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1u, ©Region);
vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier);
VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
}
// Barriers for copying image to buffer
- const VkImageAspectFlags aspect = getAspectFlags(dst.getFormat());
+ const VkImageAspectFlags formatAspect = getAspectFlags(mapVkFormat(imageParms.format));
const VkImageMemoryBarrier imageBarrier =
{
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType;
VK_QUEUE_FAMILY_IGNORED, // deUint32 dstQueueFamilyIndex;
image, // VkImage image;
{ // VkImageSubresourceRange subresourceRange;
- aspect, // VkImageAspectFlags aspectMask;
+ formatAspect, // VkImageAspectFlags aspectMask;
0u, // deUint32 baseMipLevel;
1u, // deUint32 mipLevels;
0u, // deUint32 baseArraySlice;
VK_QUEUE_FAMILY_IGNORED, // deUint32 dstQueueFamilyIndex;
image, // VkImage image;
{
- aspect, // VkImageAspectFlags aspectMask;
+ formatAspect, // VkImageAspectFlags aspectMask;
0u, // deUint32 baseMipLevel;
1u, // deUint32 mipLevels;
0u, // deUint32 baseArraySlice;
};
// Copy image to buffer
+ const VkImageAspectFlags aspect = getAspectFlags(dst.getFormat());
const VkBufferImageCopy copyRegion =
{
0u, // VkDeviceSize bufferOffset;
typedef std::map<deUint32, std::vector<float> > QueuePrioritiesMap;
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
deUint32 queueFamilyPropertiesCount = 0u;
};
m_logicalDevice = createDevice(instance, physicalDevice, &deviceInfo);
- m_allocator = de::MovePtr<Allocator>(new SimpleAllocator(deviceInterface, *m_logicalDevice, getPhysicalDeviceMemoryProperties(instance, physicalDevice)));
+ m_deviceDriver = de::MovePtr<DeviceDriver>(new DeviceDriver(instance, *m_logicalDevice));
+ m_allocator = de::MovePtr<Allocator>(new SimpleAllocator(*m_deviceDriver, *m_logicalDevice, getPhysicalDeviceMemoryProperties(instance, physicalDevice)));
for (QueuesMap::iterator queuesIter = m_queues.begin(); queuesIter != m_queues.end(); ++queuesIter)
{
Queue& queue = queuesIter->second[queueNdx];
VkQueue queueHandle = 0;
- deviceInterface.getDeviceQueue(*m_logicalDevice, queue.queueFamilyIndex, queue.queueIndex, &queueHandle);
+ m_deviceDriver->getDeviceQueue(*m_logicalDevice, queue.queueFamilyIndex, queue.queueIndex, &queueHandle);
queue.queueHandle = queueHandle;
}
#include "vkDefs.hpp"
#include "vktTestCase.hpp"
#include "vkRef.hpp"
+#include "vkPlatform.hpp"
#include "deUniquePtr.hpp"
#include <map>
void createDeviceSupportingQueues (const QueueRequirementsVec& queueRequirements);
const Queue& getQueue (const vk::VkQueueFlags queueFlags, const deUint32 queueIndex) const;
+ const vk::DeviceInterface& getDeviceInterface (void) const { return *m_deviceDriver; }
vk::VkDevice getDevice (void) const { return *m_logicalDevice; }
vk::Allocator& getAllocator (void) { return *m_allocator; }
private:
std::map<vk::VkQueueFlags, std::vector<Queue> > m_queues;
+ de::MovePtr<vk::DeviceDriver> m_deviceDriver;
vk::Move<vk::VkDevice> m_logicalDevice;
de::MovePtr<vk::Allocator> m_allocator;
};
tcu::TestStatus BufferSparseMemoryAliasingInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
if (!getPhysicalDeviceFeatures(instance, physicalDevice).sparseBinding)
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
VkBufferCreateInfo bufferCreateInfo =
{
tcu::TestStatus BufferSparseBindingInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
if (!getPhysicalDeviceFeatures(instance, physicalDevice).sparseBinding)
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
VkBufferCreateInfo bufferCreateInfo;
tcu::TestStatus BufferSparseResidencyInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
const VkPhysicalDeviceProperties physicalDeviceProperties = getPhysicalDeviceProperties(instance, physicalDevice);
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
VkBufferCreateInfo bufferCreateInfo =
{
, m_colorFormat (VK_FORMAT_R8G8B8A8_UNORM)
, m_colorBufferSize (m_renderSize.x() * m_renderSize.y() * tcu::getPixelSize(mapVkFormat(m_colorFormat)))
{
- const DeviceInterface& vk = m_context.getDeviceInterface();
const VkPhysicalDeviceFeatures features = getPhysicalDeviceFeatures(m_context.getInstanceInterface(), m_context.getPhysicalDevice());
if (!features.sparseBinding)
createDeviceSupportingQueues(requirements);
}
+ const DeviceInterface& vk = getDeviceInterface();
m_sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0u);
m_universalQueue = getQueue(VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, 0u);
Renderer::SpecializationMap specMap = Renderer::SpecializationMap())
{
const UniquePtr<Renderer> renderer(new Renderer(
- m_context.getDeviceInterface(), getDevice(), getAllocator(), m_universalQueue.queueFamilyIndex, descriptorSetLayout,
+ getDeviceInterface(), getDevice(), getAllocator(), m_universalQueue.queueFamilyIndex, descriptorSetLayout,
m_context.getBinaryCollection(), "vert", "frag", *m_colorBuffer, m_renderSize, m_colorFormat, Vec4(1.0f, 0.0f, 0.0f, 1.0f), topology, specMap));
- renderer->draw(m_context.getDeviceInterface(), getDevice(), m_universalQueue.queueHandle, *this);
+ renderer->draw(getDeviceInterface(), getDevice(), m_universalQueue.queueHandle, *this);
}
tcu::TestStatus verifyDrawResult (void) const
{
- invalidateMappedMemoryRange(m_context.getDeviceInterface(), getDevice(), m_colorBufferAlloc->getMemory(), 0ull, m_colorBufferSize);
+ invalidateMappedMemoryRange(getDeviceInterface(), getDevice(), m_colorBufferAlloc->getMemory(), 0ull, m_colorBufferSize);
const tcu::ConstPixelBufferAccess resultImage (mapVkFormat(m_colorFormat), m_renderSize.x(), m_renderSize.y(), 1u, m_colorBufferAlloc->getHostPtr());
void rendererDraw (const VkPipelineLayout pipelineLayout, const VkCommandBuffer cmdBuffer) const
{
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
const VkDeviceSize vertexOffset = 0ull;
vk.cmdBindVertexBuffers (cmdBuffer, 0u, 1u, &m_vertexBuffer.get(), &vertexOffset);
tcu::TestStatus iterate (void)
{
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
MovePtr<SparseAllocation> sparseAllocation;
Move<VkBuffer> sparseBuffer;
Move<VkBuffer> sparseBufferAliased;
DrawGridTestInstance (Context& context, const TestFlags flags, const VkBufferUsageFlags usage, const VkDeviceSize minChunkSize)
: SparseBufferTestInstance (context, flags)
{
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
VkBufferCreateInfo referenceBufferCreateInfo = getSparseBufferCreateInfo(usage);
{
{
initializeBuffers();
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
// Upload to the sparse buffer
{
m_context.getTestContext().getLog()
<< tcu::TestLog::Message << "Drawing a grid of triangles backed by a sparse vertex buffer. There should be no red pixels visible." << tcu::TestLog::EndMessage;
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
const deUint32 vertexCount = 6 * (GRID_SIZE * GRID_SIZE) / 2;
VkDeviceSize vertexOffset = 0ull;
m_context.getTestContext().getLog()
<< tcu::TestLog::Message << "Drawing a grid of triangles from a sparse index buffer. There should be no red pixels visible." << tcu::TestLog::EndMessage;
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
const VkDeviceSize vertexOffset = 0ull;
VkDeviceSize indexOffset = 0ull;
void initializeBuffers (void)
{
// Vertex buffer
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
const VkDeviceSize vertexBufferSize = 2 * m_halfVertexCount * sizeof(Vec4);
m_vertexBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(vertexBufferSize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT));
m_vertexBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_vertexBuffer, MemoryRequirement::HostVisible);
m_context.getTestContext().getLog()
<< tcu::TestLog::Message << "Drawing two triangles covering the whole viewport. There should be no red pixels visible." << tcu::TestLog::EndMessage;
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
const VkDeviceSize vertexOffset = 0ull;
VkDeviceSize indirectOffset = 0ull;
void initializeBuffers (void)
{
// Vertex buffer
- const DeviceInterface& vk = m_context.getDeviceInterface();
+ const DeviceInterface& vk = getDeviceInterface();
const VkDeviceSize vertexBufferSize = 2 * 3 * sizeof(Vec4);
m_vertexBuffer = makeBuffer(vk, getDevice(), makeBufferCreateInfo(vertexBufferSize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT));
m_vertexBufferAlloc = bindBuffer(vk, getDevice(), getAllocator(), *m_vertexBuffer, MemoryRequirement::HostVisible);
tcu::TestStatus ImageSparseMemoryAliasingInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
const tcu::UVec3 maxWorkGroupSize = tcu::UVec3(128u, 128u, 64u);
const tcu::UVec3 maxWorkGroupCount = tcu::UVec3(65535u, 65535u, 65535u);
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
// Create sparse image
const Unique<VkImage> imageRead(createImage(deviceInterface, getDevice(), &imageSparseInfo));
tcu::TestStatus ImageSparseBindingInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
VkImageCreateInfo imageSparseInfo;
std::vector<DeviceMemorySp> deviceMemUniquePtrVec;
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
imageSparseInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; //VkStructureType sType;
imageSparseInfo.pNext = DE_NULL; //const void* pNext;
tcu::TestStatus ImageSparseResidencyInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
const VkPhysicalDeviceProperties physicalDeviceProperties = getPhysicalDeviceProperties(instance, physicalDevice);
VkImageCreateInfo imageCreateInfo;
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
// Create sparse image
const Unique<VkImage> sparseImage(createImage(deviceInterface, getDevice(), &imageCreateInfo));
tcu::TestStatus MipmapSparseResidencyInstance::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
VkImageCreateInfo imageSparseInfo;
std::vector<DeviceMemorySp> deviceMemUniquePtrVec;
createDeviceSupportingQueues(queueRequirements);
}
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0);
// Create sparse image
const Unique<VkImage> imageSparse(createImage(deviceInterface, getDevice(), &imageSparseInfo));
tcu::TestStatus iterate (void)
{
- const DeviceInterface& vk = m_context.getDeviceInterface();
const InstanceInterface& vki = m_context.getInstanceInterface();
const VkPhysicalDevice physDevice = m_context.getPhysicalDevice();
const Queue* sparseQueue = DE_NULL;
}
}
+ const DeviceInterface& vk = getDeviceInterface();
+
std::vector<SemaphoreSp> allSemaphores;
std::vector<VkSemaphore> waitSemaphores;
std::vector<VkSemaphore> signalSemaphores;
tcu::TestStatus SparseShaderIntrinsicsInstanceBase::iterate (void)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
VkImageCreateInfo imageSparseInfo;
VkImageCreateInfo imageTexelsInfo;
createDeviceSupportingQueues(queueRequirements);
}
+ const DeviceInterface& deviceInterface = getDeviceInterface();
+
// Create queues supporting sparse binding operations and compute/graphics operations
- const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
- const Queue& extractQueue = getQueue(getQueueFlags(), 0);
+ const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0);
+ const Queue& extractQueue = getQueue(getQueueFlags(), 0);
// Create sparse image
const Unique<VkImage> imageSparse(createImage(deviceInterface, getDevice(), &imageSparseInfo));
const VkImage imageResidency)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
+ const DeviceInterface& deviceInterface = getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
const VkPhysicalDeviceProperties deviceProperties = getPhysicalDeviceProperties(instance, physicalDevice);
const VkImage imageResidency)
{
const InstanceInterface& instance = m_context.getInstanceInterface();
- const DeviceInterface& deviceInterface = m_context.getDeviceInterface();
+ const DeviceInterface& deviceInterface = getDeviceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
// Check if device supports image format for storage image