mirror of https://github.com/AxioDL/boo.git
D3D sync
This commit is contained in:
parent
21548bada8
commit
29364a8024
|
@ -15,19 +15,19 @@ constexpr type operator&(type a, type b)\
|
|||
using T = std::underlying_type_t<type>;\
|
||||
return type(static_cast<T>(a) & static_cast<T>(b));\
|
||||
}\
|
||||
constexpr type& operator|=(type& a, const type& b)\
|
||||
inline type& operator|=(type& a, const type& b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
a = type(static_cast<T>(a) | static_cast<T>(b));\
|
||||
return a;\
|
||||
}\
|
||||
constexpr type& operator&=(type& a, const type& b)\
|
||||
inline type& operator&=(type& a, const type& b)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
a = type(static_cast<T>(a) & static_cast<T>(b));\
|
||||
return a;\
|
||||
}\
|
||||
constexpr type operator~(const type& key)\
|
||||
inline type operator~(const type& key)\
|
||||
{\
|
||||
using T = std::underlying_type_t<type>;\
|
||||
return type(~static_cast<T>(key));\
|
||||
|
|
|
@ -500,7 +500,7 @@ class D3D11ShaderPipeline : public IShaderPipeline
|
|||
CD3D11_DEPTH_STENCIL_DESC dsDesc(D3D11_DEFAULT);
|
||||
dsDesc.DepthEnable = depthTest;
|
||||
dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK(depthWrite);
|
||||
dsDesc.DepthFunc = D3D11_COMPARISON_GREATER;
|
||||
dsDesc.DepthFunc = D3D11_COMPARISON_GREATER_EQUAL;
|
||||
ThrowIfFailed(ctx->m_dev->CreateDepthStencilState(&dsDesc, &m_dsState));
|
||||
|
||||
CD3D11_BLEND_DESC blDesc(D3D11_DEFAULT);
|
||||
|
@ -595,10 +595,6 @@ struct D3D11ShaderDataBinding : IShaderDataBinding
|
|||
}
|
||||
for (size_t i=0 ; i<texCount ; ++i)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if (!texs[i])
|
||||
Log.report(logvisor::Fatal, "null texture %d provided to newShaderDataBinding", int(i));
|
||||
#endif
|
||||
m_texs[i] = texs[i];
|
||||
}
|
||||
}
|
||||
|
@ -747,35 +743,38 @@ struct D3D11ShaderDataBinding : IShaderDataBinding
|
|||
|
||||
if (m_texCount)
|
||||
{
|
||||
ID3D11ShaderResourceView* srvs[8];
|
||||
ID3D11ShaderResourceView* srvs[8] = {};
|
||||
for (int i=0 ; i<8 && i<m_texCount ; ++i)
|
||||
{
|
||||
switch (m_texs[i]->type())
|
||||
if (m_texs[i])
|
||||
{
|
||||
case TextureType::Dynamic:
|
||||
{
|
||||
D3D11TextureD* ctex = static_cast<D3D11TextureD*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_srvs[b].Get();
|
||||
break;
|
||||
}
|
||||
case TextureType::Static:
|
||||
{
|
||||
D3D11TextureS* ctex = static_cast<D3D11TextureS*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_srv.Get();
|
||||
break;
|
||||
}
|
||||
case TextureType::StaticArray:
|
||||
{
|
||||
D3D11TextureSA* ctex = static_cast<D3D11TextureSA*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_srv.Get();
|
||||
break;
|
||||
}
|
||||
case TextureType::Render:
|
||||
{
|
||||
D3D11TextureR* ctex = static_cast<D3D11TextureR*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_colorSrv.Get();
|
||||
break;
|
||||
}
|
||||
switch (m_texs[i]->type())
|
||||
{
|
||||
case TextureType::Dynamic:
|
||||
{
|
||||
D3D11TextureD* ctex = static_cast<D3D11TextureD*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_srvs[b].Get();
|
||||
break;
|
||||
}
|
||||
case TextureType::Static:
|
||||
{
|
||||
D3D11TextureS* ctex = static_cast<D3D11TextureS*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_srv.Get();
|
||||
break;
|
||||
}
|
||||
case TextureType::StaticArray:
|
||||
{
|
||||
D3D11TextureSA* ctex = static_cast<D3D11TextureSA*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_srv.Get();
|
||||
break;
|
||||
}
|
||||
case TextureType::Render:
|
||||
{
|
||||
D3D11TextureR* ctex = static_cast<D3D11TextureR*>(m_texs[i]);
|
||||
srvs[i] = ctex->m_colorSrv.Get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx->PSSetShaderResources(0, m_texCount, srvs);
|
||||
|
|
|
@ -648,7 +648,7 @@ class D3D12ShaderPipeline : public IShaderPipeline
|
|||
if (!backfaceCulling)
|
||||
desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
||||
desc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT);
|
||||
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_GREATER;
|
||||
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_GREATER_EQUAL;
|
||||
if (!depthTest)
|
||||
desc.DepthStencilState.DepthEnable = false;
|
||||
if (!depthWrite)
|
||||
|
@ -935,10 +935,6 @@ struct D3D12ShaderDataBinding : IShaderDataBinding
|
|||
}
|
||||
for (size_t i=0 ; i<texCount ; ++i)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if (!texs[i])
|
||||
Log.report(logvisor::Fatal, "null texture %d provided to newShaderDataBinding", int(i));
|
||||
#endif
|
||||
m_texs[i] = texs[i];
|
||||
}
|
||||
}
|
||||
|
@ -996,7 +992,7 @@ struct D3D12ShaderDataBinding : IShaderDataBinding
|
|||
}
|
||||
for (size_t i=0 ; i<MAX_TEXTURE_COUNT ; ++i)
|
||||
{
|
||||
if (i<m_texCount)
|
||||
if (i<m_texCount && m_texs[i])
|
||||
{
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||
ID3D12Resource* res = GetTextureGPUResource(m_texs[i], b, srvDesc);
|
||||
|
@ -1602,6 +1598,9 @@ public:
|
|||
{
|
||||
ComPtr<ID3DBlob> errBlob;
|
||||
|
||||
//printf("%s\n", vertSource);
|
||||
//printf("%s\n", fragSource);
|
||||
|
||||
if (!vertBlobOut)
|
||||
{
|
||||
if (FAILED(D3DCompilePROC(vertSource, strlen(vertSource), "HECL Vert Source", nullptr, nullptr, "main",
|
||||
|
|
Loading…
Reference in New Issue