2
0
Эх сурвалжийг харах

GL: Fixing a bug in textures

Panagiotis Christopoulos Charitos 9 жил өмнө
parent
commit
8d3d9a758b

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

@@ -391,11 +391,13 @@ void TextureImpl::init(const TextureInitInfo& init)
 		{
 			glTexParameteri(m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
 			glTexParameteri(m_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
+			glTexParameteri(m_target, GL_TEXTURE_WRAP_R, GL_REPEAT);
 		}
 		else
 		{
 			glTexParameteri(m_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
 			glTexParameteri(m_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+			glTexParameteri(m_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
 		}
 
 		// Make sure that the texture is complete

+ 11 - 3
tests/gr/Gr.cpp

@@ -1380,7 +1380,7 @@ ANKI_TEST(Gr, 3DTextures)
 	TextureInitInfo init;
 	init.m_depth = 1;
 	init.m_format =
-		PixelFormat(ComponentFormat::R8G8B8, TransformFormat::UNORM);
+		PixelFormat(ComponentFormat::R8G8B8A8, TransformFormat::UNORM);
 	init.m_usage = TextureUsageBit::SAMPLED_FRAGMENT | TextureUsageBit::UPLOAD;
 	init.m_initialUsage = TextureUsageBit::UPLOAD;
 	init.m_height = 2;
@@ -1399,7 +1399,8 @@ ANKI_TEST(Gr, 3DTextures)
 	//
 	// Upload all textures
 	//
-	Array<U8, 2 * 2 * 2 * 3> mip0 = {{255,
+	Array<U8, 2 * 2 * 2 * 4> mip0 = {{255,
+		0,
 		0,
 		0,
 		0,
@@ -1407,24 +1408,31 @@ ANKI_TEST(Gr, 3DTextures)
 		0,
 		0,
 		0,
+		0,
 		255,
+		0,
 		255,
 		255,
 		0,
+		0,
 		255,
 		0,
 		255,
 		0,
+		0,
 		255,
 		255,
+		0,
 		255,
 		255,
 		255,
 		0,
 		0,
+		0,
+		0,
 		0}};
 
-	Array<U8, 3> mip1 = {{128, 128, 128}};
+	Array<U8, 4> mip1 = {{128, 128, 128, 0}};
 
 	CommandBufferInitInfo cmdbinit;
 	cmdbinit.m_flags = CommandBufferFlag::TRANSFER_WORK;