summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 18:20:19 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 18:20:19 +0000
commitc892a4e1d0ac1e378728319a0691184d03e70575 (patch)
tree4ef69de6f331e18af49e44b4e04ff880b38a6902 /gpu
parenta107bf0182ff5145680822c89de2cc7d5753eb21 (diff)
downloadchromium_src-c892a4e1d0ac1e378728319a0691184d03e70575.zip
chromium_src-c892a4e1d0ac1e378728319a0691184d03e70575.tar.gz
chromium_src-c892a4e1d0ac1e378728319a0691184d03e70575.tar.bz2
Add more disable-workaround checks
TEST=none BUG=96293 R=apatrick@chromium.org TBR=joi@chromium.org,sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10380014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc17
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h2
-rw-r--r--gpu/command_buffer/service/gpu_switches.cc5
-rw-r--r--gpu/command_buffer/service/gpu_switches.h1
-rw-r--r--gpu/command_buffer/service/program_manager.cc11
-rw-r--r--gpu/command_buffer/service/program_manager.h2
6 files changed, 30 insertions, 8 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index f486555..4b3c2c3 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1515,6 +1515,8 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
bool compile_shader_always_succeeds_;
+ bool disable_workarounds_;
+
#if defined(OS_MACOSX)
typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap;
TextureToIOSurfaceMap texture_to_io_surface_map_;
@@ -1926,6 +1928,9 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
force_webgl_glsl_validation_(false),
derivatives_explicitly_enabled_(false),
compile_shader_always_succeeds_(false),
+ disable_workarounds_(
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuDriverBugWorkarounds)),
viewport_x_(0),
viewport_y_(0),
viewport_width_(0),
@@ -2224,7 +2229,7 @@ bool GLES2DecoderImpl::Initialize(
has_arb_robustness_ = context->HasExtension("GL_ARB_robustness");
- if (!disallowed_features_.driver_bug_workarounds) {
+ if (!disable_workarounds_) {
#if defined(OS_MACOSX)
const char* vendor_str = reinterpret_cast<const char*>(
glGetString(GL_VENDOR));
@@ -3476,9 +3481,13 @@ void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) {
// to be that if the filtering mode is set to something that doesn't require
// mipmaps for rendering, or is never set to something other than the default,
// then glGenerateMipmap misbehaves.
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
+ if (!disable_workarounds_) {
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
+ }
glGenerateMipmapEXT(target);
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, info->min_filter());
+ if (!disable_workarounds_) {
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, info->min_filter());
+ }
}
bool GLES2DecoderImpl::GetHelper(
@@ -6194,7 +6203,7 @@ error::Error GLES2DecoderImpl::HandleReadPixels(
GLenum read_format = GetBoundReadFrameBufferInternalFormat();
uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format);
- if ((channels_exist & 0x0008) == 0) {
+ if ((channels_exist & 0x0008) == 0 && !disable_workarounds_) {
// Set the alpha to 255 because some drivers are buggy in this regard.
uint32 temp_size;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index 328446a..74c5797 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -32,12 +32,10 @@ class QueryManager;
struct DisallowedFeatures {
DisallowedFeatures()
: multisampling(false),
- driver_bug_workarounds(false),
swap_buffer_complete_callback(false) {
}
bool multisampling;
- bool driver_bug_workarounds;
bool swap_buffer_complete_callback;
};
diff --git a/gpu/command_buffer/service/gpu_switches.cc b/gpu/command_buffer/service/gpu_switches.cc
index 8174e53..3081318 100644
--- a/gpu/command_buffer/service/gpu_switches.cc
+++ b/gpu/command_buffer/service/gpu_switches.cc
@@ -16,6 +16,10 @@ const char kDisableGLErrorLimit[] = "disable-gl-error-limit";
// Disable the GLSL translator.
const char kDisableGLSLTranslator[] = "disable-glsl-translator";
+// Disable workarounds for various GPU driver bugs.
+const char kDisableGpuDriverBugWorkarounds[] =
+ "disable-gpu-driver-bug-workarounds";
+
// Turn on Logging GPU commands.
const char kEnableGPUCommandLogging[] = "enable-gpu-command-logging";
@@ -29,6 +33,7 @@ const char* kGpuSwitches[] = {
kCompileShaderAlwaysSucceeds,
kDisableGLErrorLimit,
kDisableGLSLTranslator,
+ kDisableGpuDriverBugWorkarounds,
kEnableGPUCommandLogging,
kEnableGPUDebugging,
kEnforceGLMinimums,
diff --git a/gpu/command_buffer/service/gpu_switches.h b/gpu/command_buffer/service/gpu_switches.h
index 735bcdf..388b39a 100644
--- a/gpu/command_buffer/service/gpu_switches.h
+++ b/gpu/command_buffer/service/gpu_switches.h
@@ -15,6 +15,7 @@ namespace switches {
GPU_EXPORT extern const char kCompileShaderAlwaysSucceeds[];
GPU_EXPORT extern const char kDisableGLErrorLimit[];
GPU_EXPORT extern const char kDisableGLSLTranslator[];
+GPU_EXPORT extern const char kDisableGpuDriverBugWorkarounds[];
GPU_EXPORT extern const char kEnableGPUCommandLogging[];
GPU_EXPORT extern const char kEnableGPUDebugging[];
GPU_EXPORT extern const char kEnforceGLMinimums[];
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
index 05ab6a6..6001299 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -8,12 +8,14 @@
#include <set>
#include "base/basictypes.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
+#include "gpu/command_buffer/service/gpu_switches.h"
namespace gpu {
namespace gles2 {
@@ -682,7 +684,10 @@ static int uniform_random_offset_ = 3;
ProgramManager::ProgramManager()
: uniform_swizzle_(uniform_random_offset_++ % 15),
program_info_count_(0),
- have_context_(true) {
+ have_context_(true),
+ disable_workarounds_(
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuDriverBugWorkarounds)) {
}
ProgramManager::~ProgramManager() {
@@ -786,7 +791,9 @@ void ProgramManager::UnuseProgram(
void ProgramManager::ClearUniforms(ProgramManager::ProgramInfo* info) {
DCHECK(info);
- info->ClearUniforms(&zero_);
+ if (!disable_workarounds_) {
+ info->ClearUniforms(&zero_);
+ }
}
// Swizzles the locations to prevent developers from assuming they
diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h
index 63471fc..650385c 100644
--- a/gpu/command_buffer/service/program_manager.h
+++ b/gpu/command_buffer/service/program_manager.h
@@ -342,6 +342,8 @@ class GPU_EXPORT ProgramManager {
bool have_context_;
+ bool disable_workarounds_;
+
// Used to clear uniforms.
std::vector<uint8> zero_;