2011-02-27 2 views
3

프로파일 러를 게임에 추가하고이 기능을 분리했습니다. 때로는 FPS가 떨어집니다. 이것은 내 결과입니다.presentRenderbuffer : GL_RENDERBUFFER_OES가 오래 걸립니다.

Present buffer time: 22 
Present buffer time: 1 
Present buffer time: 9 
Present buffer time: 1 
Present buffer time: 20 
Present buffer time: 6 
Present buffer time: 4 
Present buffer time: 4 
Present buffer time: 22 
Present buffer time: 4 
Present buffer time: 8 
Present buffer time: 4 
Present buffer time: 4 
Present buffer time: 15 
Present buffer time: 1 
Present buffer time: 1 
Present buffer time: 1 
Present buffer time: 11 
Present buffer time: 1 
Present buffer time: 6 
Present buffer time: 1 
Present buffer time: 1 
Present buffer time: 25 
Present buffer time: 6 
Present buffer time: 7 
Present buffer time: 1 
Present buffer time: 10 
Present buffer time: 7 
Present buffer time: 3 
Present buffer time: 1 
Present buffer time: 12 
Present buffer time: 9 
Present buffer time: 6 
Present buffer time: 9 

몇 프레임마다이 기능이 더 많은 시간이 걸리는 이유를 알고 계십니까?


    f64 time = -System::GetTime();  
    [m_context presentRenderbuffer:GL_RENDERBUFFER_OES]; 
    Log("Present buffer time: %d\n", u32((System::GetTime() + time) * 1000.)); 

답변

3

glFlush()을 명시 적으로 호출하지 않으면 버퍼의 표현 작업이 presentRenderbuffer이라는 시점에서 버퍼의 렌더링 작업이 아직 완료되지 않았기 때문에 강제로 수행해야합니다.

버퍼를 제시하고 별도로 시간을 측정하기 전에 glFlush으로 전화 해보십시오.

+1

당신이 옳습니다. glFlush()를 사용하면이 함수는 일정 시간 (almoust)에 실행됩니다. glFlush가 다른 프레임에서 다른 시간을 갖는 이유를 알고 있습니까? 나는 동일한 내용을 가지고 있지만 glFlush 시간은 1ms에서 30ms까지 다양합니다! 도와 주셔서 감사합니다! – Felics

+0

@Felics. 다른 GPU 작업이 실행 중일 수 있습니다 ... 전체 화면 모드로 작업하고 있습니까? – kvark

+0

이 코드는 iPhone 版입니다. 그것은 전체 화면이고 한 스레드에서 OpenGL을 사용합니다. 나는 이것과 관련된 다른 질문을 추가했다 : http://stackoverflow.com/questions/5146987/glflush-time-varies-from-frame-to-frame-with-same-content-on-iphone – Felics

0

는 실제로 30 또는 60Hz 주사율로 양자화되는 될 수있는 화면으로 이동 버퍼 프리젠 테이션 렌더링 :

이 내 코드입니다. 빠른 렌더링은 실제로 이전 렌더링이 완료되기 전에 이전 렌더링을 버릴 수 있습니다.

+0

나는 디스플레이 링크를 사용하고 60Hz로 제한합니다. 내 업데이트 + 내 렌더링 시간은 약 3ms (~ 1 + 2, 간단한 2D 애니메이션)이지만이 기능으로 인해 내 fps는 ~ 50이며 때때로 ~ 30fps로 떨어집니다. NSTimer를 사용할 때 디스플레이 목록을 사용하기 전에 동일한 문제가있었습니다. xcode로 만든 새로운 OpenGL 프로젝트 템플릿의 표시 목록 코드를 복사했습니다. 제발 좀 더 자세한 정보를 주시겠습니까? – Felics

관련 문제