本文整理汇总了C++中ASSERT_MAIN_THREAD函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_MAIN_THREAD函数的具体用法?C++ ASSERT_MAIN_THREAD怎么用?C++ ASSERT_MAIN_THREAD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERT_MAIN_THREAD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT_MAIN_THREAD
void sdl_window_info::destroy()
{
sdl_window_info **prevptr;
ASSERT_MAIN_THREAD();
if (multithreading_enabled)
{
sdlwindow_sync();
}
//osd_event_wait(window->rendered_event, osd_ticks_per_second()*10);
// remove us from the list
for (prevptr = &sdl_window_list; *prevptr != NULL; prevptr = &(*prevptr)->m_next)
if (*prevptr == this)
{
*prevptr = this->m_next;
break;
}
// free the textures etc
execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this));
// free the render target, after the textures!
this->machine().render().target_free(m_target);
// free the event
osd_event_free(m_rendered_event);
// free the lock
osd_lock_free(this->m_render_lock);
}
示例2: ASSERT_MAIN_THREAD
void ShaderState::DrawArrays(uint dt, size_t count) const
{
ASSERT_MAIN_THREAD();
glDrawArrays(dt, 0, (GLsizei)count);
glReportError();
graphicsDrawCount++;
}
示例3: sdlwindow_exit
static void sdlwindow_exit(running_machine &machine)
{
ASSERT_MAIN_THREAD();
mame_printf_verbose("Enter sdlwindow_exit\n");
// free all the windows
while (sdl_window_list != NULL)
{
sdl_window_info *temp = sdl_window_list;
sdl_window_list = temp->next;
sdlwindow_video_window_destroy(machine, temp);
}
// if we're multithreaded, clean up the window thread
if (multithreading_enabled)
{
sdlwindow_sync();
}
// kill the drawers
(*draw.exit)();
execute_async_wait(&sdlwindow_exit_wt, NULL);
if (multithreading_enabled)
{
osd_work_queue_wait(work_queue, 1000000);
osd_work_queue_free(work_queue);
}
mame_printf_verbose("Leave sdlwindow_exit\n");
}
示例4: ASSERT_MAIN_THREAD
int CScriptSystem::BeginCall(const char* sFuncName, const bool bRaiseError /* = true */)
{
ASSERT_MAIN_THREAD();
// Check for LUA stack corruption
CheckStackOnBeginCall();
lua_getglobal(m_pLS, sFuncName);
m_nTempArg = 0;
#ifdef _DEBUG
if (!lua_isfunction(m_pLS, -1))
{
if (bRaiseError)
{
RaiseError(m_pLS, "Function %s not found(check for syntax errors or if the file wasn't loaded)", sFuncName);
}
m_nTempArg = -1;
lua_pop(m_pLS, 1);
m_CurrentDeep--;
return 0;
}
#endif
return 1;
}
示例5: sdlwindow_video_window_update_hi
void sdlwindow_video_window_update_hi(running_machine &machine, sdl_window_info *window)
{
ASSERT_MAIN_THREAD();
// adjust the cursor state
sdlwindow_update_cursor_state(machine, window);
}
示例6: osd_malloc
int sdl_window_info::window_init()
{
worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param));
int result;
ASSERT_MAIN_THREAD();
// set the initial maximized state
// FIXME: Does not belong here
sdl_options &options = downcast<sdl_options &>(m_machine.options());
m_startmaximized = options.maximize();
// add us to the list
*last_window_ptr = this;
last_window_ptr = &this->m_next;
set_renderer(draw.create(this));
// create an event that we can use to skip blitting
m_rendered_event = osd_event_alloc(FALSE, TRUE);
// load the layout
m_target = m_machine.render().target_alloc();
// set the specific view
set_starting_view(m_index, options.view(), options.view(m_index));
// make the window title
if (video_config.numscreens == 1)
sprintf(m_title, "%s: %s [%s]", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name);
else
sprintf(m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), m_machine.system().description, m_machine.system().name, m_index);
wp->set_window(this);
// FIXME: pass error back in a different way
if (multithreading_enabled)
{
osd_work_item *wi;
wi = osd_work_item_queue(work_queue, &sdl_window_info::complete_create_wt, (void *) wp, 0);
sdlwindow_sync();
result = *((int *) (osd_work_item_result)(wi));
osd_work_item_release(wi);
}
else
result = *((int *) sdl_window_info::complete_create_wt((void *) wp, 0));
// handle error conditions
if (result == 1)
goto error;
return 0;
error:
destroy();
return 1;
}
示例7: sdlwindow_video_window_update
void sdlwindow_video_window_update(running_machine &machine, sdl_window_info *window)
{
osd_ticks_t event_wait_ticks;
ASSERT_MAIN_THREAD();
// adjust the cursor state
sdlwindow_update_cursor_state(machine, window);
// if we're visible and running and not in the middle of a resize, draw
if (window->target != NULL)
{
int tempwidth, tempheight;
// see if the games video mode has changed
window->target->compute_minimum_size(tempwidth, tempheight);
if (tempwidth != window->minwidth || tempheight != window->minheight)
{
window->minwidth = tempwidth;
window->minheight = tempheight;
if (!window->fullscreen)
{
sdlwindow_blit_surface_size(window, window->width, window->height);
sdlwindow_resize(window, window->blitwidth, window->blitheight);
}
else if (video_config.switchres)
{
pick_best_mode(window, &tempwidth, &tempheight);
sdlwindow_resize(window, tempwidth, tempheight);
}
}
if (video_config.waitvsync && video_config.syncrefresh)
event_wait_ticks = osd_ticks_per_second(); // block at most a second
else
event_wait_ticks = 0;
if (osd_event_wait(window->rendered_event, event_wait_ticks))
{
worker_param wp;
render_primitive_list *primlist;
clear_worker_param(&wp);
// ensure the target bounds are up-to-date, and then get the primitives
primlist = &window->get_primitives(window);
// and redraw now
wp.list = primlist;
wp.window = window;
wp.m_machine = &machine;
execute_async(&draw_video_contents_wt, &wp);
}
}
}
示例8: ASSERT_MAIN_THREAD
void sdl_window_info::resize(INT32 width, INT32 height)
{
ASSERT_MAIN_THREAD();
osd_dim cd = get_size();
if (width != cd.width() || height != cd.height())
{
auto wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this()), width, height);
execute_async_wait(&sdlwindow_resize_wt, std::move(wp));
}
}
示例9: sdlwindow_toggle_full_screen
void sdlwindow_toggle_full_screen(running_machine &machine, sdl_window_info *window)
{
worker_param wp;
ASSERT_MAIN_THREAD();
clear_worker_param(&wp);
wp.window = window;
wp.m_machine = &machine;
execute_async_wait(&sdlwindow_toggle_full_screen_wt, &wp);
}
示例10: sdlwindow_video_window_update
void sdlwindow_video_window_update(running_machine *machine, sdl_window_info *window)
{
ASSERT_MAIN_THREAD();
// adjust the cursor state
sdlwindow_update_cursor_state(machine, window);
// if we're visible and running and not in the middle of a resize, draw
if (window->target != NULL)
{
int tempwidth, tempheight;
// see if the games video mode has changed
render_target_get_minimum_size(window->target, &tempwidth, &tempheight);
if (tempwidth != window->minwidth || tempheight != window->minheight)
{
window->minwidth = tempwidth;
window->minheight = tempheight;
if (!window->fullscreen)
{
sdlwindow_blit_surface_size(window, window->width, window->height);
sdlwindow_resize(window, window->blitwidth, window->blitheight);
}
else if (video_config.switchres)
{
pick_best_mode(window, &tempwidth, &tempheight);
sdlwindow_resize(window, tempwidth, tempheight);
}
}
// only render if we have been signalled
if (osd_event_wait(window->rendered_event, 0))
{
worker_param wp;
const render_primitive_list *primlist;
clear_worker_param(&wp);
// ensure the target bounds are up-to-date, and then get the primitives
primlist = window->get_primitives(window);
// and redraw now
wp.list = primlist;
wp.window = window;
wp.machine = machine;
execute_async(&draw_video_contents_wt, &wp);
}
}
}
示例11: glReportValidateShaderError1
void glReportValidateShaderError1(const char *file, uint line, const char *function, GLuint program, const char *name)
{
ASSERT_MAIN_THREAD();
if (!(globals.debugRender&DBG_GLERROR) && globals.frameStep > kDebugFrames)
return;
glValidateProgram(program);
GLint status = 0;
glGetProgramiv(program, GL_VALIDATE_STATUS, &status);
checkProgramInfoLog(program, "validate");
glReportError1(file, line, function);
ASSERT_(status == GL_TRUE, file, line, function, "%s", name);
}
示例12: glReportFramebufferError1
static GLenum glReportFramebufferError1(const char *file, uint line, const char *function)
{
ASSERT_MAIN_THREAD();
if (!(globals.debugRender&DBG_GLERROR) && globals.frameStep > kDebugFrames)
return GL_NO_ERROR;
GLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (GL_FRAMEBUFFER_COMPLETE != err)
{
OLG_OnAssertFailed(file, line, function, "glCheckFramebufferStatus", "%s", getGLFrameBufferStatusString(err).c_str());
}
return err;
}
示例13: sdlwindow_resize
void sdlwindow_resize(sdl_window_info *window, INT32 width, INT32 height)
{
worker_param wp;
ASSERT_MAIN_THREAD();
if (width == window->width && height == window->height)
return;
clear_worker_param(&wp);
wp.resize_new_width = width;
wp.resize_new_height = height;
wp.window = window;
execute_async_wait(&sdlwindow_resize_wt, &wp);
}
示例14: glReportError1
GLenum glReportError1(const char *file, uint line, const char *function)
{
ASSERT_MAIN_THREAD();
if (!(globals.debugRender&DBG_GLERROR) && globals.frameStep > kDebugFrames)
return GL_NO_ERROR;
GLenum err = GL_NO_ERROR;
while (GL_NO_ERROR != (err = glGetError()))
{
const char* msg = (const char *)gluErrorString(err);
OLG_OnAssertFailed(file, line, function, "glGetError", "%s", msg);
}
return err;
}
示例15: set_starting_view
static void set_starting_view(running_machine &machine, int index, sdl_window_info *window, const char *defview, const char *view)
{
int viewindex;
ASSERT_MAIN_THREAD();
// choose non-auto over auto
if (strcmp(view, "auto") == 0 && strcmp(defview, "auto") != 0)
view = defview;
// query the video system to help us pick a view
viewindex = window->target->configured_view(view, index, video_config.numscreens);
// set the view
window->target->set_view(viewindex);
window->start_viewscreen=viewindex;
}