void DrawTestsBaseClass::initialize (void)
{
	const vk::VkDevice device				= m_context.getDevice();
	const deUint32 queueFamilyIndex			= m_context.getUniversalQueueFamilyIndex();

	const PipelineLayoutCreateInfo pipelineLayoutCreateInfo;
	m_pipelineLayout						= vk::createPipelineLayout(m_vk, device, &pipelineLayoutCreateInfo);

	const vk::VkExtent3D targetImageExtent	= { WIDTH, HEIGHT, 1 };
	const ImageCreateInfo targetImageCreateInfo(vk::VK_IMAGE_TYPE_2D, m_colorAttachmentFormat, targetImageExtent, 1, 1, vk::VK_SAMPLE_COUNT_1_BIT,
		vk::VK_IMAGE_TILING_OPTIMAL, vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT | vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);

	m_colorTargetImage						= Image::createAndAlloc(m_vk, device, targetImageCreateInfo, m_context.getDefaultAllocator(), m_context.getUniversalQueueFamilyIndex());

	const ImageViewCreateInfo colorTargetViewInfo(m_colorTargetImage->object(), vk::VK_IMAGE_VIEW_TYPE_2D, m_colorAttachmentFormat);
	m_colorTargetView						= vk::createImageView(m_vk, device, &colorTargetViewInfo);

	RenderPassCreateInfo renderPassCreateInfo;
	renderPassCreateInfo.addAttachment(AttachmentDescription(m_colorAttachmentFormat,
															 vk::VK_SAMPLE_COUNT_1_BIT,
															 vk::VK_ATTACHMENT_LOAD_OP_LOAD,
															 vk::VK_ATTACHMENT_STORE_OP_STORE,
															 vk::VK_ATTACHMENT_LOAD_OP_DONT_CARE,
															 vk::VK_ATTACHMENT_STORE_OP_STORE,
															 vk::VK_IMAGE_LAYOUT_GENERAL,
															 vk::VK_IMAGE_LAYOUT_GENERAL));


	const vk::VkAttachmentReference colorAttachmentReference =
	{
		0,
		vk::VK_IMAGE_LAYOUT_GENERAL
	};

	renderPassCreateInfo.addSubpass(SubpassDescription(vk::VK_PIPELINE_BIND_POINT_GRAPHICS,
													   0,
													   0,
													   DE_NULL,
													   1,
													   &colorAttachmentReference,
													   DE_NULL,
													   AttachmentReference(),
													   0,
													   DE_NULL));

	m_renderPass		= vk::createRenderPass(m_vk, device, &renderPassCreateInfo);

	std::vector<vk::VkImageView> colorAttachments(1);
	colorAttachments[0] = *m_colorTargetView;

	const FramebufferCreateInfo framebufferCreateInfo(*m_renderPass, colorAttachments, WIDTH, HEIGHT, 1);

	m_framebuffer		= vk::createFramebuffer(m_vk, device, &framebufferCreateInfo);

	const vk::VkVertexInputBindingDescription vertexInputBindingDescription =
	{
		0,
		sizeof(VertexElementData),
		vk::VK_VERTEX_INPUT_RATE_VERTEX,
	};

	const vk::VkVertexInputAttributeDescription vertexInputAttributeDescriptions[] =
	{
		{
			0u,
			0u,
			vk::VK_FORMAT_R32G32B32A32_SFLOAT,
			0u
		},	// VertexElementData::position
		{
			1u,
			0u,
			vk::VK_FORMAT_R32G32B32A32_SFLOAT,
			static_cast<deUint32>(sizeof(tcu::Vec4))
		},  // VertexElementData::color
		{
			2u,
			0u,
			vk::VK_FORMAT_R32_SINT,
			static_cast<deUint32>(sizeof(tcu::Vec4)) * 2
		}   // VertexElementData::refVertexIndex
	};

	m_vertexInputState = PipelineCreateInfo::VertexInputState(1,
															  &vertexInputBindingDescription,
															  DE_LENGTH_OF_ARRAY(vertexInputAttributeDescriptions),
															  vertexInputAttributeDescriptions);

	const vk::VkDeviceSize dataSize = m_data.size() * sizeof(VertexElementData);
	m_vertexBuffer = Buffer::createAndAlloc(m_vk, device, BufferCreateInfo(dataSize,
		vk::VK_BUFFER_USAGE_VERTEX_BUFFER_BIT), m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);

	deUint8* ptr = reinterpret_cast<deUint8*>(m_vertexBuffer->getBoundMemory().getHostPtr());
	deMemcpy(ptr, &m_data[0], static_cast<size_t>(dataSize));

	vk::flushMappedMemoryRange(m_vk,
							   device,
							   m_vertexBuffer->getBoundMemory().getMemory(),
							   m_vertexBuffer->getBoundMemory().getOffset(),
							   dataSize);

	const CmdPoolCreateInfo cmdPoolCreateInfo(queueFamilyIndex);
	m_cmdPool	= vk::createCommandPool(m_vk, device, &cmdPoolCreateInfo);
	m_cmdBuffer	= vk::allocateCommandBuffer(m_vk, device, *m_cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY);

	initPipeline(device);
}
void FramebufferImpl::updateFramebufferDesc() const
{
    std::vector<GLFramebufferDesc::ColorAttachment> colorAttachments(m_renderTargets.size());

    Assert(m_renderTargets.size() > 0 || m_depthTarget.engaged(), "");

    for (auto rt = 0u; rt < m_renderTargets.size(); rt++)
    {
        if (m_renderTargets[rt].engaged())
        {
            auto glName = m_renderTargets[rt].get().m_texture->glName;

            if (glName == 0)
            {
                m_renderTargets[rt].get().m_texture->allocate();
                glName = m_renderTargets[rt].get().m_texture->glName;
            }

            colorAttachments[rt].glName = glName;

            Assert(m_renderTargets[rt].get().m_texture.get(), "");

            if (m_renderTargets[rt].get().m_texture->numFaces == 1)
            {
                colorAttachments[rt].target = gl::GL_TEXTURE_2D;
            }
            else
            {
                Assert(m_renderTargets[rt].get().m_texture->numFaces == 6, "");

                /*
                    TODO
                        This is duplicated in TextureUploadExecution!
                */
                static gl::GLenum targets[] =
                {
                    gl::GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
                    gl::GL_TEXTURE_CUBE_MAP_POSITIVE_X,
                    gl::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
                    gl::GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
                    gl::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
                    gl::GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
                };

                colorAttachments[rt].target = targets[m_renderTargets[rt].get().face()];
            }
        }
    }

    GLFramebufferDesc::DepthAttachment depthAttachment;
    gl::GLuint glName;

    if (m_depthTarget.engaged())
    {
        if (m_depthTarget.get().m_texture->glName == 0)
        {
            m_depthTarget.get().m_texture->allocate();
        }
        glName = m_depthTarget.get().m_texture->glName;
    }
    else
    {
        glName = 0;
    }

    depthAttachment.glName = glName;

    m_glFramebufferDesc.reset(GLFramebufferDesc(colorAttachments, depthAttachment));
}