m_pPlayButton->setEnabled(false);
m_pTrimButton->setEnabled(false);
- if (m_traceReplayer.replay(m_pTraceReader, m_pApiCallTreeModel->root(), NULL, 0, true))
- {
- // replay was successful
- m_pPlayButton->setEnabled(true);
- m_pTrimButton->setEnabled(true);
- }
- else
- {
- vogleditor_output_error("Failed to replay the trace.");
- }
+ m_traceReplayer.replay(m_pTraceReader, m_pApiCallTreeModel->root(), NULL, 0, true);
+
+ m_pPlayButton->setEnabled(true);
+ m_pTrimButton->setEnabled(true);
setCursor(origCursor);
}
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;
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;
float fVals[16];
int iVals[16];
bool bVals[4];
+
+ memset(fVals, 0, sizeof(fVals));
+ memset(iVals, 0, sizeof(iVals));
+ memset(bVals, 0, sizeof(bVals));
+
QString tmp;
#define GET_PTR(name, num) if (generalState.get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecPtrItem* pPtrItem = new vogleditor_stateTreeStateVecPtrItem(#name, name, 0, generalState, iVals, num, false, this); this->m_diffableItems.push_back(pPtrItem); this->appendChild(pPtrItem); }
pNode->appendChild(pIntItem); }\
} pNode->setValue(tmp.sprintf("[%d]", pNode->childCount())); this->appendChild(pNode);}
+#define GET_INDEXED_BOOL(name, num, totalIndices) if (totalIndices > 0) {vogleditor_stateTreeItem* pNode = new vogleditor_stateTreeItem(#name, "", this);\
+ for (int i = 0; i < totalIndices; i++) {\
+ if (generalState.get<bool>(name, i, bVals, num, true)) {\
+ vogleditor_stateTreeStateVecBoolItem* pBoolItem = new vogleditor_stateTreeStateVecBoolItem(STR_INT(i), name, i, generalState, &(bVals[i]), num, true, pNode);\
+ this->m_diffableItems.push_back(pBoolItem);\
+ pNode->appendChild(pBoolItem); }\
+ } pNode->setValue(tmp.sprintf("[%d]", pNode->childCount())); this->appendChild(pNode);}
+
// Start of version 1.0 - 2.1
GET_INT(GL_ACCUM_ALPHA_BITS, 1);
GET_INT(GL_ACCUM_BLUE_BITS, 1);
GET_INT(GL_AUX_BUFFERS, 1);
GET_BOOL(GL_BLEND, 1);
+ int maxDrawBuffers = info.get_max_draw_buffers();
+ GET_INDEXED_BOOL(GL_BLEND, 1, maxDrawBuffers);
GET_FLOAT(GL_BLEND_COLOR, 4);
GET_ENUM(GL_BLEND_DST, 1);
GET_ENUM(GL_BLEND_DST_ALPHA, 1);
#undef GET_FLOAT
#undef GET_MATRIX
#undef GET_INDEXED_INT
+#undef GET_INDEXED_BOOL
}
#include "vogl_find_files.h"
#include "vogl_file_utils.h"
#include "vogl_gl_replayer.h"
-
+#include "vogleditor_output.h"
vogleditor_traceReplayer::vogleditor_traceReplayer()
: m_pTraceReplayer(vogl_new(vogl_gl_replayer))
bool bStatus = true;
while (status == vogl_gl_replayer::cStatusResizeWindow)
{
- vogl_warning_printf("%s: Waiting for window to resize\n", VOGL_METHOD_NAME);
+ vogleditor_output_message("Waiting for replay window to resize.");
// Pump X events in case the window is resizing
if (process_x_events())
if (bStatus && status != vogl_gl_replayer::cStatusOK)
{
- vogl_error_printf("%s: Replay unable to apply snapshot\n", VOGL_FUNCTION_NAME);
+ vogleditor_output_error("Replay unable to apply snapshot");
bStatus = false;
}
return bStatus;
}
-bool vogleditor_traceReplayer::recursive_replay_apicallTreeItem(vogleditor_apiCallTreeItem* pItem, vogleditor_gl_state_snapshot** ppNewSnapshot, uint64_t apiCallNumber)
+vogleditor_tracereplayer_result vogleditor_traceReplayer::recursive_replay_apicallTreeItem(vogleditor_apiCallTreeItem* pItem, vogleditor_gl_state_snapshot** ppNewSnapshot, uint64_t apiCallNumber)
{
- bool bStatus = true;
-
+ vogleditor_tracereplayer_result result = VOGLEDITOR_TRR_SUCCESS;
vogleditor_apiCallItem* pApiCall = pItem->apiCallItem();
if (pApiCall != NULL)
{
while (m_pTraceReplayer->get_has_pending_window_resize() || m_pTraceReplayer->get_pending_apply_snapshot())
{
// Pump X events in case the window is resizing
- bStatus = process_x_events();
- if (bStatus)
+ if (process_x_events())
{
status = m_pTraceReplayer->process_pending_window_resize();
if (status != vogl_gl_replayer::cStatusResizeWindow)
else
{
// most likely the window wants to close, so let's return
- return false;
+ return VOGLEDITOR_TRR_USER_EXIT;
}
}
// get the snapshot after the selected api call
if ((!*ppNewSnapshot) && (m_pTraceReplayer->get_last_processed_call_counter() == static_cast<int64_t>(apiCallNumber)))
{
- vogl_printf("Taking snapshot on API call # %" PRIu64 "\n", apiCallNumber);
+ dynamic_string info;
+ vogleditor_output_message(info.format("Taking snapshot on API call # %" PRIu64 "...", apiCallNumber).c_str());
vogl_gl_state_snapshot* pNewSnapshot = m_pTraceReplayer->snapshot_state();
if (pNewSnapshot == NULL)
{
- vogl_error_printf("Taking new snapshot failed!\n");
+ result = VOGLEDITOR_TRR_ERROR;
+ vogleditor_output_error("... snapshot failed!");
}
else
{
- vogl_printf("Taking snapshot succeeded\n");
+ result = VOGLEDITOR_TRR_SNAPSHOT_SUCCESS;
+ vogleditor_output_message("... snapshot succeeded!\n");
*ppNewSnapshot = vogl_new(vogleditor_gl_state_snapshot, pNewSnapshot);
if (*ppNewSnapshot == NULL)
{
- vogl_error_printf("Allocating memory for snapshot container failed!\n");
+ result = VOGLEDITOR_TRR_ERROR;
+ vogleditor_output_error("Allocating memory for snapshot container failed!");
vogl_delete(pNewSnapshot);
}
}
-
- bStatus = false;
}
}
}
else
{
// replaying the trace packet failed, set as error
- vogl_error_printf("%s: unable to replay gl entrypoint at call %" PRIu64 "\n", VOGL_FUNCTION_NAME, pTrace_packet->get_call_counter());
- bStatus = false;
+ result = VOGLEDITOR_TRR_ERROR;
+ dynamic_string info;
+ vogleditor_output_error(info.format("Unable to replay gl entrypoint at call %" PRIu64, pTrace_packet->get_call_counter()).c_str());
}
}
- if (bStatus && pItem->has_snapshot() && pItem->get_snapshot()->is_edited() && pItem->get_snapshot()->is_valid())
+ if (result == VOGLEDITOR_TRR_SUCCESS && pItem->has_snapshot() && pItem->get_snapshot()->is_edited() && pItem->get_snapshot()->is_valid())
{
- bStatus = applying_snapshot_and_process_resize(pItem->get_snapshot()->get_snapshot());
+ if(applying_snapshot_and_process_resize(pItem->get_snapshot()->get_snapshot()))
+ {
+ result = VOGLEDITOR_TRR_SUCCESS;
+ }
}
- if (bStatus)
+ if (result == VOGLEDITOR_TRR_SUCCESS)
{
for (int i = 0; i < pItem->childCount(); i++)
{
- bStatus = recursive_replay_apicallTreeItem(pItem->child(i), ppNewSnapshot, apiCallNumber);
+ result = recursive_replay_apicallTreeItem(pItem->child(i), ppNewSnapshot, apiCallNumber);
- if (!bStatus)
+ if (result != VOGLEDITOR_TRR_SUCCESS)
break;
+
+ // Pump X events in case the window is resizing
+ if (process_x_events() == false)
+ {
+ // most likely the window wants to close, so let's return
+ return VOGLEDITOR_TRR_USER_EXIT;
+ }
}
}
- return bStatus;
+ return result;
}
-bool vogleditor_traceReplayer::replay(vogl_trace_file_reader* m_pTraceReader, vogleditor_apiCallTreeItem* pRootItem, vogleditor_gl_state_snapshot** ppNewSnapshot, uint64_t apiCallNumber, bool endlessMode)
+vogleditor_tracereplayer_result vogleditor_traceReplayer::replay(vogl_trace_file_reader* m_pTraceReader, vogleditor_apiCallTreeItem* pRootItem, vogleditor_gl_state_snapshot** ppNewSnapshot, uint64_t apiCallNumber, bool endlessMode)
{
// reset to beginnning of trace file.
m_pTraceReader->seek_to_frame(0);
if (!m_window.open(initial_window_width, initial_window_height))
{
- vogl_error_printf("%s: Failed opening GL replayer window!\n", VOGL_FUNCTION_NAME);
- return false;
+ vogleditor_output_error("Failed opening GL replayer window!");
+ return VOGLEDITOR_TRR_ERROR;
}
uint replayer_flags = cGLReplayerForceDebugContexts;
if (!m_pTraceReplayer->init(replayer_flags, &m_window, m_pTraceReader->get_sof_packet(), m_pTraceReader->get_multi_blob_manager()))
{
- vogl_error_printf("%s: Failed initializing GL replayer\n", VOGL_FUNCTION_NAME);
+ vogleditor_output_error("Failed initializing GL replayer!");
m_window.close();
- return false;
+ return VOGLEDITOR_TRR_ERROR;
}
XSelectInput(m_window.get_display(), m_window.get_xwindow(),
timer tm;
tm.start();
- bool bStatus = true;
+ vogleditor_tracereplayer_result result = VOGLEDITOR_TRR_SUCCESS;
for ( ; ; )
{
if (process_x_events() == false)
{
+ result = VOGLEDITOR_TRR_USER_EXIT;
break;
}
{
vogleditor_apiCallTreeItem* pFirstFrame = pRootItem->child(0);
+ bool bStatus = true;
// if the first snapshot has not been edited, then restore it here, otherwise it will get restored in the recursive call below.
if (pFirstFrame->has_snapshot() && !pFirstFrame->get_snapshot()->is_edited())
{
if (bStatus)
{
// replay each API call.
- bStatus = recursive_replay_apicallTreeItem(pRootItem, ppNewSnapshot, apiCallNumber);
+ result = recursive_replay_apicallTreeItem(pRootItem, ppNewSnapshot, apiCallNumber);
- if (bStatus == false)
+ if (result == VOGLEDITOR_TRR_ERROR)
+ {
+ QString msg = QString("Replay ending abruptly at frame index %1, global api call %2").arg(m_pTraceReplayer->get_frame_index()).arg(m_pTraceReplayer->get_last_processed_call_counter());
+ vogleditor_output_error(msg.toStdString().c_str());
+ break;
+ }
+ else if (result == VOGLEDITOR_TRR_SNAPSHOT_SUCCESS)
+ {
+ break;
+ }
+ else if (result == VOGLEDITOR_TRR_USER_EXIT)
{
- vogl_error_printf("%s: Replay ending abruptly at frame index %u, global api call %" PRIu64 "\n", VOGL_FUNCTION_NAME, m_pTraceReplayer->get_frame_index(), m_pTraceReplayer->get_last_processed_call_counter());
- break;
+ vogleditor_output_message("Replay stopped");
+ break;
}
else
{
- vogl_message_printf("%s: At trace EOF, frame index %u\n", VOGL_FUNCTION_NAME, m_pTraceReplayer->get_frame_index());
- if (!endlessMode)
- {
- break;
- }
+ QString msg = QString("At trace EOF, frame index %1").arg(m_pTraceReplayer->get_frame_index());
+ vogleditor_output_message(msg.toStdString().c_str());
+ if (!endlessMode)
+ {
+ break;
+ }
}
}
else
m_pTraceReplayer->deinit();
m_window.close();
- return bStatus;
+ return result;
}
bool vogleditor_traceReplayer::pause()