Added GPU debug labels for vertex and index buffers with VK_EXT_debug_utils
This commit is contained in:
@@ -891,7 +891,12 @@ void KRCamera::renderPost()
|
|||||||
m_pContext->getTextureManager()->selectTexture(0, m_pContext->getTextureManager()->getTexture("font"), 0.0f, KRTexture::TEXTURE_USAGE_UI);
|
m_pContext->getTextureManager()->selectTexture(0, m_pContext->getTextureManager()->getTexture("font"), 0.0f, KRTexture::TEXTURE_USAGE_UI);
|
||||||
|
|
||||||
KRDataBlock index_data;
|
KRDataBlock index_data;
|
||||||
m_pContext->getMeshManager()->bindVBO(m_debug_text_vertices, index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), true, 1.0f);
|
m_pContext->getMeshManager()->bindVBO(m_debug_text_vertices, index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), true, 1.0f
|
||||||
|
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, "Debug Text"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, vertex_count));
|
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, vertex_count));
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ KRDeviceManager::initialize()
|
|||||||
|
|
||||||
char* extensions[] = {
|
char* extensions[] = {
|
||||||
"VK_KHR_surface",
|
"VK_KHR_surface",
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
"VK_EXT_debug_utils",
|
||||||
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
"VK_KHR_win32_surface",
|
"VK_KHR_win32_surface",
|
||||||
#endif
|
#endif
|
||||||
@@ -106,15 +109,18 @@ KRDeviceManager::initialize()
|
|||||||
inst_info.pNext = NULL;
|
inst_info.pNext = NULL;
|
||||||
inst_info.flags = 0;
|
inst_info.flags = 0;
|
||||||
inst_info.pApplicationInfo = &app_info;
|
inst_info.pApplicationInfo = &app_info;
|
||||||
#ifdef WIN32
|
|
||||||
inst_info.enabledExtensionCount = 2;
|
|
||||||
#else
|
|
||||||
inst_info.enabledExtensionCount = 1;
|
inst_info.enabledExtensionCount = 1;
|
||||||
#endif
|
|
||||||
inst_info.ppEnabledExtensionNames = extensions;
|
inst_info.ppEnabledExtensionNames = extensions;
|
||||||
inst_info.enabledLayerCount = 0;
|
inst_info.enabledLayerCount = 0;
|
||||||
inst_info.ppEnabledLayerNames = NULL;
|
inst_info.ppEnabledLayerNames = NULL;
|
||||||
|
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
inst_info.enabledExtensionCount++;
|
||||||
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
inst_info.enabledExtensionCount++;
|
||||||
|
#endif
|
||||||
|
|
||||||
res = vkCreateInstance(&inst_info, NULL, &m_vulkanInstance);
|
res = vkCreateInstance(&inst_info, NULL, &m_vulkanInstance);
|
||||||
if (res != VK_SUCCESS) {
|
if (res != VK_SUCCESS) {
|
||||||
destroyDevices();
|
destroyDevices();
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#define KRENGINE_COMMON_H
|
#define KRENGINE_COMMON_H
|
||||||
|
|
||||||
#define KRENGINE_MAX_GPU_COUNT 4
|
#define KRENGINE_MAX_GPU_COUNT 4
|
||||||
|
#define KRENGINE_DEBUG_GPU_LABELS 1
|
||||||
|
#define KRENGINE_DEBUG_GPU_LABEL_MAX_LEN 128
|
||||||
|
|
||||||
#include "public/kraken.h"
|
#include "public/kraken.h"
|
||||||
#include "KRHelpers.h"
|
#include "KRHelpers.h"
|
||||||
|
|||||||
@@ -268,7 +268,11 @@ void KRLight::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_light
|
|||||||
pParticleShader->setUniform(KRPipeline::KRENGINE_UNIFORM_FLARE_SIZE, m_dust_particle_size);
|
pParticleShader->setUniform(KRPipeline::KRENGINE_UNIFORM_FLARE_SIZE, m_dust_particle_size);
|
||||||
|
|
||||||
KRDataBlock particle_index_data;
|
KRDataBlock particle_index_data;
|
||||||
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getRandomParticles(), particle_index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), true, 1.0f);
|
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getRandomParticles(), particle_index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), true, 1.0f
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, "Light Particles"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, particle_count*3));
|
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, particle_count*3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,7 +312,11 @@ void KRLight::render(KRCamera *pCamera, std::vector<KRPointLight *> &point_light
|
|||||||
pFogShader->setUniform(KRPipeline::KRENGINE_UNIFORM_LIGHT_COLOR, (m_color * pCamera->settings.volumetric_environment_intensity * m_intensity * -slice_spacing / 1000.0f));
|
pFogShader->setUniform(KRPipeline::KRENGINE_UNIFORM_LIGHT_COLOR, (m_color * pCamera->settings.volumetric_environment_intensity * m_intensity * -slice_spacing / 1000.0f));
|
||||||
|
|
||||||
KRDataBlock index_data;
|
KRDataBlock index_data;
|
||||||
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getVolumetricLightingVertexes(), index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX), true, 1.0f);
|
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getVolumetricLightingVertexes(), index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX), true, 1.0f
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, "Participating Media"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, slice_count*6));
|
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, slice_count*6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -368,7 +368,12 @@ void KRMesh::createDataBlocks(KRMeshManager::KRVBOData::vbo_type t)
|
|||||||
if((int)m_submeshes[iSubmesh]->vertex_data_blocks.size() <= vbo_index) {
|
if((int)m_submeshes[iSubmesh]->vertex_data_blocks.size() <= vbo_index) {
|
||||||
KRDataBlock *vertex_data_block = m_pData->getSubBlock(vertex_data_offset + start_vertex_offset * m_vertex_size, vertex_count * m_vertex_size);
|
KRDataBlock *vertex_data_block = m_pData->getSubBlock(vertex_data_offset + start_vertex_offset * m_vertex_size, vertex_count * m_vertex_size);
|
||||||
KRDataBlock *index_data_block = m_pData->getSubBlock(index_data_offset + start_index_offset * 2, index_count * 2);
|
KRDataBlock *index_data_block = m_pData->getSubBlock(index_data_offset + start_index_offset * 2, index_count * 2);
|
||||||
KRMeshManager::KRVBOData *vbo_data_block = new KRMeshManager::KRVBOData(getContext().getMeshManager(), *vertex_data_block, *index_data_block, vertex_attrib_flags, true, t);
|
KRMeshManager::KRVBOData *vbo_data_block = new KRMeshManager::KRVBOData(getContext().getMeshManager(), *vertex_data_block, *index_data_block, vertex_attrib_flags, true, t
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, m_lodBaseName.c_str()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
);
|
||||||
m_submeshes[iSubmesh]->vertex_data_blocks.push_back(vertex_data_block);
|
m_submeshes[iSubmesh]->vertex_data_blocks.push_back(vertex_data_block);
|
||||||
m_submeshes[iSubmesh]->index_data_blocks.push_back(index_data_block);
|
m_submeshes[iSubmesh]->index_data_blocks.push_back(index_data_block);
|
||||||
m_submeshes[iSubmesh]->vbo_data_blocks.push_back(vbo_data_block);
|
m_submeshes[iSubmesh]->vbo_data_blocks.push_back(vbo_data_block);
|
||||||
@@ -394,7 +399,11 @@ void KRMesh::createDataBlocks(KRMeshManager::KRVBOData::vbo_type t)
|
|||||||
if((int)m_submeshes[iSubmesh]->vertex_data_blocks.size() <= vbo_index) {
|
if((int)m_submeshes[iSubmesh]->vertex_data_blocks.size() <= vbo_index) {
|
||||||
KRDataBlock *index_data_block = NULL;
|
KRDataBlock *index_data_block = NULL;
|
||||||
KRDataBlock *vertex_data_block = m_pData->getSubBlock(vertex_data_offset + iBuffer * MAX_VBO_SIZE * vertex_size, vertex_size * cBufferVertexes);
|
KRDataBlock *vertex_data_block = m_pData->getSubBlock(vertex_data_offset + iBuffer * MAX_VBO_SIZE * vertex_size, vertex_size * cBufferVertexes);
|
||||||
KRMeshManager::KRVBOData *vbo_data_block = new KRMeshManager::KRVBOData(getContext().getMeshManager(), *vertex_data_block, *index_data_block, vertex_attrib_flags, true, t);
|
KRMeshManager::KRVBOData *vbo_data_block = new KRMeshManager::KRVBOData(getContext().getMeshManager(), *vertex_data_block, *index_data_block, vertex_attrib_flags, true, t
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, m_lodBaseName.c_str()
|
||||||
|
#endif
|
||||||
|
);
|
||||||
m_submeshes[iSubmesh]->vertex_data_blocks.push_back(vertex_data_block);
|
m_submeshes[iSubmesh]->vertex_data_blocks.push_back(vertex_data_block);
|
||||||
m_submeshes[iSubmesh]->vbo_data_blocks.push_back(vbo_data_block);
|
m_submeshes[iSubmesh]->vbo_data_blocks.push_back(vbo_data_block);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,11 @@ void KRMeshManager::init() {
|
|||||||
memcpy(KRENGINE_VBO_3D_CUBE_VERTICES.getStart(), _KRENGINE_VBO_3D_CUBE_VERTEX_DATA, sizeof(GLfloat) * 3 * 14);
|
memcpy(KRENGINE_VBO_3D_CUBE_VERTICES.getStart(), _KRENGINE_VBO_3D_CUBE_VERTEX_DATA, sizeof(GLfloat) * 3 * 14);
|
||||||
KRENGINE_VBO_3D_CUBE_VERTICES.unlock();
|
KRENGINE_VBO_3D_CUBE_VERTICES.unlock();
|
||||||
|
|
||||||
KRENGINE_VBO_DATA_3D_CUBE_VERTICES.init(this, KRENGINE_VBO_3D_CUBE_VERTICES, KRENGINE_VBO_3D_CUBE_INDEXES, KRENGINE_VBO_3D_CUBE_ATTRIBS, false, KRVBOData::CONSTANT);
|
KRENGINE_VBO_DATA_3D_CUBE_VERTICES.init(this, KRENGINE_VBO_3D_CUBE_VERTICES, KRENGINE_VBO_3D_CUBE_INDEXES, KRENGINE_VBO_3D_CUBE_ATTRIBS, false, KRVBOData::CONSTANT
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, "Cube Mesh [built-in]"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +99,11 @@ void KRMeshManager::init() {
|
|||||||
memcpy(KRENGINE_VBO_2D_SQUARE_VERTICES.getStart(), _KRENGINE_VBO_2D_SQUARE_VERTEX_DATA, sizeof(GLfloat) * 5 * 4);
|
memcpy(KRENGINE_VBO_2D_SQUARE_VERTICES.getStart(), _KRENGINE_VBO_2D_SQUARE_VERTEX_DATA, sizeof(GLfloat) * 5 * 4);
|
||||||
KRENGINE_VBO_2D_SQUARE_VERTICES.unlock();
|
KRENGINE_VBO_2D_SQUARE_VERTICES.unlock();
|
||||||
|
|
||||||
KRENGINE_VBO_DATA_2D_SQUARE_VERTICES.init(this, KRENGINE_VBO_2D_SQUARE_VERTICES, KRENGINE_VBO_2D_SQUARE_INDEXES, KRENGINE_VBO_2D_SQUARE_ATTRIBS, false, KRVBOData::CONSTANT);
|
KRENGINE_VBO_DATA_2D_SQUARE_VERTICES.init(this, KRENGINE_VBO_2D_SQUARE_VERTICES, KRENGINE_VBO_2D_SQUARE_INDEXES, KRENGINE_VBO_2D_SQUARE_ATTRIBS, false, KRVBOData::CONSTANT
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, "Square Mesh [built-in]"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,9 +323,17 @@ void KRMeshManager::balanceVBOMemory(long &memoryRemaining, long &memoryRemainin
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMeshManager::bindVBO(KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, float lodCoverage)
|
void KRMeshManager::bindVBO(KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, float lodCoverage
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, const char* debug_label
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
KRVBOData *vbo_data = new KRVBOData(this, data, index_data, vertex_attrib_flags, static_vbo, KRVBOData::TEMPORARY);
|
KRVBOData *vbo_data = new KRVBOData(this, data, index_data, vertex_attrib_flags, static_vbo, KRVBOData::TEMPORARY
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, debug_label
|
||||||
|
#endif
|
||||||
|
);
|
||||||
vbo_data->load();
|
vbo_data->load();
|
||||||
bindVBO(vbo_data, lodCoverage);
|
bindVBO(vbo_data, lodCoverage);
|
||||||
}
|
}
|
||||||
@@ -520,6 +536,7 @@ std::vector<KRMeshManager::draw_call_info> KRMeshManager::getDrawCalls()
|
|||||||
|
|
||||||
KRMeshManager::KRVBOData::KRVBOData()
|
KRMeshManager::KRVBOData::KRVBOData()
|
||||||
{
|
{
|
||||||
|
m_debugLabel[0] = '\0';
|
||||||
m_is_vbo_loaded = false;
|
m_is_vbo_loaded = false;
|
||||||
m_is_vbo_ready = false;
|
m_is_vbo_ready = false;
|
||||||
m_manager = NULL;
|
m_manager = NULL;
|
||||||
@@ -538,16 +555,32 @@ KRMeshManager::KRVBOData::KRVBOData()
|
|||||||
memset(m_allocations, 0, sizeof(AllocationInfo) * KRENGINE_MAX_GPU_COUNT);
|
memset(m_allocations, 0, sizeof(AllocationInfo) * KRENGINE_MAX_GPU_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRMeshManager::KRVBOData::KRVBOData(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t)
|
KRMeshManager::KRVBOData::KRVBOData(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, const char* debug_label
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
m_debugLabel[0] = '\0';
|
||||||
memset(m_allocations, 0, sizeof(AllocationInfo) * KRENGINE_MAX_GPU_COUNT);
|
memset(m_allocations, 0, sizeof(AllocationInfo) * KRENGINE_MAX_GPU_COUNT);
|
||||||
m_is_vbo_loaded = false;
|
m_is_vbo_loaded = false;
|
||||||
m_is_vbo_ready = false;
|
m_is_vbo_ready = false;
|
||||||
init(manager, data,index_data,vertex_attrib_flags, static_vbo, t);
|
init(manager, data,index_data,vertex_attrib_flags, static_vbo, t
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, debug_label
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRMeshManager::KRVBOData::init(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t)
|
void KRMeshManager::KRVBOData::init(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, const char* debug_label
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
snprintf(m_debugLabel, KRENGINE_DEBUG_GPU_LABEL_MAX_LEN, debug_label);
|
||||||
|
#endif //KRENGINE_DEBUG_GPU_LABELS
|
||||||
m_manager = manager;
|
m_manager = manager;
|
||||||
m_type = t;
|
m_type = t;
|
||||||
m_static_vbo = static_vbo;
|
m_static_vbo = static_vbo;
|
||||||
@@ -605,6 +638,36 @@ void KRMeshManager::KRVBOData::load()
|
|||||||
allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
|
allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
|
||||||
|
|
||||||
VkResult res = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &allocation.vertex_buffer, &allocation.vertex_allocation, nullptr);
|
VkResult res = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &allocation.vertex_buffer, &allocation.vertex_allocation, nullptr);
|
||||||
|
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
char debug_label[KRENGINE_DEBUG_GPU_LABEL_MAX_LEN];
|
||||||
|
|
||||||
|
char* type_label = "";
|
||||||
|
|
||||||
|
switch (m_type) {
|
||||||
|
case vbo_type::STREAMING:
|
||||||
|
type_label = "Streaming";
|
||||||
|
break;
|
||||||
|
case vbo_type::CONSTANT:
|
||||||
|
type_label = "Constant";
|
||||||
|
break;
|
||||||
|
case vbo_type::TEMPORARY:
|
||||||
|
type_label = "Temporary";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(debug_label, KRENGINE_DEBUG_GPU_LABEL_MAX_LEN, "%s Vertices: %s", type_label, m_debugLabel);
|
||||||
|
|
||||||
|
VkDebugUtilsObjectNameInfoEXT debugInfo{};
|
||||||
|
debugInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
|
||||||
|
debugInfo.objectHandle = (uint64_t)allocation.vertex_buffer;
|
||||||
|
debugInfo.objectType = VK_OBJECT_TYPE_BUFFER;
|
||||||
|
debugInfo.pObjectName = debug_label;
|
||||||
|
res = vkSetDebugUtilsObjectNameEXT(device.m_logicalDevice, &debugInfo);
|
||||||
|
#endif // KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
|
||||||
void* mappedData = nullptr;
|
void* mappedData = nullptr;
|
||||||
m_data->lock();
|
m_data->lock();
|
||||||
vmaMapMemory(allocator, allocation.vertex_allocation, &mappedData);
|
vmaMapMemory(allocator, allocation.vertex_allocation, &mappedData);
|
||||||
@@ -616,6 +679,16 @@ void KRMeshManager::KRVBOData::load()
|
|||||||
bufferInfo.size = m_index_data->getSize();
|
bufferInfo.size = m_index_data->getSize();
|
||||||
bufferInfo.usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
bufferInfo.usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||||
res = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &allocation.index_buffer, &allocation.index_allocation, nullptr);
|
res = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &allocation.index_buffer, &allocation.index_allocation, nullptr);
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
snprintf(debug_label, KRENGINE_DEBUG_GPU_LABEL_MAX_LEN, "%s Indexes: %s", type_label, m_debugLabel);
|
||||||
|
|
||||||
|
VkDebugUtilsObjectNameInfoEXT debugInfo{};
|
||||||
|
debugInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
|
||||||
|
debugInfo.objectHandle = (uint64_t)allocation.index_buffer;
|
||||||
|
debugInfo.objectType = VK_OBJECT_TYPE_BUFFER;
|
||||||
|
debugInfo.pObjectName = debug_label;
|
||||||
|
res = vkSetDebugUtilsObjectNameEXT(device.m_logicalDevice, &debugInfo);
|
||||||
|
#endif // KRENGINE_DEBUG_GPU_LABELS
|
||||||
mappedData = nullptr;
|
mappedData = nullptr;
|
||||||
m_index_data->lock();
|
m_index_data->lock();
|
||||||
vmaMapMemory(allocator, allocation.index_allocation, &mappedData);
|
vmaMapMemory(allocator, allocation.index_allocation, &mappedData);
|
||||||
|
|||||||
@@ -75,8 +75,16 @@ public:
|
|||||||
} vbo_type;
|
} vbo_type;
|
||||||
|
|
||||||
KRVBOData();
|
KRVBOData();
|
||||||
KRVBOData(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t);
|
KRVBOData(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t
|
||||||
void init(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t);
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, const char* debug_label
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
void init(KRMeshManager *manager, KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, vbo_type t
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, const char* debug_label
|
||||||
|
#endif
|
||||||
|
);
|
||||||
~KRVBOData();
|
~KRVBOData();
|
||||||
|
|
||||||
|
|
||||||
@@ -128,10 +136,18 @@ public:
|
|||||||
} AllocationInfo;
|
} AllocationInfo;
|
||||||
|
|
||||||
AllocationInfo m_allocations[KRENGINE_MAX_GPU_COUNT];
|
AllocationInfo m_allocations[KRENGINE_MAX_GPU_COUNT];
|
||||||
|
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
char m_debugLabel[KRENGINE_DEBUG_GPU_LABEL_MAX_LEN];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void bindVBO(KRVBOData *vbo_data, float lodCoverage);
|
void bindVBO(KRVBOData *vbo_data, float lodCoverage);
|
||||||
void bindVBO(KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, float lodCoverage);
|
void bindVBO(KRDataBlock &data, KRDataBlock &index_data, int vertex_attrib_flags, bool static_vbo, float lodCoverage
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, const char* debug_label
|
||||||
|
#endif
|
||||||
|
);
|
||||||
void unbindVBO();
|
void unbindVBO();
|
||||||
long getMemUsed();
|
long getMemUsed();
|
||||||
long getMemActive();
|
long getMemActive();
|
||||||
|
|||||||
@@ -104,7 +104,12 @@ void KRParticleSystemNewtonian::render(KRCamera *pCamera, std::vector<KRPointLig
|
|||||||
pParticleShader->setUniform(KRPipeline::KRENGINE_UNIFORM_FLARE_SIZE, 1.0f);
|
pParticleShader->setUniform(KRPipeline::KRENGINE_UNIFORM_FLARE_SIZE, 1.0f);
|
||||||
|
|
||||||
KRDataBlock index_data;
|
KRDataBlock index_data;
|
||||||
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getRandomParticles(), index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), false, 1.0f);
|
m_pContext->getMeshManager()->bindVBO(m_pContext->getMeshManager()->getRandomParticles(), index_data, (1 << KRMesh::KRENGINE_ATTRIB_VERTEX) | (1 << KRMesh::KRENGINE_ATTRIB_TEXUVA), false, 1.0f
|
||||||
|
|
||||||
|
#if KRENGINE_DEBUG_GPU_LABELS
|
||||||
|
, "Newtonian Particles"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, particle_count*3));
|
GLDEBUG(glDrawArrays(GL_TRIANGLES, 0, particle_count*3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user