From 271724cff305eb9f013d5587ef3f213ed7c9e28b Mon Sep 17 00:00:00 2001 From: Dae Kim Date: Tue, 29 Dec 2015 10:41:20 +0000 Subject: [PATCH] Various fixes for dynamic state tests. * Added location qualifier to vertex output variables. * Added missing initialization of flags in some CreateInfo structures. * Check if depth bounds test is supported. * Check if multi-viewport is supported. * Check if geometry shaders are supported. * Fixed reference image in lineWidth test. --- .../data/vulkan/dynamic_state/VertexFetch.frag | 9 ++++--- .../data/vulkan/dynamic_state/VertexFetch.vert | 5 ++-- .../data/vulkan/dynamic_state/ViewportArray.geom | 8 +++--- .../vktDynamicStateCreateInfoUtil.cpp | 29 ++++++++++++++++------ .../dynamic_state/vktDynamicStateDSTests.cpp | 17 +++++++------ .../dynamic_state/vktDynamicStateRSTests.cpp | 2 +- .../dynamic_state/vktDynamicStateVPTests.cpp | 11 ++++++++ 7 files changed, 56 insertions(+), 25 deletions(-) diff --git a/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.frag b/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.frag index 3741885..cf2b27c 100644 --- a/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.frag +++ b/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.frag @@ -1,7 +1,10 @@ -#version 400 -in vec4 in_color; +#version 310 es +precision highp float; + +layout(location = 0) in vec4 in_color; layout(location = 0) out vec4 out_color; + void main() { out_color = in_color; -} \ No newline at end of file +} diff --git a/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.vert b/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.vert index 1730f5f..2b97bd9 100644 --- a/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.vert +++ b/external/vulkancts/data/vulkan/dynamic_state/VertexFetch.vert @@ -1,4 +1,5 @@ -#version 430 +#version 310 es +precision highp float; layout(location = 0) in vec4 in_position; layout(location = 1) in vec4 in_color; @@ -8,4 +9,4 @@ layout(location = 0) out vec4 out_color; void main() { gl_Position = in_position; out_color = in_color; -} \ No newline at end of file +} diff --git a/external/vulkancts/data/vulkan/dynamic_state/ViewportArray.geom b/external/vulkancts/data/vulkan/dynamic_state/ViewportArray.geom index 64c8ffe..ebf6821 100644 --- a/external/vulkancts/data/vulkan/dynamic_state/ViewportArray.geom +++ b/external/vulkancts/data/vulkan/dynamic_state/ViewportArray.geom @@ -2,15 +2,15 @@ layout(triangles) in; layout(triangle_strip, max_vertices = 3) out; -layout(location = 1) in vec4 in_color[]; -layout(location = 1) out vec4 out_color; +layout(location = 0) in vec4 in_color[]; +layout(location = 0) out vec4 out_color; void main() { for (int i=0; i(m_setLayouts.size()); + flags = 0u; + setLayoutCount = static_cast(m_setLayouts.size()); if (setLayoutCount) { @@ -774,7 +776,8 @@ PipelineCreateInfo::TesselationState::TesselationState (deUint32 _patchControlPo { sType = vk::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; pNext = DE_NULL; - patchControlPoints = _patchControlPoints; + flags = 0u; + patchControlPoints = _patchControlPoints; } PipelineCreateInfo::ViewportState::ViewportState (deUint32 _viewportCount, @@ -815,6 +818,7 @@ PipelineCreateInfo::ViewportState::ViewportState (const ViewportState& other) { sType = other.sType; pNext = other.pNext; + flags = other.flags; viewportCount = other.viewportCount; scissorCount = other.scissorCount; @@ -829,6 +833,7 @@ PipelineCreateInfo::ViewportState& PipelineCreateInfo::ViewportState::operator= { sType = other.sType; pNext = other.pNext; + flags = other.flags; viewportCount = other.viewportCount; scissorCount = other.scissorCount; @@ -890,6 +895,7 @@ PipelineCreateInfo::MultiSampleState::MultiSampleState (const MultiSampleState& { sType = other.sType; pNext = other.pNext; + flags = other.flags; rasterizationSamples = other.rasterizationSamples; sampleShadingEnable = other.sampleShadingEnable; minSampleShading = other.minSampleShading; @@ -904,6 +910,7 @@ PipelineCreateInfo::MultiSampleState& PipelineCreateInfo::MultiSampleState::oper { sType = other.sType; pNext = other.pNext; + flags = other.flags; rasterizationSamples = other.rasterizationSamples; sampleShadingEnable = other.sampleShadingEnable; minSampleShading = other.minSampleShading; @@ -938,6 +945,7 @@ PipelineCreateInfo::ColorBlendState::ColorBlendState (deUint32 _attach { sType = vk::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; pNext = DE_NULL; + flags = 0u; logicOpEnable = _logicOpEnable; logicOp = _logicOp; attachmentCount = static_cast(m_attachments.size()); @@ -949,6 +957,7 @@ PipelineCreateInfo::ColorBlendState::ColorBlendState (const vk::VkPipelineColorB { sType = createInfo.sType; pNext = createInfo.pNext; + flags = createInfo.flags; logicOpEnable = createInfo.logicOpEnable; logicOp = createInfo.logicOp; attachmentCount = static_cast(m_attachments.size()); @@ -960,6 +969,7 @@ PipelineCreateInfo::ColorBlendState::ColorBlendState (const ColorBlendState& cre { sType = createInfo.sType; pNext = createInfo.pNext; + flags = createInfo.flags; logicOpEnable = createInfo.logicOpEnable; logicOp = createInfo.logicOp; attachmentCount = static_cast(m_attachments.size()); @@ -1033,6 +1043,7 @@ PipelineCreateInfo::DynamicState::DynamicState (const std::vector(m_vertexBuffer->getBoundMemory().getHostPtr()); - deMemcpy(ptr, &m_data[0], dataSize); + deMemcpy(ptr, &m_data[0], (size_t)dataSize); vk::flushMappedMemoryRange(m_vk, device, m_vertexBuffer->getBoundMemory().getMemory(), @@ -403,6 +403,15 @@ public: m_depthStencilState_1 = PipelineCreateInfo::DepthStencilState( vk::VK_TRUE, vk::VK_TRUE, vk::VK_COMPARE_OP_ALWAYS, vk::VK_FALSE); + + // Check if depth bounds test is supported + { + const vk::VkPhysicalDeviceFeatures& deviceFeatures = m_context.getDeviceFeatures(); + + if (!deviceFeatures.depthBounds) + throw tcu::NotSupportedError("Depth bounds test is unsupported"); + } + // enable depth bounds test m_depthStencilState_2 = PipelineCreateInfo::DepthStencilState( vk::VK_FALSE, vk::VK_FALSE, vk::VK_COMPARE_OP_NEVER, vk::VK_TRUE); @@ -412,12 +421,6 @@ public: virtual tcu::TestStatus iterate (void) { - vk::VkPhysicalDeviceFeatures features; - m_context.getInstanceInterface().getPhysicalDeviceFeatures(m_context.getPhysicalDevice(), &features); - - if (!features.depthBounds) - return tcu::TestStatus(QP_TEST_RESULT_NOT_SUPPORTED, "depthBounds Vulkan feature is not supported"); - tcu::TestLog &log = m_context.getTestContext().getLog(); const vk::VkQueue queue = m_context.getUniversalQueue(); diff --git a/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp b/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp index 9d95159..2447b56 100644 --- a/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp +++ b/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp @@ -641,7 +641,7 @@ public: for (int x = 0; x < frameWidth; x++) { float xCoord = (float)(x / (0.5*frameWidth)) - 1.0f; - float lineHalfWidth = (1.0f / (float)deFloor(deviceProperties.limits.lineWidthRange[1])) * 0.5f; + float lineHalfWidth = (float)(deFloor(deviceProperties.limits.lineWidthRange[1]) / frameHeight); if (xCoord >= -1.0f && xCoord <= 1.0f && yCoord >= -lineHalfWidth && yCoord <= lineHalfWidth) referenceFrame.getLevel(0).setPixel(tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f), x, y); diff --git a/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateVPTests.cpp b/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateVPTests.cpp index 0d834fc..acfdbc0 100644 --- a/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateVPTests.cpp +++ b/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateVPTests.cpp @@ -255,6 +255,17 @@ public: virtual void initPipeline (const vk::VkDevice device) { + // Check geometry shader support + { + const vk::VkPhysicalDeviceFeatures& deviceFeatures = m_context.getDeviceFeatures(); + + if (!deviceFeatures.multiViewport) + throw tcu::NotSupportedError("Multi-viewport is not supported"); + + if (!deviceFeatures.geometryShader) + throw tcu::NotSupportedError("Geometry shaders are not supported"); + } + const vk::Unique vs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_vertexShaderName), 0)); const vk::Unique gs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_geometryShaderName), 0)); const vk::Unique fs(createShaderModule(m_vk, device, m_context.getBinaryCollection().get(m_fragmentShaderName), 0)); -- 2.7.4