mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 713266 - Update ANGLE to r930 - no review
No review because this is just syncing us with the upstream http://code.google.com/p/angleproject/
This commit is contained in:
parent
6d9dd02ad0
commit
08064474fb
@ -1,6 +1,6 @@
|
||||
This is the ANGLE project, from http://code.google.com/p/angleproject/
|
||||
|
||||
Current revision: r924
|
||||
Current revision: r930
|
||||
|
||||
== Applied local patches ==
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
#define BUILD_VERSION 0
|
||||
#define BUILD_REVISION 924
|
||||
#define BUILD_REVISION 930
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
|
@ -188,7 +188,7 @@ void OutputHLSL::header()
|
||||
|
||||
if (mUsesFragCoord)
|
||||
{
|
||||
out << "uniform float4 dx_Viewport;\n"
|
||||
out << "uniform float4 dx_Coord;\n"
|
||||
"uniform float2 dx_Depth;\n";
|
||||
}
|
||||
|
||||
|
@ -1798,11 +1798,13 @@ bool Context::applyRenderTarget(bool ignoreViewport)
|
||||
GLfloat xy[2] = {1.0f / viewport.Width, -1.0f / viewport.Height};
|
||||
programObject->setUniform2fv(halfPixelSize, 1, xy);
|
||||
|
||||
GLint viewport = programObject->getDxViewportLocation();
|
||||
GLfloat whxy[4] = {mState.viewportWidth / 2.0f, mState.viewportHeight / 2.0f,
|
||||
// These values are used for computing gl_FragCoord in Program::linkVaryings(). The approach depends on Shader Model 3.0 support.
|
||||
GLint coord = programObject->getDxCoordLocation();
|
||||
float h = mSupportsShaderModel3 ? mRenderTargetDesc.Height : mState.viewportHeight / 2.0f;
|
||||
GLfloat whxy[4] = {mState.viewportWidth / 2.0f, h,
|
||||
(float)mState.viewportX + mState.viewportWidth / 2.0f,
|
||||
(float)mState.viewportY + mState.viewportHeight / 2.0f};
|
||||
programObject->setUniform4fv(viewport, 1, whxy);
|
||||
programObject->setUniform4fv(coord, 1, whxy);
|
||||
|
||||
GLint depth = programObject->getDxDepthLocation();
|
||||
GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
|
||||
@ -2596,18 +2598,7 @@ void Context::clear(GLbitfield mask)
|
||||
float depth = clamp01(mState.depthClearValue);
|
||||
int stencil = mState.stencilClearValue & 0x000000FF;
|
||||
|
||||
IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
|
||||
if (!renderTarget)
|
||||
{
|
||||
return; // Context must be lost, return silently
|
||||
}
|
||||
|
||||
D3DSURFACE_DESC desc;
|
||||
renderTarget->GetDesc(&desc);
|
||||
renderTarget->Release();
|
||||
renderTarget = NULL;
|
||||
|
||||
bool alphaUnmasked = (dx2es::GetAlphaSize(desc.Format) == 0) || mState.colorMaskAlpha;
|
||||
bool alphaUnmasked = (dx2es::GetAlphaSize(mRenderTargetDesc.Format) == 0) || mState.colorMaskAlpha;
|
||||
|
||||
const bool needMaskedStencilClear = (flags & D3DCLEAR_STENCIL) &&
|
||||
(mState.stencilWritemask & stencilUnmasked) != stencilUnmasked;
|
||||
@ -2708,12 +2699,12 @@ void Context::clear(GLbitfield mask)
|
||||
|
||||
float quad[4][4]; // A quadrilateral covering the target, aligned to match the edges
|
||||
quad[0][0] = -0.5f;
|
||||
quad[0][1] = desc.Height - 0.5f;
|
||||
quad[0][1] = mRenderTargetDesc.Height - 0.5f;
|
||||
quad[0][2] = 0.0f;
|
||||
quad[0][3] = 1.0f;
|
||||
|
||||
quad[1][0] = desc.Width - 0.5f;
|
||||
quad[1][1] = desc.Height - 0.5f;
|
||||
quad[1][0] = mRenderTargetDesc.Width - 0.5f;
|
||||
quad[1][1] = mRenderTargetDesc.Height - 0.5f;
|
||||
quad[1][2] = 0.0f;
|
||||
quad[1][3] = 1.0f;
|
||||
|
||||
@ -2722,7 +2713,7 @@ void Context::clear(GLbitfield mask)
|
||||
quad[2][2] = 0.0f;
|
||||
quad[2][3] = 1.0f;
|
||||
|
||||
quad[3][0] = desc.Width - 0.5f;
|
||||
quad[3][0] = mRenderTargetDesc.Width - 0.5f;
|
||||
quad[3][1] = -0.5f;
|
||||
quad[3][2] = 0.0f;
|
||||
quad[3][3] = 1.0f;
|
||||
|
@ -65,7 +65,7 @@ enum
|
||||
MAX_TEXTURE_IMAGE_UNITS = 16,
|
||||
MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF = 4, // For devices supporting vertex texture fetch
|
||||
MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,
|
||||
MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Viewport, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
|
||||
MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
|
||||
MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
|
||||
MAX_DRAW_BUFFERS = 1,
|
||||
|
||||
|
@ -1600,13 +1600,20 @@ bool Program::linkVaryings()
|
||||
if (mFragmentShader->mUsesFragCoord)
|
||||
{
|
||||
mPixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
|
||||
if (sm3) {
|
||||
|
||||
if (sm3)
|
||||
{
|
||||
// dx_Coord.y contains the render target height. See Context::applyRenderTarget()
|
||||
mPixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
|
||||
" gl_FragCoord.y = 2.0 * dx_Viewport.y - input.dx_VPos.y - 0.5;\n";
|
||||
} else {
|
||||
mPixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Viewport.x + dx_Viewport.z;\n"
|
||||
" gl_FragCoord.y = -(input.gl_FragCoord.y * rhw) * dx_Viewport.y + dx_Viewport.w;\n";
|
||||
" gl_FragCoord.y = dx_Coord.y - input.dx_VPos.y - 0.5;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
// dx_Coord contains the viewport width/2, height/2, center.x and center.y. See Context::applyRenderTarget()
|
||||
mPixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Coord.x + dx_Coord.z;\n"
|
||||
" gl_FragCoord.y = -(input.gl_FragCoord.y * rhw) * dx_Coord.y + dx_Coord.w;\n";
|
||||
}
|
||||
|
||||
mPixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_Depth.x + dx_Depth.y;\n"
|
||||
" gl_FragCoord.w = rhw;\n";
|
||||
}
|
||||
@ -1732,7 +1739,7 @@ void Program::link()
|
||||
// are reserved prefixes, and do not receive additional decoration
|
||||
mDxDepthRangeLocation = getUniformLocation("dx_DepthRange");
|
||||
mDxDepthLocation = getUniformLocation("dx_Depth");
|
||||
mDxViewportLocation = getUniformLocation("dx_Viewport");
|
||||
mDxCoordLocation = getUniformLocation("dx_Coord");
|
||||
mDxHalfPixelSizeLocation = getUniformLocation("dx_HalfPixelSize");
|
||||
mDxFrontCCWLocation = getUniformLocation("dx_FrontCCW");
|
||||
mDxPointsOrLinesLocation = getUniformLocation("dx_PointsOrLines");
|
||||
@ -2420,7 +2427,7 @@ void Program::unlink(bool destroy)
|
||||
|
||||
mDxDepthRangeLocation = -1;
|
||||
mDxDepthLocation = -1;
|
||||
mDxViewportLocation = -1;
|
||||
mDxCoordLocation = -1;
|
||||
mDxHalfPixelSizeLocation = -1;
|
||||
mDxFrontCCWLocation = -1;
|
||||
mDxPointsOrLinesLocation = -1;
|
||||
@ -2841,9 +2848,9 @@ GLint Program::getDxDepthLocation() const
|
||||
return mDxDepthLocation;
|
||||
}
|
||||
|
||||
GLint Program::getDxViewportLocation() const
|
||||
GLint Program::getDxCoordLocation() const
|
||||
{
|
||||
return mDxViewportLocation;
|
||||
return mDxCoordLocation;
|
||||
}
|
||||
|
||||
GLint Program::getDxHalfPixelSizeLocation() const
|
||||
|
@ -103,7 +103,7 @@ class Program
|
||||
|
||||
GLint getDxDepthRangeLocation() const;
|
||||
GLint getDxDepthLocation() const;
|
||||
GLint getDxViewportLocation() const;
|
||||
GLint getDxCoordLocation() const;
|
||||
GLint getDxHalfPixelSizeLocation() const;
|
||||
GLint getDxFrontCCWLocation() const;
|
||||
GLint getDxPointsOrLinesLocation() const;
|
||||
@ -207,7 +207,7 @@ class Program
|
||||
|
||||
GLint mDxDepthRangeLocation;
|
||||
GLint mDxDepthLocation;
|
||||
GLint mDxViewportLocation;
|
||||
GLint mDxCoordLocation;
|
||||
GLint mDxHalfPixelSizeLocation;
|
||||
GLint mDxFrontCCWLocation;
|
||||
GLint mDxPointsOrLinesLocation;
|
||||
|
@ -79,6 +79,28 @@ static D3DFORMAT ConvertTextureFormatType(GLenum format, GLenum type)
|
||||
return D3DFMT_A8R8G8B8;
|
||||
}
|
||||
|
||||
static bool IsTextureFormatRenderable(D3DFORMAT format)
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
case D3DFMT_L8:
|
||||
case D3DFMT_A8L8:
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT5:
|
||||
return false;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
return true;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Image::Image()
|
||||
{
|
||||
mWidth = 0;
|
||||
@ -207,26 +229,9 @@ void Image::unlock()
|
||||
}
|
||||
}
|
||||
|
||||
bool Image::isRenderable() const
|
||||
bool Image::isRenderableFormat() const
|
||||
{
|
||||
switch(getD3DFormat())
|
||||
{
|
||||
case D3DFMT_L8:
|
||||
case D3DFMT_A8L8:
|
||||
case D3DFMT_DXT1:
|
||||
case D3DFMT_DXT3:
|
||||
case D3DFMT_DXT5:
|
||||
return false;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
return true;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return false;
|
||||
return IsTextureFormatRenderable(getD3DFormat());
|
||||
}
|
||||
|
||||
D3DFORMAT Image::getD3DFormat() const
|
||||
@ -1126,7 +1131,7 @@ void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
|
||||
int destYOffset = transformPixelYOffset(yoffset, height, mHeight);
|
||||
RECT destRect = {xoffset, destYOffset, xoffset + width, destYOffset + height};
|
||||
|
||||
if (isRenderable())
|
||||
if (isRenderableFormat())
|
||||
{
|
||||
result = D3DXLoadSurfaceFromSurface(getSurface(), NULL, &destRect, renderTargetData, NULL, &sourceRect, D3DX_FILTER_BOX, 0);
|
||||
|
||||
@ -1268,9 +1273,9 @@ void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
|
||||
mDirty = true;
|
||||
}
|
||||
|
||||
TextureStorage::TextureStorage(bool renderable)
|
||||
: mRenderable(renderable),
|
||||
mD3DPool(getDisplay()->getTexturePool(renderable)),
|
||||
TextureStorage::TextureStorage(bool renderTarget)
|
||||
: mRenderTarget(renderTarget),
|
||||
mD3DPool(getDisplay()->getTexturePool(mRenderTarget)),
|
||||
mTextureSerial(issueTextureSerial())
|
||||
{
|
||||
}
|
||||
@ -1279,9 +1284,9 @@ TextureStorage::~TextureStorage()
|
||||
{
|
||||
}
|
||||
|
||||
bool TextureStorage::isRenderable() const
|
||||
bool TextureStorage::isRenderTarget() const
|
||||
{
|
||||
return mRenderable;
|
||||
return mRenderTarget;
|
||||
}
|
||||
|
||||
bool TextureStorage::isManaged() const
|
||||
@ -1566,9 +1571,10 @@ IDirect3DBaseTexture9 *Texture::getTexture()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!getBaseTexture())
|
||||
// ensure the underlying texture is created
|
||||
if (getStorage(false) == NULL)
|
||||
{
|
||||
createTexture();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
updateTexture();
|
||||
@ -1592,15 +1598,15 @@ void Texture::resetDirty()
|
||||
mDirtyImages = false;
|
||||
}
|
||||
|
||||
unsigned int Texture::getTextureSerial() const
|
||||
unsigned int Texture::getTextureSerial()
|
||||
{
|
||||
TextureStorage *texture = getStorage();
|
||||
TextureStorage *texture = getStorage(false);
|
||||
return texture ? texture->getTextureSerial() : 0;
|
||||
}
|
||||
|
||||
unsigned int Texture::getRenderTargetSerial(GLenum target) const
|
||||
unsigned int Texture::getRenderTargetSerial(GLenum target)
|
||||
{
|
||||
TextureStorage *texture = getStorage();
|
||||
TextureStorage *texture = getStorage(true);
|
||||
return texture ? texture->getRenderTargetSerial(target) : 0;
|
||||
}
|
||||
|
||||
@ -1672,12 +1678,13 @@ TextureStorage2D::TextureStorage2D(IDirect3DTexture9 *surfaceTexture) : TextureS
|
||||
mTexture = surfaceTexture;
|
||||
}
|
||||
|
||||
TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable) : TextureStorage(renderable), mRenderTargetSerial(RenderbufferStorage::issueSerial())
|
||||
TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderTarget)
|
||||
: TextureStorage(renderTarget), mRenderTargetSerial(RenderbufferStorage::issueSerial())
|
||||
{
|
||||
IDirect3DDevice9 *device = getDevice();
|
||||
|
||||
mTexture = NULL;
|
||||
HRESULT result = device->CreateTexture(width, height, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
|
||||
HRESULT result = device->CreateTexture(width, height, levels, isRenderTarget() ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
|
||||
|
||||
if (FAILED(result))
|
||||
{
|
||||
@ -1902,14 +1909,14 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
|
||||
|
||||
redefineImage(level, format, width, height, GL_UNSIGNED_BYTE);
|
||||
|
||||
if (!mImageArray[level].isRenderable())
|
||||
if (!mImageArray[level].isRenderableFormat())
|
||||
{
|
||||
mImageArray[level].copy(0, 0, x, y, width, height, renderTarget);
|
||||
mDirtyImages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mTexStorage || !mTexStorage->isRenderable())
|
||||
if (!mTexStorage || !mTexStorage->isRenderTarget())
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
@ -1954,14 +1961,14 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
|
||||
return error(GL_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (!mImageArray[level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
|
||||
if (!mImageArray[level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
|
||||
{
|
||||
mImageArray[level].copy(xoffset, yoffset, x, y, width, height, renderTarget);
|
||||
mDirtyImages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mTexStorage || !mTexStorage->isRenderable())
|
||||
if (!mTexStorage || !mTexStorage->isRenderTarget())
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
@ -1996,10 +2003,10 @@ void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GL
|
||||
GLenum format = gl::ExtractFormat(internalformat);
|
||||
GLenum type = gl::ExtractType(internalformat);
|
||||
D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
|
||||
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
const bool renderTarget = IsTextureFormatRenderable(d3dfmt) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
|
||||
delete mTexStorage;
|
||||
mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderable);
|
||||
mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderTarget);
|
||||
mImmutable = true;
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
@ -2154,10 +2161,10 @@ void Texture2D::createTexture()
|
||||
GLsizei height = mImageArray[0].getHeight();
|
||||
GLint levels = creationLevels(width, height);
|
||||
D3DFORMAT format = mImageArray[0].getD3DFormat();
|
||||
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
const bool renderTarget = IsTextureFormatRenderable(format) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
|
||||
delete mTexStorage;
|
||||
mTexStorage = new TextureStorage2D(levels, format, width, height, renderable);
|
||||
mTexStorage = new TextureStorage2D(levels, format, width, height, renderTarget);
|
||||
|
||||
if (mTexStorage->isManaged())
|
||||
{
|
||||
@ -2249,7 +2256,7 @@ void Texture2D::generateMipmaps()
|
||||
mImageArray[0].getType());
|
||||
}
|
||||
|
||||
if (mTexStorage && mTexStorage->isRenderable())
|
||||
if (mTexStorage && mTexStorage->isRenderTarget())
|
||||
{
|
||||
for (unsigned int i = 1; i <= q; i++)
|
||||
{
|
||||
@ -2305,12 +2312,8 @@ IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
|
||||
{
|
||||
ASSERT(target == GL_TEXTURE_2D);
|
||||
|
||||
if (!mTexStorage || !mTexStorage->isRenderable())
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
|
||||
if (mTexStorage == NULL)
|
||||
// ensure the underlying texture is created
|
||||
if (getStorage(true) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -2320,17 +2323,30 @@ IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
|
||||
return mTexStorage->getSurfaceLevel(0);
|
||||
}
|
||||
|
||||
TextureStorage *Texture2D::getStorage() const
|
||||
TextureStorage *Texture2D::getStorage(bool renderTarget)
|
||||
{
|
||||
if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
|
||||
{
|
||||
if (renderTarget)
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
createTexture();
|
||||
}
|
||||
}
|
||||
|
||||
return mTexStorage;
|
||||
}
|
||||
|
||||
TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable) : TextureStorage(renderable), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
|
||||
TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget)
|
||||
: TextureStorage(renderTarget), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
|
||||
{
|
||||
IDirect3DDevice9 *device = getDevice();
|
||||
|
||||
mTexture = NULL;
|
||||
HRESULT result = device->CreateCubeTexture(size, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
|
||||
HRESULT result = device->CreateCubeTexture(size, levels, isRenderTarget() ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
|
||||
|
||||
if (FAILED(result))
|
||||
{
|
||||
@ -2630,10 +2646,10 @@ void TextureCubeMap::createTexture()
|
||||
GLsizei size = mImageArray[0][0].getWidth();
|
||||
GLint levels = creationLevels(size, 0);
|
||||
D3DFORMAT format = mImageArray[0][0].getD3DFormat();
|
||||
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
const bool renderTarget = IsTextureFormatRenderable(format) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
|
||||
delete mTexStorage;
|
||||
mTexStorage = new TextureStorageCubeMap(levels, format, size, renderable);
|
||||
mTexStorage = new TextureStorageCubeMap(levels, format, size, renderTarget);
|
||||
|
||||
if (mTexStorage->isManaged())
|
||||
{
|
||||
@ -2767,14 +2783,14 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
|
||||
unsigned int faceindex = faceIndex(target);
|
||||
redefineImage(faceindex, level, format, width, height, GL_UNSIGNED_BYTE);
|
||||
|
||||
if (!mImageArray[faceindex][level].isRenderable())
|
||||
if (!mImageArray[faceindex][level].isRenderableFormat())
|
||||
{
|
||||
mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
|
||||
mDirtyImages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mTexStorage || !mTexStorage->isRenderable())
|
||||
if (!mTexStorage || !mTexStorage->isRenderTarget())
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
@ -2825,14 +2841,14 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
|
||||
|
||||
unsigned int faceindex = faceIndex(target);
|
||||
|
||||
if (!mImageArray[faceindex][level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
|
||||
if (!mImageArray[faceindex][level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
|
||||
{
|
||||
mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
|
||||
mDirtyImages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mTexStorage || !mTexStorage->isRenderable())
|
||||
if (!mTexStorage || !mTexStorage->isRenderTarget())
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
@ -2867,10 +2883,10 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
|
||||
GLenum format = gl::ExtractFormat(internalformat);
|
||||
GLenum type = gl::ExtractType(internalformat);
|
||||
D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
|
||||
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
const bool renderTarget = IsTextureFormatRenderable(d3dfmt) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
|
||||
|
||||
delete mTexStorage;
|
||||
mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderable);
|
||||
mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderTarget);
|
||||
mImmutable = true;
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
@ -2933,7 +2949,7 @@ void TextureCubeMap::generateMipmaps()
|
||||
}
|
||||
}
|
||||
|
||||
if (mTexStorage && mTexStorage->isRenderable())
|
||||
if (mTexStorage && mTexStorage->isRenderTarget())
|
||||
{
|
||||
for (unsigned int f = 0; f < 6; f++)
|
||||
{
|
||||
@ -2997,12 +3013,8 @@ IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
|
||||
{
|
||||
ASSERT(IsCubemapTextureTarget(target));
|
||||
|
||||
if (!mTexStorage || !mTexStorage->isRenderable())
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
|
||||
if (mTexStorage == NULL)
|
||||
// ensure the underlying texture is created
|
||||
if (getStorage(true) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -3012,8 +3024,20 @@ IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
|
||||
return mTexStorage->getCubeMapSurface(target, 0);
|
||||
}
|
||||
|
||||
TextureStorage *TextureCubeMap::getStorage() const
|
||||
TextureStorage *TextureCubeMap::getStorage(bool renderTarget)
|
||||
{
|
||||
if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
|
||||
{
|
||||
if (renderTarget)
|
||||
{
|
||||
convertToRenderTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
createTexture();
|
||||
}
|
||||
}
|
||||
|
||||
return mTexStorage;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class Image
|
||||
HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
|
||||
void unlock();
|
||||
|
||||
bool isRenderable() const;
|
||||
bool isRenderableFormat() const;
|
||||
D3DFORMAT getD3DFormat() const;
|
||||
|
||||
GLsizei getWidth() const {return mWidth;}
|
||||
@ -144,11 +144,11 @@ class Image
|
||||
class TextureStorage
|
||||
{
|
||||
public:
|
||||
explicit TextureStorage(bool renderable);
|
||||
explicit TextureStorage(bool renderTarget);
|
||||
|
||||
virtual ~TextureStorage();
|
||||
|
||||
bool isRenderable() const;
|
||||
bool isRenderTarget() const;
|
||||
bool isManaged() const;
|
||||
D3DPOOL getPool() const;
|
||||
unsigned int getTextureSerial() const;
|
||||
@ -157,7 +157,7 @@ class TextureStorage
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(TextureStorage);
|
||||
|
||||
const bool mRenderable;
|
||||
const bool mRenderTarget;
|
||||
const D3DPOOL mD3DPool;
|
||||
|
||||
const unsigned int mTextureSerial;
|
||||
@ -205,8 +205,8 @@ class Texture : public RefCountObject
|
||||
bool hasDirtyParameters() const;
|
||||
bool hasDirtyImages() const;
|
||||
void resetDirty();
|
||||
unsigned int getTextureSerial() const;
|
||||
unsigned int getRenderTargetSerial(GLenum target) const;
|
||||
unsigned int getTextureSerial();
|
||||
unsigned int getRenderTargetSerial(GLenum target);
|
||||
|
||||
bool isImmutable() const;
|
||||
|
||||
@ -248,14 +248,14 @@ class Texture : public RefCountObject
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(Texture);
|
||||
|
||||
virtual TextureStorage *getStorage() const = 0;
|
||||
virtual TextureStorage *getStorage(bool renderTarget) = 0;
|
||||
};
|
||||
|
||||
class TextureStorage2D : public TextureStorage
|
||||
{
|
||||
public:
|
||||
explicit TextureStorage2D(IDirect3DTexture9 *surfaceTexture);
|
||||
TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable);
|
||||
TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderTarget);
|
||||
|
||||
virtual ~TextureStorage2D();
|
||||
|
||||
@ -311,7 +311,7 @@ class Texture2D : public Texture
|
||||
virtual void updateTexture();
|
||||
virtual void convertToRenderTarget();
|
||||
virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
|
||||
virtual TextureStorage *getStorage() const;
|
||||
virtual TextureStorage *getStorage(bool renderTarget);
|
||||
|
||||
bool isMipmapComplete() const;
|
||||
|
||||
@ -329,7 +329,7 @@ class Texture2D : public Texture
|
||||
class TextureStorageCubeMap : public TextureStorage
|
||||
{
|
||||
public:
|
||||
TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable);
|
||||
TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget);
|
||||
|
||||
virtual ~TextureStorageCubeMap();
|
||||
|
||||
@ -392,7 +392,7 @@ class TextureCubeMap : public Texture
|
||||
virtual void updateTexture();
|
||||
virtual void convertToRenderTarget();
|
||||
virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
|
||||
virtual TextureStorage *getStorage() const;
|
||||
virtual TextureStorage *getStorage(bool renderTarget);
|
||||
|
||||
bool isCubeComplete() const;
|
||||
bool isMipmapCubeComplete() const;
|
||||
|
Loading…
Reference in New Issue
Block a user