summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-05 00:26:56 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-05 00:26:56 +0000
commit4c6f5462a04f48cff5834b7d48bc410e0bd0ea8e (patch)
tree709f3cf12241a7b8fed4a3b303ad7673380b5fbd /gpu
parent64e82b2eae3321ae9efd3e59d1dfbefe8357010e (diff)
downloadchromium_src-4c6f5462a04f48cff5834b7d48bc410e0bd0ea8e.zip
chromium_src-4c6f5462a04f48cff5834b7d48bc410e0bd0ea8e.tar.gz
chromium_src-4c6f5462a04f48cff5834b7d48bc410e0bd0ea8e.tar.bz2
Workaround Linux AMD driver bug where TEXTURE_MAX_ANISOTROPY init value is incorrect.
So the first time we query this for a texture, we init it to 1 first before querying. BUG=348237 TEST=webgl conformance tests on Linux AMD, gpu_unittests R=bajones@chromium.org, kbr@chromium.org Review URL: https://codereview.chromium.org/182413006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254885 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py18
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc38
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h4
-rw-r--r--gpu/command_buffer/service/texture_manager.cc11
-rw-r--r--gpu/command_buffer/service/texture_manager.h6
-rw-r--r--gpu/config/gpu_driver_bug_list_json.cc14
-rw-r--r--gpu/config/gpu_driver_bug_workaround_type.h2
7 files changed, 84 insertions, 9 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index e9828ce..924cd3c 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1778,12 +1778,20 @@ _FUNCTION_INFO = {
'client_test': False,
},
'GetString': {
- 'type': 'Custom',
- 'client_test': False,
- 'cmd_args': 'GLenumStringType name, uint32 bucket_id',
+ 'type': 'Custom',
+ 'client_test': False,
+ 'cmd_args': 'GLenumStringType name, uint32 bucket_id',
+ },
+ 'GetTexParameterfv': {
+ 'type': 'GETn',
+ 'decoder_func': 'DoGetTexParameterfv',
+ 'result': ['SizedResult<GLfloat>']
+ },
+ 'GetTexParameteriv': {
+ 'type': 'GETn',
+ 'decoder_func': 'DoGetTexParameteriv',
+ 'result': ['SizedResult<GLint>']
},
- 'GetTexParameterfv': {'type': 'GETn', 'result': ['SizedResult<GLfloat>']},
- 'GetTexParameteriv': {'type': 'GETn', 'result': ['SizedResult<GLint>']},
'GetTranslatedShaderSourceANGLE': {
'type': 'STRn',
'get_len_func': 'DoGetShaderiv',
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 394479d..8555617 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1265,6 +1265,11 @@ class GLES2DecoderImpl : public GLES2Decoder,
// Wrapper for glGetShaderiv
void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params);
+ // Wrappers for glGetTexParameter.
+ void DoGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
+ void DoGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
+ void InitTextureMaxAnisotropyIfNeeded(GLenum target, GLenum pname);
+
// Wrappers for glGetVertexAttrib.
void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
@@ -6863,6 +6868,39 @@ void GLES2DecoderImpl::GetVertexAttribHelper(
}
}
+void GLES2DecoderImpl::DoGetTexParameterfv(
+ GLenum target, GLenum pname, GLfloat* params) {
+ InitTextureMaxAnisotropyIfNeeded(target, pname);
+ glGetTexParameterfv(target, pname, params);
+}
+
+void GLES2DecoderImpl::DoGetTexParameteriv(
+ GLenum target, GLenum pname, GLint* params) {
+ InitTextureMaxAnisotropyIfNeeded(target, pname);
+ glGetTexParameteriv(target, pname, params);
+}
+
+void GLES2DecoderImpl::InitTextureMaxAnisotropyIfNeeded(
+ GLenum target, GLenum pname) {
+ if (!workarounds().init_texture_max_anisotropy)
+ return;
+ if (pname != GL_TEXTURE_MAX_ANISOTROPY_EXT ||
+ !validators_->texture_parameter.IsValid(pname)) {
+ return;
+ }
+
+ TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
+ &state_, target);
+ if (!texture_ref) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_OPERATION,
+ "glGetTexParamter{fi}v", "unknown texture for target");
+ return;
+ }
+ Texture* texture = texture_ref->texture();
+ texture->InitTextureMaxAnisotropyIfNeeded(target);
+}
+
void GLES2DecoderImpl::DoGetVertexAttribfv(
GLuint index, GLenum pname, GLfloat* params) {
VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index d29abe9..f950b12 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -1223,7 +1223,7 @@ error::Error GLES2DecoderImpl::HandleGetTexParameterfv(
if (result->size != 0) {
return error::kInvalidArguments;
}
- glGetTexParameterfv(target, pname, params);
+ DoGetTexParameterfv(target, pname, params);
GLenum error = glGetError();
if (error == GL_NO_ERROR) {
result->SetNumResults(num_values);
@@ -1259,7 +1259,7 @@ error::Error GLES2DecoderImpl::HandleGetTexParameteriv(
if (result->size != 0) {
return error::kInvalidArguments;
}
- glGetTexParameteriv(target, pname, params);
+ DoGetTexParameteriv(target, pname, params);
GLenum error = glGetError();
if (error == GL_NO_ERROR) {
result->SetNumResults(num_values);
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 38516e7..e090e0b 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -119,7 +119,8 @@ Texture::Texture(GLuint service_id)
immutable_(false),
has_images_(false),
estimated_size_(0),
- can_render_condition_(CAN_RENDER_ALWAYS) {
+ can_render_condition_(CAN_RENDER_ALWAYS),
+ texture_max_anisotropy_initialized_(false) {
}
Texture::~Texture() {
@@ -755,6 +756,14 @@ bool Texture::IsLevelCleared(GLenum target, GLint level) const {
return info.cleared;
}
+void Texture::InitTextureMaxAnisotropyIfNeeded(GLenum target) {
+ if (texture_max_anisotropy_initialized_)
+ return;
+ texture_max_anisotropy_initialized_ = true;
+ GLfloat params[] = { 1.0f };
+ glTexParameterfv(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, params);
+}
+
bool Texture::ClearLevel(
GLES2Decoder* decoder, GLenum target, GLint level) {
DCHECK(decoder);
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index c44bef3..2682e46 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -159,6 +159,9 @@ class GPU_EXPORT Texture {
return estimated_size() > 0;
}
+ // Initialize TEXTURE_MAX_ANISOTROPY to 1 if we haven't done so yet.
+ void InitTextureMaxAnisotropyIfNeeded(GLenum target);
+
private:
friend class MailboxManager;
friend class MailboxManagerTest;
@@ -379,6 +382,9 @@ class GPU_EXPORT Texture {
// Cache of the computed CanRenderCondition flag.
CanRenderCondition can_render_condition_;
+ // Whether we have initialized TEXTURE_MAX_ANISOTROPY to 1.
+ bool texture_max_anisotropy_initialized_;
+
DISALLOW_COPY_AND_ASSIGN(Texture);
};
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc
index 7849073..8d6402b 100644
--- a/gpu/config/gpu_driver_bug_list_json.cc
+++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -19,7 +19,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST(
{
"name": "gpu driver bug list",
// Please update the version number whenever you change this file.
- "version": "4.2",
+ "version": "4.3",
"entries": [
{
"id": 1,
@@ -849,6 +849,18 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST(
"features": [
"unroll_for_loop_with_sampler_array_index"
]
+ },
+ {
+ "id": 64,
+ "description": "Linux AMD drivers incorrectly return initial value of 1 for TEXTURE_MAX_ANISOTROPY",
+ "cr_bugs": [348237],
+ "os": {
+ "type": "linux"
+ },
+ "vendor_id": "0x1002",
+ "features": [
+ "init_texture_max_anisotropy"
+ ]
}
]
}
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h
index fb97413..c6fb970 100644
--- a/gpu/config/gpu_driver_bug_workaround_type.h
+++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -46,6 +46,8 @@
force_integrated_gpu) \
GPU_OP(INIT_GL_POSITION_IN_VERTEX_SHADER, \
init_gl_position_in_vertex_shader) \
+ GPU_OP(INIT_TEXTURE_MAX_ANISOTROPY, \
+ init_texture_max_anisotropy) \
GPU_OP(INIT_VARYINGS_WITHOUT_STATIC_USE, \
init_varyings_without_static_use) \
GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024, \