Renamed Kraken parameters to match streamer refactoring
This commit is contained in:
@@ -11,12 +11,9 @@
|
|||||||
#include "KRContext.h"
|
#include "KRContext.h"
|
||||||
#include "KRCamera.h"
|
#include "KRCamera.h"
|
||||||
|
|
||||||
int KRContext::KRENGINE_MAX_VBO_HANDLES;
|
|
||||||
int KRContext::KRENGINE_MAX_VBO_MEM;
|
|
||||||
int KRContext::KRENGINE_MAX_SHADER_HANDLES;
|
int KRContext::KRENGINE_MAX_SHADER_HANDLES;
|
||||||
int KRContext::KRENGINE_MAX_TEXTURE_HANDLES;
|
int KRContext::KRENGINE_GPU_MEM_MAX;
|
||||||
int KRContext::KRENGINE_MAX_TEXTURE_MEM;
|
int KRContext::KRENGINE_GPU_MEM_TARGET;
|
||||||
int KRContext::KRENGINE_TARGET_TEXTURE_MEM_MAX;
|
|
||||||
int KRContext::KRENGINE_MAX_TEXTURE_DIM;
|
int KRContext::KRENGINE_MAX_TEXTURE_DIM;
|
||||||
int KRContext::KRENGINE_MIN_TEXTURE_DIM;
|
int KRContext::KRENGINE_MIN_TEXTURE_DIM;
|
||||||
int KRContext::KRENGINE_PRESTREAM_DISTANCE;
|
int KRContext::KRENGINE_PRESTREAM_DISTANCE;
|
||||||
@@ -334,8 +331,8 @@ void KRContext::getMemoryStats(long &free_memory)
|
|||||||
void KRContext::doStreaming()
|
void KRContext::doStreaming()
|
||||||
{
|
{
|
||||||
if(m_streamingEnabled) {
|
if(m_streamingEnabled) {
|
||||||
long memoryRemaining = KRENGINE_TARGET_TEXTURE_MEM_MAX/* + KRENGINE_MAX_VBO_MEM*/;
|
long memoryRemaining = KRENGINE_GPU_MEM_TARGET;
|
||||||
long memoryRemainingThisFrame = KRENGINE_MAX_TEXTURE_MEM/* + KRENGINE_MAX_VBO_MEM */ - m_pTextureManager->getMemUsed() - m_pMeshManager->getMemUsed();
|
long memoryRemainingThisFrame = KRENGINE_GPU_MEM_MAX - m_pTextureManager->getMemUsed() - m_pMeshManager->getMemUsed();
|
||||||
m_pMeshManager->doStreaming(memoryRemaining, memoryRemainingThisFrame);
|
m_pMeshManager->doStreaming(memoryRemaining, memoryRemainingThisFrame);
|
||||||
m_pTextureManager->doStreaming(memoryRemaining, memoryRemainingThisFrame);
|
m_pTextureManager->doStreaming(memoryRemaining, memoryRemainingThisFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,9 @@
|
|||||||
|
|
||||||
class KRContext {
|
class KRContext {
|
||||||
public:
|
public:
|
||||||
static int KRENGINE_MAX_VBO_HANDLES;
|
|
||||||
static int KRENGINE_MAX_VBO_MEM;
|
|
||||||
static int KRENGINE_MAX_SHADER_HANDLES;
|
static int KRENGINE_MAX_SHADER_HANDLES;
|
||||||
static int KRENGINE_MAX_TEXTURE_HANDLES;
|
static int KRENGINE_GPU_MEM_MAX;
|
||||||
static int KRENGINE_MAX_TEXTURE_MEM;
|
static int KRENGINE_GPU_MEM_TARGET;
|
||||||
static int KRENGINE_TARGET_TEXTURE_MEM_MAX;
|
|
||||||
static int KRENGINE_MAX_TEXTURE_DIM;
|
static int KRENGINE_MAX_TEXTURE_DIM;
|
||||||
static int KRENGINE_MIN_TEXTURE_DIM;
|
static int KRENGINE_MIN_TEXTURE_DIM;
|
||||||
static int KRENGINE_PRESTREAM_DISTANCE;
|
static int KRENGINE_PRESTREAM_DISTANCE;
|
||||||
|
|||||||
@@ -89,17 +89,14 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KRContext::KRENGINE_MAX_VBO_HANDLES = 10000;
|
|
||||||
KRContext::KRENGINE_MAX_SHADER_HANDLES = 4000;
|
KRContext::KRENGINE_MAX_SHADER_HANDLES = 4000;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_HANDLES = 10000;
|
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_DIM = 2048;
|
KRContext::KRENGINE_MAX_TEXTURE_DIM = 2048;
|
||||||
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
||||||
KRContext::KRENGINE_PRESTREAM_DISTANCE = 1000.0f;
|
KRContext::KRENGINE_PRESTREAM_DISTANCE = 1000.0f;
|
||||||
|
|
||||||
|
|
||||||
KRContext::KRENGINE_MAX_VBO_MEM = total_ram * 2 / 4;
|
KRContext::KRENGINE_GPU_MEM_MAX = total_ram * 1 / 8;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_MEM = total_ram * 1 / 8;
|
KRContext::KRENGINE_GPU_MEM_TARGET = KRContext::KRENGINE_GPU_MEM_MAX * 3 / 4;
|
||||||
KRContext::KRENGINE_TARGET_TEXTURE_MEM_MAX = KRContext::KRENGINE_MAX_TEXTURE_MEM * 3 / 4;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -107,32 +104,23 @@ void kraken::set_debug_text(const std::string &print_text)
|
|||||||
BOOL isIpad = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
|
BOOL isIpad = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
|
||||||
BOOL isRetina = [[UIScreen mainScreen] scale] >= 2.0;
|
BOOL isRetina = [[UIScreen mainScreen] scale] >= 2.0;
|
||||||
if(isIpad && isRetina) {
|
if(isIpad && isRetina) {
|
||||||
KRContext::KRENGINE_MAX_VBO_HANDLES = 10000;
|
|
||||||
KRContext::KRENGINE_MAX_VBO_MEM = 128000000 * 2;
|
|
||||||
KRContext::KRENGINE_MAX_SHADER_HANDLES = 100;
|
KRContext::KRENGINE_MAX_SHADER_HANDLES = 100;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_HANDLES = 10000;
|
KRContext::KRENGINE_GPU_MEM_MAX = 64000000 * 2;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_MEM = 64000000 * 2;
|
KRContext::KRENGINE_GPU_MEM_TARGET = 48000000 * 2;
|
||||||
KRContext::KRENGINE_TARGET_TEXTURE_MEM_MAX = 48000000 * 2;
|
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_DIM = 2048;
|
KRContext::KRENGINE_MAX_TEXTURE_DIM = 2048;
|
||||||
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
||||||
} else {
|
} else {
|
||||||
KRContext::KRENGINE_MAX_VBO_HANDLES = 10000;
|
|
||||||
KRContext::KRENGINE_MAX_VBO_MEM = 128000000;
|
|
||||||
KRContext::KRENGINE_MAX_SHADER_HANDLES = 100;
|
KRContext::KRENGINE_MAX_SHADER_HANDLES = 100;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_HANDLES = 10000;
|
KRContext::KRENGINE_GPU_MEM_MAX = 64000000;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_MEM = 64000000;
|
KRContext::KRENGINE_GPU_MEM_TARGET = 48000000;
|
||||||
KRContext::KRENGINE_TARGET_TEXTURE_MEM_MAX = 48000000;
|
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_DIM = 2048;
|
KRContext::KRENGINE_MAX_TEXTURE_DIM = 2048;
|
||||||
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#else
|
#else
|
||||||
KRContext::KRENGINE_MAX_VBO_HANDLES = 10000;
|
|
||||||
KRContext::KRENGINE_MAX_VBO_MEM = 256000000;
|
|
||||||
KRContext::KRENGINE_MAX_SHADER_HANDLES = 4000;
|
KRContext::KRENGINE_MAX_SHADER_HANDLES = 4000;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_HANDLES = 10000;
|
KRContext::KRENGINE_GPU_MEM_MAX = 256000000;
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_MEM = 256000000;
|
KRContext::KRENGINE_GPU_MEM_TARGET = 192000000;
|
||||||
KRContext::KRENGINE_TARGET_TEXTURE_MEM_MAX = 192000000;
|
|
||||||
KRContext::KRENGINE_MAX_TEXTURE_DIM = 8192;
|
KRContext::KRENGINE_MAX_TEXTURE_DIM = 8192;
|
||||||
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
KRContext::KRENGINE_MIN_TEXTURE_DIM = 64;
|
||||||
KRContext::KRENGINE_PRESTREAM_DISTANCE = 1000.0f;
|
KRContext::KRENGINE_PRESTREAM_DISTANCE = 1000.0f;
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ void KRMeshManager::startFrame(float deltaTime)
|
|||||||
if(m_streamerComplete) {
|
if(m_streamerComplete) {
|
||||||
assert(m_activeVBOs_streamer_copy.size() == 0); // The streamer should have emptied this if it really did complete
|
assert(m_activeVBOs_streamer_copy.size() == 0); // The streamer should have emptied this if it really did complete
|
||||||
|
|
||||||
const long KRENGINE_VBO_EXPIRY_FRAMES = 3;
|
const long KRENGINE_VBO_EXPIRY_FRAMES = 1;
|
||||||
|
|
||||||
std::set<KRVBOData *> expiredVBOs;
|
std::set<KRVBOData *> expiredVBOs;
|
||||||
for(auto itr=m_vbosActive.begin(); itr != m_vbosActive.end(); itr++) {
|
for(auto itr=m_vbosActive.begin(); itr != m_vbosActive.end(); itr++) {
|
||||||
@@ -581,17 +581,22 @@ void KRMeshManager::KRVBOData::load()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLDEBUG(glBindBuffer(GL_ARRAY_BUFFER, m_vbo_handle));
|
GLDEBUG(glBindBuffer(GL_ARRAY_BUFFER, m_vbo_handle));
|
||||||
#if GL_OES_mapbuffer
|
|
||||||
|
|
||||||
GLDEBUG(glBufferData(GL_ARRAY_BUFFER, m_data->getSize(), NULL, m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
bool use_mapbuffer = true;
|
||||||
GLDEBUG(void *map_ptr = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES));
|
#if GL_OES_mapbuffer
|
||||||
m_data->copy(map_ptr);
|
if(use_mapbuffer) {
|
||||||
GLDEBUG(glUnmapBufferOES(GL_ARRAY_BUFFER));
|
GLDEBUG(glBufferData(GL_ARRAY_BUFFER, m_data->getSize(), NULL, m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
||||||
#else
|
GLDEBUG(void *map_ptr = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES));
|
||||||
m_data->lock();
|
m_data->copy(map_ptr);
|
||||||
GLDEBUG(glBufferData(GL_ARRAY_BUFFER, m_data->getSize(), m_data->getStart(), m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
GLDEBUG(glUnmapBufferOES(GL_ARRAY_BUFFER));
|
||||||
m_data->unlock();
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
m_data->lock();
|
||||||
|
GLDEBUG(glBufferData(GL_ARRAY_BUFFER, m_data->getSize(), m_data->getStart(), m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
||||||
|
m_data->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
configureAttribs(m_vertex_attrib_flags);
|
configureAttribs(m_vertex_attrib_flags);
|
||||||
|
|
||||||
@@ -601,16 +606,19 @@ void KRMeshManager::KRVBOData::load()
|
|||||||
GLDEBUG(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_vbo_handle_indexes));
|
GLDEBUG(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_vbo_handle_indexes));
|
||||||
|
|
||||||
#if GL_OES_mapbuffer
|
#if GL_OES_mapbuffer
|
||||||
|
if(use_mapbuffer) {
|
||||||
GLDEBUG(glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_index_data->getSize(), NULL, m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
GLDEBUG(glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_index_data->getSize(), NULL, m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
||||||
GLDEBUG(void *map_ptr = glMapBufferOES(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY_OES));
|
GLDEBUG(void *map_ptr = glMapBufferOES(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY_OES));
|
||||||
m_index_data->copy(map_ptr);
|
m_index_data->copy(map_ptr);
|
||||||
GLDEBUG(glUnmapBufferOES(GL_ELEMENT_ARRAY_BUFFER));
|
GLDEBUG(glUnmapBufferOES(GL_ELEMENT_ARRAY_BUFFER));
|
||||||
#else
|
}
|
||||||
m_index_data->lock();
|
else
|
||||||
GLDEBUG(glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_index_data->getSize(), m_index_data->getStart(), m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
|
||||||
m_index_data->unlock();
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
m_index_data->lock();
|
||||||
|
GLDEBUG(glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_index_data->getSize(), m_index_data->getStart(), m_static_vbo ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW));
|
||||||
|
m_index_data->unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_is_vbo_loaded = true;
|
m_is_vbo_loaded = true;
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ void KRTextureManager::addMemoryTransferredThisFrame(long memoryTransferred)
|
|||||||
void KRTextureManager::memoryChanged(long memoryDelta)
|
void KRTextureManager::memoryChanged(long memoryDelta)
|
||||||
{
|
{
|
||||||
m_textureMemUsed += memoryDelta;
|
m_textureMemUsed += memoryDelta;
|
||||||
//fprintf(stderr, "Texture Memory: %ld / %i\n", (long)m_textureMemUsed, KRContext::KRENGINE_MAX_TEXTURE_MEM);
|
//fprintf(stderr, "Texture Memory: %ld / %i\n", (long)m_textureMemUsed, KRContext::KRENGINE_GPU_MEM_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
unordered_map<std::string, KRTexture *> &KRTextureManager::getTextures()
|
unordered_map<std::string, KRTexture *> &KRTextureManager::getTextures()
|
||||||
|
|||||||
Reference in New Issue
Block a user