Browse Source

Windows fixes

Panagiotis Christopoulos Charitos 9 years ago
parent
commit
7417f42723

+ 7 - 1
include/anki/gr/gl/GlState.h

@@ -117,7 +117,13 @@ public:
 
 private:
 	GrManager* m_manager;
-	DArray<U8> m_transferBuffer;
+
+	class alignas(16) Aligned16Type
+	{
+		U8 _m_val[16];
+	};
+
+	DArray<Aligned16Type> m_transferBuffer;
 
 	void initDynamicBuffer(
 		GLenum target, U32 aligment, U32 maxAllocationSize, BufferUsage usage);

+ 3 - 3
shaders/Dbg.frag.glsl

@@ -5,11 +5,11 @@
 
 #include "shaders/Common.glsl"
 
-layout(location = 0) in vec3 inColor;
+layout(location = 0) in vec4 in_color;
 
-out vec3 fColor;
+out vec4 out_color;
 
 void main()
 {
-	fColor = inColor;
+	out_color = in_color;
 }

+ 1 - 1
shaders/LfSpritePass.frag.glsl

@@ -7,7 +7,7 @@
 
 #include "shaders/Common.glsl"
 
-layout(UBO_BINDING(0, 0)) uniform sampler2DArray u_tex;
+layout(TEX_BINDING(0, 0)) uniform sampler2DArray u_tex;
 
 layout(location = 0) in vec3 in_uv;
 layout(location = 1) flat in vec4 in_color;

+ 1 - 1
shaders/MsCommonFrag.glsl

@@ -19,7 +19,7 @@ layout(early_fragment_tests) in;
 //
 // Input
 //
-layout(location = 0) in mediump vec2 in_uv;
+layout(location = 0) in highp vec2 in_uv;
 #if PASS == COLOR
 layout(location = 1) in mediump vec3 in_normal;
 layout(location = 2) in mediump vec4 in_tangent;

+ 2 - 2
shaders/MsCommonVert.glsl

@@ -9,7 +9,7 @@
 // Attributes
 //
 layout(location = POSITION_LOCATION) in highp vec3 in_position;
-layout(location = TEXTURE_COORDINATE_LOCATION) in mediump vec2 in_uv;
+layout(location = TEXTURE_COORDINATE_LOCATION) in highp vec2 in_uv;
 
 #if PASS == COLOR || TESSELLATION
 layout(location = NORMAL_LOCATION) in mediump vec4 in_normal;
@@ -27,7 +27,7 @@ out gl_PerVertex
 	vec4 gl_Position;
 };
 
-layout(location = 0) out mediump vec2 out_uv;
+layout(location = 0) out highp vec2 out_uv;
 
 #if PASS == COLOR || TESSELLATION
 layout(location = 1) out mediump vec3 out_normal;

+ 4 - 2
src/gr/gl/GlState.cpp

@@ -180,10 +180,12 @@ void GlState::init1()
 
 	{
 		m_transferBuffer.create(m_manager->getAllocator(),
-			m_dynamicBuffers[BufferUsage::TRANSFER].m_size);
+			m_dynamicBuffers[BufferUsage::TRANSFER].m_size
+			/ sizeof(Aligned16Type));
 
 		auto& buff = m_dynamicBuffers[BufferUsage::TRANSFER];
-		buff.m_address = &m_transferBuffer[0];
+		buff.m_address = reinterpret_cast<U8*>(&m_transferBuffer[0]);
+		ANKI_ASSERT(isAligned(ANKI_SAFE_ALIGNMENT, buff.m_address));
 		buff.m_alignment = ANKI_SAFE_ALIGNMENT;
 		buff.m_maxAllocationSize = MAX_U32;
 	}

+ 8 - 1
src/gr/gl/PipelineImpl.cpp

@@ -208,7 +208,14 @@ Error PipelineImpl::createGlPipeline()
 
 		glGetProgramInfoLog(m_glName, infoLen, &charsWritten, &infoLogTxt[0]);
 
-		ANKI_LOGE("Ppline error log follows:\n%s", &infoLogTxt[0]);
+		ANKI_LOGE("Ppline error log follows (vs:%u, fs:%u):\n%s",
+			m_in.m_shaders[ShaderType::VERTEX].isCreated()
+			? m_in.m_shaders[ShaderType::VERTEX]->getImplementation().getGlName()
+			: -1,
+			m_in.m_shaders[ShaderType::FRAGMENT].isCreated()
+			? m_in.m_shaders[ShaderType::FRAGMENT]->getImplementation().getGlName()
+			: -1,
+			&infoLogTxt[0]);
 		err = ErrorCode::USER_DATA;
 	}
 

+ 2 - 2
src/renderer/Sm.cpp

@@ -377,8 +377,8 @@ void Sm::prepareBuildCommandBuffers(RenderingContext& ctx)
 		|| spotCastersCount > m_spots.getSize())
 	{
 		ANKI_LOGW("Too many shadow casters");
-		omniCastersCount = min(omniCastersCount, m_omnis.getSize());
-		spotCastersCount = min(spotCastersCount, m_spots.getSize());
+		omniCastersCount = min<U>(omniCastersCount, m_omnis.getSize());
+		spotCastersCount = min<U>(spotCastersCount, m_spots.getSize());
 	}
 
 	if(spotCastersCount > 0)