r_occlusionQuery can be used to disable occlusion culling, which stalls GPU on some Apple's GeForce drivers

This commit is contained in:
yvt 2013-09-08 16:44:50 +09:00
parent 783916e4b7
commit b05312d01f
2 changed files with 16 additions and 14 deletions

View File

@ -38,6 +38,7 @@
SPADES_SETTING(r_water, "2");
SPADES_SETTING(r_maxAnisotropy, "8");
SPADES_SETTING(r_occlusionQuery, "1");
namespace spades {
namespace draw {
@ -696,7 +697,7 @@ namespace spades {
GLProfiler profiler(device, "Render");
if(!occlusionQuery)
if(occlusionQuery == 0 && r_occlusionQuery)
occlusionQuery = device->GenQuery();
GLColorBuffer colorBuffer;
@ -866,13 +867,15 @@ namespace spades {
device->BindBuffer(IGLDevice::ElementArrayBuffer, idxBuffer);
device->BeginQuery(IGLDevice::SamplesPassed,
occlusionQuery);
if(occlusionQuery)
device->BeginQuery(IGLDevice::SamplesPassed,
occlusionQuery);
device->DrawElements(IGLDevice::Triangles, numIndices,
IGLDevice::UnsignedInt, NULL);
device->EndQuery(IGLDevice::SamplesPassed);
if(occlusionQuery)
device->EndQuery(IGLDevice::SamplesPassed);
device->BindBuffer(IGLDevice::ElementArrayBuffer, 0);

View File

@ -70,6 +70,7 @@ SPADES_SETTING(s_eax, "1");
SPADES_SETTING(r_maxAnisotropy, "8");
SPADES_SETTING(r_colorCorrection, "1");
SPADES_SETTING(r_physicalLighting, "");
SPADES_SETTING(r_occlusionQuery, "");
static std::vector<spades::IntVector3> g_modes;
@ -499,13 +500,12 @@ void MainWindow::CheckGLCapability() {
if(extensions.find("GL_ARB_occlusion_query") ==
std::string::npos) {
if((int)r_water >= 2) {
r_water = 1;
SPLog("Disabling Water 2: no GL_ARB_occlusion_query");
if(r_occlusionQuery) {
r_occlusionQuery = 0;
SPLog("Disabling r_occlusionQuery: no GL_ARB_occlusion_query");
}
msg += "GL_ARB_occlusion_query is NOT SUPPORTED<br>";
msg += "&nbsp;&nbsp;Water 2 is disabled (3 required)<br>";
msg += "&nbsp;&nbsp;(Shader Effects is limited to Medium)<br>";
msg += "&nbsp;&nbsp;r_occlusionQuery is disabled<br>";
}else{
msg += "<font color=#007f00>";
msg += "GL_ARB_occlusion_query is supported";
@ -514,13 +514,12 @@ void MainWindow::CheckGLCapability() {
if(extensions.find("GL_NV_conditional_render") ==
std::string::npos) {
if((int)r_water >= 2) {
r_water = 1;
SPLog("Disabling Water 2: no GL_NV_conditional_render");
if(r_occlusionQuery) {
r_occlusionQuery = 0;
SPLog("Disabling r_occlusionQuery: no GL_NV_conditional_render");
}
msg += "GL_NV_conditional_render is NOT SUPPORTED<br>";
msg += "&nbsp;&nbsp;Water 2 is disabled (3 required)<br>";
msg += "&nbsp;&nbsp;(Shader Effects is limited to Medium)<br>";
msg += "&nbsp;&nbsp;r_occlusionQuery is disabled<br>";
}else{
msg += "<font color=#007f00>";
msg += "GL_NV_conditional_render is supported";