瀏覽代碼

Vulkan: Adding workarounds and fixes

Panagiotis Christopoulos Charitos 9 年之前
父節點
當前提交
1e1043b964

+ 6 - 2
shaders/FsCommonFrag.glsl

@@ -156,7 +156,9 @@ vec3 computeLightColor(vec3 diffCol)
 	uint count = u_lightIndices[idxOffset++];
 	uint count = u_lightIndices[idxOffset++];
 	while(count-- != 0)
 	while(count-- != 0)
 	{
 	{
-		PointLight light = u_pointLights[u_lightIndices[idxOffset++]];
+		PointLight light;
+		COPY_POINT_LIGHT(u_pointLights[u_lightIndices[idxOffset]], light);
+		++idxOffset;
 
 
 		vec3 diffC =
 		vec3 diffC =
 			computeDiffuseColor(diffCol, light.diffuseColorShadowmapId.rgb);
 			computeDiffuseColor(diffCol, light.diffuseColorShadowmapId.rgb);
@@ -186,7 +188,9 @@ vec3 computeLightColor(vec3 diffCol)
 	count = u_lightIndices[idxOffset++];
 	count = u_lightIndices[idxOffset++];
 	while(count-- != 0)
 	while(count-- != 0)
 	{
 	{
-		SpotLight light = u_spotLights[u_lightIndices[idxOffset++]];
+		SpotLight light;
+		COPY_SPOT_LIGHT(u_spotLights[u_lightIndices[idxOffset]], light);
+		++idxOffset;
 
 
 		vec3 diffC =
 		vec3 diffC =
 			computeDiffuseColor(diffCol, light.diffuseColorShadowmapId.rgb);
 			computeDiffuseColor(diffCol, light.diffuseColorShadowmapId.rgb);

+ 10 - 3
shaders/Is.frag.glsl

@@ -84,7 +84,10 @@ void readIndirect(in uint idxOffset,
 	uint count = u_lightIndices[idxOffset++];
 	uint count = u_lightIndices[idxOffset++];
 	while(count-- != 0)
 	while(count-- != 0)
 	{
 	{
-		ReflectionProbe probe = u_reflectionProbes[u_lightIndices[idxOffset++]];
+		ReflectionProbe probe;
+		COPY_REFLECTION_PROBE(
+			u_reflectionProbes[u_lightIndices[idxOffset]], probe);
+		++idxOffset;
 
 
 		float R2 = probe.positionRadiusSq.w;
 		float R2 = probe.positionRadiusSq.w;
 		vec3 center = probe.positionRadiusSq.xyz;
 		vec3 center = probe.positionRadiusSq.xyz;
@@ -173,7 +176,9 @@ void main()
 	uint count = u_lightIndices[idxOffset++];
 	uint count = u_lightIndices[idxOffset++];
 	while(count-- != 0)
 	while(count-- != 0)
 	{
 	{
-		PointLight light = u_pointLights[u_lightIndices[idxOffset++]];
+		PointLight light;
+		COPY_POINT_LIGHT(u_pointLights[u_lightIndices[idxOffset]], light);
+		++idxOffset;
 
 
 		LIGHTING_COMMON_BRDF();
 		LIGHTING_COMMON_BRDF();
 
 
@@ -198,7 +203,9 @@ void main()
 	count = u_lightIndices[idxOffset++];
 	count = u_lightIndices[idxOffset++];
 	while(count-- != 0)
 	while(count-- != 0)
 	{
 	{
-		SpotLight light = u_spotLights[u_lightIndices[idxOffset++]];
+		SpotLight light;
+		COPY_SPOT_LIGHT(u_spotLights[u_lightIndices[idxOffset]], light);
+		++idxOffset;
 
 
 		LIGHTING_COMMON_BRDF();
 		LIGHTING_COMMON_BRDF();
 
 

+ 20 - 0
shaders/IsFsCommon.glsl

@@ -27,6 +27,12 @@ struct PointLight
 	vec4 specularColorTexId; // xyz: spec color, w: diffuse tex ID
 	vec4 specularColorTexId; // xyz: spec color, w: diffuse tex ID
 };
 };
 
 
+// WORKAROUND: See glslang issue 304
+#define COPY_POINT_LIGHT(src_, dst_)                                           \
+	dst_.posRadius = src_.posRadius;                                           \
+	dst_.diffuseColorShadowmapId = src_.diffuseColorShadowmapId;               \
+	dst_.specularColorTexId = src_.specularColorTexId
+
 // Spot light
 // Spot light
 struct SpotLight
 struct SpotLight
 {
 {
@@ -38,6 +44,15 @@ struct SpotLight
 	mat4 texProjectionMat;
 	mat4 texProjectionMat;
 };
 };
 
 
+// WORKAROUND: See glslang issue 304
+#define COPY_SPOT_LIGHT(src_, dst_)                                            \
+	dst_.posRadius = src_.posRadius;                                           \
+	dst_.diffuseColorShadowmapId = src_.diffuseColorShadowmapId;               \
+	dst_.specularColorTexId = src_.specularColorTexId;                         \
+	dst_.lightDir = src_.lightDir;                                             \
+	dst_.outerCosInnerCos = src_.outerCosInnerCos;                             \
+	dst_.texProjectionMat = src_.texProjectionMat
+
 // Representation of a reflection probe
 // Representation of a reflection probe
 struct ReflectionProbe
 struct ReflectionProbe
 {
 {
@@ -48,6 +63,11 @@ struct ReflectionProbe
 	vec4 cubemapIndexPad3;
 	vec4 cubemapIndexPad3;
 };
 };
 
 
+// WORKAROUND: See glslang issue 304
+#define COPY_REFLECTION_PROBE(src_, dst_)                                      \
+	dst_.positionRadiusSq = src_.positionRadiusSq;                             \
+	dst_.cubemapIndexPad3.x = src_.cubemapIndexPad3.x
+
 layout(ANKI_UBO_BINDING(LIGHT_SET, LIGHT_UBO_BINDING),
 layout(ANKI_UBO_BINDING(LIGHT_SET, LIGHT_UBO_BINDING),
 	std140,
 	std140,
 	row_major) uniform u0_
 	row_major) uniform u0_

+ 8 - 1
shaders/LfSpritePass.vert.glsl

@@ -15,6 +15,12 @@ struct Sprite
 	vec4 depthPad3;
 	vec4 depthPad3;
 };
 };
 
 
+// WORKAROUND: See glslang issue 304
+#define COPY_SPRITE(src_, dst_)                                                \
+	dst_.posScale = src_.posScale;                                             \
+	dst_.color = src_.color;                                                   \
+	dst_.depthPad3.x = src_.depthPad3.x
+
 // The block contains data for all flares
 // The block contains data for all flares
 layout(std140, ANKI_UBO_BINDING(0, 0)) uniform _blk
 layout(std140, ANKI_UBO_BINDING(0, 0)) uniform _blk
 {
 {
@@ -36,7 +42,8 @@ void main()
 
 
 	vec2 position = POSITIONS[gl_VertexID];
 	vec2 position = POSITIONS[gl_VertexID];
 
 
-	Sprite sprite = u_sprites[gl_InstanceID];
+	Sprite sprite;
+	COPY_SPRITE(u_sprites[gl_InstanceID], sprite);
 
 
 	// Write tex coords of the 2D array texture
 	// Write tex coords of the 2D array texture
 	out_uv = vec3((position * 0.5) + 0.5, sprite.depthPad3.x);
 	out_uv = vec3((position * 0.5) + 0.5, sprite.depthPad3.x);

+ 3 - 5
src/anki/gr/Enums.h

@@ -120,6 +120,7 @@ enum class ComponentFormat : U8
 	// Special
 	// Special
 	R10G10B10A2,
 	R10G10B10A2,
 	R11G11B10,
 	R11G11B10,
+	DEFAULT_FRAMEBUFFER,
 
 
 	// Compressed
 	// Compressed
 	R8G8B8_S3TC, ///< DXT1
 	R8G8B8_S3TC, ///< DXT1
@@ -264,16 +265,14 @@ class PixelFormat
 public:
 public:
 	ComponentFormat m_components = ComponentFormat::NONE;
 	ComponentFormat m_components = ComponentFormat::NONE;
 	TransformFormat m_transform = TransformFormat::NONE;
 	TransformFormat m_transform = TransformFormat::NONE;
-	Bool8 m_srgb = false;
 
 
 	PixelFormat() = default;
 	PixelFormat() = default;
 
 
 	PixelFormat(const PixelFormat&) = default;
 	PixelFormat(const PixelFormat&) = default;
 
 
-	PixelFormat(ComponentFormat cf, TransformFormat tf, Bool srgb = false)
+	PixelFormat(ComponentFormat cf, TransformFormat tf)
 		: m_components(cf)
 		: m_components(cf)
 		, m_transform(tf)
 		, m_transform(tf)
-		, m_srgb(srgb)
 	{
 	{
 	}
 	}
 
 
@@ -281,8 +280,7 @@ public:
 
 
 	Bool operator==(const PixelFormat& b) const
 	Bool operator==(const PixelFormat& b) const
 	{
 	{
-		return m_components == b.m_components && m_transform == b.m_transform
-			&& m_srgb == b.m_srgb;
+		return m_components == b.m_components && m_transform == b.m_transform;
 	}
 	}
 
 
 	Bool operator!=(const PixelFormat& b) const
 	Bool operator!=(const PixelFormat& b) const

+ 0 - 3
src/anki/gr/Pipeline.h

@@ -81,7 +81,6 @@ public:
 class ColorAttachmentStateInfo
 class ColorAttachmentStateInfo
 {
 {
 public:
 public:
-	/// Ignored if ColorStateInfo::m_drawsToDefaultFramebuffer is true.
 	PixelFormat m_format;
 	PixelFormat m_format;
 
 
 	BlendMethod m_srcBlendMethod = BlendMethod::ONE;
 	BlendMethod m_srcBlendMethod = BlendMethod::ONE;
@@ -96,8 +95,6 @@ public:
 	Bool8 m_alphaToCoverageEnabled = false;
 	Bool8 m_alphaToCoverageEnabled = false;
 	U8 m_attachmentCount = 0;
 	U8 m_attachmentCount = 0;
 	Array<ColorAttachmentStateInfo, MAX_COLOR_ATTACHMENTS> m_attachments;
 	Array<ColorAttachmentStateInfo, MAX_COLOR_ATTACHMENTS> m_attachments;
-
-	Bool8 m_drawsToDefaultFramebuffer = false;
 };
 };
 
 
 enum class PipelineSubStateBit : U16
 enum class PipelineSubStateBit : U16

+ 0 - 1
src/anki/gr/gl/PipelineImpl.cpp

@@ -249,7 +249,6 @@ void PipelineImpl::initVertexState()
 	for(U i = 0; i < m_in.m_vertex.m_attributeCount; ++i)
 	for(U i = 0; i < m_in.m_vertex.m_attributeCount; ++i)
 	{
 	{
 		const VertexAttributeBinding& binding = m_in.m_vertex.m_attributes[i];
 		const VertexAttributeBinding& binding = m_in.m_vertex.m_attributes[i];
-		ANKI_ASSERT(binding.m_format.m_srgb == false);
 		Attribute& cache = m_cache.m_attribs[i];
 		Attribute& cache = m_cache.m_attribs[i];
 
 
 		// Component count
 		// Component count

+ 1 - 2
src/anki/gr/gl/TextureImpl.cpp

@@ -63,8 +63,7 @@ static void convertTextureInformation(const PixelFormat& pf,
 	{
 	{
 #if ANKI_GL == ANKI_GL_DESKTOP
 #if ANKI_GL == ANKI_GL_DESKTOP
 	case ComponentFormat::R8G8B8_S3TC:
 	case ComponentFormat::R8G8B8_S3TC:
-		format = pf.m_srgb ? GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
-						   : GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+		format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
 		internalFormat = format;
 		internalFormat = format;
 		type = GL_UNSIGNED_BYTE;
 		type = GL_UNSIGNED_BYTE;
 		break;
 		break;

+ 3 - 0
src/anki/gr/vulkan/Common.cpp

@@ -268,6 +268,8 @@ const U CONVERT_FORMAT_TABLE_SIZE =
 
 
 VkFormat convertFormat(PixelFormat ak)
 VkFormat convertFormat(PixelFormat ak)
 {
 {
+	ANKI_ASSERT(ak != PixelFormat());
+
 	VkFormat out = VK_FORMAT_UNDEFINED;
 	VkFormat out = VK_FORMAT_UNDEFINED;
 	for(U i = 0; i < CONVERT_FORMAT_TABLE_SIZE; ++i)
 	for(U i = 0; i < CONVERT_FORMAT_TABLE_SIZE; ++i)
 	{
 	{
@@ -275,6 +277,7 @@ VkFormat convertFormat(PixelFormat ak)
 		if(ak == entry.m_ak)
 		if(ak == entry.m_ak)
 		{
 		{
 			out = entry.m_vk;
 			out = entry.m_vk;
+			break;
 		}
 		}
 	}
 	}
 
 

+ 92 - 80
src/anki/gr/vulkan/CompatibleRenderPassCreator.cpp

@@ -48,98 +48,110 @@ VkRenderPass CompatibleRenderPassCreator::getOrCreateCompatibleRenderPass(
 	else
 	else
 	{
 	{
 		// Not found, create one
 		// Not found, create one
-		VkRenderPassCreateInfo ci = {};
-		ci.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+		VkRenderPass rpass = createNewRenderPass(init);
 
 
-		Array<VkAttachmentDescription, MAX_COLOR_ATTACHMENTS + 1>
-			attachmentDescriptions;
-		memset(&attachmentDescriptions[0], 0, sizeof(attachmentDescriptions));
+		m_hashmap.pushBack(m_manager->getAllocator(), key, rpass);
+		out = rpass;
+	}
 
 
-		Array<VkAttachmentReference, MAX_COLOR_ATTACHMENTS> references;
-		memset(&references[0], 0, sizeof(references));
+	ANKI_ASSERT(out);
+	return out;
+}
 
 
-		for(U i = 0; i < init.m_color.m_attachmentCount; ++i)
-		{
-			// We only care about samples and format
-
-			// Workaround unsupported formats
-			VkFormat fmt;
-			if(init.m_color.m_attachments[i].m_format.m_components
-					== ComponentFormat::R8G8B8
-				&& !m_manager->getR8g8b8ImagesSupported())
-			{
-				PixelFormat newFmt = init.m_color.m_attachments[i].m_format;
-				newFmt.m_components = ComponentFormat::R8G8B8A8;
-				fmt = convertFormat(newFmt);
-			}
-			else
-			{
-				fmt = convertFormat(init.m_color.m_attachments[i].m_format);
-			}
-
-			VkAttachmentDescription& desc = attachmentDescriptions[i];
-			desc.format = (!init.m_color.m_drawsToDefaultFramebuffer)
-				? fmt
-				: m_manager->getDefaultFramebufferSurfaceFormat();
-			desc.samples = VK_SAMPLE_COUNT_1_BIT;
-			desc.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
-			desc.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
-			desc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
-			desc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
-			desc.initialLayout = VK_IMAGE_LAYOUT_GENERAL;
-			desc.finalLayout = VK_IMAGE_LAYOUT_GENERAL;
-
-			references[i].attachment = i;
-			references[i].layout = VK_IMAGE_LAYOUT_GENERAL;
-		}
+//==============================================================================
+VkRenderPass CompatibleRenderPassCreator::createNewRenderPass(
+	const PipelineInitInfo& init)
+{
+	VkRenderPassCreateInfo ci = {};
+	ci.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+
+	Array<VkAttachmentDescription, MAX_COLOR_ATTACHMENTS + 1>
+		attachmentDescriptions;
+	memset(&attachmentDescriptions[0], 0, sizeof(attachmentDescriptions));
 
 
-		ci.attachmentCount = init.m_color.m_attachmentCount;
+	Array<VkAttachmentReference, MAX_COLOR_ATTACHMENTS> references;
+	memset(&references[0], 0, sizeof(references));
+
+	for(U i = 0; i < init.m_color.m_attachmentCount; ++i)
+	{
+		// We only care about samples and format
 
 
-		Bool hasDepthStencil =
-			init.m_depthStencil.m_format.m_components != ComponentFormat::NONE;
-		VkAttachmentReference dsReference = {0, VK_IMAGE_LAYOUT_GENERAL};
-		if(hasDepthStencil)
+		// Workaround unsupported formats
+		VkFormat fmt;
+		if(init.m_color.m_attachments[i].m_format.m_components
+				== ComponentFormat::R8G8B8
+			&& !m_manager->getR8g8b8ImagesSupported())
 		{
 		{
-			VkAttachmentDescription& desc =
-				attachmentDescriptions[ci.attachmentCount];
-			desc.format = convertFormat(init.m_depthStencil.m_format);
-			desc.samples = VK_SAMPLE_COUNT_1_BIT;
-			desc.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
-			desc.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
-			desc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
-			desc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
-			desc.initialLayout = VK_IMAGE_LAYOUT_GENERAL;
-			desc.finalLayout = VK_IMAGE_LAYOUT_GENERAL;
-
-			dsReference.attachment = ci.attachmentCount;
-			dsReference.layout = VK_IMAGE_LAYOUT_GENERAL;
-
-			++ci.attachmentCount;
+			PixelFormat newFmt = init.m_color.m_attachments[i].m_format;
+			newFmt.m_components = ComponentFormat::R8G8B8A8;
+			fmt = convertFormat(newFmt);
+		}
+		else if(init.m_color.m_attachments[i].m_format.m_components
+			== ComponentFormat::DEFAULT_FRAMEBUFFER)
+		{
+			// Default FB
+			fmt = m_manager->getDefaultFramebufferSurfaceFormat();
+		}
+		else
+		{
+			fmt = convertFormat(init.m_color.m_attachments[i].m_format);
 		}
 		}
 
 
-		VkSubpassDescription desc = {};
-		desc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
-		desc.colorAttachmentCount = init.m_color.m_attachmentCount;
-		desc.pColorAttachments =
-			(init.m_color.m_attachmentCount) ? &references[0] : nullptr;
-		desc.pDepthStencilAttachment =
-			(hasDepthStencil) ? &dsReference : nullptr;
-
-		ANKI_ASSERT(ci.attachmentCount);
-		ci.pAttachments = &attachmentDescriptions[0];
-		ci.subpassCount = 1;
-		ci.pSubpasses = &desc;
+		VkAttachmentDescription& desc = attachmentDescriptions[i];
+		desc.format = fmt;
+		desc.samples = VK_SAMPLE_COUNT_1_BIT;
+		desc.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+		desc.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+		desc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+		desc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+		desc.initialLayout = VK_IMAGE_LAYOUT_GENERAL;
+		desc.finalLayout = VK_IMAGE_LAYOUT_GENERAL;
+
+		references[i].attachment = i;
+		references[i].layout = VK_IMAGE_LAYOUT_GENERAL;
+	}
 
 
-		VkRenderPass rpass;
-		ANKI_VK_CHECKF(
-			vkCreateRenderPass(m_manager->getDevice(), &ci, nullptr, &rpass));
+	ci.attachmentCount = init.m_color.m_attachmentCount;
 
 
-		m_hashmap.pushBack(m_manager->getAllocator(), key, rpass);
-		out = rpass;
+	Bool hasDepthStencil =
+		init.m_depthStencil.m_format.m_components != ComponentFormat::NONE;
+	VkAttachmentReference dsReference = {0, VK_IMAGE_LAYOUT_GENERAL};
+	if(hasDepthStencil)
+	{
+		VkAttachmentDescription& desc =
+			attachmentDescriptions[ci.attachmentCount];
+		desc.format = convertFormat(init.m_depthStencil.m_format);
+		desc.samples = VK_SAMPLE_COUNT_1_BIT;
+		desc.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+		desc.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+		desc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+		desc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+		desc.initialLayout = VK_IMAGE_LAYOUT_GENERAL;
+		desc.finalLayout = VK_IMAGE_LAYOUT_GENERAL;
+
+		dsReference.attachment = ci.attachmentCount;
+		dsReference.layout = VK_IMAGE_LAYOUT_GENERAL;
+
+		++ci.attachmentCount;
 	}
 	}
 
 
-	ANKI_ASSERT(out);
-	return out;
+	VkSubpassDescription desc = {};
+	desc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
+	desc.colorAttachmentCount = init.m_color.m_attachmentCount;
+	desc.pColorAttachments =
+		(init.m_color.m_attachmentCount) ? &references[0] : nullptr;
+	desc.pDepthStencilAttachment = (hasDepthStencil) ? &dsReference : nullptr;
+
+	ANKI_ASSERT(ci.attachmentCount);
+	ci.pAttachments = &attachmentDescriptions[0];
+	ci.subpassCount = 1;
+	ci.pSubpasses = &desc;
+
+	VkRenderPass rpass;
+	ANKI_VK_CHECKF(
+		vkCreateRenderPass(m_manager->getDevice(), &ci, nullptr, &rpass));
+
+	return rpass;
 }
 }
 
 
 } // end namespace anki
 } // end namespace anki

+ 2 - 0
src/anki/gr/vulkan/CompatibleRenderPassCreator.h

@@ -81,6 +81,8 @@ private:
 	Mutex m_mtx;
 	Mutex m_mtx;
 	HashMap<RenderPassKey, VkRenderPass, RenderPassHasher, RenderPassCompare>
 	HashMap<RenderPassKey, VkRenderPass, RenderPassHasher, RenderPassCompare>
 		m_hashmap;
 		m_hashmap;
+
+	VkRenderPass createNewRenderPass(const PipelineInitInfo& init);
 };
 };
 /// @}
 /// @}
 
 

+ 0 - 1
src/anki/resource/TextureResource.cpp

@@ -236,7 +236,6 @@ Error TextureResource::load(const ResourceFilename& filename)
 
 
 	// Internal format
 	// Internal format
 	init.m_format.m_transform = TransformFormat::UNORM;
 	init.m_format.m_transform = TransformFormat::UNORM;
-	init.m_format.m_srgb = false;
 
 
 	if(loader.getColorFormat() == ImageLoader::ColorFormat::RGB8)
 	if(loader.getColorFormat() == ImageLoader::ColorFormat::RGB8)
 	{
 	{

+ 2 - 0
src/anki/scene/DecalNode.cpp

@@ -95,6 +95,8 @@ Error DecalNode::init()
 
 
 	comp = getSceneAllocator().newInstance<SpatialComponent>(this, &m_obbW);
 	comp = getSceneAllocator().newInstance<SpatialComponent>(this, &m_obbW);
 	addComponent(comp, true);
 	addComponent(comp, true);
+
+	return ErrorCode::NONE;
 }
 }
 
 
 //==============================================================================
 //==============================================================================

+ 4 - 3
tests/gr/Gr.cpp

@@ -319,7 +319,8 @@ static PipelinePtr createSimplePpline(
 	PipelineInitInfo init;
 	PipelineInitInfo init;
 	init.m_shaders[ShaderType::VERTEX] = vert;
 	init.m_shaders[ShaderType::VERTEX] = vert;
 	init.m_shaders[ShaderType::FRAGMENT] = frag;
 	init.m_shaders[ShaderType::FRAGMENT] = frag;
-	init.m_color.m_drawsToDefaultFramebuffer = true;
+	init.m_color.m_attachments[0].m_format.m_components =
+		ComponentFormat::DEFAULT_FRAMEBUFFER;
 	init.m_color.m_attachmentCount = 1;
 	init.m_color.m_attachmentCount = 1;
 	init.m_depthStencil.m_depthWriteEnabled = false;
 	init.m_depthStencil.m_depthWriteEnabled = false;
 	init.m_depthStencil.m_depthCompareFunction = CompareOperation::ALWAYS;
 	init.m_depthStencil.m_depthCompareFunction = CompareOperation::ALWAYS;
@@ -659,7 +660,8 @@ ANKI_TEST(Gr, DrawWithVertex)
 	PipelineInitInfo init;
 	PipelineInitInfo init;
 	init.m_shaders[ShaderType::VERTEX] = vert;
 	init.m_shaders[ShaderType::VERTEX] = vert;
 	init.m_shaders[ShaderType::FRAGMENT] = frag;
 	init.m_shaders[ShaderType::FRAGMENT] = frag;
-	init.m_color.m_drawsToDefaultFramebuffer = true;
+	init.m_color.m_attachments[0].m_format.m_components =
+		ComponentFormat::DEFAULT_FRAMEBUFFER;
 	init.m_color.m_attachmentCount = 1;
 	init.m_color.m_attachmentCount = 1;
 	init.m_depthStencil.m_depthWriteEnabled = false;
 	init.m_depthStencil.m_depthWriteEnabled = false;
 	init.m_depthStencil.m_depthCompareFunction = CompareOperation::ALWAYS;
 	init.m_depthStencil.m_depthCompareFunction = CompareOperation::ALWAYS;
@@ -1106,7 +1108,6 @@ static void drawOffscreen(GrManager& gr, Bool useSecondLevel)
 	PipelineInitInfo pinit;
 	PipelineInitInfo pinit;
 	pinit.m_shaders[ShaderType::VERTEX] = vert;
 	pinit.m_shaders[ShaderType::VERTEX] = vert;
 	pinit.m_shaders[ShaderType::FRAGMENT] = frag;
 	pinit.m_shaders[ShaderType::FRAGMENT] = frag;
-	pinit.m_color.m_drawsToDefaultFramebuffer = false;
 	pinit.m_color.m_attachmentCount = 2;
 	pinit.m_color.m_attachmentCount = 2;
 	pinit.m_color.m_attachments[0].m_format = COL_FORMAT;
 	pinit.m_color.m_attachments[0].m_format = COL_FORMAT;
 	pinit.m_color.m_attachments[1].m_format = COL_FORMAT;
 	pinit.m_color.m_attachments[1].m_format = COL_FORMAT;