OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 return; | 2000 return; |
2001 if (!tex->canGenerateMipmaps()) { | 2001 if (!tex->canGenerateMipmaps()) { |
2002 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "generateMipmap"
, "level 0 not power of 2 or not all the same size"); | 2002 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "generateMipmap"
, "level 0 not power of 2 or not all the same size"); |
2003 return; | 2003 return; |
2004 } | 2004 } |
2005 if (!validateSettableTexFormat("generateMipmap", tex->getInternalFormat(targ
et, 0))) | 2005 if (!validateSettableTexFormat("generateMipmap", tex->getInternalFormat(targ
et, 0))) |
2006 return; | 2006 return; |
2007 | 2007 |
2008 // generateMipmap won't work properly if minFilter is not NEAREST_MIPMAP_LIN
EAR | 2008 // generateMipmap won't work properly if minFilter is not NEAREST_MIPMAP_LIN
EAR |
2009 // on Mac. Remove the hack once this driver bug is fixed. | 2009 // on Mac. Remove the hack once this driver bug is fixed. |
2010 #if OS(DARWIN) | 2010 #if OS(MACOSX) |
2011 bool needToResetMinFilter = false; | 2011 bool needToResetMinFilter = false; |
2012 if (tex->getMinFilter() != GraphicsContext3D::NEAREST_MIPMAP_LINEAR) { | 2012 if (tex->getMinFilter() != GraphicsContext3D::NEAREST_MIPMAP_LINEAR) { |
2013 m_context->texParameteri(target, GraphicsContext3D::TEXTURE_MIN_FILTER,
GraphicsContext3D::NEAREST_MIPMAP_LINEAR); | 2013 m_context->texParameteri(target, GraphicsContext3D::TEXTURE_MIN_FILTER,
GraphicsContext3D::NEAREST_MIPMAP_LINEAR); |
2014 needToResetMinFilter = true; | 2014 needToResetMinFilter = true; |
2015 } | 2015 } |
2016 #endif | 2016 #endif |
2017 m_context->generateMipmap(target); | 2017 m_context->generateMipmap(target); |
2018 #if OS(DARWIN) | 2018 #if OS(MACOSX) |
2019 if (needToResetMinFilter) | 2019 if (needToResetMinFilter) |
2020 m_context->texParameteri(target, GraphicsContext3D::TEXTURE_MIN_FILTER,
tex->getMinFilter()); | 2020 m_context->texParameteri(target, GraphicsContext3D::TEXTURE_MIN_FILTER,
tex->getMinFilter()); |
2021 #endif | 2021 #endif |
2022 tex->generateMipmapLevelInfo(); | 2022 tex->generateMipmapLevelInfo(); |
2023 } | 2023 } |
2024 | 2024 |
2025 PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram*
program, GC3Duint index) | 2025 PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram*
program, GC3Duint index) |
2026 { | 2026 { |
2027 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) | 2027 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) |
2028 return 0; | 2028 return 0; |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 } | 3072 } |
3073 | 3073 |
3074 clearIfComposited(); | 3074 clearIfComposited(); |
3075 void* data = pixels->baseAddress(); | 3075 void* data = pixels->baseAddress(); |
3076 | 3076 |
3077 { | 3077 { |
3078 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBin
ding.get()); | 3078 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBin
ding.get()); |
3079 m_context->readPixels(x, y, width, height, format, type, data); | 3079 m_context->readPixels(x, y, width, height, format, type, data); |
3080 } | 3080 } |
3081 | 3081 |
3082 #if OS(DARWIN) | 3082 #if OS(MACOSX) |
3083 // FIXME: remove this section when GL driver bug on Mac is fixed, i.e., | 3083 // FIXME: remove this section when GL driver bug on Mac is fixed, i.e., |
3084 // when alpha is off, readPixels should set alpha to 255 instead of 0. | 3084 // when alpha is off, readPixels should set alpha to 255 instead of 0. |
3085 if (!m_framebufferBinding && !m_context->getContextAttributes().alpha) { | 3085 if (!m_framebufferBinding && !m_context->getContextAttributes().alpha) { |
3086 unsigned char* pixels = reinterpret_cast<unsigned char*>(data); | 3086 unsigned char* pixels = reinterpret_cast<unsigned char*>(data); |
3087 for (GC3Dsizei iy = 0; iy < height; ++iy) { | 3087 for (GC3Dsizei iy = 0; iy < height; ++iy) { |
3088 for (GC3Dsizei ix = 0; ix < width; ++ix) { | 3088 for (GC3Dsizei ix = 0; ix < width; ++ix) { |
3089 pixels[3] = 255; | 3089 pixels[3] = 255; |
3090 pixels += 4; | 3090 pixels += 4; |
3091 } | 3091 } |
3092 pixels += padding; | 3092 pixels += padding; |
(...skipping 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5569 if (m_textureUnits[i].m_texture2DBinding | 5569 if (m_textureUnits[i].m_texture2DBinding |
5570 || m_textureUnits[i].m_textureCubeMapBinding) { | 5570 || m_textureUnits[i].m_textureCubeMapBinding) { |
5571 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5571 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5572 return; | 5572 return; |
5573 } | 5573 } |
5574 } | 5574 } |
5575 m_onePlusMaxNonDefaultTextureUnit = 0; | 5575 m_onePlusMaxNonDefaultTextureUnit = 0; |
5576 } | 5576 } |
5577 | 5577 |
5578 } // namespace WebCore | 5578 } // namespace WebCore |
OLD | NEW |