Răsfoiți Sursa

Making tile size static of size 64x64

Panagiotis Christopoulos Charitos 10 ani în urmă
părinte
comite
20d9978a30

+ 1 - 1
include/anki/gr/gl/RenderingThread.h

@@ -15,7 +15,7 @@ namespace anki {
 /// @addtogroup opengl
 /// @{
 
-#define ANKI_DISABLE_GL_RENDERING_THREAD 1
+#define ANKI_DISABLE_GL_RENDERING_THREAD 0
 
 /// Command queue. It's essentialy a queue of command buffers waiting for 
 /// execution and a server

+ 8 - 8
shaders/IsLp.vert.glsl

@@ -7,11 +7,11 @@
 
 #pragma anki include "shaders/IsCommon.glsl"
 
-layout(location = 0) in vec2 inPosition;
+layout(location = 0) in vec2 in_position;
 
-layout(location = 0) out vec2 outTexCoord;
-layout(location = 1) flat out int outInstanceId;
-layout(location = 2) out vec2 outProjectionParams;
+layout(location = 0) out vec2 out_texCoord;
+layout(location = 1) flat out int out_instanceId;
+layout(location = 2) out vec2 out_projectionParams;
 
 out gl_PerVertex
 {
@@ -26,16 +26,16 @@ void main()
 		mod(instIdF, float(TILES_X_COUNT)), 
 		floor(instIdF / float(TILES_X_COUNT)));
 
-	outInstanceId = int(gl_InstanceID);
+	out_instanceId = int(gl_InstanceID);
 
 	const vec2 SIZES = 
 		vec2(1.0 / float(TILES_X_COUNT), 1.0 / float(TILES_Y_COUNT));
 
-	outTexCoord = (inPosition + ij) * SIZES;
-	vec2 vertPosNdc = outTexCoord * 2.0 - 1.0;
+	out_texCoord = (in_position + ij) * SIZES;
+	vec2 vertPosNdc = out_texCoord * 2.0 - 1.0;
 	gl_Position = vec4(vertPosNdc, 0.0, 1.0);
 
-	outProjectionParams = u_projectionParams.xy * vertPosNdc;
+	out_projectionParams = u_projectionParams.xy * vertPosNdc;
 }
 
 

+ 0 - 2
src/core/Config.cpp

@@ -68,8 +68,6 @@ Config::Config()
 	newOption("renderingQuality", 1.0); // Applies only to MainRenderer
 	newOption("lodDistance", 10.0); // Distance that used to calculate the LOD
 	newOption("samples", 1);
-	newOption("tilesXCount", 30);
-	newOption("tilesYCount", 20);
 	newOption("tessellation", true);
 	newOption("sceneFrameAllocatorSize", 1024 * 1024);
 

+ 2 - 5
src/renderer/Is.cpp

@@ -141,8 +141,6 @@ Error Is::init(const ConfigSet& config)
 //==============================================================================
 Error Is::initInternal(const ConfigSet& config)
 {
-	Error err = ErrorCode::NONE;
-
 	m_groundLightEnabled = config.get("is.groundLightEnabled");
 	m_maxPointLights = config.get("is.maxPointLights");
 	m_maxSpotLights = config.get("is.maxSpotLights");
@@ -167,8 +165,7 @@ Error Is::initInternal(const ConfigSet& config)
 	//
 	// Init the passes
 	//
-	err = m_sm.init(config);
-	if(err) return err;
+	ANKI_CHECK(m_sm.init(config));
 
 	//
 	// Load the programs
@@ -283,7 +280,7 @@ Error Is::initInternal(const ConfigSet& config)
 			m_lightIdsBuffers[i].getPersistentMappingAddress();
 	}
 
-	return err;
+	return ErrorCode::NONE;
 }
 
 //==============================================================================

+ 8 - 4
src/renderer/Renderer.cpp

@@ -56,17 +56,21 @@ Error Renderer::init(
 Error Renderer::initInternal(const ConfigSet& config)
 {
 	// Set from the config
+	const U TILE_SIZE = 64;
+
 	m_renderingQuality = config.get("renderingQuality");
 	m_defaultFbWidth = config.get("width");
 	m_defaultFbHeight = config.get("height");
-	m_width = m_defaultFbWidth * m_renderingQuality;
-	m_height = m_defaultFbHeight * m_renderingQuality;
+	m_width = getAlignedRoundDown(
+		TILE_SIZE, U(m_defaultFbWidth * m_renderingQuality));
+	m_height = getAlignedRoundDown(
+		TILE_SIZE, U(m_defaultFbHeight * m_renderingQuality));
 	m_lodDistance = config.get("lodDistance");
 	m_framesNum = 0;
 	m_samples = config.get("samples");
 	m_isOffscreen = config.get("offscreen");
-	m_tilesCount.x() = config.get("tilesXCount");
-	m_tilesCount.y() = config.get("tilesYCount");
+	m_tilesCount.x() = m_width / TILE_SIZE;
+	m_tilesCount.y() = m_height / TILE_SIZE;
 	m_tilesCountXY = m_tilesCount.x() * m_tilesCount.y();
 
 	m_tessellation = config.get("tessellation");

+ 1 - 13
testapp/Main.cpp

@@ -510,20 +510,8 @@ Error initSubsystems(int argc, char* argv[])
 	config.set("lodDistance", 20.0);
 	config.set("samples", 1);
 	config.set("tessellation", true);
-	config.set("tilesXCount", 60);
-	config.set("tilesYCount", 30);
-
 	//config.set("maxTextureSize", 256);
-
-	Bool fullscreen = true;
-
-	config.set("fullscreenDesktopResolution", fullscreen);
-	if(!fullscreen)
-	{
-		config.set("tilesXCount", 40);
-		config.set("tilesYCount", 24);
-	}
-
+	config.set("fullscreenDesktopResolution", true);
 	config.set("debugContext", false);
 
 	app = new App;