Commit c2da55cc by Jamie Madill

Make CompilePS a shared utility method in the d3d11 namespace, and add methods…

Make CompilePS a shared utility method in the d3d11 namespace, and add methods for vertex and geometry shaders. TRAC #23841 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods
parent bdfa2289
...@@ -161,16 +161,6 @@ static void Write3DVertices(const gl::Box &sourceArea, const gl::Extents &source ...@@ -161,16 +161,6 @@ static void Write3DVertices(const gl::Box &sourceArea, const gl::Extents &source
*outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
} }
template <unsigned int N>
static ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
{
ID3D11PixelShader *ps = NULL;
HRESULT result = device->CreatePixelShader(byteCode, N, NULL, &ps);
ASSERT(SUCCEEDED(result));
d3d11::SetDebugName(ps, name);
return ps;
}
Blit11::Blit11(rx::Renderer11 *renderer) Blit11::Blit11(rx::Renderer11 *renderer)
: mRenderer(renderer), mShaderMap(compareBlitParameters), mVertexBuffer(NULL), : mRenderer(renderer), mShaderMap(compareBlitParameters), mVertexBuffer(NULL),
mPointSampler(NULL), mLinearSampler(NULL), mScissorEnabledRasterizerState(NULL), mPointSampler(NULL), mLinearSampler(NULL), mScissorEnabledRasterizerState(NULL),
...@@ -756,39 +746,39 @@ void Blit11::buildShaderMap() ...@@ -756,39 +746,39 @@ void Blit11::buildShaderMap()
{ {
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
add2DShaderToMap(GL_RGBA, false, CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D RGBA pixel shader" )); add2DShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D RGBA pixel shader" ));
add2DShaderToMap(GL_RGBA_INTEGER, false, CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" )); add2DShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" ));
add2DShaderToMap(GL_RGBA_INTEGER, true, CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" )); add2DShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" ));
add2DShaderToMap(GL_BGRA_EXT, false, CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D BGRA pixel shader" )); add2DShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D BGRA pixel shader" ));
add2DShaderToMap(GL_RGB, false, CompilePS(device, g_PS_PassthroughRGB2D, "Blit11 2D RGB pixel shader" )); add2DShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2D, "Blit11 2D RGB pixel shader" ));
add2DShaderToMap(GL_RGB_INTEGER, false, CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" )); add2DShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" ));
add2DShaderToMap(GL_RGB_INTEGER, true, CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" )); add2DShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" ));
add2DShaderToMap(GL_RG, false, CompilePS(device, g_PS_PassthroughRG2D, "Blit11 2D RG pixel shader" )); add2DShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG2D, "Blit11 2D RG pixel shader" ));
add2DShaderToMap(GL_RG_INTEGER, false, CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" )); add2DShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" ));
add2DShaderToMap(GL_RG_INTEGER, true, CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" )); add2DShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" ));
add2DShaderToMap(GL_RED, false, CompilePS(device, g_PS_PassthroughR2D, "Blit11 2D R pixel shader" )); add2DShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR2D, "Blit11 2D R pixel shader" ));
add2DShaderToMap(GL_RED_INTEGER, false, CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" )); add2DShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" ));
add2DShaderToMap(GL_RED_INTEGER, true, CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" )); add2DShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" ));
add2DShaderToMap(GL_ALPHA, false, CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D alpha pixel shader" )); add2DShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D alpha pixel shader" ));
add2DShaderToMap(GL_LUMINANCE, false, CompilePS(device, g_PS_PassthroughLum2D, "Blit11 2D lum pixel shader" )); add2DShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum2D, "Blit11 2D lum pixel shader" ));
add2DShaderToMap(GL_LUMINANCE_ALPHA, false, CompilePS(device, g_PS_PassthroughLumAlpha2D, "Blit11 2D luminance alpha pixel shader")); add2DShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha2D, "Blit11 2D luminance alpha pixel shader"));
add3DShaderToMap(GL_RGBA, false, CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D RGBA pixel shader" )); add3DShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D RGBA pixel shader" ));
add3DShaderToMap(GL_RGBA_INTEGER, false, CompilePS(device, g_PS_PassthroughRGBA3DUI, "Blit11 3D UI RGBA pixel shader" )); add3DShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DUI, "Blit11 3D UI RGBA pixel shader" ));
add3DShaderToMap(GL_RGBA_INTEGER, true, CompilePS(device, g_PS_PassthroughRGBA3DI, "Blit11 3D I RGBA pixel shader" )); add3DShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DI, "Blit11 3D I RGBA pixel shader" ));
add3DShaderToMap(GL_BGRA_EXT, false, CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D BGRA pixel shader" )); add3DShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D BGRA pixel shader" ));
add3DShaderToMap(GL_RGB, false, CompilePS(device, g_PS_PassthroughRGB3D, "Blit11 3D RGB pixel shader" )); add3DShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3D, "Blit11 3D RGB pixel shader" ));
add3DShaderToMap(GL_RGB_INTEGER, false, CompilePS(device, g_PS_PassthroughRGB3DUI, "Blit11 3D RGB UI pixel shader" )); add3DShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3DUI, "Blit11 3D RGB UI pixel shader" ));
add3DShaderToMap(GL_RGB_INTEGER, true, CompilePS(device, g_PS_PassthroughRGB3DI, "Blit11 3D RGB I pixel shader" )); add3DShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB3DI, "Blit11 3D RGB I pixel shader" ));
add3DShaderToMap(GL_RG, false, CompilePS(device, g_PS_PassthroughRG3D, "Blit11 3D RG pixel shader" )); add3DShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG3D, "Blit11 3D RG pixel shader" ));
add3DShaderToMap(GL_RG_INTEGER, false, CompilePS(device, g_PS_PassthroughRG3DUI, "Blit11 3D RG UI pixel shader" )); add3DShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG3DUI, "Blit11 3D RG UI pixel shader" ));
add3DShaderToMap(GL_RG_INTEGER, true, CompilePS(device, g_PS_PassthroughRG3DI, "Blit11 3D RG I pixel shader" )); add3DShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG3DI, "Blit11 3D RG I pixel shader" ));
add3DShaderToMap(GL_RED, false, CompilePS(device, g_PS_PassthroughR3D, "Blit11 3D R pixel shader" )); add3DShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR3D, "Blit11 3D R pixel shader" ));
add3DShaderToMap(GL_RED_INTEGER, false, CompilePS(device, g_PS_PassthroughR3DUI, "Blit11 3D R UI pixel shader" )); add3DShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR3DUI, "Blit11 3D R UI pixel shader" ));
add3DShaderToMap(GL_RED_INTEGER, true, CompilePS(device, g_PS_PassthroughR3DI, "Blit11 3D R I pixel shader" )); add3DShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR3DI, "Blit11 3D R I pixel shader" ));
add3DShaderToMap(GL_ALPHA, false, CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D alpha pixel shader" )); add3DShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D alpha pixel shader" ));
add3DShaderToMap(GL_LUMINANCE, false, CompilePS(device, g_PS_PassthroughLum3D, "Blit11 3D luminance pixel shader" )); add3DShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum3D, "Blit11 3D luminance pixel shader" ));
add3DShaderToMap(GL_LUMINANCE_ALPHA, false, CompilePS(device, g_PS_PassthroughLumAlpha3D, "Blit11 3D luminance alpha pixel shader")); add3DShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha3D, "Blit11 3D luminance alpha pixel shader"));
} }
void Blit11::clearShaderMap() void Blit11::clearShaderMap()
......
...@@ -108,6 +108,36 @@ inline bool isDeviceLostError(HRESULT errorCode) ...@@ -108,6 +108,36 @@ inline bool isDeviceLostError(HRESULT errorCode)
} }
} }
template <unsigned int N>
inline ID3D11VertexShader *CompileVS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
{
ID3D11VertexShader *vs = NULL;
HRESULT result = device->CreateVertexShader(byteCode, N, NULL, &vs);
ASSERT(SUCCEEDED(result));
SetDebugName(vs, name);
return vs;
}
template <unsigned int N>
inline ID3D11GeometryShader *CompileGS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
{
ID3D11GeometryShader *gs = NULL;
HRESULT result = device->CreateGeometryShader(byteCode, N, NULL, &gs);
ASSERT(SUCCEEDED(result));
SetDebugName(gs, name);
return gs;
}
template <unsigned int N>
inline ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
{
ID3D11PixelShader *ps = NULL;
HRESULT result = device->CreatePixelShader(byteCode, N, NULL, &ps);
ASSERT(SUCCEEDED(result));
SetDebugName(ps, name);
return ps;
}
} }
} }
......
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