DX11: Add error checking to about any device object creation. Since we aren't handling creation errors that well right now we should at least output an error message.
Remove superfluous _WIN32 checks in DX11 and DX9. Meant to port that code over to Linux or what? :P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5738 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
866859493a
commit
bf36f171a6
|
@ -178,7 +178,8 @@ void EmuGfxState::ApplyState()
|
||||||
{
|
{
|
||||||
unsigned int size = ((sizeof(float)*952)&(~0xffff))+0x10000; // must be a multiple of 16
|
unsigned int size = ((sizeof(float)*952)&(~0xffff))+0x10000; // must be a multiple of 16
|
||||||
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(size, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
|
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(size, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
|
||||||
device->CreateBuffer(&cbdesc, NULL, &vscbuf);
|
hr = device->CreateBuffer(&cbdesc, NULL, &vscbuf);
|
||||||
|
CHECK(hr==S_OK, "Create vertex shader constant buffer (size=%u)", size);
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)vscbuf, "a vertex shader constant buffer of EmuGfxState");
|
SetDebugObjectName((ID3D11DeviceChild*)vscbuf, "a vertex shader constant buffer of EmuGfxState");
|
||||||
}
|
}
|
||||||
if (vscbufchanged)
|
if (vscbufchanged)
|
||||||
|
@ -196,6 +197,7 @@ void EmuGfxState::ApplyState()
|
||||||
unsigned int size = ((sizeof(float)*116)&(~0xffff))+0x10000; // must be a multiple of 16
|
unsigned int size = ((sizeof(float)*116)&(~0xffff))+0x10000; // must be a multiple of 16
|
||||||
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(size, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
|
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(size, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
|
||||||
device->CreateBuffer(&cbdesc, NULL, &pscbuf);
|
device->CreateBuffer(&cbdesc, NULL, &pscbuf);
|
||||||
|
CHECK(hr==S_OK, "Create pixel shader constant buffer (size=%u)", size);
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)pscbuf, "a pixel shader constant buffer of EmuGfxState");
|
SetDebugObjectName((ID3D11DeviceChild*)pscbuf, "a pixel shader constant buffer of EmuGfxState");
|
||||||
}
|
}
|
||||||
if (pscbufchanged)
|
if (pscbufchanged)
|
||||||
|
@ -363,6 +365,7 @@ HRESULT Create(HWND wnd)
|
||||||
}
|
}
|
||||||
backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
||||||
buf->Release();
|
buf->Release();
|
||||||
|
CHECK(backbuf!=NULL, "Create back buffer texture");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture");
|
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view");
|
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view");
|
||||||
|
|
||||||
|
@ -427,6 +430,7 @@ void Reset()
|
||||||
}
|
}
|
||||||
backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
||||||
buf->Release();
|
buf->Release();
|
||||||
|
CHECK(backbuf!=NULL, "Create back buffer texture");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture");
|
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view");
|
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view");
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,18 +236,20 @@ int CD3DFont::Init()
|
||||||
blenddesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
|
blenddesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
|
||||||
blenddesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
|
blenddesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
|
||||||
blenddesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
blenddesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||||
D3D::device->CreateBlendState(&blenddesc, &m_blendstate);
|
hr = D3D::device->CreateBlendState(&blenddesc, &m_blendstate);
|
||||||
|
CHECK(hr==S_OK, "Create font blend state");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_blendstate, "blend state of a CD3DFont object");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_blendstate, "blend state of a CD3DFont object");
|
||||||
|
|
||||||
// this might need to be changed when adding multisampling support
|
// this might need to be changed when adding multisampling support
|
||||||
D3D11_RASTERIZER_DESC rastdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false);
|
D3D11_RASTERIZER_DESC rastdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false);
|
||||||
D3D::device->CreateRasterizerState(&rastdesc, &m_raststate);
|
hr = D3D::device->CreateRasterizerState(&rastdesc, &m_raststate);
|
||||||
|
CHECK(hr==S_OK, "Create font rasterizer state");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_raststate, "rasterizer state of a CD3DFont object");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_raststate, "rasterizer state of a CD3DFont object");
|
||||||
|
|
||||||
D3D11_BUFFER_DESC vbdesc = CD3D11_BUFFER_DESC(MAX_NUM_VERTICES*sizeof(FONT2DVERTEX), D3D11_BIND_VERTEX_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
|
D3D11_BUFFER_DESC vbdesc = CD3D11_BUFFER_DESC(MAX_NUM_VERTICES*sizeof(FONT2DVERTEX), D3D11_BIND_VERTEX_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
|
||||||
if (FAILED(hr = device->CreateBuffer(&vbdesc, NULL, &m_pVB)))
|
if (FAILED(hr = device->CreateBuffer(&vbdesc, NULL, &m_pVB)))
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to create vertex buffer!\n");
|
PanicAlert("Failed to create font vertex buffer at %s, line %d\n", __FILE__, __LINE__);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_pVB, "vertex buffer of a CD3DFont object");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_pVB, "vertex buffer of a CD3DFont object");
|
||||||
|
@ -420,12 +422,15 @@ void InitUtils()
|
||||||
else SetDebugObjectName((ID3D11DeviceChild*)stqsamplerstate, "sampler state of drawShadedTexQuad");
|
else SetDebugObjectName((ID3D11DeviceChild*)stqsamplerstate, "sampler state of drawShadedTexQuad");
|
||||||
|
|
||||||
stqvb = CreateQuadVertexBuffer(4*sizeof(STQVertex), NULL);
|
stqvb = CreateQuadVertexBuffer(4*sizeof(STQVertex), NULL);
|
||||||
|
CHECK(stqvb!=NULL, "Create vertex buffer of drawShadedTexQuad");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)stqvb, "vertex buffer of drawShadedTexQuad");
|
SetDebugObjectName((ID3D11DeviceChild*)stqvb, "vertex buffer of drawShadedTexQuad");
|
||||||
|
|
||||||
stsqvb = CreateQuadVertexBuffer(4*sizeof(STSQVertex), NULL);
|
stsqvb = CreateQuadVertexBuffer(4*sizeof(STSQVertex), NULL);
|
||||||
|
CHECK(stsqvb!=NULL, "Create vertex buffer of drawShadedTexSubQuad");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)stsqvb, "vertex buffer of drawShadedTexSubQuad");
|
SetDebugObjectName((ID3D11DeviceChild*)stsqvb, "vertex buffer of drawShadedTexSubQuad");
|
||||||
|
|
||||||
clearvb = CreateQuadVertexBuffer(4*sizeof(ClearVertex), NULL);
|
clearvb = CreateQuadVertexBuffer(4*sizeof(ClearVertex), NULL);
|
||||||
|
CHECK(clearvb!=NULL, "Create vertex buffer of drawClearQuad");
|
||||||
SetDebugObjectName((ID3D11DeviceChild*)clearvb, "vertex buffer of drawClearQuad");
|
SetDebugObjectName((ID3D11DeviceChild*)clearvb, "vertex buffer of drawClearQuad");
|
||||||
|
|
||||||
samDesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_POINT, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, 0.f, 16, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
|
samDesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_POINT, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, 0.f, 16, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
|
||||||
|
|
|
@ -84,7 +84,8 @@ void FramebufferManager::Create()
|
||||||
// sampler state for FramebufferManager::copyToVirtualXFB
|
// sampler state for FramebufferManager::copyToVirtualXFB
|
||||||
float border[4] = {0.f, 0.f, 0.f, 0.f};
|
float border[4] = {0.f, 0.f, 0.f, 0.f};
|
||||||
D3D11_SAMPLER_DESC samplerdesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_LINEAR, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, 0.f, 1, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
|
D3D11_SAMPLER_DESC samplerdesc = CD3D11_SAMPLER_DESC(D3D11_FILTER_MIN_MAG_MIP_LINEAR, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, D3D11_TEXTURE_ADDRESS_CLAMP, 0.f, 1, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX);
|
||||||
D3D::device->CreateSamplerState(&samplerdesc, ©toVirtualXFBsampler);
|
hr = D3D::device->CreateSamplerState(&samplerdesc, ©toVirtualXFBsampler);
|
||||||
|
CHECK(hr==S_OK, "Create sampler state for FramebufferManager::copyToVirtualXFB");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)copytoVirtualXFBsampler, "sampler state used for FramebufferManager::copyToVirtualXFB");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)copytoVirtualXFBsampler, "sampler state used for FramebufferManager::copyToVirtualXFB");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,18 +166,22 @@ void PixelShaderCache::Init()
|
||||||
{
|
{
|
||||||
// used when drawing clear quads
|
// used when drawing clear quads
|
||||||
s_ClearProgram = D3D::CompileAndCreatePixelShader(clear_program_code, strlen(clear_program_code));
|
s_ClearProgram = D3D::CompileAndCreatePixelShader(clear_program_code, strlen(clear_program_code));
|
||||||
|
CHECK(s_ClearProgram!=NULL, "Create clear pixel shader");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "clear pixel shader");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "clear pixel shader");
|
||||||
|
|
||||||
// used when copying/resolving the color buffer
|
// used when copying/resolving the color buffer
|
||||||
s_ColorCopyProgram = D3D::CompileAndCreatePixelShader(color_copy_program_code, strlen(color_copy_program_code));
|
s_ColorCopyProgram = D3D::CompileAndCreatePixelShader(color_copy_program_code, strlen(color_copy_program_code));
|
||||||
|
CHECK(s_ColorCopyProgram!=NULL, "Create color copy pixel shader");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "color copy pixel shader");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "color copy pixel shader");
|
||||||
|
|
||||||
// used for color conversion
|
// used for color conversion
|
||||||
s_ColorMatrixProgram = D3D::CompileAndCreatePixelShader(color_matrix_program_code, strlen(color_matrix_program_code));
|
s_ColorMatrixProgram = D3D::CompileAndCreatePixelShader(color_matrix_program_code, strlen(color_matrix_program_code));
|
||||||
|
CHECK(s_ColorMatrixProgram!=NULL, "Create color matrix pixel shader");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "color matrix pixel shader");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "color matrix pixel shader");
|
||||||
|
|
||||||
// used for depth copy
|
// used for depth copy
|
||||||
s_DepthMatrixProgram = D3D::CompileAndCreatePixelShader(depth_matrix_program, strlen(depth_matrix_program));
|
s_DepthMatrixProgram = D3D::CompileAndCreatePixelShader(depth_matrix_program, strlen(depth_matrix_program));
|
||||||
|
CHECK(s_DepthMatrixProgram!=NULL, "Create depth matrix pixel shader");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "depth matrix pixel shader");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_ClearProgram, "depth matrix pixel shader");
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
|
@ -228,6 +228,8 @@ static const D3D11_TEXTURE_ADDRESS_MODE d3dClamps[4] =
|
||||||
|
|
||||||
void SetupDeviceObjects()
|
void SetupDeviceObjects()
|
||||||
{
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
D3D::font.Init();
|
D3D::font.Init();
|
||||||
VertexLoaderManager::Init();
|
VertexLoaderManager::Init();
|
||||||
FBManager.Create();
|
FBManager.Create();
|
||||||
|
@ -240,7 +242,9 @@ void SetupDeviceObjects()
|
||||||
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(20*sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(20*sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
||||||
D3D11_SUBRESOURCE_DATA data;
|
D3D11_SUBRESOURCE_DATA data;
|
||||||
data.pSysMem = colmat;
|
data.pSysMem = colmat;
|
||||||
D3D::device->CreateBuffer(&cbdesc, &data, &access_efb_cbuf);
|
hr = D3D::device->CreateBuffer(&cbdesc, &data, &access_efb_cbuf);
|
||||||
|
CHECK(hr==S_OK, "Create constant buffer for Renderer::AccessEFB");
|
||||||
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)access_efb_cbuf, "constant buffer for Renderer::AccessEFB");
|
||||||
|
|
||||||
D3D11_DEPTH_STENCIL_DESC ddesc;
|
D3D11_DEPTH_STENCIL_DESC ddesc;
|
||||||
ddesc.DepthEnable = FALSE;
|
ddesc.DepthEnable = FALSE;
|
||||||
|
@ -249,16 +253,19 @@ void SetupDeviceObjects()
|
||||||
ddesc.StencilEnable = FALSE;
|
ddesc.StencilEnable = FALSE;
|
||||||
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
||||||
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
||||||
D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[0]);
|
hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[0]);
|
||||||
|
CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen");
|
||||||
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
||||||
ddesc.DepthEnable = TRUE;
|
ddesc.DepthEnable = TRUE;
|
||||||
D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[1]);
|
hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[1]);
|
||||||
|
CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)cleardepthstates[0], "depth state for Renderer::ClearScreen (depth buffer disabled)");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)cleardepthstates[0], "depth state for Renderer::ClearScreen (depth buffer disabled)");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)cleardepthstates[1], "depth state for Renderer::ClearScreen (depth buffer enabled)");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)cleardepthstates[1], "depth state for Renderer::ClearScreen (depth buffer enabled)");
|
||||||
|
|
||||||
// TODO: once multisampling gets implemented, this might need to be changed
|
// TODO: once multisampling gets implemented, this might need to be changed
|
||||||
D3D11_RASTERIZER_DESC rdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, true, false, false);
|
D3D11_RASTERIZER_DESC rdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, true, false, false);
|
||||||
D3D::device->CreateRasterizerState(&rdesc, &clearraststate);
|
hr = D3D::device->CreateRasterizerState(&rdesc, &clearraststate);
|
||||||
|
CHECK(hr==S_OK, "Create rasterizer state for Renderer::ClearScreen");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)clearraststate, "rasterizer state for Renderer::ClearScreen");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)clearraststate, "rasterizer state for Renderer::ClearScreen");
|
||||||
|
|
||||||
D3D11_BLEND_DESC blenddesc;
|
D3D11_BLEND_DESC blenddesc;
|
||||||
|
@ -272,7 +279,8 @@ void SetupDeviceObjects()
|
||||||
blenddesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
blenddesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
||||||
blenddesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
blenddesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
||||||
blenddesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
blenddesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||||
D3D::device->CreateBlendState(&blenddesc, &resetblendstate);
|
hr = D3D::device->CreateBlendState(&blenddesc, &resetblendstate);
|
||||||
|
CHECK(hr==S_OK, "Create blend state for Renderer::ResetAPIState");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetblendstate, "blend state for Renderer::ResetAPIState");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetblendstate, "blend state for Renderer::ResetAPIState");
|
||||||
|
|
||||||
// TODO: For some reason this overwrites existing resource private data...
|
// TODO: For some reason this overwrites existing resource private data...
|
||||||
|
@ -282,12 +290,14 @@ void SetupDeviceObjects()
|
||||||
ddesc.StencilEnable = FALSE;
|
ddesc.StencilEnable = FALSE;
|
||||||
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
||||||
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
||||||
D3D::device->CreateDepthStencilState(&ddesc, &resetdepthstate);
|
hr = D3D::device->CreateDepthStencilState(&ddesc, &resetdepthstate);
|
||||||
|
CHECK(hr==S_OK, "Create depth state for Renderer::ResetAPIState");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetdepthstate, "depth stencil state for Renderer::ResetAPIState");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetdepthstate, "depth stencil state for Renderer::ResetAPIState");
|
||||||
|
|
||||||
// this might need to be changed once multisampling support gets added
|
// this might need to be changed once multisampling support gets added
|
||||||
D3D11_RASTERIZER_DESC rastdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false);
|
D3D11_RASTERIZER_DESC rastdesc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0.f, false, false, false, false);
|
||||||
D3D::device->CreateRasterizerState(&rastdesc, &resetraststate);
|
hr = D3D::device->CreateRasterizerState(&rastdesc, &resetraststate);
|
||||||
|
CHECK(hr==S_OK, "Create rasterizer state for Renderer::ClearScreen");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetraststate, "rasterizer state for Renderer::ResetAPIState");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetraststate, "rasterizer state for Renderer::ResetAPIState");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@ void TextureCache::TCacheEntry::Destroy(bool shutdown)
|
||||||
|
|
||||||
void TextureCache::Init()
|
void TextureCache::Init()
|
||||||
{
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
|
temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
|
||||||
TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter);
|
TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter);
|
||||||
HiresTextures::Init(globals->unique_id);
|
HiresTextures::Init(globals->unique_id);
|
||||||
|
@ -82,7 +84,8 @@ void TextureCache::Init()
|
||||||
blenddesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
blenddesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
||||||
blenddesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
blenddesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
||||||
blenddesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
blenddesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||||
D3D::device->CreateBlendState(&blenddesc, &efbcopyblendstate);
|
hr = D3D::device->CreateBlendState(&blenddesc, &efbcopyblendstate);
|
||||||
|
CHECK(hr==S_OK, "Create blend state for TextureCache::CopyRenderTargetToTexture");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopyblendstate, "blend state used in TextureCache::CopyRenderTargetToTexture");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopyblendstate, "blend state used in TextureCache::CopyRenderTargetToTexture");
|
||||||
|
|
||||||
D3D11_DEPTH_STENCIL_DESC depthdesc;
|
D3D11_DEPTH_STENCIL_DESC depthdesc;
|
||||||
|
@ -92,7 +95,8 @@ void TextureCache::Init()
|
||||||
depthdesc.StencilEnable = FALSE;
|
depthdesc.StencilEnable = FALSE;
|
||||||
depthdesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
depthdesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
|
||||||
depthdesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
depthdesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
|
||||||
D3D::device->CreateDepthStencilState(&depthdesc, &efbcopydepthstate);
|
hr = D3D::device->CreateDepthStencilState(&depthdesc, &efbcopydepthstate);
|
||||||
|
CHECK(hr==S_OK, "Create depth state for TextureCache::CopyRenderTargetToTexture");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopydepthstate, "depth stencil state used in TextureCache::CopyRenderTargetToTexture");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopydepthstate, "depth stencil state used in TextureCache::CopyRenderTargetToTexture");
|
||||||
|
|
||||||
D3D11_RASTERIZER_DESC rastdesc;
|
D3D11_RASTERIZER_DESC rastdesc;
|
||||||
|
@ -106,7 +110,8 @@ void TextureCache::Init()
|
||||||
rastdesc.ScissorEnable = false;
|
rastdesc.ScissorEnable = false;
|
||||||
rastdesc.MultisampleEnable = false;
|
rastdesc.MultisampleEnable = false;
|
||||||
rastdesc.AntialiasedLineEnable = false;
|
rastdesc.AntialiasedLineEnable = false;
|
||||||
D3D::device->CreateRasterizerState(&rastdesc, &efbcopyraststate);
|
hr = D3D::device->CreateRasterizerState(&rastdesc, &efbcopyraststate);
|
||||||
|
CHECK(hr==S_OK, "Create rasterizer state for TextureCache::CopyRenderTargetToTexture");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopyraststate, "rasterizer state used in TextureCache::CopyRenderTargetToTexture");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopyraststate, "rasterizer state used in TextureCache::CopyRenderTargetToTexture");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +294,7 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
|
||||||
if (usage == D3D11_USAGE_DYNAMIC)
|
if (usage == D3D11_USAGE_DYNAMIC)
|
||||||
{
|
{
|
||||||
entry.texture = D3DTexture2D::Create(width, height, D3D11_BIND_SHADER_RESOURCE, usage, d3d_fmt, TexLevels);
|
entry.texture = D3DTexture2D::Create(width, height, D3D11_BIND_SHADER_RESOURCE, usage, d3d_fmt, TexLevels);
|
||||||
|
CHECK(entry.texture!=NULL, "Create dynamic texture of the TextureCache");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetTex(), "a (dynamic) texture of the TextureCache");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetTex(), "a (dynamic) texture of the TextureCache");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetSRV(), "shader resource view of a (dynamic) texture of the TextureCache");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetSRV(), "shader resource view of a (dynamic) texture of the TextureCache");
|
||||||
}
|
}
|
||||||
|
@ -305,6 +311,7 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
entry.texture = new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE);
|
entry.texture = new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE);
|
||||||
|
CHECK(entry.texture!=NULL, "Create dynamic texture of the TextureCache");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetTex(), "a (static) texture of the TextureCache");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetTex(), "a (static) texture of the TextureCache");
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetSRV(), "shader resource view of a (static) texture of the TextureCache");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)entry.texture->GetSRV(), "shader resource view of a (static) texture of the TextureCache");
|
||||||
pTexture->Release();
|
pTexture->Release();
|
||||||
|
@ -543,7 +550,9 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(20*sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(20*sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
||||||
D3D11_SUBRESOURCE_DATA data;
|
D3D11_SUBRESOURCE_DATA data;
|
||||||
data.pSysMem = colmat;
|
data.pSysMem = colmat;
|
||||||
D3D::device->CreateBuffer(&cbdesc, &data, &efbcopycbuf[cbufid]);
|
HRESULT hr = D3D::device->CreateBuffer(&cbdesc, &data, &efbcopycbuf[cbufid]);
|
||||||
|
CHECK(hr==S_OK, "Create efb copy constant buffer %d", cbufid);
|
||||||
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)efbcopycbuf[cbufid], "a constant buffer used in TextureCache::CopyRenderTargetToTexture");
|
||||||
}
|
}
|
||||||
D3D::context->PSSetConstantBuffers(0, 1, &efbcopycbuf[cbufid]);
|
D3D::context->PSSetConstantBuffers(0, 1, &efbcopycbuf[cbufid]);
|
||||||
|
|
||||||
|
|
|
@ -105,20 +105,14 @@ bool IsD3D11()
|
||||||
|
|
||||||
// This is used for the functions right below here which use wxwidgets
|
// This is used for the functions right below here which use wxwidgets
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
#ifdef _WIN32
|
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxWindow* GetParentedWxWindow(HWND Parent)
|
wxWindow* GetParentedWxWindow(HWND Parent)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
|
||||||
wxSetInstance((HINSTANCE)g_hInstance);
|
wxSetInstance((HINSTANCE)g_hInstance);
|
||||||
#endif
|
|
||||||
wxWindow* win = new wxWindow();
|
wxWindow* win = new wxWindow();
|
||||||
#ifdef _WIN32
|
|
||||||
win->SetHWND((WXHWND)Parent);
|
win->SetHWND((WXHWND)Parent);
|
||||||
win->AdoptAttributesFromHWND();
|
win->AdoptAttributesFromHWND();
|
||||||
#endif
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -183,7 +177,7 @@ void UpdateFPSDisplay(const char* text)
|
||||||
SetWindowTextA(EmuWindow::GetWnd(), temp);
|
SetWindowTextA(EmuWindow::GetWnd(), temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||||
{
|
{
|
||||||
_PluginInfo->Version = 0x0100;
|
_PluginInfo->Version = 0x0100;
|
||||||
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
||||||
|
|
|
@ -93,20 +93,14 @@ bool IsD3D()
|
||||||
|
|
||||||
// This is used for the functions right below here which use wxwidgets
|
// This is used for the functions right below here which use wxwidgets
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
#ifdef _WIN32
|
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxWindow* GetParentedWxWindow(HWND Parent)
|
wxWindow* GetParentedWxWindow(HWND Parent)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
|
||||||
wxSetInstance((HINSTANCE)g_hInstance);
|
wxSetInstance((HINSTANCE)g_hInstance);
|
||||||
#endif
|
|
||||||
wxWindow *win = new wxWindow();
|
wxWindow *win = new wxWindow();
|
||||||
#ifdef _WIN32
|
|
||||||
win->SetHWND((WXHWND)Parent);
|
win->SetHWND((WXHWND)Parent);
|
||||||
win->AdoptAttributesFromHWND();
|
win->AdoptAttributesFromHWND();
|
||||||
#endif
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -219,20 +213,16 @@ void DllConfig(HWND _hParent)
|
||||||
m_ConfigFrame = new GFXConfigDialogDX(frame);
|
m_ConfigFrame = new GFXConfigDialogDX(frame);
|
||||||
|
|
||||||
// Prevent user to show more than 1 config window at same time
|
// Prevent user to show more than 1 config window at same time
|
||||||
#ifdef _WIN32
|
|
||||||
frame->Disable();
|
frame->Disable();
|
||||||
m_ConfigFrame->CreateGUIControls();
|
m_ConfigFrame->CreateGUIControls();
|
||||||
m_ConfigFrame->ShowModal();
|
m_ConfigFrame->ShowModal();
|
||||||
frame->Enable();
|
frame->Enable();
|
||||||
#else
|
|
||||||
m_ConfigFrame->CreateGUIControls();
|
m_ConfigFrame->CreateGUIControls();
|
||||||
m_ConfigFrame->ShowModal();
|
m_ConfigFrame->ShowModal();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
frame->SetFocus();
|
frame->SetFocus();
|
||||||
frame->SetHWND(NULL);
|
frame->SetHWND(NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
m_ConfigFrame->Destroy();
|
m_ConfigFrame->Destroy();
|
||||||
m_ConfigFrame = NULL;
|
m_ConfigFrame = NULL;
|
||||||
|
|
Loading…
Reference in New Issue