summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/core/cross/gl/sampler_gl.cc7
-rw-r--r--o3d/core/win/d3d9/sampler_d3d9.cc8
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());