10ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos#ifndef _VKTYPEUTIL_HPP 20ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos#define _VKTYPEUTIL_HPP 30ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos/*------------------------------------------------------------------------- 40ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * Vulkan CTS Framework 50ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * -------------------- 60ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * 70ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * Copyright (c) 2015 Google Inc. 80ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * 9978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * Licensed under the Apache License, Version 2.0 (the "License"); 10978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * you may not use this file except in compliance with the License. 11978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * You may obtain a copy of the License at 120ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * 13978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * http://www.apache.org/licenses/LICENSE-2.0 140ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * 15978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * Unless required by applicable law or agreed to in writing, software 16978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * distributed under the License is distributed on an "AS IS" BASIS, 17978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * See the License for the specific language governing permissions and 19978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * limitations under the License. 200ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * 210ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos *//*! 220ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * \file 230ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos * \brief Utilities for creating commonly used composite types. 240ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos *//*--------------------------------------------------------------------*/ 250ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 260ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos#include "vkDefs.hpp" 2768e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos#include "tcuVector.hpp" 280ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 290ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulosnamespace vk 300ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos{ 310ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 320ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos#include "vkTypeUtil.inl" 330ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 340ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulosinline VkClearValue makeClearValueColorF32 (float r, float g, float b, float a) 350ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos{ 360ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos VkClearValue v; 373d2071b82061ee418aa87064333069281133eddaPyry Haulos v.color.float32[0] = r; 383d2071b82061ee418aa87064333069281133eddaPyry Haulos v.color.float32[1] = g; 393d2071b82061ee418aa87064333069281133eddaPyry Haulos v.color.float32[2] = b; 403d2071b82061ee418aa87064333069281133eddaPyry Haulos v.color.float32[3] = a; 410ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos return v; 420ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos} 430ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 44a7d993643d59be88684d97427e386e8ee350e12fPeter Siketinline VkClearValue makeClearValueColorU32 (deUint32 r, deUint32 g, deUint32 b, deUint32 a) 45a7d993643d59be88684d97427e386e8ee350e12fPeter Siket{ 46a7d993643d59be88684d97427e386e8ee350e12fPeter Siket VkClearValue v; 47a7d993643d59be88684d97427e386e8ee350e12fPeter Siket v.color.uint32[0] = r; 48a7d993643d59be88684d97427e386e8ee350e12fPeter Siket v.color.uint32[1] = g; 49a7d993643d59be88684d97427e386e8ee350e12fPeter Siket v.color.uint32[2] = b; 50a7d993643d59be88684d97427e386e8ee350e12fPeter Siket v.color.uint32[3] = a; 51a7d993643d59be88684d97427e386e8ee350e12fPeter Siket return v; 52a7d993643d59be88684d97427e386e8ee350e12fPeter Siket} 53a7d993643d59be88684d97427e386e8ee350e12fPeter Siket 5468e7282426d639b54d15c4710d97ba97e72c76efPyry Haulosinline VkClearValue makeClearValueColor (const tcu::Vec4& color) 550ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos{ 5668e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos VkClearValue v; 5768e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.color.float32[0] = color[0]; 5868e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.color.float32[1] = color[1]; 5968e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.color.float32[2] = color[2]; 6068e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.color.float32[3] = color[3]; 6168e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos return v; 6268e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos} 6368e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos 6468e7282426d639b54d15c4710d97ba97e72c76efPyry Haulosinline VkClearValue makeClearValueDepthStencil (float depth, deUint32 stencil) 6568e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos{ 6668e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos VkClearValue v; 6768e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.depthStencil.depth = depth; 6868e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.depthStencil.stencil = stencil; 6968e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos return v; 7068e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos} 7168e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos 7268e7282426d639b54d15c4710d97ba97e72c76efPyry Haulosinline VkClearValue makeClearValue (VkClearColorValue color) 7368e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos{ 7468e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos VkClearValue v; 7568e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos v.color = color; 7668e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos return v; 7768e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos} 7868e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos 7968e7282426d639b54d15c4710d97ba97e72c76efPyry Haulosinline VkComponentMapping makeComponentMappingRGBA (void) 8068e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos{ 8168e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos return makeComponentMapping(VK_COMPONENT_SWIZZLE_R, 8268e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos VK_COMPONENT_SWIZZLE_G, 8368e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos VK_COMPONENT_SWIZZLE_B, 8468e7282426d639b54d15c4710d97ba97e72c76efPyry Haulos VK_COMPONENT_SWIZZLE_A); 850ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos} 860ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 87dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantochinline VkExtent3D makeExtent3D(const tcu::IVec3& vec) 88dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch{ 89dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch return makeExtent3D((deUint32)vec.x(), (deUint32)vec.y(), (deUint32)vec.z()); 90dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch} 91dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch 92dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantochinline VkExtent3D makeExtent3D(const tcu::UVec3& vec) 93dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch{ 94dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch return makeExtent3D(vec.x(), vec.y(), vec.z()); 95dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch} 96dcfd57cba8ed2d848b64b07047a3a8cce23a68a2Kantoch 970ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos} // vk 980ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos 990ae6069583c8d178964c87b1e321d8e9448bd197Pyry Haulos#endif // _VKTYPEUTIL_HPP 100