Commit 0654d32a by Geoff Lang

Fix texture formats backed by extra channels.

Fix rendering to, initializing and clearing textures that are backed by more channels in D3D11 than the GL format has. Change-Id: I250c349254acf4e6f85d4eff58e2190edb1782ef Reviewed-on: https://chromium-review.googlesource.com/183994Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Commit-Queue: Nicolas Capens <nicolascapens@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 3f2c0b38
......@@ -1778,7 +1778,7 @@ void Context::applyState(GLenum drawMode)
{
mask = 0xFFFFFFFF;
}
mRenderer->setBlendState(mState.blend, mState.blendColor, mask);
mRenderer->setBlendState(framebufferObject, mState.blend, mState.blendColor, mask);
mRenderer->setDepthStencilState(mState.depthStencil, mState.stencilRef, mState.stencilBackRef,
mState.rasterizer.frontFace == GL_CCW);
......
......@@ -119,7 +119,7 @@ class Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
virtual void setRasterizerState(const gl::RasterizerState &rasterState) = 0;
virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask) = 0;
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW) = 0;
......
......@@ -106,9 +106,15 @@ void Image11::generateMipmap(Image11 *dest, Image11 *src)
dest->markDirty();
}
static bool FormatRequiresInitialization(DXGI_FORMAT dxgiFormat, GLenum internalFormat)
{
return (dxgiFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(internalFormat) == 0) ||
(dxgiFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(internalFormat) == 0);
}
bool Image11::isDirty() const
{
return (mStagingTexture && mDirty);
return ((mStagingTexture || FormatRequiresInitialization(mDXGIFormat, mInternalFormat)) && mDirty);
}
bool Image11::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
......@@ -371,6 +377,27 @@ unsigned int Image11::getStagingSubresource()
return mStagingSubresource;
}
template <typename T, size_t N>
static void setDefaultData(ID3D11DeviceContext *deviceContext, ID3D11Texture2D *texture, UINT subresource,
GLsizei width, GLsizei height, const T (&defaultData)[N])
{
D3D11_MAPPED_SUBRESOURCE map;
deviceContext->Map(texture, subresource, D3D11_MAP_WRITE, 0, &map);
unsigned char* ptr = reinterpret_cast<unsigned char*>(map.pData);
size_t pixelSize = sizeof(T) * N;
for (GLsizei y = 0; y < height; y++)
{
for (GLsizei x = 0; x < width; x++)
{
memcpy(ptr + (y * map.RowPitch) + (x * pixelSize), defaultData, pixelSize);
}
}
deviceContext->Unmap(texture, subresource);
}
void Image11::createStagingTexture()
{
if (mStagingTexture)
......@@ -418,6 +445,17 @@ void Image11::createStagingTexture()
mStagingTexture = newTexture;
mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
mDirty = false;
if (mDXGIFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(mInternalFormat) == 0)
{
unsigned char defaultPixel[4] = { 0, 0, 0, 255 };
setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
}
else if (mDXGIFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(mInternalFormat) == 0)
{
float defaultPixel[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
}
}
HRESULT Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
......
......@@ -11,6 +11,9 @@
#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/utilities.h"
#include "common/debug.h"
#include "third_party/murmurhash/MurmurHash3.h"
......@@ -71,21 +74,21 @@ void RenderStateCache::clear()
mSamplerStateCache.clear();
}
std::size_t RenderStateCache::hashBlendState(const gl::BlendState &blendState)
std::size_t RenderStateCache::hashBlendState(const BlendStateKey &blendState)
{
static const unsigned int seed = 0xABCDEF98;
std::size_t hash = 0;
MurmurHash3_x86_32(&blendState, sizeof(gl::BlendState), seed, &hash);
MurmurHash3_x86_32(&blendState, sizeof(BlendStateKey), seed, &hash);
return hash;
}
bool RenderStateCache::compareBlendStates(const gl::BlendState &a, const gl::BlendState &b)
bool RenderStateCache::compareBlendStates(const BlendStateKey &a, const BlendStateKey &b)
{
return memcmp(&a, &b, sizeof(gl::BlendState)) == 0;
}
ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendState)
ID3D11BlendState *RenderStateCache::getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState)
{
if (!mDevice)
{
......@@ -93,7 +96,36 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
BlendStateMap::iterator i = mBlendStateCache.find(blendState);
bool mrt = false;
BlendStateKey key = { 0 };
key.blendState = blendState;
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
gl::Renderbuffer *renderBuffer = framebuffer->getColorbuffer(i);
if (renderBuffer)
{
if (i > 0)
{
mrt = true;
}
GLenum internalFormat = renderBuffer->getInternalFormat();
key.rtChannels[i][0] = gl::GetRedSize(internalFormat) > 0;
key.rtChannels[i][1] = gl::GetGreenSize(internalFormat) > 0;
key.rtChannels[i][2] = gl::GetBlueSize(internalFormat) > 0;;
key.rtChannels[i][3] = gl::GetAlphaSize(internalFormat) > 0;
}
else
{
key.rtChannels[i][0] = false;
key.rtChannels[i][1] = false;
key.rtChannels[i][2] = false;
key.rtChannels[i][3] = false;
}
}
BlendStateMap::iterator i = mBlendStateCache.find(key);
if (i != mBlendStateCache.end())
{
BlendStateCounterPair &state = i->second;
......@@ -122,7 +154,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
// Create a new blend state and insert it into the cache
D3D11_BLEND_DESC blendDesc = { 0 };
blendDesc.AlphaToCoverageEnable = blendState.sampleAlphaToCoverage;
blendDesc.IndependentBlendEnable = FALSE;
blendDesc.IndependentBlendEnable = mrt ? TRUE : FALSE;
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
......@@ -140,10 +172,10 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
rtBlend.BlendOpAlpha = gl_d3d11::ConvertBlendOp(blendState.blendEquationAlpha);
}
rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendState.colorMaskRed,
blendState.colorMaskGreen,
blendState.colorMaskBlue,
blendState.colorMaskAlpha);
rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(key.rtChannels[i][0] && blendState.colorMaskRed,
key.rtChannels[i][1] && blendState.colorMaskGreen,
key.rtChannels[i][2] && blendState.colorMaskBlue,
key.rtChannels[i][3] && blendState.colorMaskAlpha);
}
ID3D11BlendState *dx11BlendState = NULL;
......@@ -154,7 +186,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
mBlendStateCache.insert(std::make_pair(blendState, std::make_pair(dx11BlendState, mCounter++)));
mBlendStateCache.insert(std::make_pair(key, std::make_pair(dx11BlendState, mCounter++)));
return dx11BlendState;
}
......
......@@ -13,6 +13,11 @@
#include "libGLESv2/angletypes.h"
#include "common/angleutils.h"
namespace gl
{
class Framebuffer;
}
namespace rx
{
......@@ -26,7 +31,7 @@ class RenderStateCache
void clear();
// Increments refcount on the returned blend state, Release() must be called.
ID3D11BlendState *getBlendState(const gl::BlendState &blendState);
ID3D11BlendState *getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState);
ID3D11RasterizerState *getRasterizerState(const gl::RasterizerState &rasterState,
bool scissorEnabled, unsigned int depthSize);
ID3D11DepthStencilState *getDepthStencilState(const gl::DepthStencilState &dsState);
......@@ -38,14 +43,19 @@ class RenderStateCache
unsigned long long mCounter;
// Blend state cache
static std::size_t hashBlendState(const gl::BlendState &blendState);
static bool compareBlendStates(const gl::BlendState &a, const gl::BlendState &b);
struct BlendStateKey
{
gl::BlendState blendState;
bool rtChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
};
static std::size_t hashBlendState(const BlendStateKey &blendState);
static bool compareBlendStates(const BlendStateKey &a, const BlendStateKey &b);
static const unsigned int kMaxBlendStates;
typedef std::size_t (*BlendStateHashFunction)(const gl::BlendState &);
typedef bool (*BlendStateEqualityFunction)(const gl::BlendState &, const gl::BlendState &);
typedef std::size_t (*BlendStateHashFunction)(const BlendStateKey &);
typedef bool (*BlendStateEqualityFunction)(const BlendStateKey &, const BlendStateKey &);
typedef std::pair<ID3D11BlendState*, unsigned long long> BlendStateCounterPair;
typedef std::unordered_map<gl::BlendState, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
typedef std::unordered_map<BlendStateKey, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
BlendStateMap mBlendStateCache;
// Rasterizer state cache
......
......@@ -658,7 +658,7 @@ void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
void Renderer11::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask)
{
if (mForceSetBlendState ||
......@@ -666,7 +666,7 @@ void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color
memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0 ||
sampleMask != mCurSampleMask)
{
ID3D11BlendState *dxBlendState = mStateCache.getBlendState(blendState);
ID3D11BlendState *dxBlendState = mStateCache.getBlendState(framebuffer, blendState);
if (!dxBlendState)
{
ERR("NULL blend state returned by RenderStateCache::getBlendState, setting the default "
......@@ -1535,10 +1535,14 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
bool alphaUnmasked = (gl::GetAlphaSize(mRenderTargetDesc.format) == 0) || clearParams.colorMaskAlpha;
gl::Renderbuffer *firstRenderbuffer = frameBuffer->getFirstColorbuffer();
GLenum internalFormat = firstRenderbuffer ? firstRenderbuffer->getInternalFormat() : GL_NONE;
bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
!(clearParams.colorMaskRed && clearParams.colorMaskGreen &&
clearParams.colorMaskBlue && alphaUnmasked);
((!clearParams.colorMaskRed && gl::GetRedSize(internalFormat) > 0) ||
(!clearParams.colorMaskGreen && gl::GetGreenSize(internalFormat) > 0) ||
(!clearParams.colorMaskBlue && gl::GetBlueSize(internalFormat) > 0) ||
(!clearParams.colorMaskAlpha && gl::GetAlphaSize(internalFormat) > 0));
unsigned int stencilUnmasked = 0x0;
if (frameBuffer->hasStencil())
......@@ -1555,7 +1559,7 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
if (needMaskedColorClear || needMaskedStencilClear || needScissoredClear)
{
maskedClear(clearParams, frameBuffer->usingExtendedDrawBuffers());
maskedClear(clearParams, frameBuffer);
}
else
{
......@@ -1582,10 +1586,12 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
return;
}
const float clearValues[4] = { clearParams.colorClearValue.red,
clearParams.colorClearValue.green,
clearParams.colorClearValue.blue,
clearParams.colorClearValue.alpha };
GLenum format = renderbufferObject->getInternalFormat();
const float clearValues[4] = { (gl::GetRedSize(format) > 0) ? clearParams.colorClearValue.red : 0.0f,
(gl::GetGreenSize(format) > 0) ? clearParams.colorClearValue.green : 0.0f,
(gl::GetBlueSize(format) > 0) ? clearParams.colorClearValue.blue : 0.0f,
(gl::GetAlphaSize(format) > 0) ? clearParams.colorClearValue.alpha : 1.0f };
mDeviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
}
}
......@@ -1629,7 +1635,7 @@ void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *
}
}
void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers)
void Renderer11::maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
HRESULT result;
......@@ -1749,7 +1755,7 @@ void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingE
static const float blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static const UINT sampleMask = 0xFFFFFFFF;
ID3D11BlendState *blendState = mStateCache.getBlendState(glBlendState);
ID3D11BlendState *blendState = mStateCache.getBlendState(frameBuffer, glBlendState);
// Set the vertices
D3D11_MAPPED_SUBRESOURCE mappedResource;
......@@ -1776,7 +1782,7 @@ void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingE
mDeviceContext->RSSetState(mScissorEnabled ? mClearScissorRS : mClearNoScissorRS);
// Apply shaders
ID3D11PixelShader *pixelShader = usingExtendedDrawBuffers ? mClearMultiplePS : mClearSinglePS;
ID3D11PixelShader *pixelShader = frameBuffer->usingExtendedDrawBuffers() ? mClearMultiplePS : mClearSinglePS;
mDeviceContext->IASetInputLayout(mClearIL);
mDeviceContext->VSSetShader(mClearVS, NULL, 0);
......@@ -3003,7 +3009,7 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi
area.width = width;
area.height = height;
readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch,
readTextureData(colorBufferTexture, subresourceIndex, area, colorbuffer->getActualFormat(), format, type, outputPitch,
packReverseRowOrder, packAlignment, pixels);
colorBufferTexture->Release();
......@@ -3039,7 +3045,7 @@ TextureStorage *Renderer11::createTextureStorageCube(int levels, GLenum internal
return new TextureStorage11_Cube(this, levels, internalformat, usage, forceRenderable, size);
}
static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType)
static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum sourceGLFormat, GLenum destFormat, GLenum destType)
{
if (sourceFormat == DXGI_FORMAT_A8_UNORM &&
destFormat == GL_ALPHA &&
......@@ -3047,9 +3053,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 1;
}
else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
destFormat == GL_RGBA &&
destType == GL_UNSIGNED_BYTE)
else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
sourceGLFormat == GL_RGBA8_OES &&
destFormat == GL_RGBA &&
destType == GL_UNSIGNED_BYTE)
{
return 4;
}
......@@ -3059,9 +3066,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 4;
}
else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
destFormat == GL_RGBA &&
destType == GL_HALF_FLOAT_OES)
else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
sourceGLFormat == GL_RGBA16F_EXT &&
destFormat == GL_RGBA &&
destType == GL_HALF_FLOAT_OES)
{
return 8;
}
......@@ -3071,9 +3079,10 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
{
return 12;
}
else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
destFormat == GL_RGBA &&
destType == GL_FLOAT)
else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
sourceGLFormat == GL_RGBA32F_EXT &&
destFormat == GL_RGBA &&
destType == GL_FLOAT)
{
return 16;
}
......@@ -3083,7 +3092,7 @@ static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum
}
}
static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, unsigned int x,
static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, GLenum glFormat, unsigned int x,
unsigned int y, int inputPitch, gl::Color *outColor)
{
switch (format)
......@@ -3094,7 +3103,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = (rgba & 0x000000FF) * (1.0f / 0x000000FF);
outColor->green = (rgba & 0x0000FF00) * (1.0f / 0x0000FF00);
outColor->blue = (rgba & 0x00FF0000) * (1.0f / 0x00FF0000);
outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
if (gl::GetAlphaSize(glFormat) > 0)
{
outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
}
else
{
outColor->alpha = 1.0f;
}
}
break;
......@@ -3112,7 +3129,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 0);
outColor->green = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 1);
outColor->blue = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 2);
outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
if (gl::GetAlphaSize(glFormat) > 0)
{
outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
}
else
{
outColor->alpha = 1.0f;
}
}
break;
......@@ -3130,7 +3155,15 @@ static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format,
outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 0));
outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 1));
outColor->blue = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 2));
outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
if (gl::GetAlphaSize(glFormat) > 0)
{
outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
}
else
{
outColor->alpha = 1.0f;
}
}
break;
......@@ -3292,7 +3325,7 @@ static inline void writePixelColor(const gl::Color &color, GLenum format, GLenum
}
void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLint packAlignment, void *pixels)
{
D3D11_TEXTURE2D_DESC textureDesc;
......@@ -3381,7 +3414,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
inputPitch = static_cast<int>(mapping.RowPitch);
}
unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, format, type);
unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, sourceFormat, format, type);
if (fastPixelSize != 0)
{
unsigned char *dest = static_cast<unsigned char*>(pixels);
......@@ -3416,7 +3449,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
{
for (int i = 0; i < area.width; i++)
{
readPixelColor(source, textureDesc.Format, i, j, inputPitch, &pixelColor);
readPixelColor(source, textureDesc.Format, sourceFormat, i, j, inputPitch, &pixelColor);
writePixelColor(pixelColor, format, type, i, j, outputPitch, pixels);
}
}
......
......@@ -58,7 +58,7 @@ class Renderer11 : public Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
......@@ -191,10 +191,10 @@ class Renderer11 : public Renderer
void drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
GLint packAlignment, void *pixels);
void maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers);
void maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
rx::Range getViewportBounds() const;
bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
......
......@@ -852,7 +852,7 @@ void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
void Renderer9::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
{
bool blendStateChanged = mForceSetBlendState || memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0;
bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0;
......
......@@ -72,7 +72,7 @@ class Renderer9 : public Renderer
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
......
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