#version 430
-
+
layout(location = 0) in vec4 in_position;
layout(location = 1) in vec4 in_color;
#version 430
-
+
layout(location = 0) in vec4 in_position;
layout(location = 1) in vec4 in_color;
void main() {
vec2 perVertex = vec2(in_position.x, in_position.y);
vec2 perInstance[6] = vec2[6](vec2(0.7, -0.7), vec2(-0.75, 0.8), vec2(0.0, 0.0), vec2(0.3, 0.0), vec2(0.0, -0.3),vec2(0.3, -0.3) );
-
+
gl_Position = vec4(perVertex + perInstance[gl_InstanceID], 0.0, 1.0);
out_color = in_color;
}
\ No newline at end of file
vktDrawSimpleTest.hpp
vktDrawSimpleTest.cpp
vktDrawBaseClass.hpp
- vktDrawBaseClass.cpp
+ vktDrawBaseClass.cpp
vktDrawCreateInfoUtil.hpp
vktDrawCreateInfoUtil.cpp
vktDrawImageObjectUtil.hpp
vktDrawBufferObjectUtil.hpp
vktDrawBufferObjectUtil.cpp
vktDrawTestCaseUtil.hpp
-
)
set(DEQP_VK_DRAW_LIBS
* \brief Command draw Tests - Base Class
*//*--------------------------------------------------------------------*/
-
#include "vktDrawBaseClass.hpp"
namespace vkt
namespace Draw
{
-DrawTestsBaseClass::DrawTestsBaseClass (Context &context, const char* vertexShaderName, const char* fragmentShaderName)
+DrawTestsBaseClass::DrawTestsBaseClass (Context& context, const char* vertexShaderName, const char* fragmentShaderName)
: TestInstance (context)
, m_colorAttachmentFormat (vk::VK_FORMAT_R8G8B8A8_UNORM)
, m_topology (vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP)
{
}
-
-
void DrawTestsBaseClass::initialize (void)
{
tcu::TestLog &log = m_context.getTestContext().getLog();
vk::VK_ATTACHMENT_STORE_OP_STORE,
vk::VK_IMAGE_LAYOUT_GENERAL,
vk::VK_IMAGE_LAYOUT_GENERAL));
-
+
const vk::VkAttachmentReference colorAttachmentReference =
{
2,
vertexInputAttributeDescriptions);
- const vk::VkDeviceSize dataSize = m_data.size() * sizeof(Vec4RGBA);
+ const vk::VkDeviceSize dataSize = m_data.size() * sizeof(PositionColorVertex);
m_vertexBuffer = Buffer::createAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
vk::VK_BUFFER_USAGE_VERTEX_BUFFER_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_vertexBuffer->getBoundMemory().getHostPtr());
+ deUint8* ptr = reinterpret_cast<deUint8*>(m_vertexBuffer->getBoundMemory().getHostPtr());
deMemcpy(ptr, &m_data[0], dataSize);
- vk::flushMappedMemoryRange(m_vk,
+ vk::flushMappedMemoryRange(m_vk,
device,
m_vertexBuffer->getBoundMemory().getMemory(),
m_vertexBuffer->getBoundMemory().getOffset(),
pipelineCreateInfo.addState(PipelineCreateInfo::DepthStencilState());
pipelineCreateInfo.addState(PipelineCreateInfo::RasterizerState());
pipelineCreateInfo.addState(PipelineCreateInfo::MultiSampleState());
-
+
m_pipeline = vk::createGraphicsPipeline(m_vk, device, DE_NULL, &pipelineCreateInfo);
}
{
const vk::VkClearColorValue clearColor = { { 0.0f, 0.0f, 0.0f, 1.0f } };
const CmdBufferBeginInfo beginInfo;
-
+
m_vk.beginCommandBuffer(*m_cmdBuffer, &beginInfo);
initialTransitionColor2DImage(m_vk, *m_cmdBuffer, m_colorTargetImage->object(), vk::VK_IMAGE_LAYOUT_GENERAL);
-
+
const ImageSubresourceRange subresourceRange(vk::VK_IMAGE_ASPECT_COLOR_BIT);
m_vk.cmdClearColorImage(*m_cmdBuffer, m_colorTargetImage->object(),
vk::VK_IMAGE_LAYOUT_GENERAL, &clearColor, 1, &subresourceRange);
const RenderPassBeginInfo renderPassBegin(*m_renderPass, *m_framebuffer, renderArea);
m_vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBegin, vk::VK_SUBPASS_CONTENTS_INLINE);
-
}
-} //Draw
-} //vkt
+} // Draw
+} // vkt
* \brief Command draw Tests - Base Class
*//*--------------------------------------------------------------------*/
+#include "vkDefs.hpp"
#include "vktTestCase.hpp"
#include "tcuTestLog.hpp"
namespace Draw
{
-inline tcu::Vec4 vec4Red(void)
+struct PositionColorVertex
{
- return tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f);
-}
+ PositionColorVertex(tcu::Vec4 position_, tcu::Vec4 color_)
+ : position(position_)
+ , color(color_)
+ {}
+ tcu::Vec4 position;
+ tcu::Vec4 color;
+};
-inline tcu::Vec4 vec4Green(void)
+struct ReferenceImageCoordinates
{
- return tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f);
-}
+ ReferenceImageCoordinates (void)
+ : left (-0.3)
+ , right (0.3)
+ , top (0.3)
+ , bottom (-0.3)
+ {
+ }
-inline tcu::Vec4 vec4Blue(void)
-{
- return tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f);
-}
+ double left;
+ double right;
+ double top;
+ double bottom;
+};
-struct Vec4RGBA
+struct ReferenceImageInstancedCoordinates
{
- Vec4RGBA(tcu::Vec4 p, tcu::Vec4 c)
- : position (p)
- , color (c)
- {}
- tcu::Vec4 position;
- tcu::Vec4 color;
+ ReferenceImageInstancedCoordinates (void)
+ : left (-0.3)
+ , right (0.6)
+ , top (0.3)
+ , bottom (-0.6)
+ {
+ }
+
+ double left;
+ double right;
+ double top;
+ double bottom;
};
class DrawTestsBaseClass : public TestInstance
{
public:
- DrawTestsBaseClass (Context &context, const char* vertexShaderName, const char* fragmentShaderName);
+ DrawTestsBaseClass (Context& context, const char* vertexShaderName, const char* fragmentShaderName);
protected:
void initialize (void);
vk::Move<vk::VkPipeline> m_pipeline;
vk::Move<vk::VkPipelineLayout> m_pipelineLayout;
-
+
de::SharedPtr<Image> m_colorTargetImage;
vk::Move<vk::VkImageView> m_colorTargetView;
const std::string m_vertexShaderName;
const std::string m_fragmentShaderName;
- std::vector<Vec4RGBA> m_data;
+ std::vector<PositionColorVertex> m_data;
std::vector<deUint32> m_indexes;
de::SharedPtr<Buffer> m_indexBuffer;
};
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif //_VKTDRAWBASECLASS_HPP
+#endif // _VKTDRAWBASECLASS_HPP
namespace Draw
{
-Buffer::Buffer (const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object)
+Buffer::Buffer (const vk::DeviceInterface& vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object)
: m_object (object)
, m_allocation (DE_NULL)
, m_vk (vk)
m_allocation = allocation;
}
-de::SharedPtr<Buffer> Buffer::createAndAlloc (const vk::DeviceInterface &vk,
+de::SharedPtr<Buffer> Buffer::createAndAlloc (const vk::DeviceInterface& vk,
vk::VkDevice device,
const vk::VkBufferCreateInfo &createInfo,
vk::Allocator &allocator,
return ret;
}
-de::SharedPtr<Buffer> Buffer::create (const vk::DeviceInterface &vk,
+de::SharedPtr<Buffer> Buffer::create (const vk::DeviceInterface& vk,
vk::VkDevice device,
- const vk::VkBufferCreateInfo &createInfo)
+ const vk::VkBufferCreateInfo& createInfo)
{
return de::SharedPtr<Buffer>(new Buffer(vk, device, vk::createBuffer(vk, device, &createInfo)));
}
-} //Draw
-} //vkt
+} // Draw
+} // vkt
* \brief Buffer Object Util
*//*--------------------------------------------------------------------*/
-#include "vkDefs.hpp"
#include "vkMemUtil.hpp"
#include "vkRefUtil.hpp"
Buffer (const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object);
-
void bindMemory (de::MovePtr<vk::Allocation> allocation);
-
vk::VkBuffer object (void) const { return *m_object; }
vk::Allocation getBoundMemory (void) const { return *m_allocation; }
private:
Buffer (const Buffer& other); // Not allowed!
- Buffer &operator= (const Buffer& other); // Not allowed!
-
+ Buffer& operator= (const Buffer& other); // Not allowed!
de::MovePtr<vk::Allocation> m_allocation;
vk::Unique<vk::VkBuffer> m_object;
- const vk::DeviceInterface & m_vk;
- vk::VkDevice m_device;
+ const vk::DeviceInterface& m_vk;
+ vk::VkDevice m_device;
};
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif // _VKT_DRAWBUFFEROBJECTUTIL_HPP
+#endif // _VKTDRAWBUFFEROBJECTUTIL_HPP
range = _range;
}
-
BufferCreateInfo::BufferCreateInfo (vk::VkDeviceSize _size,
vk::VkBufferUsageFlags _usage,
vk::VkSharingMode _sharingMode,
deUint32 _queueFamilyIndexCount,
const deUint32* _pQueueFamilyIndices,
vk::VkBufferCreateFlags _flags)
-{
+{
sType = vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
pNext = DE_NULL;
size = _size;
else
{
pQueueFamilyIndices = _pQueueFamilyIndices;
- }
+ }
}
BufferCreateInfo::BufferCreateInfo (const BufferCreateInfo &other)
vk::VkImageUsageFlags _usage,
vk::VkSharingMode _sharingMode,
deUint32 _queueFamilyIndexCount,
- const deUint32* _pQueueFamilyIndices,
+ const deUint32* _pQueueFamilyIndices,
vk::VkImageCreateFlags _flags,
vk::VkImageLayout _initialLayout)
{
}
FramebufferCreateInfo::FramebufferCreateInfo (vk::VkRenderPass _renderPass,
- const std::vector<vk::VkImageView>& atachments,
+ const std::vector<vk::VkImageView>& atachments,
deUint32 _width,
deUint32 _height,
deUint32 _layers)
{
sType = vk::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
pNext = DE_NULL;
- flags = 0;
+ flags = 0;
attachmentCount = static_cast<deUint32>(m_attachments.size());
pAttachments = &m_attachmentsStructs[0];
RenderPassBeginInfo::RenderPassBeginInfo (vk::VkRenderPass _renderPass,
vk::VkFramebuffer _framebuffer,
vk::VkRect2D _renderArea,
- const std::vector<vk::VkClearValue>& _clearValues)
+ const std::vector<vk::VkClearValue>& _clearValues)
{
m_clearValues = _clearValues;
finalLayout = _finalLayout;
}
-AttachmentDescription::AttachmentDescription (const vk::VkAttachmentDescription &rhs)
+AttachmentDescription::AttachmentDescription (const vk::VkAttachmentDescription& rhs)
{
flags = rhs.flags;
format = rhs.format;
dependencyFlags = _dependencyFlags;
}
-SubpassDependency::SubpassDependency (const vk::VkSubpassDependency &rhs)
+SubpassDependency::SubpassDependency (const vk::VkSubpassDependency& rhs)
{
srcSubpass = rhs.srcSubpass;
dstSubpass = rhs.dstSubpass;
pBinding = _pBindings;
}
-
PipelineLayoutCreateInfo::PipelineLayoutCreateInfo (deUint32 _descriptorSetCount,
const vk::VkDescriptorSetLayout* _pSetLayouts,
deUint32 _pushConstantRangeCount,
}
}
-
PipelineCreateInfo::PipelineShaderStage::PipelineShaderStage (vk::VkShaderModule _module, const char* _pName, vk::VkShaderStageFlagBits _stage)
{
sType = vk::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
flags = 0u;
viewportCount = _viewportCount;
scissorCount = _viewportCount;
-
+
if (!_viewports.size())
{
m_viewports.resize(viewportCount);
pScissors = &m_scissors[0];
}
-PipelineCreateInfo::ViewportState::ViewportState (const ViewportState &other)
+PipelineCreateInfo::ViewportState::ViewportState (const ViewportState& other)
{
sType = other.sType;
pNext = other.pNext;
pScissors = &m_scissors[0];
}
-PipelineCreateInfo::ViewportState & PipelineCreateInfo::ViewportState::operator= (const ViewportState &other)
+PipelineCreateInfo::ViewportState& PipelineCreateInfo::ViewportState::operator= (const ViewportState& other)
{
sType = other.sType;
pNext = other.pNext;
vk::VkBool32 _sampleShadingEnable,
float _minSampleShading,
const std::vector<vk::VkSampleMask>& _sampleMask,
- bool _alphaToCoverageEnable,
+ bool _alphaToCoverageEnable,
bool _alphaToOneEnable)
: m_sampleMask(_sampleMask)
{
alphaToOneEnable = _alphaToOneEnable;
}
-PipelineCreateInfo::MultiSampleState::MultiSampleState (const MultiSampleState &other)
+PipelineCreateInfo::MultiSampleState::MultiSampleState (const MultiSampleState& other)
{
sType = other.sType;
pNext = other.pNext;
rasterizationSamples = other.rasterizationSamples;
sampleShadingEnable = other.sampleShadingEnable;
minSampleShading = other.minSampleShading;
-
+
const size_t sampleMaskArrayLen = (sizeof(vk::VkSampleMask) * 8 + other.rasterizationSamples) / (sizeof(vk::VkSampleMask) * 8);
m_sampleMask = std::vector<vk::VkSampleMask>(other.pSampleMask, other.pSampleMask + sampleMaskArrayLen);
pSampleMask = &m_sampleMask[0];
}
-PipelineCreateInfo::MultiSampleState& PipelineCreateInfo::MultiSampleState::operator= (const MultiSampleState & other)
+PipelineCreateInfo::MultiSampleState& PipelineCreateInfo::MultiSampleState::operator= (const MultiSampleState& other)
{
sType = other.sType;
pNext = other.pNext;
: m_attachments(_attachments)
{
sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- pNext = DE_NULL;
+ pNext = DE_NULL;
flags = 0u;
logicOpEnable = _logicOpEnable;
logicOp = _logicOp;
}
PipelineCreateInfo::ColorBlendState::ColorBlendState (deUint32 _attachmentCount,
- const vk::VkPipelineColorBlendAttachmentState* _attachments,
+ const vk::VkPipelineColorBlendAttachmentState* _attachments,
vk::VkBool32 _logicOpEnable,
vk::VkLogicOp _logicOp)
: m_attachments(_attachments, _attachments + _attachmentCount)
{
sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- pNext = DE_NULL;
+ pNext = DE_NULL;
logicOpEnable = _logicOpEnable;
logicOp = _logicOp;
attachmentCount = static_cast<deUint32>(m_attachments.size());
pAttachments = &m_attachments[0];
}
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo &createInfo)
+PipelineCreateInfo::ColorBlendState::ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo)
: m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
{
sType = createInfo.sType;
pAttachments = &m_attachments[0];
}
-PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState &createInfo, std::vector<float> _blendConstants)
+PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState& createInfo, std::vector<float> _blendConstants)
: m_attachments (createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount)
{
sType = createInfo.sType;
pDynamicStates = &m_dynamicStates[0];
}
-PipelineCreateInfo::DynamicState & PipelineCreateInfo::DynamicState::operator= (const DynamicState &other)
+PipelineCreateInfo::DynamicState& PipelineCreateInfo::DynamicState::operator= (const DynamicState& other)
{
sType = other.sType;
pNext = other.pNext;
pDynamicState = DE_NULL;
}
-PipelineCreateInfo& PipelineCreateInfo::addShader (const vk::VkPipelineShaderStageCreateInfo &shader)
+PipelineCreateInfo& PipelineCreateInfo::addShader (const vk::VkPipelineShaderStageCreateInfo& shader)
{
m_shaders.push_back(shader);
}
SamplerCreateInfo::SamplerCreateInfo (vk::VkFilter _magFilter,
- vk::VkFilter _minFilter,
- vk::VkSamplerMipmapMode _mipmapMode,
- vk::VkSamplerAddressMode _addressModeU,
- vk::VkSamplerAddressMode _addressModeV,
- vk::VkSamplerAddressMode _addressModeW,
- float _mipLodBias,
- float _maxAnisotropy,
- vk::VkBool32 _compareEnable,
- vk::VkCompareOp _compareOp,
- float _minLod,
- float _maxLod,
- vk::VkBorderColor _borderColor,
- vk::VkBool32 _unnormalizedCoordinates)
+ vk::VkFilter _minFilter,
+ vk::VkSamplerMipmapMode _mipmapMode,
+ vk::VkSamplerAddressMode _addressModeU,
+ vk::VkSamplerAddressMode _addressModeV,
+ vk::VkSamplerAddressMode _addressModeW,
+ float _mipLodBias,
+ float _maxAnisotropy,
+ vk::VkBool32 _compareEnable,
+ vk::VkCompareOp _compareOp,
+ float _minLod,
+ float _maxLod,
+ vk::VkBorderColor _borderColor,
+ vk::VkBool32 _unnormalizedCoordinates)
{
sType = vk::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
pNext = DE_NULL;
borderColor = _borderColor;
unnormalizedCoordinates = _unnormalizedCoordinates;
}
-
} // Draw
} // vkt
-#ifndef _VKTDRAWCREATEINFO_UTIL_HPP
-#define _VKTDRAWCREATEINFO_UTIL_HPP
+#ifndef _VKTDRAWCREATEINFOUTIL_HPP
+#define _VKTDRAWCREATEINFOUTIL_HPP
/*------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
#include "vkDefs.hpp"
#include "tcuVector.hpp"
-
#include "deSharedPtr.hpp"
-
#include <vector>
namespace vkt
class ImageSubresourceRange : public vk::VkImageSubresourceRange
{
public:
- ImageSubresourceRange ( vk::VkImageAspectFlags aspectMask,
- deUint32 baseMipLevel = 0,
- deUint32 levelCount = 1,
- deUint32 baseArrayLayer = 0,
- deUint32 layerCount = 1);
+ ImageSubresourceRange (vk::VkImageAspectFlags aspectMask,
+ deUint32 baseMipLevel = 0,
+ deUint32 levelCount = 1,
+ deUint32 baseArrayLayer = 0,
+ deUint32 layerCount = 1);
};
class ComponentMapping : public vk::VkComponentMapping
{
public:
- ComponentMapping ( vk::VkComponentSwizzle r = vk::VK_COMPONENT_SWIZZLE_R,
- vk::VkComponentSwizzle g = vk::VK_COMPONENT_SWIZZLE_G,
- vk::VkComponentSwizzle b = vk::VK_COMPONENT_SWIZZLE_B,
- vk::VkComponentSwizzle a = vk::VK_COMPONENT_SWIZZLE_A);
+ ComponentMapping (vk::VkComponentSwizzle r = vk::VK_COMPONENT_SWIZZLE_R,
+ vk::VkComponentSwizzle g = vk::VK_COMPONENT_SWIZZLE_G,
+ vk::VkComponentSwizzle b = vk::VK_COMPONENT_SWIZZLE_B,
+ vk::VkComponentSwizzle a = vk::VK_COMPONENT_SWIZZLE_A);
};
class ImageViewCreateInfo : public vk::VkImageViewCreateInfo
{
public:
- ImageViewCreateInfo ( vk::VkImage image,
- vk::VkImageViewType viewType,
- vk::VkFormat format,
- const vk::VkImageSubresourceRange& subresourceRange,
- const vk::VkComponentMapping& components = ComponentMapping(),
- vk::VkImageViewCreateFlags flags = 0);
-
- ImageViewCreateInfo ( vk::VkImage image,
- vk::VkImageViewType viewType,
- vk::VkFormat format,
- const vk::VkComponentMapping& components = ComponentMapping(),
- vk::VkImageViewCreateFlags flags = 0);
+ ImageViewCreateInfo (vk::VkImage image,
+ vk::VkImageViewType viewType,
+ vk::VkFormat format,
+ const vk::VkImageSubresourceRange& subresourceRange,
+ const vk::VkComponentMapping& components = ComponentMapping(),
+ vk::VkImageViewCreateFlags flags = 0);
+
+ ImageViewCreateInfo (vk::VkImage image,
+ vk::VkImageViewType viewType,
+ vk::VkFormat format,
+ const vk::VkComponentMapping& components = ComponentMapping(),
+ vk::VkImageViewCreateFlags flags = 0);
};
class BufferViewCreateInfo : public vk::VkBufferViewCreateInfo
{
public:
- BufferViewCreateInfo ( vk::VkBuffer buffer,
- vk::VkFormat format,
- vk::VkDeviceSize offset,
- vk::VkDeviceSize range);
+ BufferViewCreateInfo (vk::VkBuffer buffer,
+ vk::VkFormat format,
+ vk::VkDeviceSize offset,
+ vk::VkDeviceSize range);
};
class BufferCreateInfo : public vk::VkBufferCreateInfo
{
public:
- BufferCreateInfo ( vk::VkDeviceSize size,
- vk::VkBufferCreateFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyIndexCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkBufferCreateFlags flags = 0);
+ BufferCreateInfo (vk::VkDeviceSize size,
+ vk::VkBufferCreateFlags usage,
+ vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
+ deUint32 queueFamilyIndexCount = 0,
+ const deUint32* pQueueFamilyIndices = DE_NULL,
+ vk::VkBufferCreateFlags flags = 0);
- BufferCreateInfo (const BufferCreateInfo &other);
- BufferCreateInfo &operator= (const BufferCreateInfo &other);
+ BufferCreateInfo (const BufferCreateInfo& other);
+ BufferCreateInfo& operator= (const BufferCreateInfo& other);
private:
std::vector<deUint32> m_queueFamilyIndices;
};
-
class ImageCreateInfo : public vk::VkImageCreateInfo
{
public:
- ImageCreateInfo ( vk::VkImageType imageType,
- vk::VkFormat format,
- vk::VkExtent3D extent,
- deUint32 mipLevels,
- deUint32 arrayLayers,
- vk::VkSampleCountFlagBits samples,
- vk::VkImageTiling tiling,
- vk::VkImageUsageFlags usage,
- vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
- deUint32 queueFamilyIndexCount = 0,
- const deUint32* pQueueFamilyIndices = DE_NULL,
- vk::VkImageCreateFlags flags = 0,
- vk::VkImageLayout initialLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED);
+ ImageCreateInfo (vk::VkImageType imageType,
+ vk::VkFormat format,
+ vk::VkExtent3D extent,
+ deUint32 mipLevels,
+ deUint32 arrayLayers,
+ vk::VkSampleCountFlagBits samples,
+ vk::VkImageTiling tiling,
+ vk::VkImageUsageFlags usage,
+ vk::VkSharingMode sharingMode = vk::VK_SHARING_MODE_EXCLUSIVE,
+ deUint32 queueFamilyIndexCount = 0,
+ const deUint32* pQueueFamilyIndices = DE_NULL,
+ vk::VkImageCreateFlags flags = 0,
+ vk::VkImageLayout initialLayout = vk::VK_IMAGE_LAYOUT_UNDEFINED);
private:
- ImageCreateInfo (const ImageCreateInfo &other);
- ImageCreateInfo &operator= (const ImageCreateInfo &other);
+ ImageCreateInfo (const ImageCreateInfo& other);
+ ImageCreateInfo& operator= (const ImageCreateInfo& other);
std::vector<deUint32> m_queueFamilyIndices;
};
class FramebufferCreateInfo : public vk::VkFramebufferCreateInfo
{
public:
- FramebufferCreateInfo ( vk::VkRenderPass renderPass,
- const std::vector<vk::VkImageView>& attachments,
- deUint32 width,
- deUint32 height,
- deUint32 layers);
+ FramebufferCreateInfo (vk::VkRenderPass renderPass,
+ const std::vector<vk::VkImageView>& attachments,
+ deUint32 width,
+ deUint32 height,
+ deUint32 layers);
};
class AttachmentDescription : public vk::VkAttachmentDescription
{
public:
- AttachmentDescription ( vk::VkFormat format,
- vk::VkSampleCountFlagBits samples,
- vk::VkAttachmentLoadOp loadOp,
- vk::VkAttachmentStoreOp storeOp,
- vk::VkAttachmentLoadOp stencilLoadOp,
- vk::VkAttachmentStoreOp stencilStoreOp,
- vk::VkImageLayout initialLayout,
- vk::VkImageLayout finalLayout);
-
- AttachmentDescription (const vk::VkAttachmentDescription &);
+ AttachmentDescription (vk::VkFormat format,
+ vk::VkSampleCountFlagBits samples,
+ vk::VkAttachmentLoadOp loadOp,
+ vk::VkAttachmentStoreOp storeOp,
+ vk::VkAttachmentLoadOp stencilLoadOp,
+ vk::VkAttachmentStoreOp stencilStoreOp,
+ vk::VkImageLayout initialLayout,
+ vk::VkImageLayout finalLayout);
+
+ AttachmentDescription (const vk::VkAttachmentDescription &);
};
class AttachmentReference : public vk::VkAttachmentReference
{
public:
- AttachmentReference (deUint32 attachment, vk::VkImageLayout layout);
- AttachmentReference (void);
+ AttachmentReference (deUint32 attachment, vk::VkImageLayout layout);
+ AttachmentReference (void);
};
class SubpassDescription : public vk::VkSubpassDescription
{
public:
- SubpassDescription ( vk::VkPipelineBindPoint pipelineBindPoint,
- vk::VkSubpassDescriptionFlags flags,
- deUint32 inputAttachmentCount,
- const vk::VkAttachmentReference* inputAttachments,
- deUint32 colorAttachmentCount,
- const vk::VkAttachmentReference* colorAttachments,
- const vk::VkAttachmentReference* resolveAttachments,
- vk::VkAttachmentReference depthStencilAttachment,
- deUint32 preserveAttachmentCount,
- const vk::VkAttachmentReference* preserveAttachments);
-
- SubpassDescription (const vk::VkSubpassDescription& other);
- SubpassDescription (const SubpassDescription& other);
- SubpassDescription& operator= (const SubpassDescription& other);
+ SubpassDescription (vk::VkPipelineBindPoint pipelineBindPoint,
+ vk::VkSubpassDescriptionFlags flags,
+ deUint32 inputAttachmentCount,
+ const vk::VkAttachmentReference* inputAttachments,
+ deUint32 colorAttachmentCount,
+ const vk::VkAttachmentReference* colorAttachments,
+ const vk::VkAttachmentReference* resolveAttachments,
+ vk::VkAttachmentReference depthStencilAttachment,
+ deUint32 preserveAttachmentCount,
+ const vk::VkAttachmentReference* preserveAttachments);
+
+ SubpassDescription (const vk::VkSubpassDescription& other);
+ SubpassDescription (const SubpassDescription& other);
+ SubpassDescription& operator= (const SubpassDescription& other);
private:
- std::vector<vk::VkAttachmentReference> m_inputAttachments;
- std::vector<vk::VkAttachmentReference> m_colorAttachments;
- std::vector<vk::VkAttachmentReference> m_resolveAttachments;
- std::vector<vk::VkAttachmentReference> m_preserveAttachments;
+ std::vector<vk::VkAttachmentReference> m_inputAttachments;
+ std::vector<vk::VkAttachmentReference> m_colorAttachments;
+ std::vector<vk::VkAttachmentReference> m_resolveAttachments;
+ std::vector<vk::VkAttachmentReference> m_preserveAttachments;
vk::VkAttachmentReference m_depthStencilAttachment;
};
class RenderPassCreateInfo : public vk::VkRenderPassCreateInfo
{
public:
- RenderPassCreateInfo ( const std::vector<vk::VkAttachmentDescription>& attachments,
- const std::vector<vk::VkSubpassDescription>& subpasses,
- const std::vector<vk::VkSubpassDependency>& dependiences = std::vector<vk::VkSubpassDependency>());
+ RenderPassCreateInfo (const std::vector<vk::VkAttachmentDescription>& attachments,
+ const std::vector<vk::VkSubpassDescription>& subpasses,
+ const std::vector<vk::VkSubpassDependency>& dependiences = std::vector<vk::VkSubpassDependency>());
- RenderPassCreateInfo ( deUint32 attachmentCount = 0,
- const vk::VkAttachmentDescription* pAttachments = DE_NULL,
- deUint32 subpassCount = 0,
- const vk::VkSubpassDescription* pSubpasses = DE_NULL,
- deUint32 dependencyCount = 0,
- const vk::VkSubpassDependency* pDependiences = DE_NULL);
+ RenderPassCreateInfo (deUint32 attachmentCount = 0,
+ const vk::VkAttachmentDescription* pAttachments = DE_NULL,
+ deUint32 subpassCount = 0,
+ const vk::VkSubpassDescription* pSubpasses = DE_NULL,
+ deUint32 dependencyCount = 0,
+ const vk::VkSubpassDependency* pDependiences = DE_NULL);
- void addAttachment (vk::VkAttachmentDescription attachment);
- void addSubpass (vk::VkSubpassDescription subpass);
- void addDependency (vk::VkSubpassDependency dependency);
+ void addAttachment (vk::VkAttachmentDescription attachment);
+ void addSubpass (vk::VkSubpassDescription subpass);
+ void addDependency (vk::VkSubpassDependency dependency);
private:
std::vector<AttachmentDescription> m_attachments;
std::vector<vk::VkSubpassDependency> m_dependiencesStructs;
RenderPassCreateInfo (const RenderPassCreateInfo &other); //Not allowed!
- RenderPassCreateInfo &operator= (const RenderPassCreateInfo &other); //Not allowed!
+ RenderPassCreateInfo& operator= (const RenderPassCreateInfo &other); //Not allowed!
};
class RenderPassBeginInfo : public vk::VkRenderPassBeginInfo
{
public:
- RenderPassBeginInfo ( vk::VkRenderPass renderPass,
- vk::VkFramebuffer framebuffer,
- vk::VkRect2D renderArea,
- const std::vector<vk::VkClearValue>& clearValues = std::vector<vk::VkClearValue>());
+ RenderPassBeginInfo (vk::VkRenderPass renderPass,
+ vk::VkFramebuffer framebuffer,
+ vk::VkRect2D renderArea,
+ const std::vector<vk::VkClearValue>& clearValues = std::vector<vk::VkClearValue>());
private:
std::vector<vk::VkClearValue> m_clearValues;
- RenderPassBeginInfo (const RenderPassBeginInfo &other); //Not allowed!
- RenderPassBeginInfo &operator= (const RenderPassBeginInfo &other); //Not allowed!
+ RenderPassBeginInfo (const RenderPassBeginInfo& other); //Not allowed!
+ RenderPassBeginInfo& operator= (const RenderPassBeginInfo& other); //Not allowed!
};
class CmdPoolCreateInfo : public vk::VkCommandPoolCreateInfo
{
public:
- CmdPoolCreateInfo (deUint32 queueFamilyIndex,
- vk::VkCommandPoolCreateFlags flags = vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
+ CmdPoolCreateInfo (deUint32 queueFamilyIndex,
+ vk::VkCommandPoolCreateFlags flags = vk::VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
};
class CmdBufferBeginInfo : public vk::VkCommandBufferBeginInfo
{
public:
- CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags flags = 0);
+ CmdBufferBeginInfo (vk::VkCommandBufferUsageFlags flags = 0);
CmdBufferBeginInfo (vk::VkRenderPass renderPass,
deUint32 subpass,
vk::VkFramebuffer framebuffer,
- vk::VkCommandBufferUsageFlags flags = 0,
+ vk::VkCommandBufferUsageFlags flags = 0,
bool occlusionQueryEnable = false,
vk::VkQueryControlFlags queryFlags = 0u,
vk::VkQueryPipelineStatisticFlags pipelineStatistics = 0u);
};
-
class DescriptorPoolSize : public vk::VkDescriptorPoolSize
{
public:
class DescriptorPoolCreateInfo : public vk::VkDescriptorPoolCreateInfo
{
public:
- DescriptorPoolCreateInfo ( const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,\r
- vk::VkDescriptorPoolCreateFlags flags, \r
- deUint32 maxSets);
+ DescriptorPoolCreateInfo (const std::vector<vk::VkDescriptorPoolSize>& poolSizeCounts,
+ vk::VkDescriptorPoolCreateFlags flags,
+ deUint32 maxSets);
DescriptorPoolCreateInfo& addDescriptors (vk::VkDescriptorType type, deUint32 count);
std::vector<vk::VkDescriptorPoolSize> m_poolSizeCounts;
};
-
class DescriptorSetLayoutCreateInfo : public vk::VkDescriptorSetLayoutCreateInfo
{
public:
DescriptorSetLayoutCreateInfo (deUint32 bindingCount, const vk::VkDescriptorSetLayoutBinding* pBindings);
};
-
class PipelineLayoutCreateInfo : public vk::VkPipelineLayoutCreateInfo
{
public:
- PipelineLayoutCreateInfo ( deUint32 descriptorSetCount,
- const vk::VkDescriptorSetLayout* pSetLayouts,
- deUint32 pushConstantRangeCount = 0,
- const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
+ PipelineLayoutCreateInfo (deUint32 descriptorSetCount,
+ const vk::VkDescriptorSetLayout* pSetLayouts,
+ deUint32 pushConstantRangeCount = 0,
+ const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
- PipelineLayoutCreateInfo ( const std::vector<vk::VkDescriptorSetLayout>& setLayouts = std::vector<vk::VkDescriptorSetLayout>(),
- deUint32 pushConstantRangeCount = 0,
- const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
+ PipelineLayoutCreateInfo (const std::vector<vk::VkDescriptorSetLayout>& setLayouts = std::vector<vk::VkDescriptorSetLayout>(),
+ deUint32 pushConstantRangeCount = 0,
+ const vk::VkPushConstantRange* pPushConstantRanges = DE_NULL);
private:
std::vector<vk::VkDescriptorSetLayout> m_setLayouts;
class VertexInputState : public vk::VkPipelineVertexInputStateCreateInfo
{
public:
- VertexInputState ( deUint32 vertexBindingDescriptionCount = 0,
- const vk::VkVertexInputBindingDescription* pVertexBindingDescriptions = NULL,
- deUint32 vertexAttributeDescriptionCount = 0,
- const vk::VkVertexInputAttributeDescription* pVertexAttributeDescriptions = NULL);
+ VertexInputState (deUint32 vertexBindingDescriptionCount = 0,
+ const vk::VkVertexInputBindingDescription* pVertexBindingDescriptions = NULL,
+ deUint32 vertexAttributeDescriptionCount = 0,
+ const vk::VkVertexInputAttributeDescription* pVertexAttributeDescriptions = NULL);
};
class InputAssemblerState : public vk::VkPipelineInputAssemblyStateCreateInfo
class ViewportState : public vk::VkPipelineViewportStateCreateInfo
{
public:
- ViewportState ( deUint32 viewportCount,
- std::vector<vk::VkViewport> viewports = std::vector<vk::VkViewport>(0),
- std::vector<vk::VkRect2D> scissors = std::vector<vk::VkRect2D>(0));
+ ViewportState (deUint32 viewportCount,
+ std::vector<vk::VkViewport> viewports = std::vector<vk::VkViewport>(0),
+ std::vector<vk::VkRect2D> scissors = std::vector<vk::VkRect2D>(0));
- ViewportState (const ViewportState &other);
- ViewportState &operator= (const ViewportState &other);
+ ViewportState (const ViewportState& other);
+ ViewportState& operator= (const ViewportState& other);
std::vector<vk::VkViewport> m_viewports;
std::vector<vk::VkRect2D> m_scissors;
class RasterizerState : public vk::VkPipelineRasterizationStateCreateInfo
{
public:
- RasterizerState ( vk::VkBool32 depthClampEnable = false,
- vk::VkBool32 rasterizerDiscardEnable = false,
- vk::VkPolygonMode polygonMode = vk::VK_POLYGON_MODE_FILL,
- vk::VkCullModeFlags cullMode = vk::VK_CULL_MODE_NONE,
- vk::VkFrontFace frontFace = vk::VK_FRONT_FACE_CLOCKWISE,
- vk::VkBool32 depthBiasEnable = true,\r
- float depthBiasConstantFactor = 0.0f,
- float depthBiasClamp = 0.0f,
- float depthBiasSlopeFactor = 0.0f,
- float lineWidth = 1.0f);
+ RasterizerState (vk::VkBool32 depthClampEnable = false,
+ vk::VkBool32 rasterizerDiscardEnable = false,
+ vk::VkPolygonMode polygonMode = vk::VK_POLYGON_MODE_FILL,
+ vk::VkCullModeFlags cullMode = vk::VK_CULL_MODE_NONE,
+ vk::VkFrontFace frontFace = vk::VK_FRONT_FACE_CLOCKWISE,
+ vk::VkBool32 depthBiasEnable = true,
+ float depthBiasConstantFactor = 0.0f,
+ float depthBiasClamp = 0.0f,
+ float depthBiasSlopeFactor = 0.0f,
+ float lineWidth = 1.0f);
};
class MultiSampleState : public vk::VkPipelineMultisampleStateCreateInfo
{
public:
- MultiSampleState ( vk::VkSampleCountFlagBits rasterizationSamples = vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VkBool32 sampleShadingEnable = false,
- float minSampleShading = 0.0f,
- const std::vector<vk::VkSampleMask>& sampleMask = std::vector<vk::VkSampleMask>(1, 0xffffffff),
- bool alphaToCoverageEnable = false,
- bool alphaToOneEnable = false);
+ MultiSampleState (vk::VkSampleCountFlagBits rasterizationSamples = vk::VK_SAMPLE_COUNT_1_BIT,
+ vk::VkBool32 sampleShadingEnable = false,
+ float minSampleShading = 0.0f,
+ const std::vector<vk::VkSampleMask>& sampleMask = std::vector<vk::VkSampleMask>(1, 0xffffffff),
+ bool alphaToCoverageEnable = false,
+ bool alphaToOneEnable = false);
- MultiSampleState (const MultiSampleState &other);
- MultiSampleState &operator= (const MultiSampleState &other);
+ MultiSampleState (const MultiSampleState& other);
+ MultiSampleState& operator= (const MultiSampleState& other);
private:
std::vector<vk::VkSampleMask> m_sampleMask;
vk::VkBlendFactor srcAlphaBlendFactor = vk::VK_BLEND_FACTOR_SRC_COLOR,
vk::VkBlendFactor dstAlphaBlendFactor = vk::VK_BLEND_FACTOR_DST_COLOR,
vk::VkBlendOp alphaBlendOp = vk::VK_BLEND_OP_ADD,
- deUint8 colorWriteMask = 0xff);
+ deUint8 colorWriteMask = 0xff);
};
- ColorBlendState ( const std::vector<vk::VkPipelineColorBlendAttachmentState>& attachments,
- vk::VkBool32 alphaToCoverageEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
+ ColorBlendState (const std::vector<vk::VkPipelineColorBlendAttachmentState>& attachments,
+ vk::VkBool32 alphaToCoverageEnable = false,
+ vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
- ColorBlendState ( deUint32 attachmentCount,
- const vk::VkPipelineColorBlendAttachmentState* attachments,
- vk::VkBool32 logicOpEnable = false,
- vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
+ ColorBlendState (deUint32 attachmentCount,
+ const vk::VkPipelineColorBlendAttachmentState* attachments,
+ vk::VkBool32 logicOpEnable = false,
+ vk::VkLogicOp logicOp = vk::VK_LOGIC_OP_COPY);
- ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo &createInfo);
- ColorBlendState (const ColorBlendState &createInfo, std::vector<float> blendConstants = std::vector<float>(4));
+ ColorBlendState (const vk::VkPipelineColorBlendStateCreateInfo& createInfo);
+ ColorBlendState (const ColorBlendState& createInfo,
+ std::vector<float> blendConstants = std::vector<float>(4));
private:
std::vector<vk::VkPipelineColorBlendAttachmentState> m_attachments;
class StencilOpState : public vk::VkStencilOpState
{
public:
- StencilOpState (vk::VkStencilOp failOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp passOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkStencilOp depthFailOp = vk::VK_STENCIL_OP_REPLACE,
- vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
- deUint32 compareMask = 0xffffffffu,\r
- deUint32 writeMask = 0xffffffffu,\r
- deUint32 reference = 0);
+ StencilOpState (vk::VkStencilOp failOp = vk::VK_STENCIL_OP_REPLACE,
+ vk::VkStencilOp passOp = vk::VK_STENCIL_OP_REPLACE,
+ vk::VkStencilOp depthFailOp = vk::VK_STENCIL_OP_REPLACE,
+ vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
+ deUint32 compareMask = 0xffffffffu,
+ deUint32 writeMask = 0xffffffffu,
+ deUint32 reference = 0);
};
- DepthStencilState ( vk::VkBool32 depthTestEnable = false,
- vk::VkBool32 depthWriteEnable = false,
- vk::VkCompareOp depthCompareOp = vk::VK_COMPARE_OP_ALWAYS,
- vk::VkBool32 depthBoundsTestEnable = false,
- vk::VkBool32 stencilTestEnable = false,
- StencilOpState front = StencilOpState(),
- StencilOpState back = StencilOpState(),
- float minDepthBounds = -1.0f,
- float maxDepthBounds = 1.0f);
+ DepthStencilState (vk::VkBool32 depthTestEnable = false,
+ vk::VkBool32 depthWriteEnable = false,
+ vk::VkCompareOp depthCompareOp = vk::VK_COMPARE_OP_ALWAYS,
+ vk::VkBool32 depthBoundsTestEnable = false,
+ vk::VkBool32 stencilTestEnable = false,
+ StencilOpState front = StencilOpState(),
+ StencilOpState back = StencilOpState(),
+ float minDepthBounds = -1.0f,
+ float maxDepthBounds = 1.0f);
};
class PipelineShaderStage : public vk::VkPipelineShaderStageCreateInfo
{
public:
- PipelineShaderStage (vk::VkShaderModule shaderModule, const char* _pName, vk::VkShaderStageFlagBits stage);
+ PipelineShaderStage (vk::VkShaderModule shaderModule, const char* pName, vk::VkShaderStageFlagBits stage);
};
class DynamicState : public vk::VkPipelineDynamicStateCreateInfo
{
public:
- DynamicState (const std::vector<vk::VkDynamicState>& dynamicStates = std::vector<vk::VkDynamicState>(0));
+ DynamicState (const std::vector<vk::VkDynamicState>& dynamicStates = std::vector<vk::VkDynamicState>(0));
- DynamicState (const DynamicState &other);
- DynamicState &operator= (const DynamicState &other);
+ DynamicState (const DynamicState& other);
+ DynamicState& operator= (const DynamicState& other);
std::vector<vk::VkDynamicState> m_dynamicStates;
};
- PipelineCreateInfo(vk::VkPipelineLayout layout, vk::VkRenderPass renderPass, int subpass, vk::VkPipelineCreateFlags flags);
+ PipelineCreateInfo (vk::VkPipelineLayout layout,
+ vk::VkRenderPass renderPass,
+ int subpass,
+ vk::VkPipelineCreateFlags flags);
- PipelineCreateInfo& addShader (const vk::VkPipelineShaderStageCreateInfo& shader);
+ PipelineCreateInfo& addShader (const vk::VkPipelineShaderStageCreateInfo& shader);
- PipelineCreateInfo& addState (const vk::VkPipelineVertexInputStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineColorBlendStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineViewportStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineDepthStencilStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineTessellationStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineRasterizationStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineMultisampleStateCreateInfo& state);
- PipelineCreateInfo& addState (const vk::VkPipelineDynamicStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineVertexInputStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineInputAssemblyStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineColorBlendStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineViewportStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineDepthStencilStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineTessellationStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineRasterizationStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineMultisampleStateCreateInfo& state);
+ PipelineCreateInfo& addState (const vk::VkPipelineDynamicStateCreateInfo& state);
private:
std::vector<vk::VkPipelineShaderStageCreateInfo> m_shaders;
vk::VkPipelineMultisampleStateCreateInfo m_multisampleState;
vk::VkPipelineDynamicStateCreateInfo m_dynamicState;
- std::vector<vk::VkDynamicState> m_dynamicStates;
+ std::vector<vk::VkDynamicState> m_dynamicStates;
- std::vector<vk::VkViewport> m_viewports;
- std::vector<vk::VkRect2D> m_scissors;
+ std::vector<vk::VkViewport> m_viewports;
+ std::vector<vk::VkRect2D> m_scissors;
- std::vector<vk::VkSampleMask> m_multisampleStateSampleMask;
+ std::vector<vk::VkSampleMask> m_multisampleStateSampleMask;
};
class SamplerCreateInfo : public vk::VkSamplerCreateInfo
{
public:
- SamplerCreateInfo ( vk::VkFilter magFilter = vk::VK_FILTER_NEAREST,
- vk::VkFilter minFilter = vk::VK_FILTER_NEAREST,
- vk::VkSamplerMipmapMode mipmapMode = vk::VK_SAMPLER_MIPMAP_MODE_NEAREST,
- vk::VkSamplerAddressMode addressU = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- vk::VkSamplerAddressMode addressV = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- vk::VkSamplerAddressMode addressW = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
- float mipLodBias = 0.0f,
- float maxAnisotropy = 1.0f,
- vk::VkBool32 compareEnable = false,
- vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
- float minLod = 0.0f,
- float maxLod = 16.0f,
- vk::VkBorderColor borderColor = vk::VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE,
- vk::VkBool32 unnormalizedCoordinates = false);
+ SamplerCreateInfo (vk::VkFilter magFilter = vk::VK_FILTER_NEAREST,
+ vk::VkFilter minFilter = vk::VK_FILTER_NEAREST,
+ vk::VkSamplerMipmapMode mipmapMode = vk::VK_SAMPLER_MIPMAP_MODE_NEAREST,
+ vk::VkSamplerAddressMode addressU = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
+ vk::VkSamplerAddressMode addressV = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
+ vk::VkSamplerAddressMode addressW = vk::VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
+ float mipLodBias = 0.0f,
+ float maxAnisotropy = 1.0f,
+ vk::VkBool32 compareEnable = false,
+ vk::VkCompareOp compareOp = vk::VK_COMPARE_OP_ALWAYS,
+ float minLod = 0.0f,
+ float maxLod = 16.0f,
+ vk::VkBorderColor borderColor = vk::VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE,
+ vk::VkBool32 unnormalizedCoordinates = false);
};
} // Draw
} // vkt
-#endif // _VKTDRAWCREATEINFO_UTIL_HPP
+#endif // _VKTDRAWCREATEINFOUTIL_HPP
int width,
int height,
int depth,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
+ vk::VkDeviceSize rowPitchOrZero,
+ vk::VkDeviceSize depthPitchOrZero,
const void * srcBuffer,
void * destBuffer)
{
- if (rowPitch == 0)
+ vk::VkDeviceSize rowPitch = rowPitchOrZero;
+ vk::VkDeviceSize depthPitch = depthPitchOrZero;
+
+ if (rowPitch == 0)
rowPitch = width * pixelSize;
- if (depthPitch == 0)
+ if (depthPitch == 0)
depthPitch = rowPitch * height;
const vk::VkDeviceSize size = depthPitch * depth;
- const char *srcRow = reinterpret_cast<const char *>(srcBuffer);
- const char *srcStart;
+ const deUint8* srcRow = reinterpret_cast<const deUint8*>(srcBuffer);
+ const deUint8* srcStart;
srcStart = srcRow;
- char *dstRow = reinterpret_cast<char *>(destBuffer);
- char *dstStart;
+ deUint8* dstRow = reinterpret_cast<deUint8 *>(destBuffer);
+ deUint8* dstStart;
dstStart = dstRow;
if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
- depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
+ depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
{
// fast path
deMemcpy(dstRow, srcRow, static_cast<size_t>(size));
vk::VkDeviceSize offsetDepthSrc = d * (pixelSize * width * height);
srcRow = srcStart + offsetDepthSrc;
dstRow = dstStart + offsetDepthDst;
- for (int r = 0; r < height; ++r)
+ for (int r = 0; r < height; ++r)
{
deMemcpy(dstRow, srcRow, static_cast<size_t>(rowPitch));
srcRow += pixelSize * width;
int width,
int height,
int depth,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
+ vk::VkDeviceSize rowPitchOrZero,
+ vk::VkDeviceSize depthPitchOrZero,
const void * srcBuffer,
void * destBuffer)
{
+ vk::VkDeviceSize rowPitch = rowPitchOrZero;
+ vk::VkDeviceSize depthPitch = depthPitchOrZero;
+
if (rowPitch == 0)
rowPitch = width * pixelSize;
- if (depthPitch == 0)
+ if (depthPitch == 0)
depthPitch = rowPitch * height;
const vk::VkDeviceSize size = depthPitch * depth;
- const char *srcRow = reinterpret_cast<const char *>(srcBuffer);
- const char *srcStart;
+ const deUint8* srcRow = reinterpret_cast<const deUint8*>(srcBuffer);
+ const deUint8* srcStart;
srcStart = srcRow;
- char *dstRow = reinterpret_cast<char *>(destBuffer);
- char *dstStart;
+ deUint8* dstRow = reinterpret_cast<deUint8*>(destBuffer);
+ deUint8* dstStart;
dstStart = dstRow;
if (rowPitch == static_cast<vk::VkDeviceSize>(width * pixelSize) &&
- depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
+ depthPitch == static_cast<vk::VkDeviceSize>(rowPitch * height))
{
// fast path
deMemcpy(dstRow, srcRow, static_cast<size_t>(size));
vk::VkDeviceSize offsetDepthSrc = d * depthPitch;
srcRow = srcStart + offsetDepthSrc;
dstRow = dstStart + offsetDepthDst;
- for (int r = 0; r < height; ++r)
+ for (int r = 0; r < height; ++r)
{
deMemcpy(dstRow, srcRow, static_cast<size_t>(pixelSize * width));
srcRow += rowPitch;
}
}
-Image::Image (const vk::DeviceInterface &vk,
+Image::Image (const vk::DeviceInterface& vk,
vk::VkDevice device,
vk::VkFormat format,
- const vk::VkExtent3D &extend,
+ const vk::VkExtent3D& extend,
deUint32 levelCount,
deUint32 layerCount,
vk::Move<vk::VkImage> object)
vk::VkImageType type,
void * data)
{
- if (layout != vk::VK_IMAGE_LAYOUT_GENERAL && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL)
- TCU_FAIL("Image::uploadFromSurface usage error: this function is not going to change Image layout!");
+ DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
de::SharedPtr<Image> stagingResource = copyToLinearImage(queue, allocator, layout, offset, width,
height, depth, mipLevel, arrayElement, aspect, type);
vk::VkImageAspectFlagBits aspect,
void * data)
{
- if (layout != vk::VK_IMAGE_LAYOUT_GENERAL && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL)
- TCU_FAIL("Image::uploadFromSurface usage error: this function is not going to change Image layout!");
+ DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);;
de::SharedPtr<Buffer> stagingResource;
stagingResource = Buffer::createAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
{
- #pragma message("Get queue family index")
+ //todo [scygan] get proper queueFamilyIndex
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
void* barriers[] = { &barrier };
- m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ m_vk.cmdPipelineBarrier(*copyCmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
false, DE_LENGTH_OF_ARRAY(barriers), barriers);
}
- vk::VkBufferImageCopy region =
+ vk::VkBufferImageCopy region =
{
0, 0, 0,
{ aspect, mipLevel, arrayElement, 1 },
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
DE_NULL, // const void* pNext;\r
- 0, // deUint32 waitSemaphoreCount;\r
- DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
- 1, // deUint32 commandBufferCount;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
- 0, // deUint32 signalSemaphoreCount;\r
+ 0, // deUint32 signalSemaphoreCount;\r
DE_NULL // const VkSemaphore* pSignalSemaphores;\r
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
VK_CHECK(m_vk.queueWaitIdle(queue));
}
- char* destPtr = reinterpret_cast<char*>(stagingResource->getBoundMemory().getHostPtr());
+ deUint8* destPtr = reinterpret_cast<deUint8*>(stagingResource->getBoundMemory().getHostPtr());
deMemcpy(data, destPtr, bufferSize);
}
m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource, &imageLayout);
- const char* srcPtr = reinterpret_cast<const char*>(getBoundMemory().getHostPtr());
+ const deUint8* srcPtr = reinterpret_cast<const deUint8*>(getBoundMemory().getHostPtr());
srcPtr += imageLayout.offset + getPixelOffset(offset, imageLayout.rowPitch, imageLayout.depthPitch, mipLevel, arrayElement);
MemoryOp::unpack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
de::SharedPtr<Image> stagingResource;
{
vk::VkExtent3D stagingExtent = {width, height, depth};
- ImageCreateInfo stagingResourceCreateInfo(
- type, m_format, stagingExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
- vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
+ ImageCreateInfo stagingResourceCreateInfo(type, m_format, stagingExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
+ vk::VK_IMAGE_TILING_LINEAR, vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
- vk::MemoryRequirement::HostVisible);
+ vk::MemoryRequirement::HostVisible);
- #pragma message("Get queue family index")
+ //todo [scygan] get proper queueFamilyIndex
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
DE_NULL, // const void* pNext;\r
- 0, // deUint32 waitSemaphoreCount;\r
- DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
- 1, // deUint32 commandBufferCount;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
- 0, // deUint32 signalSemaphoreCount;\r
+ 0, // deUint32 signalSemaphoreCount;\r
DE_NULL // const VkSemaphore* pSignalSemaphores;\r
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
void Image::uploadVolume(const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
vk::VkImageAspectFlagBits aspect,
void Image::uploadSurface (const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
vk::VkImageAspectFlagBits aspect,
void Image::uploadSurface1D (const tcu::ConstPixelBufferAccess& access,
vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
vk::VkImageAspectFlagBits aspect,
}
void Image::upload (vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
int width,
vk::VkImageType type,
const void * data)
{
-
- if (layout != vk::VK_IMAGE_LAYOUT_UNDEFINED
- && layout != vk::VK_IMAGE_LAYOUT_GENERAL
- && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL)
- {
- TCU_FAIL("Image::uploadFromRaw usage error: this function is not going to change Image layout!");
- }
+ DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_UNDEFINED || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
de::SharedPtr<Image> stagingResource;
vk::VkExtent3D extent = {width, height, depth};
stagingResource = Image::createAndAlloc(m_vk, m_device, stagingResourceCreateInfo, allocator,
vk::MemoryRequirement::HostVisible);
-
+
const vk::VkOffset3D zeroOffset = { 0, 0, 0 };
stagingResource->uploadLinear(zeroOffset, width, height, depth, 0, 0, aspect, data);
{
- #pragma message("Get queue family index")
+ //todo [scygan] get proper queueFamilyIndex
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
1u, // deUint32 bufferCount;
};
+
vk::Unique<vk::VkCommandBuffer> copyCmdBuffer(vk::allocateCommandBuffer(m_vk, m_device, &cmdBufferAllocateInfo));
CmdBufferBeginInfo beginInfo;
VK_CHECK(m_vk.beginCommandBuffer(*copyCmdBuffer, &beginInfo));
-
+
if (layout == vk::VK_IMAGE_LAYOUT_UNDEFINED)
{
layout = vk::VK_IMAGE_LAYOUT_GENERAL;
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
DE_NULL, // const void* pNext;\r
- 0, // deUint32 waitSemaphoreCount;\r
- DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
- 1, // deUint32 commandBufferCount;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
- 0, // deUint32 signalSemaphoreCount;\r
+ 0, // deUint32 signalSemaphoreCount;\r
DE_NULL // const VkSemaphore* pSignalSemaphores;\r
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
}
void Image::uploadUsingBuffer (vk::VkQueue queue,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::VkImageLayout layout,
vk::VkOffset3D offset,
int width,
vk::VkImageAspectFlagBits aspect,
const void * data)
{
- if (layout != vk::VK_IMAGE_LAYOUT_UNDEFINED
- && layout != vk::VK_IMAGE_LAYOUT_GENERAL
- && layout != vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL)
- {
- TCU_FAIL("Image::uploadFromRaw usage error: this function is not going to change Image layout!");
- }
+ DE_ASSERT(layout == vk::VK_IMAGE_LAYOUT_GENERAL || layout == vk::VK_IMAGE_LAYOUT_UNDEFINED || layout == vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
de::SharedPtr<Buffer> stagingResource;
bool isCombinedType = isCombinedDepthStencilType(vk::mapVkFormat(m_format).type);
}
BufferCreateInfo stagingBufferResourceCreateInfo(bufferSize, vk::VK_BUFFER_USAGE_TRANSFER_DST_BIT | vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
stagingResource = Buffer::createAndAlloc(m_vk, m_device, stagingBufferResourceCreateInfo, allocator, vk::MemoryRequirement::HostVisible);
- char* destPtr = reinterpret_cast<char*>(stagingResource->getBoundMemory().getHostPtr());
+ deUint8* destPtr = reinterpret_cast<deUint8*>(stagingResource->getBoundMemory().getHostPtr());
deMemcpy(destPtr, data, bufferSize);
vk::flushMappedMemoryRange(m_vk, m_device, stagingResource->getBoundMemory().getMemory(), stagingResource->getBoundMemory().getOffset(), bufferSize);
{
- #pragma message("Get queue family index")
+ //todo [scygan] get proper queueFamilyIndex
CmdPoolCreateInfo copyCmdPoolCreateInfo(0);
vk::Unique<vk::VkCommandPool> copyCmdPool(vk::createCommandPool(m_vk, m_device, ©CmdPoolCreateInfo));
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;\r
DE_NULL, // const void* pNext;\r
- 0, // deUint32 waitSemaphoreCount;\r
- DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
- 1, // deUint32 commandBufferCount;\r
+ 0, // deUint32 waitSemaphoreCount;\r
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;\r
+ 1, // deUint32 commandBufferCount;\r
©CmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;\r
- 0, // deUint32 signalSemaphoreCount;\r
+ 0, // deUint32 signalSemaphoreCount;\r
DE_NULL // const VkSemaphore* pSignalSemaphores;\r
};
m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL);
}
}
-
void Image::uploadLinear (vk::VkOffset3D offset,
int width,
int height,
m_vk.getImageSubresourceLayout(m_device, object(), &imageSubResource,
&imageLayout);
- char* destPtr = reinterpret_cast<char*>(getBoundMemory().getHostPtr());
+ deUint8* destPtr = reinterpret_cast<deUint8*>(getBoundMemory().getHostPtr());
destPtr += imageLayout.offset + getPixelOffset(offset, imageLayout.rowPitch, imageLayout.depthPitch, mipLevel, arrayElement);
- MemoryOp::pack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
+ MemoryOp::pack(vk::mapVkFormat(m_format).getPixelSize(), width, height, depth,
imageLayout.rowPitch, imageLayout.depthPitch, data, destPtr);
}
unsigned int level,
unsigned int layer)
{
- if (level >= m_levelCount)
- TCU_FAIL("mip level too large");
-
- if (layer >= m_layerCount)
- TCU_FAIL("array element too large");
+ DE_ASSERT(level < m_levelCount);
+ DE_ASSERT(layer < m_layerCount);
vk::VkDeviceSize mipLevelSizes[32];
vk::VkDeviceSize mipLevelRectSizes[32];
de::SharedPtr<Image> Image::createAndAlloc(const vk::DeviceInterface& vk,
vk::VkDevice device,
const vk::VkImageCreateInfo& createInfo,
- vk::Allocator& allocator,
+ vk::Allocator& allocator,
vk::MemoryRequirement memoryRequirement)
{
de::SharedPtr<Image> ret = create(vk, device, createInfo);
vk::createImage(vk, device, &createInfo)));
}
-void transition2DImage (const vk::DeviceInterface& vk,
- vk::VkCommandBuffer cmdBuffer,
- vk::VkImage image,
- vk::VkImageAspectFlags aspectMask,
+void transition2DImage (const vk::DeviceInterface& vk,
+ vk::VkCommandBuffer cmdBuffer,
+ vk::VkImage image,
+ vk::VkImageAspectFlags aspectMask,
vk::VkImageLayout oldLayout,
vk::VkImageLayout newLayout)
{
- vk::VkImageMemoryBarrier barrier;
+ vk::VkImageMemoryBarrier barrier;
barrier.sType = vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.pNext = DE_NULL;
barrier.srcAccessMask = 0;
vk.cmdPipelineBarrier(cmdBuffer, vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, DE_LENGTH_OF_ARRAY(barriers), barriers);
}
-
void initialTransitionColor2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout)
{
transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_COLOR_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
transition2DImage(vk, cmdBuffer, image, vk::VK_IMAGE_ASPECT_DEPTH_BIT | vk::VK_IMAGE_ASPECT_STENCIL_BIT, vk::VK_IMAGE_LAYOUT_UNDEFINED, layout);
}
-} //Draw
-} //vkt
+} // Draw
+} // vkt
* \brief Image Object Util
*//*--------------------------------------------------------------------*/
-#include "vkDefs.hpp"
#include "vkMemUtil.hpp"
#include "vkRefUtil.hpp"
int width,
int height,
int depth,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
+ vk::VkDeviceSize rowPitchOrZero,
+ vk::VkDeviceSize depthPitchOrZero,
const void * srcBuffer,
void * destBuffer);
int width,
int height,
int depth,
- vk::VkDeviceSize rowPitch,
- vk::VkDeviceSize depthPitch,
+ vk::VkDeviceSize rowPitchOrZero,
+ vk::VkDeviceSize depthPitchOrZero,
const void * srcBuffer,
void * destBuffer);
};
-
class Image
{
public:
- static de::SharedPtr<Image> create (const vk::DeviceInterface &vk, vk::VkDevice device, const vk::VkImageCreateInfo &createInfo);
+ static de::SharedPtr<Image> create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkImageCreateInfo& createInfo);
static de::SharedPtr<Image> createAndAlloc (const vk::DeviceInterface& vk,
vk::VkDevice device,
unsigned int mipLevel = 0,
unsigned int arrayElement = 0);
-
tcu::ConstPixelBufferAccess readSurfaceLinear (vk::VkOffset3D offset,
int width,
int height,
deUint32 layerCount,
vk::Move<vk::VkImage> object);
- Image (const Image &other); // Not allowed!
- Image &operator= (const Image &other); // Not allowed!
+ Image (const Image& other); // Not allowed!
+ Image& operator= (const Image& other); // Not allowed!
- de::MovePtr<vk::Allocation> m_allocation;
+ de::MovePtr<vk::Allocation> m_allocation;
vk::Unique<vk::VkImage> m_object;
vk::VkFormat m_format;
vk::VkDevice m_device;
};
-void transition2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageAspectFlags aspectMask, vk::VkImageLayout oldLayout, vk::VkImageLayout newLayout);
+void transition2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageAspectFlags aspectMask, vk::VkImageLayout oldLayout, vk::VkImageLayout newLayout);
-void initialTransitionColor2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
+void initialTransitionColor2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-void initialTransitionDepth2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
+void initialTransitionDepth2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-void initialTransitionStencil2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
+void initialTransitionStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-void initialTransitionDepthStencil2DImage (const vk::DeviceInterface &vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
+void initialTransitionDepthStencil2DImage (const vk::DeviceInterface& vk, vk::VkCommandBuffer cmdBuffer, vk::VkImage image, vk::VkImageLayout layout);
-} //Draw
-} //vkt
+} // Draw
+} // vkt
#endif // _VKTDRAWIMAGEOBJECTUTIL_HPP
#include "tcuResource.hpp"
#include "tcuImageCompare.hpp"
#include "tcuTextureUtil.hpp"
+#include "tcuRGBA.hpp"
#include "vkDefs.hpp"
{
m_topology = topology;
- /*0*/ m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- /*1*/ m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- /*2*/ m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- /*3*/ m_data.push_back(Vec4RGBA(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), vec4Blue()));
- /*4*/ m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- /*5*/ m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- /*6*/ m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- /*7*/ m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- /*8*/ m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
+ /*0*/ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*1*/ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*2*/ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*3*/ m_data.push_back(PositionColorVertex(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*4*/ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*5*/ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*6*/ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*7*/ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ /*8*/ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
switch (m_topology)
{
m_indexes.push_back(7);
break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
+ break;
default:
- ;
+ DE_FATAL("Unknown topology");
+ break;
}
-
- DrawTestsBaseClass::initialize();
+ initialize();
};
tcu::TestStatus DrawIndexed::iterate (void)
beginRenderPass();
const vk::VkDeviceSize dataSize = m_indexes.size() * sizeof(deUint32);
- m_indexBuffer = Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(dataSize,
- vk::VK_BUFFER_USAGE_INDEX_BUFFER_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
+ m_indexBuffer = Buffer::createAndAlloc( m_vk, m_context.getDevice(),
+ BufferCreateInfo(dataSize,
+ vk::VK_BUFFER_USAGE_INDEX_BUFFER_BIT),
+ m_context.getDefaultAllocator(),
+ vk::MemoryRequirement::HostVisible);
+
+ deUint8* ptr = reinterpret_cast<deUint8*>(m_indexBuffer->getBoundMemory().getHostPtr());
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_indexBuffer->getBoundMemory().getHostPtr());
deMemcpy(ptr, &m_indexes[0], dataSize);
vk::flushMappedMemoryRange(m_vk, m_context.getDevice(),
const vk::VkDeviceSize vertexBufferOffset = 0;
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
const vk::VkBuffer indexBuffer = m_indexBuffer->object();
+
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
m_vk.cmdBindIndexBuffer(*m_cmdBuffer, indexBuffer, 0, vk::VK_INDEX_TYPE_UINT32);
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- 1, // deUint32 commandBufferCount;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
&m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
tcu::clear(referenceFrame.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ ReferenceImageCoordinates refCoords;
+
for (int y = 0; y < frameHeight; y++)
{
const float yCoord = (float)(y / (0.5*frameHeight)) - 1.0f;
{
const float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f;
- if ((yCoord >= -0.3f && yCoord <= 0.3f && xCoord >= -0.3f && xCoord <= 0.3f))
+ if ((yCoord >= refCoords.bottom &&
+ yCoord <= refCoords.top &&
+ xCoord >= refCoords.left &&
+ xCoord <= refCoords.right))
referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), x, y);
}
}
beginRenderPass();
const vk::VkDeviceSize dataSize = m_indexes.size() * sizeof(deUint32);
- m_indexBuffer = Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(dataSize, vk::VK_BUFFER_USAGE_INDEX_BUFFER_BIT),
- m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
+ m_indexBuffer = Buffer::createAndAlloc( m_vk, m_context.getDevice(),
+ BufferCreateInfo(dataSize,
+ vk::VK_BUFFER_USAGE_INDEX_BUFFER_BIT),
+ m_context.getDefaultAllocator(),
+ vk::MemoryRequirement::HostVisible);
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_indexBuffer->getBoundMemory().getHostPtr());
- deMemcpy(ptr, &m_indexes[0], dataSize);
+ deUint8* ptr = reinterpret_cast<deUint8*>(m_indexBuffer->getBoundMemory().getHostPtr());
+ deMemcpy(ptr, &m_indexes[0], dataSize);
vk::flushMappedMemoryRange(m_vk, m_context.getDevice(),
m_vertexBuffer->getBoundMemory().getMemory(),
m_vertexBuffer->getBoundMemory().getOffset(),
const vk::VkDeviceSize vertexBufferOffset = 0;
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
const vk::VkBuffer indexBuffer = m_indexBuffer->object();
+
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
m_vk.cmdBindIndexBuffer(*m_cmdBuffer, indexBuffer, 0, vk::VK_INDEX_TYPE_UINT32);
-
m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
switch (m_topology)
{
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
m_vk.cmdDrawIndexed(*m_cmdBuffer, 6, 4, 2, 0, 2);
break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
m_vk.cmdDrawIndexed(*m_cmdBuffer, 4, 4, 2, 0, 2);
break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
break;
default:
+ DE_FATAL("Unknown topology");
break;
}
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- 1, // deUint32 commandBufferCount;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
&m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
tcu::clear(referenceFrame.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ ReferenceImageInstancedCoordinates refInstancedCoords;
+
for (int y = 0; y < frameHeight; y++)
{
const float yCoord = (float)(y / (0.5*frameHeight)) - 1.0f;
{
const float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f;
- if ((yCoord >= -0.6f && yCoord <= 0.3f && xCoord >= -0.3f && xCoord <= 0.6f))
+ if ((yCoord >= refInstancedCoords.bottom &&
+ yCoord <= refInstancedCoords.top &&
+ xCoord >= refInstancedCoords.left &&
+ xCoord <= refInstancedCoords.right))
referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), x, y);
}
}
ShaderMap shaderPaths;
shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetch.vert";
shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
+
addChild(new InstanceFactory<DrawIndexed>(m_testCtx, "draw_indexed_triangle_list", "Draws indexed triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
addChild(new InstanceFactory<DrawIndexed>(m_testCtx, "draw_indexed_triangle_strip", "Draws indexed triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchWithInstance.vert";
shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
+
addChild(new InstanceFactory<DrawIndexed>(m_testCtx, "draw_instanced_indexed_triangle_list", "Draws indexed triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
addChild(new InstanceFactory<DrawIndexed>(m_testCtx, "draw_instanced_indexed_triangle_strip", "Draws indexed triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
}
} // DrawTests
-} // vkt
\ No newline at end of file
+} // vkt
-#ifndef _VKTDRAWINDEXEDTESTS_HPP
-#define _VKTDRAWINDEXEDTESTS_HPP
+#ifndef _VKTDRAWINDEXEDTEST_HPP
+#define _VKTDRAWINDEXEDTEST_HPP
/*------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
class DrawIndexedTests : public tcu::TestCaseGroup
{
public:
- DrawIndexedTests (tcu::TestContext &testCtx);
- ~DrawIndexedTests (void);
- void init (void);
+ DrawIndexedTests (tcu::TestContext &testCtx);
+ ~DrawIndexedTests (void);
+ void init (void);
private:
- DrawIndexedTests (const DrawIndexedTests &other);
- DrawIndexedTests& operator=(const DrawIndexedTests &other);
+ DrawIndexedTests (const DrawIndexedTests &other);
+ DrawIndexedTests& operator= (const DrawIndexedTests &other);
};
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif // #define _VKTDRAWINDEXEDTESTS_HPP
+#endif // _VKTDRAWINDEXEDTEST_HPP
#include "tcuResource.hpp"
#include "tcuImageCompare.hpp"
#include "tcuTextureUtil.hpp"
+#include "tcuRGBA.hpp"
#include "vkDefs.hpp"
{
struct JunkData
{
- deUint16 x16 = 16;
- deUint32 x32 = 32;
- std::string str = "junk_data";
+ JunkData()
+ : varA (0xcd)
+ , varB (0xcd)
+ {
+ }
+ const deUint16 varA;
+ const deUint32 varB;
};
class IndirectDraw : public DrawTestsBaseClass
{
public:
IndirectDraw (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology);
- virtual tcu::TestStatus iterate (void);
+ virtual tcu::TestStatus iterate (void);
private:
- de::SharedPtr<Buffer> m_IndirectBuffer;
+ de::SharedPtr<Buffer> m_indirectBuffer;
std::vector<vk::VkDrawIndirectCommand> m_indirectDrawCmd;
vk::VkDeviceSize m_offsetInBuffer;
deUint32 m_strideInBuffer;
IndirectDrawInstanced (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology);
virtual tcu::TestStatus iterate (void);
private:
- de::SharedPtr<Buffer> m_IndirectBuffer;
+ de::SharedPtr<Buffer> m_indirectBuffer;
std::vector<vk::VkDrawIndirectCommand> m_indirectDrawCmd;
vk::VkDeviceSize m_offsetInBuffer;
deUint32 m_strideInBuffer;
IndirectDraw::IndirectDraw (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology)
: DrawTestsBaseClass(context, shaders[glu::SHADERTYPE_VERTEX], shaders[glu::SHADERTYPE_FRAGMENT])
- {
- m_topology = topology;
-
- switch (m_topology)
- {
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
- m_data.push_back(Vec4RGBA(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
- m_data.push_back(Vec4RGBA(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-0.3f, 0.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-0.3f, 0.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4(-1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
- break;
- default:
- break;
- }
+{
+ m_topology = topology;
- DrawTestsBaseClass::initialize();
+ switch (m_topology)
+ {
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4(-1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4(-0.3f, 0.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4(-0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4(-0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4(-0.3f, 0.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4(-1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
+ case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
+ break;
+ default:
+ DE_FATAL("Unknown topology");
+ break;
}
+ initialize();
+}
tcu::TestStatus IndirectDraw::iterate (void)
{
switch (m_topology)
{
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
- m_indirectDrawCmd.push_back(
- {
- 3, //vertexCount
- 1, //instanceCount
- 2, //firstVertex
- 0 //firstInstance
- });
-
- // and this is junk data for stride
- m_indirectDrawCmd.push_back({ -4, -2, -11, -9 });
-
- m_indirectDrawCmd.push_back(
+ {
+ vk::VkDrawIndirectCommand drawCommands[] =
{
- 3, //vertexCount
- 1, //instanceCount
- 5, //firstVertex
- 0 //firstInstance
- });
+ {
+ 3, //vertexCount
+ 1, //instanceCount
+ 2, //firstVertex
+ 0 //firstInstance
+ },
+ { -4, -2, -11, -9 }, // junk (stride)
+ {
+ 3, //vertexCount
+ 1, //instanceCount
+ 5, //firstVertex
+ 0 //firstInstance
+ }
+ };
+ m_indirectDrawCmd.push_back(drawCommands[0]);
+ m_indirectDrawCmd.push_back(drawCommands[1]);
+ m_indirectDrawCmd.push_back(drawCommands[2]);
break;
+ }
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
- m_indirectDrawCmd.push_back(
- {
- 4, //vertexCount
- 1, //instanceCount
- 2, //firstVertex
- 0 //firstInstance
- });
-
- // and this is junk data for stride
- m_indirectDrawCmd.push_back({ -4, -2, -11, -9 });
-
- m_indirectDrawCmd.push_back(
+ {
+ vk::VkDrawIndirectCommand drawCommands[] =
{
- 4, //vertexCount
- 1, //instanceCount
- 6, //firstVertex
- 0 //firstInstance
- });
+ {
+ 4, //vertexCount
+ 1, //instanceCount
+ 2, //firstVertex
+ 0 //firstInstance
+ },
+ { -4, -2, -11, -9 }, // junk (stride)
+ {
+ 4, //vertexCount
+ 1, //instanceCount
+ 6, //firstVertex
+ 0 //firstInstance
+ }
+ };
+ m_indirectDrawCmd.push_back(drawCommands[0]);
+ m_indirectDrawCmd.push_back(drawCommands[1]);
+ m_indirectDrawCmd.push_back(drawCommands[2]);
break;
+ }
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
break;
default:
+ DE_FATAL("Unknown topology");
break;
}
m_strideInBuffer = 2 * sizeof(m_indirectDrawCmd[0]);
m_drawCount = 2;
m_offsetInBuffer = sizeof(m_junkData);
-
+
beginRenderPass();
const vk::VkDeviceSize vertexBufferOffset = 0;
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
+
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
const vk::VkDeviceSize dataSize = m_indirectDrawCmd.size()*sizeof(m_indirectDrawCmd[0]);
- m_IndirectBuffer = Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(dataSize,
- vk::VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_IndirectBuffer->getBoundMemory().getHostPtr());
+ m_indirectBuffer = Buffer::createAndAlloc( m_vk,
+ m_context.getDevice(),
+ BufferCreateInfo(dataSize,
+ vk::VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT),
+ m_context.getDefaultAllocator(),
+ vk::MemoryRequirement::HostVisible);
+
+ deUint8* ptr = reinterpret_cast<deUint8*>(m_indirectBuffer->getBoundMemory().getHostPtr());
+
deMemcpy(ptr, &m_junkData, m_offsetInBuffer);
deMemcpy((ptr+m_offsetInBuffer), &m_indirectDrawCmd[0], dataSize);
dataSize);
m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
-
- m_vk.cmdDrawIndirect(*m_cmdBuffer, m_IndirectBuffer->object(), m_offsetInBuffer, m_drawCount, m_strideInBuffer);
-
+ m_vk.cmdDrawIndirect(*m_cmdBuffer, m_indirectBuffer->object(), m_offsetInBuffer, m_drawCount, m_strideInBuffer);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- 1, // deUint32 commandBufferCount;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
&m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
+
VK_CHECK(m_vk.queueWaitIdle(queue));
// Validation
tcu::clear(referenceFrame.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ ReferenceImageCoordinates refCoords;
+
for (int y = 0; y < frameHeight; y++)
{
const float yCoord = (float)(y / (0.5*frameHeight)) - 1.0f;
{
const float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f;
- if ((yCoord >= -0.3f && yCoord <= 0.3f && xCoord >= -0.3f && xCoord <= 0.3f))
+ if ((yCoord >= refCoords.bottom &&
+ yCoord <= refCoords.top &&
+ xCoord >= refCoords.left &&
+ xCoord <= refCoords.right))
referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), x, y);
}
}
}
IndirectDrawInstanced::IndirectDrawInstanced (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology)
- : IndirectDraw (context, shaders, topology)
+ : IndirectDraw (context, shaders, topology)
{
}
switch (m_topology)
{
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
- m_indirectDrawCmd.push_back(
- {
- 3, //vertexCount
- 4, //instanceCount
- 2, //firstVertex
- 2 //firstInstance
- });
-
- // and this is junk data for stride
- m_indirectDrawCmd.push_back({ -4, -2, -11, -9 });
-
- m_indirectDrawCmd.push_back(
+ {
+ vk::VkDrawIndirectCommand drawCmd[] =
{
- 3, //vertexCount
- 4, //instanceCount
- 5, //firstVertex
- 2 //firstInstance
- });
-
+ {
+ 3, //vertexCount
+ 4, //instanceCount
+ 2, //firstVertex
+ 2 //firstInstance
+ },
+ { -4, -2, -11, -9 }, // junk (stride)
+ {
+ 3, //vertexCount
+ 4, //instanceCount
+ 5, //firstVertex
+ 2 //firstInstance
+ }
+ };
+ m_indirectDrawCmd.push_back(drawCmd[0]);
+ m_indirectDrawCmd.push_back(drawCmd[1]);
+ m_indirectDrawCmd.push_back(drawCmd[2]);
break;
+ }
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
- m_indirectDrawCmd.push_back(
- {
- 4, //vertexCount
- 4, //instanceCount
- 2, //firstVertex
- 2 //firstInstance
- });
-
- // and this is junk data for stride
- m_indirectDrawCmd.push_back({ -4, -2, -11, -9 });
-
- m_indirectDrawCmd.push_back(
+ {
+ vk::VkDrawIndirectCommand drawCmd[] =
{
- 4, //vertexCount
- 4, //instanceCount
- 6, //firstVertex
- 2 //firstInstance
- });
-
+ {
+ 4, //vertexCount
+ 4, //instanceCount
+ 2, //firstVertex
+ 2 //firstInstance
+ },
+ { -4, -2, -11, -9 },
+ {
+ 4, //vertexCount
+ 4, //instanceCount
+ 6, //firstVertex
+ 2 //firstInstance
+ }
+ };
+ m_indirectDrawCmd.push_back(drawCmd[0]);
+ m_indirectDrawCmd.push_back(drawCmd[1]);
+ m_indirectDrawCmd.push_back(drawCmd[2]);
break;
+ }
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
break;
default:
+ DE_FATAL("Unknown topology");
break;
}
const vk::VkDeviceSize vertexBufferOffset = 0;
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
+
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
const vk::VkDeviceSize dataSize = m_indirectDrawCmd.size()*sizeof(m_indirectDrawCmd[0]);
- m_IndirectBuffer = Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(dataSize,
- vk::VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
- unsigned char *ptr = reinterpret_cast<unsigned char *>(m_IndirectBuffer->getBoundMemory().getHostPtr());
+ m_indirectBuffer = Buffer::createAndAlloc( m_vk,
+ m_context.getDevice(),
+ BufferCreateInfo(dataSize,
+ vk::VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT),
+ m_context.getDefaultAllocator(),
+ vk::MemoryRequirement::HostVisible);
+
+ deUint8* ptr = reinterpret_cast<deUint8*>(m_indirectBuffer->getBoundMemory().getHostPtr());
+
deMemcpy(ptr, &m_junkData, m_offsetInBuffer);
deMemcpy((ptr + m_offsetInBuffer), &m_indirectDrawCmd[0], dataSize);
dataSize);
m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
-
- m_vk.cmdDrawIndirect(*m_cmdBuffer, m_IndirectBuffer->object(), m_offsetInBuffer, m_drawCount, m_strideInBuffer);
-
+ m_vk.cmdDrawIndirect(*m_cmdBuffer, m_indirectBuffer->object(), m_offsetInBuffer, m_drawCount, m_strideInBuffer);
m_vk.cmdEndRenderPass(*m_cmdBuffer);
m_vk.endCommandBuffer(*m_cmdBuffer);
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- 1, // deUint32 commandBufferCount;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
&m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
-
+
VK_CHECK(m_vk.queueWaitIdle(queue));
// Validation
VK_CHECK(m_vk.queueWaitIdle(queue));
tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
+
referenceFrame.allocLevel(0);
const deInt32 frameWidth = referenceFrame.getWidth();
tcu::clear(referenceFrame.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ ReferenceImageInstancedCoordinates refInstancedCoords;
+
for (int y = 0; y < frameHeight; y++)
{
const float yCoord = (float)(y / (0.5*frameHeight)) - 1.0f;
{
const float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f;
- if ((yCoord >= -0.6f && yCoord <= 0.3f && xCoord >= -0.3f && xCoord <= 0.6f))
+ if ((yCoord >= refInstancedCoords.bottom &&
+ yCoord <= refInstancedCoords.top &&
+ xCoord >= refInstancedCoords.left &&
+ xCoord <= refInstancedCoords.right))
referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), x, y);
}
}
ShaderMap shaderPaths;
shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetch.vert";
shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
+
addChild(new InstanceFactory<IndirectDraw>(m_testCtx, "indirect_draw_triangle_list", "Draws triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
addChild(new InstanceFactory<IndirectDraw>(m_testCtx, "indirect_draw_triangle_strip", "Draws triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchWithInstance.vert";
shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
+
addChild(new InstanceFactory<IndirectDrawInstanced>(m_testCtx, "indirect_draw_instanced_triangle_list", "Draws an instanced triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
addChild(new InstanceFactory<IndirectDrawInstanced>(m_testCtx, "indirect_draw_instanced_triangle_strip", "Draws an instanced triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
}
} // DrawTests
-} // vkt
\ No newline at end of file
+} // vkt
-#ifndef _VKTDRAWINDIRECTDRAWTESTS_HPP
-#define _VKTDRAWINDIRECTDRAWTESTS_HPP
+#ifndef _VKTDRAWINDIRECTTEST_HPP
+#define _VKTDRAWINDIRECTTEST_HPP
/*------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
class IndirectDrawTests : public tcu::TestCaseGroup
{
public:
- IndirectDrawTests (tcu::TestContext &testCtx);
- ~IndirectDrawTests (void);
- void init (void);
+ IndirectDrawTests (tcu::TestContext &testCtx);
+ ~IndirectDrawTests (void);
+ void init (void);
private:
- IndirectDrawTests (const IndirectDrawTests &other);
- IndirectDrawTests& operator=(const IndirectDrawTests &other);
+ IndirectDrawTests (const IndirectDrawTests &other);
+ IndirectDrawTests& operator= (const IndirectDrawTests &other);
};
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif // #define _VKTDRAWINDIRECTDRAWTESTS_HPP
+#endif // _VKTDRAWINDIRECTTEST_HPP
* \brief Simple Draw Tests
*//*--------------------------------------------------------------------*/
-#include "vktDrawsimpleTest.hpp"
+#include "vktDrawSimpleTest.hpp"
#include "vktTestCaseUtil.hpp"
#include "vktDrawTestCaseUtil.hpp"
#include "tcuResource.hpp"
#include "tcuImageCompare.hpp"
#include "tcuTextureUtil.hpp"
+#include "tcuRGBA.hpp"
#include "vkDefs.hpp"
namespace Draw
{
namespace
-{
+{
class SimpleDraw : public DrawTestsBaseClass
{
public:
- SimpleDraw (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology);
- virtual tcu::TestStatus iterate (void);
+ SimpleDraw (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology);
+ virtual tcu::TestStatus iterate (void);
};
class SimpleDrawInstanced : public SimpleDraw
{
public:
- SimpleDrawInstanced (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology);
- tcu::TestStatus SimpleDrawInstanced::iterate (void);
+ SimpleDrawInstanced (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology);
+ tcu::TestStatus iterate (void);
};
SimpleDraw::SimpleDraw (Context &context, ShaderMap shaders, vk::VkPrimitiveTopology topology)
switch (m_topology)
{
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
- m_data.push_back(Vec4RGBA(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
- m_data.push_back(Vec4RGBA(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), vec4Blue()));
- m_data.push_back(Vec4RGBA(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), vec4Blue()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, -0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( 0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -0.3f, 0.3f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
+ m_data.push_back(PositionColorVertex(tcu::Vec4( -1.0f, 1.0f, 1.0f, 1.0f), tcu::RGBA::blue().toVec()));
break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
break;
default:
+ DE_FATAL("Unknown topology");
break;
}
- DrawTestsBaseClass::initialize();
+ initialize();
}
tcu::TestStatus SimpleDraw::iterate (void)
const vk::VkDeviceSize vertexBufferOffset = 0;
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
- m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
+ m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
switch (m_topology)
{
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
m_vk.cmdDraw(*m_cmdBuffer, 6, 1, 2, 0);
break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
m_vk.cmdDraw(*m_cmdBuffer, 4, 1, 2, 0);
break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
break;
default:
+ DE_FATAL("Unknown topology");
break;
}
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- 1, // deUint32 commandBufferCount;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
&m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
// Validation
tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
+
referenceFrame.allocLevel(0);
const deInt32 frameWidth = referenceFrame.getWidth();
tcu::clear(referenceFrame.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ ReferenceImageCoordinates refCoords;
+
for (int y = 0; y < frameHeight; y++)
{
const float yCoord = (float)(y / (0.5*frameHeight)) - 1.0f;
{
const float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f;
- if ((yCoord >= -0.3f && yCoord <= 0.3f && xCoord >= -0.3f && xCoord <= 0.3f))
+ if ((yCoord >= refCoords.bottom &&
+ yCoord <= refCoords.top &&
+ xCoord >= refCoords.left &&
+ xCoord <= refCoords.right))
referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), x, y);
}
}
tcu::TestStatus SimpleDrawInstanced::iterate (void)
{
tcu::TestLog &log = m_context.getTestContext().getLog();
+
const vk::VkQueue queue = m_context.getUniversalQueue();
beginRenderPass();
const vk::VkDeviceSize vertexBufferOffset = 0;
const vk::VkBuffer vertexBuffer = m_vertexBuffer->object();
+
m_vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
m_vk.cmdBindPipeline(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
switch (m_topology)
{
- case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
- break;
- case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
m_vk.cmdDraw(*m_cmdBuffer, 6, 4, 2, 2);
break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
m_vk.cmdDraw(*m_cmdBuffer, 4, 4, 2, 2);
break;
+ case vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+ case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
- break;
case vk::VK_PRIMITIVE_TOPOLOGY_LAST:
+ DE_FATAL("Topology not implemented");
break;
default:
+ DE_FATAL("Unknown topology");
break;
}
{
vk::VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
- 0, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- 1, // deUint32 commandBufferCount;
+ 0, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ 1, // deUint32 commandBufferCount;
&m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
- 0, // deUint32 signalSemaphoreCount;
+ 0, // deUint32 signalSemaphoreCount;
DE_NULL // const VkSemaphore* pSignalSemaphores;
};
VK_CHECK(m_vk.queueSubmit(queue, 1, &submitInfo, DE_NULL));
VK_CHECK(m_vk.queueWaitIdle(queue));
tcu::Texture2D referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), (int)(0.5 + WIDTH), (int)(0.5 + HEIGHT));
+
referenceFrame.allocLevel(0);
const deInt32 frameWidth = referenceFrame.getWidth();
tcu::clear(referenceFrame.getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ ReferenceImageInstancedCoordinates refInstancedCoords;
+
for (int y = 0; y < frameHeight; y++)
{
const float yCoord = (float)(y / (0.5*frameHeight)) - 1.0f;
{
const float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f;
- if ((yCoord >= -0.6f && yCoord <= 0.3f && xCoord >= -0.3f && xCoord <= 0.6f))
+ if ((yCoord >= refInstancedCoords.bottom &&
+ yCoord <= refInstancedCoords.top &&
+ xCoord >= refInstancedCoords.left &&
+ xCoord <= refInstancedCoords.right))
referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f), x, y);
}
}
ShaderMap shaderPaths;
shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetch.vert";
shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
+
addChild(new InstanceFactory<SimpleDraw>(m_testCtx, "simple_draw_triangle_list", "Draws triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
addChild(new InstanceFactory<SimpleDraw>(m_testCtx, "simple_draw_triangle_strip", "Draws triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
shaderPaths[glu::SHADERTYPE_VERTEX] = "vulkan/draw/VertexFetchWithInstance.vert";
shaderPaths[glu::SHADERTYPE_FRAGMENT] = "vulkan/draw/VertexFetch.frag";
+
addChild(new InstanceFactory<SimpleDrawInstanced>(m_testCtx, "simple_draw_instanced_triangle_list", "Draws an instanced triangle list", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
addChild(new InstanceFactory<SimpleDrawInstanced>(m_testCtx, "simple_draw_instanced_triangle_strip", "Draws an instanced triangle strip", shaderPaths, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP));
}
} // DrawTests
-} // vkt
\ No newline at end of file
+} // vkt
-#ifndef _VKT_SIMPLE_DRAWTESTS_HPP
-#define _VKT_SIMPLE_DRAWTESTS_HPP
+#ifndef _VKTDRAWSIMPLETEST_HPP
+#define _VKTDRAWSIMPLETEST_HPP
/*------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
class SimpleDrawTests : public tcu::TestCaseGroup
{
public:
- SimpleDrawTests (tcu::TestContext &testCtx);
- ~SimpleDrawTests (void);
- void init (void);
+ SimpleDrawTests (tcu::TestContext &testCtx);
+ ~SimpleDrawTests (void);
+ void init (void);
private:
- SimpleDrawTests (const SimpleDrawTests &other);
- SimpleDrawTests& operator=(const SimpleDrawTests &other);
+ SimpleDrawTests (const SimpleDrawTests &other);
+ SimpleDrawTests& operator= (const SimpleDrawTests &other);
};
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif // #define _VKT_SIMPLE_DRAWTESTS_HPP
+#endif // _VKTDRAWSIMPLETEST_HPP
-#ifndef _VKTDRAWTESTS_TESTCASEUTIL_HPP
-#define _VKTDRAWTESTS_TESTCASEUTIL_HPP
+#ifndef _VKTDRAWTESTCASEUTIL_HPP
+#define _VKTDRAWTESTCASEUTIL_HPP
/*------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
namespace Draw
{
-class ShaderSourceProvider
+class ShaderSourceProvider
{
-public:
+public:
static std::string getSource (tcu::Archive& archive, const char* path)
{
tcu::Resource *resource = archive.getResource(path);
{
}
- TestInstance* createInstance (Context& context) const
- {
- return new Instance(context, m_shaderPaths, m_topology);
+ TestInstance* createInstance (Context& context) const
+ {
+ return new Instance(context, m_shaderPaths, m_topology);
}
virtual void initPrograms (vk::SourceCollections& programCollection) const
const vk::VkPrimitiveTopology m_topology;
};
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif //_VKTDRAWTESTS_TESTCASEUTIL_HPP
\ No newline at end of file
+#endif // _VKTDRAWTESTCASEUTIL_HPP
\ No newline at end of file
-#ifndef _VK_DRAWTESTS_HPP
-#define _VK_DRAWTESTS_HPP
+#ifndef _VKTDRAWTESTS_HPP
+#define _VKTDRAWTESTS_HPP
/*------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
namespace vkt
{
- namespace Draw
+namespace Draw
{
tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx);
-} //Draw
-} //vkt
+} // Draw
+} // vkt
-#endif // _VK_DRAWTESTS_HPP
+#endif // _VKTDRAWTESTS_HPP