diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 02:59:25 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 02:59:25 +0000 |
commit | 1b2caa09136acf6a0b5e88425bcac872db584ffa (patch) | |
tree | cf8ac4c4921171122a7612bad56e770a15675e26 /o3d | |
parent | 74ed94e642faae99da430e320acda1bbeddc5053 (diff) | |
download | chromium_src-1b2caa09136acf6a0b5e88425bcac872db584ffa.zip chromium_src-1b2caa09136acf6a0b5e88425bcac872db584ffa.tar.gz chromium_src-1b2caa09136acf6a0b5e88425bcac872db584ffa.tar.bz2 |
Check that texture being bound is not the current
render surface.
Review URL: http://codereview.chromium.org/469011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34033 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/cross/gl/sampler_gl.cc | 7 | ||||
-rw-r--r-- | o3d/core/win/d3d9/sampler_d3d9.cc | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/o3d/core/cross/gl/sampler_gl.cc b/o3d/core/cross/gl/sampler_gl.cc index 0dc3ab7..6c72d64 100644 --- a/o3d/core/cross/gl/sampler_gl.cc +++ b/o3d/core/cross/gl/sampler_gl.cc @@ -144,6 +144,13 @@ void SamplerGL::SetTextureAndStates(CGparameter cg_param) { } } + if (!renderer_->SafeToBindTexture(texture_object)) { + O3D_ERROR(renderer_->service_locator()) + << "Attempt to bind texture, " << texture_object->name() + << " when drawing to same texture as a RenderSurface"; + texture_object = renderer_->error_texture(); + } + GLuint handle = static_cast<GLuint>(reinterpret_cast<intptr_t>( texture_object->GetTextureHandle())); if (handle) { diff --git a/o3d/core/win/d3d9/sampler_d3d9.cc b/o3d/core/win/d3d9/sampler_d3d9.cc index 79ea219..36a0029 100644 --- a/o3d/core/win/d3d9/sampler_d3d9.cc +++ b/o3d/core/win/d3d9/sampler_d3d9.cc @@ -128,6 +128,7 @@ D3DTEXTUREFILTERTYPE D3DMipFilter(Sampler::FilterType o3d_mag_filter) { void SamplerD3D9::SetTextureAndStates(int sampler_unit) { DLOG_ASSERT(d3d_device_); + DLOG_ASSERT(renderer_); // First get the d3d texture and set it. Texture* texture_object = texture(); @@ -140,6 +141,13 @@ void SamplerD3D9::SetTextureAndStates(int sampler_unit) { } } + if (!renderer_->SafeToBindTexture(texture_object)) { + O3D_ERROR(renderer_->service_locator()) + << "Attempt to bind texture, " << texture_object->name() + << " when drawing to same texture as a RenderSurface"; + texture_object = renderer_->error_texture(); + } + IDirect3DBaseTexture9* d3d_texture = static_cast<IDirect3DBaseTexture9*>(texture_object->GetTextureHandle()); |