Commit 1293cf4b by Shannon Woods Committed by Gerrit Code Review

Merge "Renamed some Blit11 types and methods to imply they are for blitting (as…

Merge "Renamed some Blit11 types and methods to imply they are for blitting (as opposed to swizzleing)." into es3proto
parents 00a8465b 26533604
...@@ -162,7 +162,7 @@ static void Write3DVertices(const gl::Box &sourceArea, const gl::Extents &source ...@@ -162,7 +162,7 @@ static void Write3DVertices(const gl::Box &sourceArea, const gl::Extents &source
} }
Blit11::Blit11(rx::Renderer11 *renderer) Blit11::Blit11(rx::Renderer11 *renderer)
: mRenderer(renderer), mShaderMap(compareBlitParameters), mVertexBuffer(NULL), : mRenderer(renderer), mBlitShaderMap(compareBlitParameters), mVertexBuffer(NULL),
mPointSampler(NULL), mLinearSampler(NULL), mScissorEnabledRasterizerState(NULL), mPointSampler(NULL), mLinearSampler(NULL), mScissorEnabledRasterizerState(NULL),
mScissorDisabledRasterizerState(NULL), mDepthStencilState(NULL), mScissorDisabledRasterizerState(NULL), mDepthStencilState(NULL),
mQuad2DIL(NULL), mQuad2DVS(NULL), mDepthPS(NULL), mQuad2DIL(NULL), mQuad2DVS(NULL), mDepthPS(NULL),
...@@ -342,14 +342,14 @@ bool Blit11::copyTexture(ID3D11ShaderResourceView *source, const gl::Box &source ...@@ -342,14 +342,14 @@ bool Blit11::copyTexture(ID3D11ShaderResourceView *source, const gl::Box &source
parameters.mSignedInteger = gl::GetComponentType(sourceInternalFormat, mRenderer->getCurrentClientVersion()) == GL_INT; parameters.mSignedInteger = gl::GetComponentType(sourceInternalFormat, mRenderer->getCurrentClientVersion()) == GL_INT;
parameters.m3DBlit = sourceArea.depth > 1; parameters.m3DBlit = sourceArea.depth > 1;
BlitShaderMap::const_iterator i = mShaderMap.find(parameters); BlitShaderMap::const_iterator i = mBlitShaderMap.find(parameters);
if (i == mShaderMap.end()) if (i == mBlitShaderMap.end())
{ {
UNREACHABLE(); UNREACHABLE();
return false; return false;
} }
const BlitShader& shader = i->second; const Shader& shader = i->second;
// Set vertices // Set vertices
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
...@@ -702,93 +702,93 @@ bool Blit11::compareBlitParameters(const Blit11::BlitParameters &a, const Blit11 ...@@ -702,93 +702,93 @@ bool Blit11::compareBlitParameters(const Blit11::BlitParameters &a, const Blit11
return memcmp(&a, &b, sizeof(Blit11::BlitParameters)) < 0; return memcmp(&a, &b, sizeof(Blit11::BlitParameters)) < 0;
} }
void Blit11::add2DShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps) void Blit11::add2DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps)
{ {
BlitParameters params = { 0 }; BlitParameters params = { 0 };
params.mDestinationFormat = destFormat; params.mDestinationFormat = destFormat;
params.mSignedInteger = signedInteger; params.mSignedInteger = signedInteger;
params.m3DBlit = false; params.m3DBlit = false;
ASSERT(mShaderMap.find(params) == mShaderMap.end()); ASSERT(mBlitShaderMap.find(params) == mBlitShaderMap.end());
ASSERT(ps); ASSERT(ps);
BlitShader shader; Shader shader;
shader.mVertexWriteFunction = Write2DVertices; shader.mVertexWriteFunction = Write2DVertices;
shader.mInputLayout = mQuad2DIL; shader.mInputLayout = mQuad2DIL;
shader.mVertexShader = mQuad2DVS; shader.mVertexShader = mQuad2DVS;
shader.mGeometryShader = NULL; shader.mGeometryShader = NULL;
shader.mPixelShader = ps; shader.mPixelShader = ps;
mShaderMap[params] = shader; mBlitShaderMap[params] = shader;
} }
void Blit11::add3DShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps) void Blit11::add3DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps)
{ {
BlitParameters params = { 0 }; BlitParameters params = { 0 };
params.mDestinationFormat = destFormat; params.mDestinationFormat = destFormat;
params.mSignedInteger = signedInteger; params.mSignedInteger = signedInteger;
params.m3DBlit = true; params.m3DBlit = true;
ASSERT(mShaderMap.find(params) == mShaderMap.end()); ASSERT(mBlitShaderMap.find(params) == mBlitShaderMap.end());
ASSERT(ps); ASSERT(ps);
BlitShader shader; Shader shader;
shader.mVertexWriteFunction = Write3DVertices; shader.mVertexWriteFunction = Write3DVertices;
shader.mInputLayout = mQuad3DIL; shader.mInputLayout = mQuad3DIL;
shader.mVertexShader = mQuad3DVS; shader.mVertexShader = mQuad3DVS;
shader.mGeometryShader = mQuad3DGS; shader.mGeometryShader = mQuad3DGS;
shader.mPixelShader = ps; shader.mPixelShader = ps;
mShaderMap[params] = shader; mBlitShaderMap[params] = shader;
} }
void Blit11::buildShaderMap() void Blit11::buildShaderMap()
{ {
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
add2DShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D RGBA pixel shader" )); add2DBlitShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D RGBA pixel shader" ));
add2DShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" )); add2DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" ));
add2DShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" )); add2DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" ));
add2DShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D BGRA pixel shader" )); add2DBlitShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D BGRA pixel shader" ));
add2DShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2D, "Blit11 2D RGB pixel shader" )); add2DBlitShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2D, "Blit11 2D RGB pixel shader" ));
add2DShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" )); add2DBlitShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" ));
add2DShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" )); add2DBlitShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" ));
add2DShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG2D, "Blit11 2D RG pixel shader" )); add2DBlitShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG2D, "Blit11 2D RG pixel shader" ));
add2DShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" )); add2DBlitShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" ));
add2DShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" )); add2DBlitShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" ));
add2DShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR2D, "Blit11 2D R pixel shader" )); add2DBlitShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR2D, "Blit11 2D R pixel shader" ));
add2DShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" )); add2DBlitShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" ));
add2DShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" )); add2DBlitShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" ));
add2DShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D alpha pixel shader" )); add2DBlitShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D alpha pixel shader" ));
add2DShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum2D, "Blit11 2D lum pixel shader" )); add2DBlitShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum2D, "Blit11 2D lum pixel shader" ));
add2DShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha2D, "Blit11 2D luminance alpha pixel shader")); add2DBlitShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha2D, "Blit11 2D luminance alpha pixel shader"));
add3DShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D RGBA pixel shader" )); add3DBlitShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D RGBA pixel shader" ));
add3DShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DUI, "Blit11 3D UI RGBA pixel shader" )); add3DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DUI, "Blit11 3D UI RGBA pixel shader" ));
add3DShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DI, "Blit11 3D I RGBA pixel shader" )); add3DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DI, "Blit11 3D I RGBA pixel shader" ));
add3DShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D BGRA pixel shader" )); add3DBlitShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D BGRA pixel shader" ));
add3DShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3D, "Blit11 3D RGB pixel shader" )); add3DBlitShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3D, "Blit11 3D RGB pixel shader" ));
add3DShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3DUI, "Blit11 3D RGB UI pixel shader" )); add3DBlitShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3DUI, "Blit11 3D RGB UI pixel shader" ));
add3DShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB3DI, "Blit11 3D RGB I pixel shader" )); add3DBlitShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB3DI, "Blit11 3D RGB I pixel shader" ));
add3DShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG3D, "Blit11 3D RG pixel shader" )); add3DBlitShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG3D, "Blit11 3D RG pixel shader" ));
add3DShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG3DUI, "Blit11 3D RG UI pixel shader" )); add3DBlitShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG3DUI, "Blit11 3D RG UI pixel shader" ));
add3DShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG3DI, "Blit11 3D RG I pixel shader" )); add3DBlitShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG3DI, "Blit11 3D RG I pixel shader" ));
add3DShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR3D, "Blit11 3D R pixel shader" )); add3DBlitShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR3D, "Blit11 3D R pixel shader" ));
add3DShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR3DUI, "Blit11 3D R UI pixel shader" )); add3DBlitShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR3DUI, "Blit11 3D R UI pixel shader" ));
add3DShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR3DI, "Blit11 3D R I pixel shader" )); add3DBlitShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR3DI, "Blit11 3D R I pixel shader" ));
add3DShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D alpha pixel shader" )); add3DBlitShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D alpha pixel shader" ));
add3DShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum3D, "Blit11 3D luminance pixel shader" )); add3DBlitShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum3D, "Blit11 3D luminance pixel shader" ));
add3DShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha3D, "Blit11 3D luminance alpha pixel shader")); add3DBlitShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha3D, "Blit11 3D luminance alpha pixel shader"));
} }
void Blit11::clearShaderMap() void Blit11::clearShaderMap()
{ {
for (BlitShaderMap::iterator i = mShaderMap.begin(); i != mShaderMap.end(); ++i) for (BlitShaderMap::iterator i = mBlitShaderMap.begin(); i != mBlitShaderMap.end(); ++i)
{ {
BlitShader &shader = i->second; Shader &shader = i->second;
SafeRelease(shader.mPixelShader); SafeRelease(shader.mPixelShader);
} }
mShaderMap.clear(); mBlitShaderMap.clear();
} }
} }
...@@ -65,7 +65,7 @@ class Blit11 ...@@ -65,7 +65,7 @@ class Blit11
void *outVertices, unsigned int *outStride, unsigned int *outVertexCount, void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
D3D11_PRIMITIVE_TOPOLOGY *outTopology); D3D11_PRIMITIVE_TOPOLOGY *outTopology);
struct BlitShader struct Shader
{ {
WriteVertexFunction mVertexWriteFunction; WriteVertexFunction mVertexWriteFunction;
ID3D11InputLayout *mInputLayout; ID3D11InputLayout *mInputLayout;
...@@ -75,11 +75,11 @@ class Blit11 ...@@ -75,11 +75,11 @@ class Blit11
}; };
typedef bool (*BlitParametersComparisonFunction)(const BlitParameters&, const BlitParameters &); typedef bool (*BlitParametersComparisonFunction)(const BlitParameters&, const BlitParameters &);
typedef std::map<BlitParameters, BlitShader, BlitParametersComparisonFunction> BlitShaderMap; typedef std::map<BlitParameters, Shader, BlitParametersComparisonFunction> BlitShaderMap;
BlitShaderMap mShaderMap; BlitShaderMap mBlitShaderMap;
void add2DShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps); void add2DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps);
void add3DShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps); void add3DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps);
void buildShaderMap(); void buildShaderMap();
void clearShaderMap(); void clearShaderMap();
......
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