Browse Source

Fix some bugs after updating to the new driver

Panagiotis Christopoulos Charitos 9 years ago
parent
commit
2947e06c60
2 changed files with 7 additions and 8 deletions
  1. 1 1
      src/anki/gr/common/Misc.cpp
  2. 6 7
      src/anki/renderer/Ssao.cpp

+ 1 - 1
src/anki/gr/common/Misc.cpp

@@ -141,7 +141,7 @@ void getFormatInfo(const PixelFormat& fmt, U& texelComponents, U& texelBytes, U&
 		texelBytes = texelComponents * 4;
 		break;
 	case ComponentFormat::R32G32B32A32:
-		texelComponents = 3;
+		texelComponents = 4;
 		texelBytes = texelComponents * 4;
 		break;
 	case ComponentFormat::R10G10B10A2:

+ 6 - 7
src/anki/renderer/Ssao.cpp

@@ -33,17 +33,16 @@ static void genKernel(Vec3* ANKI_RESTRICT arr, Vec3* ANKI_RESTRICT arrEnd)
 	} while(++arr != arrEnd);
 }
 
-static void genNoise(Vec3* ANKI_RESTRICT arr, Vec3* ANKI_RESTRICT arrEnd)
+static void genNoise(Vec4* ANKI_RESTRICT arr, Vec4* ANKI_RESTRICT arrEnd)
 {
 	ANKI_ASSERT(arr && arrEnd && arr != arrEnd);
 
 	do
 	{
 		// Calculate the normal
-		arr->x() = randRange(-1.0f, 1.0f);
-		arr->y() = randRange(-1.0f, 1.0f);
-		arr->z() = 0.0;
-		arr->normalize();
+		Vec3 v(randRange(-1.0f, 1.0f), randRange(-1.0f, 1.0f), 0.0f);
+		v.normalize();
+		*arr = Vec4(v, 0.0f);
 	} while(++arr != arrEnd);
 }
 
@@ -101,14 +100,14 @@ Error Ssao::initInternal(const ConfigSet& config)
 	tinit.m_depth = 1;
 	tinit.m_layerCount = 1;
 	tinit.m_type = TextureType::_2D;
-	tinit.m_format = PixelFormat(ComponentFormat::R32G32B32, TransformFormat::FLOAT);
+	tinit.m_format = PixelFormat(ComponentFormat::R32G32B32A32, TransformFormat::FLOAT);
 	tinit.m_mipmapsCount = 1;
 	tinit.m_sampling.m_minMagFilter = SamplingFilter::LINEAR;
 	tinit.m_sampling.m_repeat = true;
 
 	m_noiseTex = gr.newInstance<Texture>(tinit);
 
-	Array<Vec3, NOISE_TEX_SIZE * NOISE_TEX_SIZE> noise;
+	Array<Vec4, NOISE_TEX_SIZE * NOISE_TEX_SIZE> noise;
 	genNoise(&noise[0], &noise[0] + noise.getSize());
 
 	CommandBufferInitInfo cmdbInit;