Commit 0e0510fd by Jamie Madill

Place the method responsible for checking for fast pixel unpack buffer support into the Renderer.

TRAC #23997 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods
parent 6b9cb259
......@@ -22,6 +22,7 @@
#include "libEGL/Surface.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/renderer/BufferStorage.h"
#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
{
......@@ -232,7 +233,7 @@ bool Texture::fastUnpackPixels(const PixelUnpackState &unpack, const void *pixel
// In order to perform the fast copy through the shader, we must have the right format, and be able
// to create a render target.
if (IsFastCopyBufferToTextureSupported(sizedInternalFormat, mRenderer->getCurrentClientVersion()))
if (mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat))
{
unsigned int offset = reinterpret_cast<unsigned int>(pixels);
rx::RenderTarget *destRenderTarget = getStorage(true)->getStorageInstance()->getRenderTarget(level);
......
......@@ -1590,9 +1590,4 @@ ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clie
return (iter != formats.end()) ? iter->second.mColorWriteFunction : NULL;
}
bool IsFastCopyBufferToTextureSupported(GLint internalFormat, GLuint clientVersion)
{
return false;
}
}
......@@ -88,8 +88,6 @@ GLuint GetCompressedBlockHeight(GLint internalFormat, GLuint clientVersion);
ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
bool IsFastCopyBufferToTextureSupported(GLint internalFormat, GLuint clientVersion);
}
#endif LIBGLESV2_FORMATUTILS_H_
......@@ -260,6 +260,7 @@ class Renderer
int getCurrentClientVersion() const { return mCurrentClientVersion; }
// Buffer-to-texture and Texture-to-buffer copies
virtual bool supportsFastCopyBufferToTexture(GLint internalFormat) const = 0;
virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea) = 0;
......
......@@ -152,7 +152,7 @@ bool PixelTransfer11::copyBufferToTexture(const gl::PixelUnpackState &unpack, un
int clientVersion = mRenderer->getCurrentClientVersion();
const gl::Buffer &sourceBuffer = *unpack.pixelBuffer.get();
ASSERT(gl::IsFastCopyBufferToTextureSupported(destinationFormat, clientVersion));
ASSERT(mRenderer->supportsFastCopyBufferToTexture(destinationFormat));
ID3D11PixelShader *pixelShader = findBufferToTexturePS(destinationFormat);
ASSERT(pixelShader);
......
......@@ -2767,10 +2767,16 @@ FenceImpl *Renderer11::createFence()
return new Fence11(this);
}
bool Renderer11::supportsFastCopyBufferToTexture(GLint internalFormat) const
{
//TODO
return false;
}
bool Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
{
ASSERT(gl::IsFastCopyBufferToTextureSupported(destinationFormat, getCurrentClientVersion()));
ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
}
......
......@@ -208,6 +208,7 @@ class Renderer11 : public Renderer
Blit11 *getBlitter() { return mBlit; }
// Buffer-to-texture and Texture-to-buffer copies
virtual bool supportsFastCopyBufferToTexture(GLint internalFormat) const;
virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
......
......@@ -723,6 +723,12 @@ FenceImpl *Renderer9::createFence()
return new Fence9(this);
}
bool Renderer9::supportsFastCopyBufferToTexture(GLint internalFormat) const
{
// Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
return false;
}
bool Renderer9::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
{
......
......@@ -217,6 +217,7 @@ class Renderer9 : public Renderer
virtual FenceImpl *createFence();
// Buffer-to-texture and Texture-to-buffer copies
virtual bool supportsFastCopyBufferToTexture(GLint internalFormat) const;
virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment