[Ìá¤ë]
Windows ¤Î vsync ÌäÂêÃí¡Ë2001/08/15 »þÅÀ¤Î¾ðÊó¤Ë´ð¤Å¤¤¤¿ÆâÍƤǤ¹¡£¸½¾õ¤È¤Ï¹çÃפ·¤Ê¤¤²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£Windows ¾å¤Ç¥²¡¼¥à¤òºî¤ë¾ì¹ç¤Ë¤Ö¤ÁÅö¤¿¤ë vsync ÌäÂê¤Ë¤Ä¤¤¤Æ¤Þ¤È¤á¤Þ¤¹¡£ ÍѸì¤È´ðÁÃÃμ±
¥Õ¥ì¡¼¥à¥ì¡¼¥È¤È¤Ï¡¢ 1 Éô֤˲¿²ó¥²¡¼¥à²èÌ̤¬¹¹¿·¤µ¤ì¤ë¤«¤ò¼¨¤¹¿ô»ú¤Ç¤¹¡£ Éô֥ե졼¥à¿ô¤ò°ÕÌ£¤¹¤ë frame per second ¤ÎƬʸ»ú¤ò¤È¤Ã¤Æ¡¢ fps ¤È¸À¤¦Ã±°Ì¤¬»È¤ï¤ì¤Þ¤¹¡£ ¥â¥Ë¥¿¡¼¤Îɽ¼¨¹¹¿·¤Ï¡¢ÁöººÀþ¤È¸Æ¤Ð¤ì¤ë¥é¥¤¥ó¤¬¡¢ ²èÌÌÁ´ÂΤòÁöºº¤¹¤ë¤³¤È¤Ç¹Ô¤ï¤ì¤Þ¤¹¡£ ¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤È¤Ï¡¢ 1 Éô֤˲¿²óÁöºº¤¬¹Ô¤ï¤ì¤ë¤«¤ò¼¨¤¹¿ô»ú¤Ç¤¹¡£ ñ°Ì¤Ï Hz ¤Ç¤¹¡£ ¥²¡¼¥à¤Î¥Õ¥ì¡¼¥à¥ì¡¼¥È¤È¥â¥Ë¥¿¡¼¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤¬¤º¤ì¤Æ¤¤¤ë¤È¡¢ ¥²¡¼¥à²èÌ̤ι¹¿·¤¬¥¬¥¯¥¬¥¯¤ÈÉÔ°ÂÄê¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ Ä̾沈¡¼¥à¥½¥Õ¥È¤Ç¤Ï¤³¤ì¤òÈò¤±¤ë¤¿¤á¡¢ ¥²¡¼¥à¤Î¥Õ¥ì¡¼¥à¥ì¡¼¥È¤ò¥â¥Ë¥¿¡¼¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤ËƱ´ü¤µ¤»¤Æ¡¢ °ÂÄꤷ¤¿²èÌÌɽ¼¨¤ò¹Ô¤¤¤Þ¤¹¡£ ¤³¤Î¼êË¡¤ò vsync ¤È¸Æ¤Ó¤Þ¤¹¡£ ¡Ö¿âľƱ´ü¡×¤ä¡ÖV Ʊ´ü¡×¤È¸Æ¤Ö¿Í¤â¤¤¤Þ¤¹¡£ ¥â¥Ë¥¿¡¼¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤ÎÌäÂêÅÀ
¥â¥Ë¥¿¡¼¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤Ï¡¢¥æ¡¼¥¶¡¼¤ÎÀßÄ꼡Âè¤ÇÊѤï¤Ã¤Æ¤¤Þ¤¹¡£ ÂçÄñ¤Ï 60Hz¡¢¹â¤¤¤â¤Î¤À¤È 120Hz °Ê¾å¤Î¤â¤Î¤â¤¢¤ê¤Þ¤¹¡£ vsync ¤ò¹Ô¤Ã¤Æ¤¤¤ë¥½¥Õ¥È¤ò¡¢60Hz ¤Î´Ä¶¤È 120Hz ¤Î´Ä¶¤Ç¼Â¹Ô¤¹¤ë¾ì¹ç¡¢ ¼Â¹Ô®ÅÙ¤Ë 2 Çܤκ¹¤¬½Ð¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ ¤³¤ì¤Ç¤Ï¡¢¥²¡¼¥à¥Ð¥é¥ó¥¹¤Ï¤á¤Á¤ã¤¯¤Á¤ã¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ ¥â¥Ë¥¿¡¼¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤Ï¡¢DirectX ·Ðͳ¤ÇÀßÄê²Äǽ¤Ç¤¹¡£ ¤¿¤À¤·À©Ì󤬤¢¤ê¤Þ¤¹¡£ ¤Þ¤º¡¢¥â¥Ë¥¿¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È°Ê³°¤ËÀßÄꤹ¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£ ¤½¤·¤Æ¡¢¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤ÎÊѹ¹¤Ï¡¢¥Õ¥ë¥¹¥¯¥ê¡¼¥ó¥â¡¼¥É»þ¤Î¤ßÍøÍѲÄǽ¤Ç¤¹¡£ Window ¥â¡¼¥É¤Ç¤â¼Â¹Ô¤·¤¿¤¤¥²¡¼¥à¤Ç¤Ï¡¢¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥ÈÊѹ¹¤Ï¤½¤â¤½¤âÉÔ²Äǽ¤È¤Ê¤ê¤Þ¤¹¡£ ¤¤¤º¤ì¤â¡¢¥É¥é¥¤¥Ð¤Î¥µ¥Ý¡¼¥È¾õ¶·¼¡Âè¤Ç¡¢ °Õ¿Þ¤·¤¿¤È¤ª¤ê¤ÎÆ°ºî¤ò¤·¤Æ¤¯¤ì¤Ê¤¤¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ vsync API ¤ÎÌäÂê
DirectX ¤Ë¤Ï vsync ¤ò¼è¤ë API ¤¬Ä󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£ Î㤨¤Ð DirectDrawSurface ¤Î Flip ¥á¥½¥Ã¥ÉÅù¤Ë¤Ï¡¢ vsync ¤ÎÍ̵¤ò°ú¿ô¤Ç»ØÄê²Äǽ¤Ç¤¹¡£ ¤¿¤À¤·¤³¤ì¤Ï¥Õ¥ë¥¹¥¯¥ê¡¼¥ó¥â¡¼¥É»þ¤Î¤ß͸ú¤Ç¤¹¡£ Á°½Ò¤Î Flip ¥á¥½¥Ã¥ÉÅù¤Ï¡¢ ¥Ó¥Ç¥ª¥«¡¼¥É¤Î¥Ù¥ó¥À¤´¤È¤Î¼ÂÁõ¤Ëº¸±¦¤µ¤ì¤ä¤¹¤¯¡¢ Á´¤¯µ¡Ç½¤·¤Ê¤¤¾ì¹ç¤â¤¢¤ê¤Þ¤¹¡£ vsync ¤ÎÂåÂؼêÃÊ¥â¥Ë¥¿¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤òÌÜŪ¤ÎÃͤËÀßÄê¤Ç¤¤Ê¤¤¤«¡¢ vsync API ¤¬ÍøÍѤǤ¤Ê¤¤¾ì¹ç¡¢ÂåÂؼêÃʤ¬É¬ÍפǤ¹¡£ °ìÈÌŪ¤Ë¡¢¹âÀºÅ٤Υ¿¥¤¥Þ¡¼¤òÍøÍѤ·¤Þ¤¹¡£ vsync ¤ò¹Ô¤¦¾ì¹ç¤Ë¤¯¤é¤Ù¡¢ ¥²¡¼¥à²èÌ̤Îɽ¼¨¤¬¥¬¥¯¥¬¥¯¤ÈÉÔ°ÂÄê¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¤¬¡¢ ÇؤËÊ¢¤ÏÊѤ¨¤é¤ì¤Þ¤»¤ó¡£ ¤¤¤¯¤Ä¤«¤ÎÊýË¡¤¬¤¢¤ê¤Þ¤¹¡£
Windows ¤Ë¤Ï¡¢ ¥Þ¥ë¥Á¥á¥Ç¥£¥¢¥¿¥¤¥Þ¡¼ ¤È¤¤¤¦¹âÀºÅÙ¥¿¥¤¥Þ¡¼¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤³¤ì¤Ï¡¢timeGetTime ´Ø¿ô¤Ç¼èÆÀ¤Ç¤¡¢ ʬ²òǽ¤ÏºÇÂç 1ms ñ°Ì¤Ç¤¹¡£ 60fps = 16.7ms ¤Ê¤Î¤Ç¡¢¤ª¤ª¤à¤Í½½Ê¬¤ÊÀºÅ٤Ǥ¹¡£ ¥Þ¥ë¥Á¥á¥Ç¥£¥¢¥¿¥¤¥Þ¡¼¤ò»ÈÍѤ¹¤ë¾ì¹ç¡¢Ãí°ÕÅÀ¤¬¤¢¤ê¤Þ¤¹¡£ ¥Þ¥ë¥Á¥á¥Ç¥£¥¢¥¿¥¤¥Þ¡¼¤Îʬ²òǽ¤Ï¡¢ timeBeginPeriod ´Ø¿ô¤Ç»ØÄꤷ¤¿Ãͤˤʤê¤Þ¤¹¡£ ¤è¤Ã¤Æ¡¢¤è¤ê¹â¤¤ÀºÅÙ¤òÆÀ¤¿¤¤¤Ê¤é¤Ð¡¢ »öÁ°¤Ë°Ê²¼¤Î¤è¤¦¤Ë¼Â¹Ô¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£ TIMECAPS tc ; timeGetDevCaps( &tc , sizeof(TIMECAPS) ); /* ¥Þ¥ë¥Á¥á¥Ç¥£¥¢¥¿¥¤¥Þ¡¼¤Î¥µ¡¼¥Ó¥¹ÀºÅÙ¤òºÇÂç¤Ë */ timeBeginPeriod( tc.wPeriodMin );¡ÖWindows API ¥Ð¥¤¥Ö¥ë 3¡×¤Î¥Þ¥ë¥Á¥á¥Ç¥£¥¢¥¿¥¤¥Þ¡¼¤Î¹àÌÜ(p.902)¤Ë¤Ï¡¢ ¡ÖtimeGetTime ´Ø¿ô¤ÎÀºÅÙ¤Ï timeBeginPeriod ´Ø¿ô¤Ë°Í¸¤·¤Ê¤¤¡×¤È¤¢¤ê¤Þ¤¹¤¬¡¢ ¤³¤Îµ½Ò¤Ï¸í¤ê¤ÎÍͤǤ¹¡£ MSDN online 2001-4·î¥ê¥ê¡¼¥¹¤Ë¤Ï¡¢ Windows NT¡§timeGetTime ´Ø¿ô¤Î´ûÄê¤ÎÀºÅ٤ϡ¢ ¥Þ¥·¥ó¤Ë¤è¤Ã¤Æ¤Ï 5 ¥ß¥êÉðʾå¤Ë¤Ê¤ë¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£ timeGetTime ´Ø¿ô¤ÎÀºÅ٤ϡ¢ timeBeginPeriod ´Ø¿ô¤È timeEndPeriod ´Ø¿ô¤ò»È¤Ã¤Æ¾å¤²¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ ¤³¤¦¤¹¤ë¤È¡¢ 2 ¤Ä¤ÎϢ³¤·¤¿ timeGetTime ´Ø¿ô¤ÎÌá¤êÃͤκ¹¤ÎºÇ¾®Ãͤϡ¢ timeBeginPeriod ´Ø¿ô¤È timeEndPeriod ´Ø¿ô¤ò»È¤Ã¤ÆÀßÄꤵ¤ì¤¿´Ö³Ö¤ÎºÇ¾®ÃͤÈƱ¤¸¤Ë¤Ê¤ê¤Þ¤¹¡£¤È¤¢¤ê¡¢¤ä¤Ï¤ê timeBeginPeriod ´Ø¿ô¤Ë°Í¸¤¹¤ë¤è¤¦¤Ç¤¹¡£ ¡Ê¾ðÊóÄó¶¡¤Ï ¤ä¤Í¤¦¤é¤ª ¤µ¤ó¤Ç¤¹¡£¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£¡Ë »ä¤Î Win2000 ´Ä¶¤ÇÄ´¤Ù¤¿·ë²Ì¤Ç¤â¡¢ ¤ä¤Ï¤ê timeBeginPeriod ´Ø¿ô¤Ë°Í¸¤·¤Æ¤¤¤Þ¤·¤¿¡£ timeGetTime ´Ø¿ô¤Ç¡¢¼ÂºÝ¤Ë 1ms ñ°Ì¤ÎÀºÅÙ¤¬ÆÀ¤é¤ì¤ë¤³¤È¤â³Îǧ¤·¤Þ¤·¤¿¡£ Windows ¤Ë¤Ï¡¢ ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¥«¥¦¥ó¥¿¡¼¤È¤¤¤¦¹âÀºÅÙ¥«¥¦¥ó¥¿¤¬¤¢¤ê¤Þ¤¹¡£ ¤³¤Á¤é¤Ï 1ms °Ê²¼¤ÎÀºÅÙ¤¬³ÎÊݲÄǽ¤Ç¤¹¡£ ¤¿¤À¤·¡¢¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¥«¥¦¥ó¥¿¡¼¤Ï¡¢ Á´¤Æ¤Î Windows ´Ä¶¤ÇÍøÍѤǤ¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó ¡Ê°ì¸«ÍøÍѲÄǽ¤Ë¸«¤¨¤Æ¡¢¼ÂºÝ¤Ë¤Ï¾ï¤Ë¥¿¥¤¥Þ¡¼ÃÍ¤Ë 0 ¤òÊÖ¤·¤Æ¤¤¿¤ê¡¢ÍÍ¡¹¤Ç¤¹¡Ë¡£ ¤Þ¤¿¡¢¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¥«¥¦¥ó¥¿¡¼¤ÎÀºÅ٤ϡ¢ Âô»³¤Î¥×¥í¥»¥¹¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¤È²¼¤¬¤Ã¤Æ¤¤¤¤Þ¤¹¡£ ¤è¤êÎɤ¤ vsync ¤ÎÂåÂؼêÃʤò³ÎÊݤ·¤¿¤¤¤Ê¤é¡¢ ¥Þ¥ë¥Á¥á¥Ç¥£¥¢¥¿¥¤¥Þ¡¼¤È¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¥«¥¦¥ó¥¿¡¼¤ÎÀºÅÙ¤ò¼Â¹Ô»þ¤ËÈæ³Ó¤·¤Æ¡¢ Îɤ¤¤Û¤¦¤òÁªÂò¤¹¤ë¤È¤¤¤¦¼êË¡¤¬É¬Íפˤʤê¤Þ¤¹¡£ ¤½¤Î¾¤Îº¤¤Ã¤¿ÌäÂê
¥²¡¼¥à¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬Æ°ºî¤·¤Æ¤¤¤ëºÇÃæ¤â¡¢ Windows ¤Ï΢¤Ç OS ¤ÎÍÍ¡¹¤Ê¾¤Î¥µ¡¼¥Ó¥¹¤ò¤³¤Ê¤·¤Æ¤¤¤Þ¤¹¡£ ¤½¤Î¤¿¤á¡¢¥²¡¼¥à¤Î°ÂÄêÆ°ºî¤¬Á˳²¤µ¤ì¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ DirectX ¤Î¶¨Ä´¥â¡¼¥É¤ò¡ÖÇÓ¾¥â¡¼¥É¡×¤ËÊѹ¹¤¹¤ë¤³¤È¤Ç¡¢ Windows ¤¬Î¢¤Ç¹Ô¤Ã¤Æ¤¤¤ë¥µ¡¼¥Ó¥¹¤Î±Æ¶Á¤òºÇ¾®¸Â¤Ë¤Ç¤¤ë¤È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤·¤«¤·¡¢¤³¤ì¤Ï´°Á´¤Ç¤Ï¤Ê¤¯¤Æ¡¢ ¥á¥â¥ê¥¹¥ï¥Ã¥×¤Î HDD ¥¢¥¯¥»¥¹¤¬È¯À¸¤¹¤ë¤È¤¤Ê¤É¤Ï¡¢ ¥²¡¼¥à¤Î¿Ê¹Ô¤Ï¤ä¤Ï¤ê°ì»þÄä»ß¤·¤Þ¤¹¡£ ¤³¤ÎÌäÂê¤ò²ò¾Ã¤¹¤ëÊýË¡¤ò¡¢»ä¤ÏÃΤê¤Þ¤»¤ó¡£ ¤½¤â¤½¤â¥²¡¼¥àÍÑÅÓ¤ËÆò½¤·¤¿ OS ¤Ç¤Ï¤Ê¤¤¤Ê¤Î¤Ç¡¢ ¤³¤³¤éÊդ꤬¸Â³¦¤Î¤è¤¦¤Ç¤¹¡£ DirectX ¤Î 256 ¿§¥â¡¼¥É¸ÇͤÎÌäÂê¤Ç¤¹¡£ ¥Ó¥Ç¥ª¥«¡¼¥É¥Ù¥ó¥À¤Î¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¡¢ ¥Ñ¥ì¥Ã¥ÈÀßÄê¤ò¹Ô¤¦¤È¤¡¢ API Æâ¤Ç¾¡¼ê¤Ë vsync ¤¬¼Â¹Ô¤µ¤ì¤ë¤è¤¦¤Ç¤¹¡£ ¤³¤ÎÍýͳ¤«¤é¡¢256 ¿§¥â¡¼¥É¤ÎÍøÍѤÏÄü¤á¤ë¤·¤«¤¢¤ê¤Þ¤»¤ó¡£ 256 ¿§¥â¡¼¥É¼«ÂΥ쥬¥·¡¼²½¤·¤Æ¤¤¤ë¤Î¤Ç¡¢ ¤µ¤Û¤ÉÌäÂê¤Ë¤Ê¤ë¤³¤È¤Ï̵¤¤¤È»×¤¤¤Þ¤¹¤¬¡£ ¡ÊÀÛºî¤Î ĶϢ¼Í68K ¤Ç¤ÏÂçÌäÂê¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡Ë ¤â¤¦°ì¤Ä¤Î vsync ÌäÂê²ò·èÊýË¡ ¡Öùt ²ÄÊѡפ³¤³¤Þ¤Ç¤Çµó¤²¤Æ¤¤¿¼êË¡¤Ï¡¢ ¥²¡¼¥à¥×¥í¥°¥é¥à¦¤Ç°Õ¿Þ¤·¤¿¥ì¡¼¥È¤Ç vsync ¤ò¹Ô¤¦¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤Þ¤·¤¿¡£ ¤³¤ì¤È¤ÏµÕ¤Ë¡¢¥â¥Ë¥¿¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤Ï²ÄÊѤǤ¢¤ë¤È¤¤¤¦Á°Äó¤ËΩ¤Ã¤Æ¡¢ ¥²¡¼¥à¤ÎÃæ¤Î»þ´Ö¿Ê¹Ô¼«ÂΤò¡¢ ¥â¥Ë¥¿¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤Ë¹ç¤ï¤»¤ë¤È¤¤¤¦¼êË¡¤¬¤¢¤ê¤Þ¤¹¡£¥²¡¼¥àÆâ¤Î 1 ¥Õ¥ì¡¼¥àʬ¤Î»þ´Ö¤Ï¡¢ °ìÈ̤Ëùt¡Ê¥Ç¥ë¥¿ ¥Æ¥£¡¼¡Ë¤È¸À¤¤¤Þ¤¹¡£ Á°¼Ô¤Î¡¢ ¥²¡¼¥àÆâ¤Î 1 ¥Õ¥ì¡¼¥àʬ¤Î»þ´Ö¤Ï°ìÄê¤È¤¹¤ë¥¹¥¿¥¤¥ë¤ò¡Öùt ¸ÇÄê¡×¡¢ ²ÄÊѤȤ¹¤ë¥¹¥¿¥¤¥ë¤ò¡Öùt ²ÄÊѡס¢ ¤È¸À¤¤¤Þ¤¹¡£ ùt = ¥â¥Ë¥¿¤Î¥ê¥Õ¥ì¥Ã¥·¥å¥ì¡¼¥È¤È¤¹¤ë¡Öùt ²ÄÊѡץ¹¥¿¥¤¥ë¤òºÎÍѤ¹¤ë¤³¤È¤Ç¡¢ °ìÏ¢¤ÎÌäÂê¤Ï²ò·è¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£ ¤¿¤À¤·¼ÂÁõ¤ÎÆñ°×Å٤Ͼ徺¤·¤Þ¤¹¤·¡¢ ´ØÏ¢¤¹¤ëÍÍ¡¹¤ÊÌäÂ꤬ȯÀ¸¤·¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢Ãí°Õ¤¬É¬ÍפǤ¹¡£ [Ìá¤ë] |