* GL state objects that belong to shared contexts can now be visualized if the parent context is current.
* Framebuffer Objects are NOT considered shared state by OpenGL because they reference textures and renderbuffers which ARE shared state objects.
if (curContextHandle != 0)
{
vogl_context_snapshot* pContext = pStateSnapshot->get_context(curContextHandle);
-
- // textures
- vogl_gl_object_state_ptr_vec textureObjects;
- pContext->get_all_objects_of_category(cGLSTTexture, textureObjects);
- m_pTextureExplorer->set_texture_objects(textureObjects);
-
- GLuint curActiveTextureUnit = pContext->get_general_state().get_value<GLuint>(GL_ACTIVE_TEXTURE);
- if (curActiveTextureUnit >= GL_TEXTURE0 && curActiveTextureUnit < (GL_TEXTURE0 + pContext->get_context_info().get_max_texture_image_units()))
- {
- GLuint cur2DBinding = pContext->get_general_state().get_value<GLuint>(GL_TEXTURE_2D_BINDING_EXT, curActiveTextureUnit - GL_TEXTURE0);
- displayTexture(cur2DBinding, false);
- }
- if (textureObjects.size() > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->textureTab); }
-
- // renderbuffers
- vogl_gl_object_state_ptr_vec renderbufferObjects;
- pContext->get_all_objects_of_category(cGLSTRenderbuffer, renderbufferObjects);
- m_pRenderbufferExplorer->set_texture_objects(renderbufferObjects);
- if (renderbufferObjects.size() > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->renderbufferTab); }
-
- // framebuffer
- vogl_gl_object_state_ptr_vec framebufferObjects;
- pContext->get_all_objects_of_category(cGLSTFramebuffer, framebufferObjects);
- m_pFramebufferExplorer->set_framebuffer_objects(framebufferObjects, *pContext, pStateSnapshot->get_default_framebuffer());
- GLuint64 curDrawFramebuffer = pContext->get_general_state().get_value<GLuint64>(GL_DRAW_FRAMEBUFFER_BINDING);
- displayFramebuffer(curDrawFramebuffer, false);
- if (framebufferObjects.size() > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->framebufferTab); }
-
- // programs
- vogl_gl_object_state_ptr_vec programObjects;
- pContext->get_all_objects_of_category(cGLSTProgram, programObjects);
- m_pProgramExplorer->set_program_objects(programObjects);
- GLuint64 curProgram = pContext->get_general_state().get_value<GLuint64>(GL_CURRENT_PROGRAM);
- m_pProgramExplorer->set_active_program(curProgram);
- if (programObjects.size() > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->programTab); }
-
- // shaders
- vogl_gl_object_state_ptr_vec shaderObjects;
- pContext->get_all_objects_of_category(cGLSTShader, shaderObjects);
- m_pShaderExplorer->set_shader_objects(shaderObjects);
- if (curProgram != 0)
- {
- for (vogl_gl_object_state_ptr_vec::iterator iter = programObjects.begin(); iter != programObjects.end(); iter++)
- {
- if ((*iter)->get_snapshot_handle() == curProgram)
- {
- vogl_program_state* pProgramState = static_cast<vogl_program_state*>(*iter);
- if (pProgramState->get_attached_shaders().size() > 0)
- {
- uint curShader = pProgramState->get_attached_shaders()[0];
- m_pShaderExplorer->set_active_shader(curShader);
- }
- break;
- }
- }
- }
- if (shaderObjects.size() > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->shaderTab); }
+ update_ui_for_context(pContext, pStateSnapshot);
}
}
this->setCursor(origCursor);
}
+void VoglEditor::update_ui_for_context(vogl_context_snapshot* pContext, vogleditor_gl_state_snapshot* pStateSnapshot)
+{
+ // vogl stores all the created objects in the deepest context, so need to find that context to populate the UI
+ vogl::vector<vogl_context_snapshot*> sharingContexts;
+ sharingContexts.push_back(pContext);
+ vogl_context_snapshot* pRootContext = pContext;
+ vogl_context_snapshot* pTmpContext = NULL;
+ while (pRootContext->get_context_desc().get_trace_share_context() != 0)
+ {
+ pTmpContext = pStateSnapshot->get_context(pRootContext->get_context_desc().get_trace_share_context());
+ VOGL_ASSERT(pTmpContext != NULL);
+ if (pTmpContext == NULL)
+ {
+ // this is a bug
+ break;
+ }
+
+ // update the root context
+ pRootContext = pTmpContext;
+ }
+
+ // add the root context if it is new (ie, not equal the supplied context)
+ if (pRootContext != pContext)
+ {
+ sharingContexts.push_back(pRootContext);
+ }
+
+ // textures
+ m_pTextureExplorer->clear();
+ uint textureCount = m_pTextureExplorer->set_texture_objects(sharingContexts);
+
+ GLuint curActiveTextureUnit = pContext->get_general_state().get_value<GLuint>(GL_ACTIVE_TEXTURE);
+ if (curActiveTextureUnit >= GL_TEXTURE0 && curActiveTextureUnit < (GL_TEXTURE0 + pContext->get_context_info().get_max_texture_image_units()))
+ {
+ GLuint cur2DBinding = pContext->get_general_state().get_value<GLuint>(GL_TEXTURE_2D_BINDING_EXT, curActiveTextureUnit - GL_TEXTURE0);
+ displayTexture(cur2DBinding, false);
+ }
+ if (textureCount > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->textureTab); }
+
+ // renderbuffers
+ m_pRenderbufferExplorer->clear();
+ int renderbufferCount = m_pRenderbufferExplorer->set_renderbuffer_objects(sharingContexts);
+ if (renderbufferCount > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->renderbufferTab); }
+
+ // framebuffer
+ m_pFramebufferExplorer->clear();
+ uint framebufferCount = m_pFramebufferExplorer->set_framebuffer_objects(pContext, sharingContexts, &(pStateSnapshot->get_default_framebuffer()));
+ GLuint64 curDrawFramebuffer = pContext->get_general_state().get_value<GLuint64>(GL_DRAW_FRAMEBUFFER_BINDING);
+ displayFramebuffer(curDrawFramebuffer, false);
+ if (framebufferCount > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->framebufferTab); }
+
+ // programs
+ m_pProgramExplorer->clear();
+ uint programCount = m_pProgramExplorer->set_program_objects(sharingContexts);
+ GLuint64 curProgram = pContext->get_general_state().get_value<GLuint64>(GL_CURRENT_PROGRAM);
+ m_pProgramExplorer->set_active_program(curProgram);
+ if (programCount > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->programTab); }
+
+ // shaders
+ m_pShaderExplorer->clear();
+ uint shaderCount = m_pShaderExplorer->set_shader_objects(sharingContexts);
+ if (curProgram != 0)
+ {
+ bool bFound = false;
+ for (uint c = 0; c < sharingContexts.size(); c++)
+ {
+ vogl_gl_object_state_ptr_vec programObjects;
+ sharingContexts[c]->get_all_objects_of_category(cGLSTProgram, programObjects);
+ for (vogl_gl_object_state_ptr_vec::iterator iter = programObjects.begin(); iter != programObjects.end(); iter++)
+ {
+ if ((*iter)->get_snapshot_handle() == curProgram)
+ {
+ vogl_program_state* pProgramState = static_cast<vogl_program_state*>(*iter);
+ if (pProgramState->get_attached_shaders().size() > 0)
+ {
+ uint curShader = pProgramState->get_attached_shaders()[0];
+ m_pShaderExplorer->set_active_shader(curShader);
+ }
+
+ bFound = true;
+ break;
+ }
+ }
+
+ if (bFound)
+ break;
+ }
+ }
+ if (shaderCount > 0) { VOGLEDITOR_ENABLE_STATE_TAB(ui->shaderTab); }
+}
+
void VoglEditor::on_stateTreeView_clicked(const QModelIndex &index)
{
vogleditor_stateTreeItem* pStateItem = static_cast<vogleditor_stateTreeItem*>(index.internalPointer());
void reset_snapshot_ui();
void update_ui_for_snapshot(vogleditor_gl_state_snapshot *pStateSnapshot);
+
+ void update_ui_for_context(vogl_context_snapshot* pContext, vogleditor_gl_state_snapshot *pStateSnapshot);
+
void displayMachineInfoHelper(QString prefix, const QString& sectionKeyStr, const vogl::json_value& value, QString& rMachineInfoStr);
void displayMachineInfo();
void recursive_update_snapshot_flags(vogleditor_apiCallTreeItem* pItem, bool& bFoundEditedSnapshot);
vogleditor_QFramebufferExplorer::~vogleditor_QFramebufferExplorer()
{
+ clear();
delete ui;
delete m_colorExplorerLayout;
void vogleditor_QFramebufferExplorer::clear()
{
+ m_objects.clear();
+ m_sharing_contexts.clear();
ui->framebufferObjectListbox->clear();
clearViewers();
m_viewers.clear();
}
-void vogleditor_QFramebufferExplorer::set_framebuffer_objects(vogl_gl_object_state_ptr_vec objects, vogl_context_snapshot& context, vogl_default_framebuffer_state& defaultFramebufferState)
+uint vogleditor_QFramebufferExplorer::set_framebuffer_objects(vogl_context_snapshot* pContext, vogl::vector<vogl_context_snapshot*> sharingContexts, vogl_default_framebuffer_state* pDefaultFramebufferState)
{
clear();
- m_context = &context;
- m_objects = objects;
- m_pDefaultFramebufferState = &defaultFramebufferState;
+ m_sharing_contexts = sharingContexts;
+
+ uint framebufferCount = 0;
+
+ framebufferCount += set_default_framebuffer(pDefaultFramebufferState);
+
+ // framebuffers are not shared state objects, but they can reference shared objects,
+ // so only add the framebuffers from the main context
+ vogl_gl_object_state_ptr_vec framebufferObjects;
+ pContext->get_all_objects_of_category(cGLSTFramebuffer, framebufferObjects);
+ framebufferCount += add_framebuffer_objects(sharingContexts, framebufferObjects);
+
+ return framebufferCount;
+}
+
+uint vogleditor_QFramebufferExplorer::set_default_framebuffer(vogl_default_framebuffer_state* pDefaultFramebufferState)
+{
+ int numAdded = 0;
+ if (pDefaultFramebufferState != NULL)
+ {
+ m_pDefaultFramebufferState = pDefaultFramebufferState;
+
+ // add default framebuffer
+ vogl_framebuffer_container defaultContainer;
+ defaultContainer.index = 0;
+ defaultContainer.pFBOState = NULL;
+ defaultContainer.pDefaultFBState = m_pDefaultFramebufferState;
+ ui->framebufferObjectListbox->addItem("Framebuffer 0 - (default framebuffer)", QVariant::fromValue(defaultContainer));
+ numAdded = 1;
+ }
+ return numAdded;
+}
- // add default framebuffer
- vogl_framebuffer_container defaultContainer;
- defaultContainer.index = 0;
- defaultContainer.pFBOState = NULL;
- defaultContainer.pDefaultFBState = m_pDefaultFramebufferState;
- ui->framebufferObjectListbox->addItem("Framebuffer 0 - (default framebuffer)", QVariant::fromValue(defaultContainer));
+uint vogleditor_QFramebufferExplorer::add_framebuffer_objects(vogl::vector<vogl_context_snapshot*> sharingContexts, vogl_gl_object_state_ptr_vec objects)
+{
+ m_objects.append(objects);
// add framebuffer objects
QString valueStr;
const vogl_framebuffer_attachment* pAttachment = &(pState->get_attachments().begin()->second);
if (pAttachment->get_type() == GL_TEXTURE)
{
- vogl_texture_state* pTexState = this->get_texture_attachment(NULL, pAttachment->get_handle());
- if (pTexState != NULL)
+ for (uint c = 0; c < sharingContexts.size(); c++)
{
- width = pTexState->get_texture().get_width();
- height = pTexState->get_texture().get_height();
+ vogl_texture_state* pTexState = this->get_texture_attachment(*(sharingContexts[c]), pAttachment->get_handle());
+ if (pTexState != NULL)
+ {
+ width = pTexState->get_texture().get_width();
+ height = pTexState->get_texture().get_height();
+ break;
+ }
}
}
else if (pAttachment->get_type() == GL_RENDERBUFFER)
{
- vogl_renderbuffer_state* pRbState = this->get_renderbuffer_attachment(NULL, pAttachment->get_handle());
- if (pRbState != NULL)
+ for (uint c = 0; c < sharingContexts.size(); c++)
{
- width = pRbState->get_texture().get_texture().get_width();
- height = pRbState->get_texture().get_texture().get_height();
+ vogl_renderbuffer_state* pRbState = this->get_renderbuffer_attachment(*(sharingContexts[c]), pAttachment->get_handle());
+ if (pRbState != NULL)
+ {
+ width = pRbState->get_texture().get_texture().get_width();
+ height = pRbState->get_texture().get_texture().get_height();
+ break;
+ }
}
}
valueStr = valueStr.sprintf("Framebuffer %" PRIu64 " - %d attachments", pState->get_snapshot_handle(), pState->get_attachments().size());
}
- vogl_framebuffer_container defaultContainer;
- defaultContainer.index = 0;
- defaultContainer.pFBOState = pState;
- defaultContainer.pDefaultFBState = NULL;
+ vogl_framebuffer_container container;
+ container.index = ui->framebufferObjectListbox->count();
+ container.pFBOState = pState;
+ container.pDefaultFBState = NULL;
- ui->framebufferObjectListbox->addItem(valueStr, QVariant::fromValue(defaultContainer));
+ ui->framebufferObjectListbox->addItem(valueStr, QVariant::fromValue(container));
}
+
+ return objects.size();
}
bool vogleditor_QFramebufferExplorer::set_active_framebuffer(unsigned long long framebufferHandle)
}
else
{
- int index = 1;
- for (vogl_gl_object_state_ptr_vec::iterator iter = m_objects.begin(); iter != m_objects.end(); iter++)
+ for (int index = 0; index < ui->framebufferObjectListbox->count(); index++)
{
- vogl_framebuffer_state* pState = static_cast<vogl_framebuffer_state*>(*iter);
- if (pState->get_snapshot_handle() == framebufferHandle)
+ vogl_framebuffer_container container = ui->framebufferObjectListbox->itemData(index).value<vogl_framebuffer_container>();
+ vogl_framebuffer_state* pState = container.pFBOState;
+ if (pState != NULL && pState->get_snapshot_handle() == framebufferHandle)
{
ui->framebufferObjectListbox->setCurrentIndex(index);
bDisplayedFramebuffer = true;
break;
}
-
- ++index;
}
}
return bDisplayedFramebuffer;
vogl_framebuffer_state* pState = container.pFBOState;
if (pState != NULL)
{
- vogl_gl_object_state_ptr_vec textureVec;
- m_context->get_all_objects_of_category(cGLSTTexture, textureVec);
-
- vogl_gl_object_state_ptr_vec renderbufferVec;
- m_context->get_all_objects_of_category(cGLSTRenderbuffer, renderbufferVec);
-
const vogl_framebuffer_state::GLenum_to_attachment_map& rAttachments = pState->get_attachments();
for (vogl_framebuffer_state::GLenum_to_attachment_map::const_iterator iter = rAttachments.begin(); iter != rAttachments.end(); iter++)
{
const vogl_framebuffer_attachment* pAttachment = &(iter->second);
if (pAttachment->get_type() == GL_TEXTURE)
{
- vogl_texture_state* pTexState = this->get_texture_attachment(&textureVec, pAttachment->get_handle());
- if (pTexState != NULL)
+ for (uint c = 0; c < m_sharing_contexts.size(); c++)
{
- if (iter->first == GL_DEPTH_ATTACHMENT ||
- iter->first == GL_DEPTH)
+ vogl_texture_state* pTexState = this->get_texture_attachment(*(m_sharing_contexts[c]), pAttachment->get_handle());
+ if (pTexState != NULL)
{
- depthVec.push_back(pTexState);
- }
- else if (iter->first == GL_STENCIL_ATTACHMENT ||
- iter->first == GL_STENCIL)
- {
- stencilVec.push_back(pTexState);
- }
- else
- {
- colorVec.push_back(pTexState);
-
- ADD_COLOR_BUFFER_VIEWER
+ if (iter->first == GL_DEPTH_ATTACHMENT ||
+ iter->first == GL_DEPTH)
+ {
+ depthVec.push_back(pTexState);
+ }
+ else if (iter->first == GL_STENCIL_ATTACHMENT ||
+ iter->first == GL_STENCIL)
+ {
+ stencilVec.push_back(pTexState);
+ }
+ else
+ {
+ colorVec.push_back(pTexState);
+
+ ADD_COLOR_BUFFER_VIEWER
+ }
+ break;
}
}
}
else if (pAttachment->get_type() == GL_RENDERBUFFER)
{
- vogl_renderbuffer_state* pRbState = this->get_renderbuffer_attachment(&renderbufferVec, pAttachment->get_handle());
- if (pRbState != NULL)
+ for (uint c = 0; c < m_sharing_contexts.size(); c++)
{
- if (iter->first == GL_DEPTH_ATTACHMENT ||
- iter->first == GL_DEPTH)
- {
- depthVec.push_back(pRbState);
- }
- else if (iter->first == GL_STENCIL_ATTACHMENT ||
- iter->first == GL_STENCIL)
- {
- stencilVec.push_back(pRbState);
- }
- else
+ vogl_renderbuffer_state* pRbState = this->get_renderbuffer_attachment(*(m_sharing_contexts[c]), pAttachment->get_handle());
+ if (pRbState != NULL)
{
- colorVec.push_back(pRbState);
-
- ADD_COLOR_BUFFER_VIEWER
+ if (iter->first == GL_DEPTH_ATTACHMENT ||
+ iter->first == GL_DEPTH)
+ {
+ depthVec.push_back(pRbState);
+ }
+ else if (iter->first == GL_STENCIL_ATTACHMENT ||
+ iter->first == GL_STENCIL)
+ {
+ stencilVec.push_back(pRbState);
+ }
+ else
+ {
+ colorVec.push_back(pRbState);
+
+ ADD_COLOR_BUFFER_VIEWER
+ }
+ break;
}
}
}
}
}
-vogl_texture_state* vogleditor_QFramebufferExplorer::get_texture_attachment(vogl_gl_object_state_ptr_vec* pObjectVec, unsigned int handle)
+vogl_texture_state* vogleditor_QFramebufferExplorer::get_texture_attachment(vogl_context_snapshot& context, unsigned int handle)
{
vogl_gl_object_state_ptr_vec textureVec;
- if (pObjectVec == NULL)
- {
- m_context->get_all_objects_of_category(cGLSTTexture, textureVec);
- pObjectVec = &textureVec;
- }
+ context.get_all_objects_of_category(cGLSTTexture, textureVec);
vogl_texture_state* pTexState = NULL;
- for (vogl_gl_object_state_ptr_vec::iterator texIter = pObjectVec->begin(); texIter != pObjectVec->end(); texIter++)
+ for (vogl_gl_object_state_ptr_vec::iterator texIter = textureVec.begin(); texIter != textureVec.end(); texIter++)
{
if ((*texIter)->get_snapshot_handle() == handle)
{
return pTexState;
}
-vogl_renderbuffer_state* vogleditor_QFramebufferExplorer::get_renderbuffer_attachment(vogl_gl_object_state_ptr_vec* pObjectVec, unsigned int handle)
+vogl_renderbuffer_state* vogleditor_QFramebufferExplorer::get_renderbuffer_attachment(vogl_context_snapshot& context, unsigned int handle)
{
vogl_gl_object_state_ptr_vec renderbufferVec;
- if (pObjectVec == NULL)
- {
- m_context->get_all_objects_of_category(cGLSTRenderbuffer, renderbufferVec);
- pObjectVec = &renderbufferVec;
- }
+ context.get_all_objects_of_category(cGLSTRenderbuffer, renderbufferVec);
vogl_renderbuffer_state* pRenderbufferState = NULL;
- for (vogl_gl_object_state_ptr_vec::iterator texIter = pObjectVec->begin(); texIter != pObjectVec->end(); texIter++)
+ for (vogl_gl_object_state_ptr_vec::iterator texIter = renderbufferVec.begin(); texIter != renderbufferVec.end(); texIter++)
{
if ((*texIter)->get_snapshot_handle() == handle)
{
explicit vogleditor_QFramebufferExplorer(QWidget *parent = 0);
~vogleditor_QFramebufferExplorer();
- void set_framebuffer_objects(vogl_gl_object_state_ptr_vec objects, vogl_context_snapshot& context, vogl_default_framebuffer_state& defaultFramebufferState);
+ uint set_framebuffer_objects(vogl_context_snapshot* pContext, vogl::vector<vogl_context_snapshot*> sharingContexts, vogl_default_framebuffer_state *pDefaultFramebufferState);
bool set_active_framebuffer(unsigned long long framebufferHandle);
QVBoxLayout* m_stencilExplorerLayout;
vogleditor_QTextureExplorer* m_depthExplorer;
vogleditor_QTextureExplorer* m_stencilExplorer;
- vogl_context_snapshot* m_context;
+ vogl::vector<vogl_context_snapshot*> m_sharing_contexts;
vogl_default_framebuffer_state* m_pDefaultFramebufferState;
void clearViewers();
- vogl_texture_state* get_texture_attachment(vogl_gl_object_state_ptr_vec* pObjectVec, unsigned int handle);
- vogl_renderbuffer_state* get_renderbuffer_attachment(vogl_gl_object_state_ptr_vec* pObjectVec, unsigned int handle);
+
+ uint set_default_framebuffer(vogl_default_framebuffer_state* pDefaultFramebufferState);
+ uint add_framebuffer_objects(vogl::vector<vogl_context_snapshot*> sharingContexts, vogl_gl_object_state_ptr_vec objects);
+
+ vogl_texture_state* get_texture_attachment(vogl_context_snapshot& context, unsigned int handle);
+ vogl_renderbuffer_state* get_renderbuffer_attachment(vogl_context_snapshot &context, unsigned int handle);
private slots:
void selectedFramebufferIndexChanged(int index);
#include "ui_vogleditor_qprogramexplorer.h"
#include "vogl_gl_object.h"
+#include "vogl_gl_state_snapshot.h"
#include "vogl_program_state.h"
Q_DECLARE_METATYPE(vogl_program_state*);
ui->shaderTextEdit->clear();
}
-void vogleditor_QProgramExplorer::set_program_objects(vogl_gl_object_state_ptr_vec objects)
+uint vogleditor_QProgramExplorer::set_program_objects(vogl::vector<vogl_context_snapshot*> sharingContexts)
{
clear();
- m_objects = objects;
+
+ uint programCount = 0;
+ for (uint c = 0; c < sharingContexts.size(); c++)
+ {
+ vogl_gl_object_state_ptr_vec programObjects;
+ sharingContexts[c]->get_all_objects_of_category(cGLSTProgram, programObjects);
+
+ programCount += add_program_objects(programObjects);
+ }
+
+ return programCount;
+}
+
+uint vogleditor_QProgramExplorer::add_program_objects(vogl_gl_object_state_ptr_vec objects)
+{
+ m_objects.append(objects);
for (vogl_gl_object_state_ptr_vec::iterator iter = objects.begin(); iter != objects.end(); iter++)
{
VOGL_ASSERT(!"Unhandled object type in vogleditor_QProgramExplorer");
}
}
+
+ return objects.size();
}
bool vogleditor_QProgramExplorer::set_active_program(unsigned long long programHandle)
#include "vogl_core.h"
+class vogl_context_snapshot;
class vogl_gl_object_state;
class vogl_program_state;
typedef vogl::vector<vogl_gl_object_state *> vogl_gl_object_state_ptr_vec;
void clear();
- void set_program_objects(vogl_gl_object_state_ptr_vec objects);
+ uint set_program_objects(vogl::vector<vogl_context_snapshot*> sharingContexts);
bool set_active_program(unsigned long long programHandle);
Ui::vogleditor_QProgramExplorer *ui;
vogl_gl_object_state_ptr_vec m_objects;
+ uint add_program_objects(vogl_gl_object_state_ptr_vec objects);
+
signals:
void program_edited(vogl_program_state* pNewProgramState);
#include "ui_vogleditor_qshaderexplorer.h"
#include "vogl_gl_object.h"
+#include "vogl_gl_state_snapshot.h"
#include "vogl_shader_state.h"
Q_DECLARE_METATYPE(vogl_shader_state*);
ui->shaderTextEdit->clear();
}
-void vogleditor_QShaderExplorer::set_shader_objects(vogl_gl_object_state_ptr_vec objects)
+uint vogleditor_QShaderExplorer::set_shader_objects(vogl::vector<vogl_context_snapshot*> sharingContexts)
{
clear();
- m_objects = objects;
+
+ uint shaderCount = 0;
+ for (uint c = 0; c < sharingContexts.size(); c++)
+ {
+ vogl_gl_object_state_ptr_vec shaderObjects;
+ sharingContexts[c]->get_all_objects_of_category(cGLSTShader, shaderObjects);
+
+ shaderCount += add_shader_objects(shaderObjects);
+ }
+
+ return shaderCount;
+}
+
+uint vogleditor_QShaderExplorer::add_shader_objects(vogl_gl_object_state_ptr_vec objects)
+{
+ m_objects.append(objects);
for (vogl_gl_object_state_ptr_vec::iterator iter = objects.begin(); iter != objects.end(); iter++)
{
VOGL_ASSERT(!"Unhandled object type in vogleditor_QShaderExplorer");
}
}
+
+ return m_objects.size();
}
#include "vogl_core.h"
+class vogl_context_snapshot;
class vogl_gl_object_state;
typedef vogl::vector<vogl_gl_object_state *> vogl_gl_object_state_ptr_vec;
void clear();
- void set_shader_objects(vogl_gl_object_state_ptr_vec objects);
+ uint set_shader_objects(vogl::vector<vogl_context_snapshot*> sharingContexts);
bool set_active_shader(unsigned long long shaderHandle);
private:
Ui::vogleditor_QShaderExplorer *ui;
vogl_gl_object_state_ptr_vec m_objects;
+
+ uint add_shader_objects(vogl_gl_object_state_ptr_vec objects);
};
#endif // VOGLEDITOR_QSHADEREXPLORER_H
#include "ui_vogleditor_qtextureexplorer.h"
#include "vogl_gl_object.h"
+#include "vogl_gl_state_snapshot.h"
#include "vogl_texture_state.h"
#include "vogl_renderbuffer_state.h"
#include <QColorDialog>
vogleditor_QTextureExplorer::~vogleditor_QTextureExplorer()
{
+ clear();
delete ui;
}
void vogleditor_QTextureExplorer::clear()
{
+ m_objects.clear();
+
ui->textureObjectListbox->clear();
m_textureViewer.clear();
return m_textureViewer.get_preferred_height() + ui->textureObjectListbox->height() * 2 + 50;
}
-void vogleditor_QTextureExplorer::set_texture_objects(vogl_gl_object_state_ptr_vec objects)
+uint vogleditor_QTextureExplorer::set_texture_objects(vogl::vector<vogl_context_snapshot*> sharingContexts)
+{
+ clear();
+
+ uint textureCount = 0;
+
+ for (uint c = 0; c < sharingContexts.size(); c++)
+ {
+ vogl_gl_object_state_ptr_vec textureObjects;
+ sharingContexts[c]->get_all_objects_of_category(cGLSTTexture, textureObjects);
+
+ textureCount += add_texture_objects(textureObjects);
+ }
+
+ return textureCount;
+}
+
+uint vogleditor_QTextureExplorer::set_renderbuffer_objects(vogl::vector<vogl_context_snapshot*> sharingContexts)
+{
+ clear();
+
+ uint textureCount = 0;
+
+ for (uint c = 0; c < sharingContexts.size(); c++)
+ {
+ vogl_gl_object_state_ptr_vec renderbufferObjects;
+ sharingContexts[c]->get_all_objects_of_category(cGLSTRenderbuffer, renderbufferObjects);
+
+ textureCount += add_texture_objects(renderbufferObjects);
+ }
+
+ return textureCount;
+}
+
+uint vogleditor_QTextureExplorer::set_texture_objects(vogl_gl_object_state_ptr_vec textureObjects)
{
clear();
- m_objects = objects;
- for (vogl_gl_object_state_ptr_vec::iterator iter = objects.begin(); iter != objects.end(); iter++)
+ return add_texture_objects(textureObjects);
+}
+
+uint vogleditor_QTextureExplorer::add_texture_objects(vogl_gl_object_state_ptr_vec textureObjects)
+{
+ uint textureCount = 0;
+
+ for (vogl_gl_object_state_ptr_vec::iterator iter = textureObjects.begin(); iter != textureObjects.end(); iter++)
{
+ ++textureCount;
+ m_objects.push_back(*iter);
+
if ((*iter)->get_type() == cGLSTTexture)
{
vogl_texture_state* pTexState = static_cast<vogl_texture_state*>(*iter);
VOGL_ASSERT(!"Unhandled object type in TextureExplorer");
}
}
+
+ return textureCount;
}
-void vogleditor_QTextureExplorer::add_texture_object(vogl_texture_state& textureState, vogl::dynamic_string bufferType)
+uint vogleditor_QTextureExplorer::add_texture_object(vogl_texture_state& textureState, vogl::dynamic_string bufferType)
{
m_objects.push_back(&textureState);
valueStr = valueStr.sprintf("%s (%u x %u) %s", bufferType.c_str(), textureState.get_texture().get_width(), textureState.get_texture().get_height(), g_gl_enums.find_name(textureState.get_texture().get_ogl_internal_fmt()));
ui->textureObjectListbox->addItem(valueStr, QVariant::fromValue((vogl_gl_object_state*)&textureState));
+ return 1;
}
bool vogleditor_QTextureExplorer::set_active_texture(unsigned long long textureHandle)
#include "vogleditor_qtextureviewer.h"
class vogl_gl_object_state;
+class vogl_context_snapshot;
typedef vogl::vector<vogl_gl_object_state *> vogl_gl_object_state_ptr_vec;
class vogl_texture_state;
explicit vogleditor_QTextureExplorer(QWidget *parent = 0);
~vogleditor_QTextureExplorer();
- void set_texture_objects(vogl_gl_object_state_ptr_vec objects);
- void add_texture_object(vogl_texture_state& textureState, vogl::dynamic_string bufferType);
+ uint set_texture_objects(vogl::vector<vogl_context_snapshot*> sharingContexts);
+ uint set_renderbuffer_objects(vogl::vector<vogl_context_snapshot*> sharingContexts);
+ uint set_texture_objects(vogl_gl_object_state_ptr_vec objects);
+ uint add_texture_object(vogl_texture_state& textureState, vogl::dynamic_string bufferType);
bool set_active_texture(unsigned long long textureHandle);
vogl_gl_object_state_ptr_vec m_objects;
QTextureViewer m_textureViewer;
+ uint add_texture_objects(vogl_gl_object_state_ptr_vec objects);
+
private slots:
void selectedTextureIndexChanged(int index);
void channelSelectionChanged(int index);