improvements for #90
This commit is contained in:
@@ -177,6 +177,14 @@ namespace wiAudio
|
||||
sourceVoice->DestroyVoice();
|
||||
}
|
||||
};
|
||||
SoundInternal* to_internal(const Sound* param)
|
||||
{
|
||||
return static_cast<SoundInternal*>(param->internal_state.get());
|
||||
}
|
||||
SoundInstanceInternal* to_internal(const SoundInstance* param)
|
||||
{
|
||||
return static_cast<SoundInstanceInternal*>(param->internal_state.get());
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
@@ -366,7 +374,7 @@ namespace wiAudio
|
||||
{
|
||||
if (instance != nullptr && instance->IsValid())
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
HRESULT hr = instanceinternal->sourceVoice->Start();
|
||||
assert(SUCCEEDED(hr));
|
||||
}
|
||||
@@ -375,7 +383,7 @@ namespace wiAudio
|
||||
{
|
||||
if (instance != nullptr && instance->IsValid())
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
HRESULT hr = instanceinternal->sourceVoice->Stop(); // preserves cursor position
|
||||
assert(SUCCEEDED(hr));
|
||||
}
|
||||
@@ -384,7 +392,7 @@ namespace wiAudio
|
||||
{
|
||||
if (instance != nullptr && instance->IsValid())
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
HRESULT hr = instanceinternal->sourceVoice->Stop(); // preserves cursor position
|
||||
assert(SUCCEEDED(hr));
|
||||
hr = instanceinternal->sourceVoice->FlushSourceBuffers(); // reset submitted audio buffer
|
||||
@@ -402,7 +410,7 @@ namespace wiAudio
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
HRESULT hr = instanceinternal->sourceVoice->SetVolume(volume);
|
||||
assert(SUCCEEDED(hr));
|
||||
}
|
||||
@@ -416,7 +424,7 @@ namespace wiAudio
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
instanceinternal->sourceVoice->GetVolume(&volume);
|
||||
}
|
||||
return volume;
|
||||
@@ -425,7 +433,7 @@ namespace wiAudio
|
||||
{
|
||||
if (instance != nullptr && instance->IsValid())
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
HRESULT hr = instanceinternal->sourceVoice->ExitLoop();
|
||||
assert(SUCCEEDED(hr));
|
||||
}
|
||||
@@ -447,7 +455,7 @@ namespace wiAudio
|
||||
{
|
||||
if (instance != nullptr && instance->IsValid())
|
||||
{
|
||||
const auto& instanceinternal = std::static_pointer_cast<SoundInstanceInternal>(instance->internal_state);
|
||||
auto instanceinternal = to_internal(instance);
|
||||
|
||||
X3DAUDIO_LISTENER listener = {};
|
||||
listener.Position = instance3D.listenerPos;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
namespace wiGraphics
|
||||
@@ -1153,6 +1152,43 @@ namespace DX11_Internal
|
||||
std::shared_ptr<GraphicsDevice_DX11> device;
|
||||
ComPtr<ID3D11Query> resource;
|
||||
};
|
||||
|
||||
Resource_DX11* to_internal(const GPUResource* param)
|
||||
{
|
||||
return static_cast<Resource_DX11*>(param->internal_state.get());
|
||||
}
|
||||
Resource_DX11* to_internal(const GPUBuffer* param)
|
||||
{
|
||||
return static_cast<Resource_DX11*>(param->internal_state.get());
|
||||
}
|
||||
Texture_DX11* to_internal(const Texture* param)
|
||||
{
|
||||
return static_cast<Texture_DX11*>(param->internal_state.get());
|
||||
}
|
||||
InputLayout_DX11* to_internal(const InputLayout* param)
|
||||
{
|
||||
return static_cast<InputLayout_DX11*>(param->internal_state.get());
|
||||
}
|
||||
BlendState_DX11* to_internal(const BlendState* param)
|
||||
{
|
||||
return static_cast<BlendState_DX11*>(param->internal_state.get());
|
||||
}
|
||||
DepthStencilState_DX11* to_internal(const DepthStencilState* param)
|
||||
{
|
||||
return static_cast<DepthStencilState_DX11*>(param->internal_state.get());
|
||||
}
|
||||
RasterizerState_DX11* to_internal(const RasterizerState* param)
|
||||
{
|
||||
return static_cast<RasterizerState_DX11*>(param->internal_state.get());
|
||||
}
|
||||
Sampler_DX11* to_internal(const Sampler* param)
|
||||
{
|
||||
return static_cast<Sampler_DX11*>(param->internal_state.get());
|
||||
}
|
||||
Query_DX11* to_internal(const GPUQuery* param)
|
||||
{
|
||||
return static_cast<Query_DX11*>(param->internal_state.get());
|
||||
}
|
||||
}
|
||||
using namespace DX11_Internal;
|
||||
|
||||
@@ -1214,7 +1250,7 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiPlatform::window_type window, bool fu
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
stringstream ss("");
|
||||
std::stringstream ss("");
|
||||
ss << "Failed to create the graphics device! ERROR: " << std::hex << hr;
|
||||
wiHelper::messageBox(ss.str(), "Error!");
|
||||
exit(1);
|
||||
@@ -1855,7 +1891,7 @@ bool GraphicsDevice_DX11::CreateRenderPass(const RenderPassDesc* pDesc, RenderPa
|
||||
|
||||
int GraphicsDevice_DX11::CreateSubresource(Texture* texture, SUBRESOURCE_TYPE type, uint32_t firstSlice, uint32_t sliceCount, uint32_t firstMip, uint32_t mipCount)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX11>(texture->internal_state);
|
||||
auto internal_state = to_internal(texture);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -2252,8 +2288,8 @@ int GraphicsDevice_DX11::CreateSubresource(Texture* texture, SUBRESOURCE_TYPE ty
|
||||
bool GraphicsDevice_DX11::DownloadResource(const GPUResource* resourceToDownload, const GPUResource* resourceDest, void* dataDest)
|
||||
{
|
||||
assert(resourceToDownload->type == resourceDest->type);
|
||||
auto internal_state_src = static_pointer_cast<Resource_DX11>(resourceToDownload->internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Resource_DX11>(resourceDest->internal_state);
|
||||
auto internal_state_src = to_internal(resourceToDownload);
|
||||
auto internal_state_dst = to_internal(resourceDest);
|
||||
|
||||
if (resourceToDownload->IsBuffer())
|
||||
{
|
||||
@@ -2334,7 +2370,7 @@ bool GraphicsDevice_DX11::DownloadResource(const GPUResource* resourceToDownload
|
||||
|
||||
void GraphicsDevice_DX11::SetName(GPUResource* pResource, const std::string& name)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX11>(pResource->internal_state);
|
||||
auto internal_state = to_internal(pResource);
|
||||
internal_state->resource->SetPrivateData(WKPDID_D3DDebugObjectName, (uint32_t)name.length(), name.c_str());
|
||||
}
|
||||
|
||||
@@ -2454,7 +2490,7 @@ void GraphicsDevice_DX11::commit_allocations(CommandList cmd)
|
||||
|
||||
if (frame_allocators[cmd].dirty)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX11>(frame_allocators[cmd].buffer.internal_state);
|
||||
auto internal_state = std::static_pointer_cast<Resource_DX11>(frame_allocators[cmd].buffer.internal_state);
|
||||
deviceContexts[cmd]->Unmap(internal_state->resource.Get(), 0);
|
||||
frame_allocators[cmd].dirty = false;
|
||||
}
|
||||
@@ -2474,7 +2510,7 @@ void GraphicsDevice_DX11::RenderPassBegin(const RenderPass* renderpass, CommandL
|
||||
const RenderPassAttachment& attachment = desc.attachments[i];
|
||||
const Texture* texture = attachment.texture;
|
||||
int subresource = attachment.subresource;
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX11>(texture->internal_state);
|
||||
auto internal_state = to_internal(texture);
|
||||
|
||||
if (attachment.type == RenderPassAttachment::RENDERTARGET)
|
||||
{
|
||||
@@ -2568,7 +2604,7 @@ void GraphicsDevice_DX11::BindResource(SHADERSTAGE stage, const GPUResource* res
|
||||
{
|
||||
if (resource != nullptr && resource->IsValid())
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX11>(resource->internal_state);
|
||||
auto internal_state = to_internal(resource);
|
||||
ID3D11ShaderResourceView* SRV;
|
||||
|
||||
if (subresource < 0)
|
||||
@@ -2613,7 +2649,7 @@ void GraphicsDevice_DX11::BindResources(SHADERSTAGE stage, const GPUResource *co
|
||||
ID3D11ShaderResourceView* srvs[16];
|
||||
for (uint32_t i = 0; i < count; ++i)
|
||||
{
|
||||
srvs[i] = resources[i] != nullptr && resources[i]->IsValid() ? static_pointer_cast<Texture_DX11>(resources[i]->internal_state)->srv.Get() : nullptr;
|
||||
srvs[i] = resources[i] != nullptr && resources[i]->IsValid() ? to_internal(resources[i])->srv.Get() : nullptr;
|
||||
}
|
||||
|
||||
switch (stage)
|
||||
@@ -2645,7 +2681,7 @@ void GraphicsDevice_DX11::BindUAV(SHADERSTAGE stage, const GPUResource* resource
|
||||
{
|
||||
if (resource != nullptr && resource->IsValid())
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX11>(resource->internal_state);
|
||||
auto internal_state = to_internal(resource);
|
||||
ID3D11UnorderedAccessView* UAV;
|
||||
|
||||
if (subresource < 0)
|
||||
@@ -2676,7 +2712,7 @@ void GraphicsDevice_DX11::BindUAVs(SHADERSTAGE stage, const GPUResource *const*
|
||||
ID3D11UnorderedAccessView* uavs[8];
|
||||
for (uint32_t i = 0; i < count; ++i)
|
||||
{
|
||||
uavs[i] = resources[i] != nullptr && resources[i]->IsValid() ? static_pointer_cast<Texture_DX11>(resources[i]->internal_state)->uav.Get() : nullptr;
|
||||
uavs[i] = resources[i] != nullptr && resources[i]->IsValid() ? to_internal(resources[i])->uav.Get() : nullptr;
|
||||
|
||||
if(stage != CS)
|
||||
{
|
||||
@@ -2716,7 +2752,7 @@ void GraphicsDevice_DX11::BindSampler(SHADERSTAGE stage, const Sampler* sampler,
|
||||
{
|
||||
if (sampler != nullptr && sampler->IsValid())
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Sampler_DX11>(sampler->internal_state);
|
||||
auto internal_state = to_internal(sampler);
|
||||
ID3D11SamplerState* SAM = internal_state->resource.Get();
|
||||
|
||||
switch (stage)
|
||||
@@ -2747,7 +2783,7 @@ void GraphicsDevice_DX11::BindSampler(SHADERSTAGE stage, const Sampler* sampler,
|
||||
}
|
||||
void GraphicsDevice_DX11::BindConstantBuffer(SHADERSTAGE stage, const GPUBuffer* buffer, uint32_t slot, CommandList cmd)
|
||||
{
|
||||
ID3D11Buffer* res = buffer != nullptr && buffer->IsValid() ? (ID3D11Buffer*)static_pointer_cast<Resource_DX11>(buffer->internal_state)->resource.Get() : nullptr;
|
||||
ID3D11Buffer* res = buffer != nullptr && buffer->IsValid() ? (ID3D11Buffer*)to_internal(buffer)->resource.Get() : nullptr;
|
||||
switch (stage)
|
||||
{
|
||||
case wiGraphics::VS:
|
||||
@@ -2779,13 +2815,13 @@ void GraphicsDevice_DX11::BindVertexBuffers(const GPUBuffer *const* vertexBuffer
|
||||
ID3D11Buffer* res[8] = { 0 };
|
||||
for (uint32_t i = 0; i < count; ++i)
|
||||
{
|
||||
res[i] = vertexBuffers[i] != nullptr && vertexBuffers[i]->IsValid() ? (ID3D11Buffer*)static_pointer_cast<Resource_DX11>(vertexBuffers[i]->internal_state)->resource.Get() : nullptr;
|
||||
res[i] = vertexBuffers[i] != nullptr && vertexBuffers[i]->IsValid() ? (ID3D11Buffer*)to_internal(vertexBuffers[i])->resource.Get() : nullptr;
|
||||
}
|
||||
deviceContexts[cmd]->IASetVertexBuffers(slot, count, res, strides, (offsets != nullptr ? offsets : reinterpret_cast<const uint32_t*>(__nullBlob)));
|
||||
}
|
||||
void GraphicsDevice_DX11::BindIndexBuffer(const GPUBuffer* indexBuffer, const INDEXBUFFER_FORMAT format, uint32_t offset, CommandList cmd)
|
||||
{
|
||||
ID3D11Buffer* res = indexBuffer != nullptr && indexBuffer->IsValid() ? (ID3D11Buffer*)static_pointer_cast<Resource_DX11>(indexBuffer->internal_state)->resource.Get() : nullptr;
|
||||
ID3D11Buffer* res = indexBuffer != nullptr && indexBuffer->IsValid() ? (ID3D11Buffer*)to_internal(indexBuffer)->resource.Get() : nullptr;
|
||||
deviceContexts[cmd]->IASetIndexBuffer(res, (format == INDEXBUFFER_FORMAT::INDEXFORMAT_16BIT ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT), offset);
|
||||
}
|
||||
void GraphicsDevice_DX11::BindStencilRef(uint32_t value, CommandList cmd)
|
||||
@@ -2803,38 +2839,38 @@ void GraphicsDevice_DX11::BindPipelineState(const PipelineState* pso, CommandLis
|
||||
{
|
||||
const PipelineStateDesc& desc = pso != nullptr ? pso->GetDesc() : PipelineStateDesc();
|
||||
|
||||
ID3D11VertexShader* vs = desc.vs == nullptr ? nullptr : static_pointer_cast<VertexShader_DX11>(desc.vs->internal_state)->resource.Get();
|
||||
ID3D11VertexShader* vs = desc.vs == nullptr ? nullptr : static_cast<VertexShader_DX11*>(desc.vs->internal_state.get())->resource.Get();
|
||||
if (vs != prev_vs[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->VSSetShader(vs, nullptr, 0);
|
||||
prev_vs[cmd] = vs;
|
||||
}
|
||||
ID3D11PixelShader* ps = desc.ps == nullptr ? nullptr : static_pointer_cast<PixelShader_DX11>(desc.ps->internal_state)->resource.Get();
|
||||
ID3D11PixelShader* ps = desc.ps == nullptr ? nullptr : static_cast<PixelShader_DX11*>(desc.ps->internal_state.get())->resource.Get();
|
||||
if (ps != prev_ps[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->PSSetShader(ps, nullptr, 0);
|
||||
prev_ps[cmd] = ps;
|
||||
}
|
||||
ID3D11HullShader* hs = desc.hs == nullptr ? nullptr : static_pointer_cast<HullShader_DX11>(desc.hs->internal_state)->resource.Get();
|
||||
ID3D11HullShader* hs = desc.hs == nullptr ? nullptr : static_cast<HullShader_DX11*>(desc.hs->internal_state.get())->resource.Get();
|
||||
if (hs != prev_hs[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->HSSetShader(hs, nullptr, 0);
|
||||
prev_hs[cmd] = hs;
|
||||
}
|
||||
ID3D11DomainShader* ds = desc.ds == nullptr ? nullptr : static_pointer_cast<DomainShader_DX11>(desc.ds->internal_state)->resource.Get();
|
||||
ID3D11DomainShader* ds = desc.ds == nullptr ? nullptr : static_cast<DomainShader_DX11*>(desc.ds->internal_state.get())->resource.Get();
|
||||
if (ds != prev_ds[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->DSSetShader(ds, nullptr, 0);
|
||||
prev_ds[cmd] = ds;
|
||||
}
|
||||
ID3D11GeometryShader* gs = desc.gs == nullptr ? nullptr : static_pointer_cast<GeometryShader_DX11>(desc.gs->internal_state)->resource.Get();
|
||||
ID3D11GeometryShader* gs = desc.gs == nullptr ? nullptr : static_cast<GeometryShader_DX11*>(desc.gs->internal_state.get())->resource.Get();
|
||||
if (gs != prev_gs[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->GSSetShader(gs, nullptr, 0);
|
||||
prev_gs[cmd] = gs;
|
||||
}
|
||||
|
||||
ID3D11BlendState* bs = desc.bs == nullptr ? nullptr : static_pointer_cast<BlendState_DX11>(desc.bs->internal_state)->resource.Get();
|
||||
ID3D11BlendState* bs = desc.bs == nullptr ? nullptr : to_internal(desc.bs)->resource.Get();
|
||||
if (bs != prev_bs[cmd] || desc.sampleMask != prev_samplemask[cmd] ||
|
||||
blendFactor[cmd].x != prev_blendfactor[cmd].x ||
|
||||
blendFactor[cmd].y != prev_blendfactor[cmd].y ||
|
||||
@@ -2849,14 +2885,14 @@ void GraphicsDevice_DX11::BindPipelineState(const PipelineState* pso, CommandLis
|
||||
prev_samplemask[cmd] = desc.sampleMask;
|
||||
}
|
||||
|
||||
ID3D11RasterizerState* rs = desc.rs == nullptr ? nullptr : static_pointer_cast<RasterizerState_DX11>(desc.rs->internal_state)->resource.Get();
|
||||
ID3D11RasterizerState* rs = desc.rs == nullptr ? nullptr : to_internal(desc.rs)->resource.Get();
|
||||
if (rs != prev_rs[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->RSSetState(rs);
|
||||
prev_rs[cmd] = rs;
|
||||
}
|
||||
|
||||
ID3D11DepthStencilState* dss = desc.dss == nullptr ? nullptr : static_pointer_cast<DepthStencilState_DX11>(desc.dss->internal_state)->resource.Get();
|
||||
ID3D11DepthStencilState* dss = desc.dss == nullptr ? nullptr : to_internal(desc.dss)->resource.Get();
|
||||
if (dss != prev_dss[cmd] || stencilRef[cmd] != prev_stencilRef[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->OMSetDepthStencilState(dss, stencilRef[cmd]);
|
||||
@@ -2864,7 +2900,7 @@ void GraphicsDevice_DX11::BindPipelineState(const PipelineState* pso, CommandLis
|
||||
prev_stencilRef[cmd] = stencilRef[cmd];
|
||||
}
|
||||
|
||||
ID3D11InputLayout* il = desc.il == nullptr ? nullptr : static_pointer_cast<InputLayout_DX11>(desc.il->internal_state)->resource.Get();
|
||||
ID3D11InputLayout* il = desc.il == nullptr ? nullptr : to_internal(desc.il)->resource.Get();
|
||||
if (il != prev_il[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->IASetInputLayout(il);
|
||||
@@ -2905,7 +2941,7 @@ void GraphicsDevice_DX11::BindPipelineState(const PipelineState* pso, CommandLis
|
||||
}
|
||||
void GraphicsDevice_DX11::BindComputeShader(const Shader* cs, CommandList cmd)
|
||||
{
|
||||
ID3D11ComputeShader* _cs = cs == nullptr ? nullptr : static_pointer_cast<ComputeShader_DX11>(cs->internal_state)->resource.Get();
|
||||
ID3D11ComputeShader* _cs = cs == nullptr ? nullptr : static_cast<ComputeShader_DX11*>(cs->internal_state.get())->resource.Get();
|
||||
if (_cs != prev_cs[cmd])
|
||||
{
|
||||
deviceContexts[cmd]->CSSetShader(_cs, nullptr, 0);
|
||||
@@ -2940,13 +2976,13 @@ void GraphicsDevice_DX11::DrawInstancedIndirect(const GPUBuffer* args, uint32_t
|
||||
{
|
||||
commit_allocations(cmd);
|
||||
|
||||
deviceContexts[cmd]->DrawInstancedIndirect((ID3D11Buffer*)static_pointer_cast<Resource_DX11>(args->internal_state)->resource.Get(), args_offset);
|
||||
deviceContexts[cmd]->DrawInstancedIndirect((ID3D11Buffer*)to_internal(args)->resource.Get(), args_offset);
|
||||
}
|
||||
void GraphicsDevice_DX11::DrawIndexedInstancedIndirect(const GPUBuffer* args, uint32_t args_offset, CommandList cmd)
|
||||
{
|
||||
commit_allocations(cmd);
|
||||
|
||||
deviceContexts[cmd]->DrawIndexedInstancedIndirect((ID3D11Buffer*)static_pointer_cast<Resource_DX11>(args->internal_state)->resource.Get(), args_offset);
|
||||
deviceContexts[cmd]->DrawIndexedInstancedIndirect((ID3D11Buffer*)to_internal(args)->resource.Get(), args_offset);
|
||||
}
|
||||
void GraphicsDevice_DX11::Dispatch(uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ, CommandList cmd)
|
||||
{
|
||||
@@ -2958,28 +2994,28 @@ void GraphicsDevice_DX11::DispatchIndirect(const GPUBuffer* args, uint32_t args_
|
||||
{
|
||||
commit_allocations(cmd);
|
||||
|
||||
deviceContexts[cmd]->DispatchIndirect((ID3D11Buffer*)static_pointer_cast<Resource_DX11>(args->internal_state)->resource.Get(), args_offset);
|
||||
deviceContexts[cmd]->DispatchIndirect((ID3D11Buffer*)to_internal(args)->resource.Get(), args_offset);
|
||||
}
|
||||
void GraphicsDevice_DX11::CopyResource(const GPUResource* pDst, const GPUResource* pSrc, CommandList cmd)
|
||||
{
|
||||
assert(pDst != nullptr && pSrc != nullptr);
|
||||
auto internal_state_src = static_pointer_cast<Resource_DX11>(pSrc->internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Resource_DX11>(pDst->internal_state);
|
||||
auto internal_state_src = to_internal(pSrc);
|
||||
auto internal_state_dst = to_internal(pDst);
|
||||
deviceContexts[cmd]->CopyResource(internal_state_dst->resource.Get(), internal_state_src->resource.Get());
|
||||
}
|
||||
void GraphicsDevice_DX11::CopyTexture2D_Region(const Texture* pDst, uint32_t dstMip, uint32_t dstX, uint32_t dstY, const Texture* pSrc, uint32_t srcMip, CommandList cmd)
|
||||
{
|
||||
assert(pDst != nullptr && pSrc != nullptr);
|
||||
auto internal_state_src = static_pointer_cast<Texture_DX11>(pSrc->internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Texture_DX11>(pDst->internal_state);
|
||||
auto internal_state_src = to_internal(pSrc);
|
||||
auto internal_state_dst = to_internal(pDst);
|
||||
deviceContexts[cmd]->CopySubresourceRegion(internal_state_dst->resource.Get(), D3D11CalcSubresource(dstMip, 0, pDst->GetDesc().MipLevels), dstX, dstY, 0,
|
||||
internal_state_src->resource.Get(), D3D11CalcSubresource(srcMip, 0, pSrc->GetDesc().MipLevels), nullptr);
|
||||
}
|
||||
void GraphicsDevice_DX11::MSAAResolve(const Texture* pDst, const Texture* pSrc, CommandList cmd)
|
||||
{
|
||||
assert(pDst != nullptr && pSrc != nullptr);
|
||||
auto internal_state_src = static_pointer_cast<Texture_DX11>(pSrc->internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Texture_DX11>(pDst->internal_state);
|
||||
auto internal_state_src = to_internal(pSrc);
|
||||
auto internal_state_dst = to_internal(pDst);
|
||||
deviceContexts[cmd]->ResolveSubresource(internal_state_dst->resource.Get(), 0, internal_state_src->resource.Get(), 0, _ConvertFormat(pDst->desc.Format));
|
||||
}
|
||||
void GraphicsDevice_DX11::UpdateBuffer(const GPUBuffer* buffer, const void* data, CommandList cmd, int dataSize)
|
||||
@@ -2992,7 +3028,7 @@ void GraphicsDevice_DX11::UpdateBuffer(const GPUBuffer* buffer, const void* data
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX11>(buffer->internal_state);
|
||||
auto internal_state = to_internal(buffer);
|
||||
|
||||
dataSize = std::min((int)buffer->desc.ByteWidth, dataSize);
|
||||
|
||||
@@ -3023,19 +3059,19 @@ void GraphicsDevice_DX11::UpdateBuffer(const GPUBuffer* buffer, const void* data
|
||||
|
||||
void GraphicsDevice_DX11::QueryBegin(const GPUQuery* query, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Query_DX11>(query->internal_state);
|
||||
auto internal_state = to_internal(query);
|
||||
deviceContexts[cmd]->Begin(internal_state->resource.Get());
|
||||
}
|
||||
void GraphicsDevice_DX11::QueryEnd(const GPUQuery* query, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Query_DX11>(query->internal_state);
|
||||
auto internal_state = to_internal(query);
|
||||
deviceContexts[cmd]->End(internal_state->resource.Get());
|
||||
}
|
||||
bool GraphicsDevice_DX11::QueryRead(const GPUQuery* query, GPUQueryResult* result)
|
||||
{
|
||||
const uint32_t _flags = D3D11_ASYNC_GETDATA_DONOTFLUSH;
|
||||
|
||||
const auto& internal_state = static_pointer_cast<Query_DX11>(query->internal_state);
|
||||
auto internal_state = to_internal(query);
|
||||
ID3D11Query* QUERY = internal_state->resource.Get();
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
@@ -3078,7 +3114,7 @@ GraphicsDevice::GPUAllocation GraphicsDevice_DX11::AllocateGPU(size_t dataSize,
|
||||
{
|
||||
return result;
|
||||
}
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX11>(allocator.buffer.internal_state);
|
||||
auto internal_state = std::static_pointer_cast<Resource_DX11>(allocator.buffer.internal_state);
|
||||
|
||||
allocator.dirty = true;
|
||||
|
||||
@@ -3106,7 +3142,7 @@ GraphicsDevice::GPUAllocation GraphicsDevice_DX11::AllocateGPU(size_t dataSize,
|
||||
|
||||
void GraphicsDevice_DX11::EventBegin(const std::string& name, CommandList cmd)
|
||||
{
|
||||
userDefinedAnnotations[cmd]->BeginEvent(wstring(name.begin(), name.end()).c_str());
|
||||
userDefinedAnnotations[cmd]->BeginEvent(std::wstring(name.begin(), name.end()).c_str());
|
||||
}
|
||||
void GraphicsDevice_DX11::EventEnd(CommandList cmd)
|
||||
{
|
||||
@@ -3114,7 +3150,7 @@ void GraphicsDevice_DX11::EventEnd(CommandList cmd)
|
||||
}
|
||||
void GraphicsDevice_DX11::SetMarker(const std::string& name, CommandList cmd)
|
||||
{
|
||||
userDefinedAnnotations[cmd]->SetMarker(wstring(name.begin(),name.end()).c_str());
|
||||
userDefinedAnnotations[cmd]->SetMarker(std::wstring(name.begin(),name.end()).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// Uncomment this to enable DX12 renderpass feature:
|
||||
//#define DX12_REAL_RENDERPASS
|
||||
|
||||
using namespace std;
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
namespace wiGraphics
|
||||
@@ -1016,6 +1015,35 @@ namespace DX12_Internal
|
||||
}
|
||||
};
|
||||
|
||||
Resource_DX12* to_internal(const GPUResource* param)
|
||||
{
|
||||
return static_cast<Resource_DX12*>(param->internal_state.get());
|
||||
}
|
||||
Resource_DX12* to_internal(const GPUBuffer* param)
|
||||
{
|
||||
return static_cast<Resource_DX12*>(param->internal_state.get());
|
||||
}
|
||||
Texture_DX12* to_internal(const Texture* param)
|
||||
{
|
||||
return static_cast<Texture_DX12*>(param->internal_state.get());
|
||||
}
|
||||
Sampler_DX12* to_internal(const Sampler* param)
|
||||
{
|
||||
return static_cast<Sampler_DX12*>(param->internal_state.get());
|
||||
}
|
||||
Query_DX12* to_internal(const GPUQuery* param)
|
||||
{
|
||||
return static_cast<Query_DX12*>(param->internal_state.get());
|
||||
}
|
||||
PipelineState_DX12* to_internal(const Shader* param)
|
||||
{
|
||||
assert(param->stage == CS); // only compute shader has pipeline state!
|
||||
return static_cast<PipelineState_DX12*>(param->internal_state.get());
|
||||
}
|
||||
PipelineState_DX12* to_internal(const PipelineState* param)
|
||||
{
|
||||
return static_cast<PipelineState_DX12*>(param->internal_state.get());
|
||||
}
|
||||
}
|
||||
using namespace DX12_Internal;
|
||||
|
||||
@@ -1211,7 +1239,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(buffer->internal_state);
|
||||
auto internal_state = to_internal(buffer);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE dst = heap.start_cpu;
|
||||
dst.ptr += (heap.ringOffset + slot) * device->resource_descriptor_size;
|
||||
@@ -1224,7 +1252,7 @@ using namespace DX12_Internal;
|
||||
DynamicResourceState& state = it->second;
|
||||
state.binding[stage] = true;
|
||||
D3D12_CONSTANT_BUFFER_VIEW_DESC cbv;
|
||||
cbv.BufferLocation = static_pointer_cast<Resource_DX12>(state.allocation.buffer->internal_state)->resource->GetGPUVirtualAddress();
|
||||
cbv.BufferLocation = to_internal(state.allocation.buffer)->resource->GetGPUVirtualAddress();
|
||||
cbv.BufferLocation += (D3D12_GPU_VIRTUAL_ADDRESS)state.allocation.offset;
|
||||
cbv.SizeInBytes = (uint32_t)Align((size_t)buffer->desc.ByteWidth, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
|
||||
|
||||
@@ -1247,7 +1275,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(resource->internal_state);
|
||||
auto internal_state = to_internal(resource);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE src = {};
|
||||
if (subresource < 0)
|
||||
@@ -1277,7 +1305,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(resource->internal_state);
|
||||
auto internal_state = to_internal(resource);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE src = {};
|
||||
if (subresource < 0)
|
||||
@@ -1348,7 +1376,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto& internal_state = static_pointer_cast<Sampler_DX12>(sampler->internal_state);
|
||||
auto internal_state = to_internal(sampler);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE src = internal_state->descriptor;
|
||||
|
||||
@@ -1543,7 +1571,7 @@ using namespace DX12_Internal;
|
||||
hr = D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
stringstream ss("");
|
||||
std::stringstream ss("");
|
||||
ss << "Failed to create the graphics device! ERROR: " << std::hex << hr;
|
||||
wiHelper::messageBox(ss.str(), "Error!");
|
||||
assert(0);
|
||||
@@ -2545,7 +2573,7 @@ using namespace DX12_Internal;
|
||||
|
||||
int GraphicsDevice_DX12::CreateSubresource(Texture* texture, SUBRESOURCE_TYPE type, uint32_t firstSlice, uint32_t sliceCount, uint32_t firstMip, uint32_t mipCount)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX12>(texture->internal_state);
|
||||
auto internal_state = to_internal(texture);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -2923,8 +2951,8 @@ using namespace DX12_Internal;
|
||||
|
||||
void GraphicsDevice_DX12::SetName(GPUResource* pResource, const std::string& name)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(pResource->internal_state);
|
||||
internal_state->resource->SetName(wstring(name.begin(), name.end()).c_str());
|
||||
auto internal_state = to_internal(pResource);
|
||||
internal_state->resource->SetName(std::wstring(name.begin(), name.end()).c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -3301,7 +3329,7 @@ using namespace DX12_Internal;
|
||||
const RenderPassAttachment& attachment = desc.attachments[i];
|
||||
const Texture* texture = attachment.texture;
|
||||
int subresource = attachment.subresource;
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX12>(texture->internal_state);
|
||||
auto internal_state = to_internal(texture);
|
||||
|
||||
D3D12_CLEAR_VALUE clear_value;
|
||||
clear_value.Format = _ConvertFormat(texture->desc.Format);
|
||||
@@ -3411,7 +3439,7 @@ using namespace DX12_Internal;
|
||||
const RenderPassAttachment& attachment = desc.attachments[i];
|
||||
const Texture* texture = attachment.texture;
|
||||
int subresource = attachment.subresource;
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX12>(texture->internal_state);
|
||||
auto internal_state = to_internal(texture);
|
||||
|
||||
if (attachment.type == RenderPassAttachment::RENDERTARGET)
|
||||
{
|
||||
@@ -3478,7 +3506,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto& internal_state = static_pointer_cast<Texture_DX12>(attachment.texture->internal_state);
|
||||
auto internal_state = to_internal(attachment.texture);
|
||||
|
||||
D3D12_RESOURCE_BARRIER& barrierdesc = barrierdescs[numBarriers++];
|
||||
|
||||
@@ -3599,7 +3627,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
if (vertexBuffers[i] != nullptr)
|
||||
{
|
||||
res[i].BufferLocation = vertexBuffers[i]->IsValid() ? static_pointer_cast<Resource_DX12>(vertexBuffers[i]->internal_state)->resource->GetGPUVirtualAddress() : 0;
|
||||
res[i].BufferLocation = vertexBuffers[i]->IsValid() ? to_internal(vertexBuffers[i])->resource->GetGPUVirtualAddress() : 0;
|
||||
res[i].SizeInBytes = vertexBuffers[i]->desc.ByteWidth;
|
||||
if (offsets != nullptr)
|
||||
{
|
||||
@@ -3616,7 +3644,7 @@ using namespace DX12_Internal;
|
||||
D3D12_INDEX_BUFFER_VIEW res = {};
|
||||
if (indexBuffer != nullptr)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(indexBuffer->internal_state);
|
||||
auto internal_state = to_internal(indexBuffer);
|
||||
|
||||
res.BufferLocation = internal_state->resource->GetGPUVirtualAddress() + (D3D12_GPU_VIRTUAL_ADDRESS)offset;
|
||||
res.Format = (format == INDEXBUFFER_FORMAT::INDEXFORMAT_16BIT ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT);
|
||||
@@ -3901,8 +3929,7 @@ using namespace DX12_Internal;
|
||||
}
|
||||
void GraphicsDevice_DX12::BindComputeShader(const Shader* cs, CommandList cmd)
|
||||
{
|
||||
assert(cs->stage == CS);
|
||||
const auto& internal_state = static_pointer_cast<PipelineState_DX12>(cs->internal_state);
|
||||
auto internal_state = to_internal(cs);
|
||||
|
||||
prev_pipeline_hash[cmd] = 0; // note: same bind point for compute and graphics in dx12!
|
||||
GetDirectCommandList(cmd)->SetPipelineState(internal_state->resource.Get());
|
||||
@@ -3929,13 +3956,13 @@ using namespace DX12_Internal;
|
||||
}
|
||||
void GraphicsDevice_DX12::DrawInstancedIndirect(const GPUBuffer* args, uint32_t args_offset, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(args->internal_state);
|
||||
auto internal_state = to_internal(args);
|
||||
GetFrameResources().descriptors[cmd].validate(cmd);
|
||||
GetDirectCommandList(cmd)->ExecuteIndirect(drawInstancedIndirectCommandSignature.Get(), 1, internal_state->resource.Get(), args_offset, nullptr, 0);
|
||||
}
|
||||
void GraphicsDevice_DX12::DrawIndexedInstancedIndirect(const GPUBuffer* args, uint32_t args_offset, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(args->internal_state);
|
||||
auto internal_state = to_internal(args);
|
||||
GetFrameResources().descriptors[cmd].validate(cmd);
|
||||
GetDirectCommandList(cmd)->ExecuteIndirect(drawIndexedInstancedIndirectCommandSignature.Get(), 1, internal_state->resource.Get(), args_offset, nullptr, 0);
|
||||
}
|
||||
@@ -3946,20 +3973,20 @@ using namespace DX12_Internal;
|
||||
}
|
||||
void GraphicsDevice_DX12::DispatchIndirect(const GPUBuffer* args, uint32_t args_offset, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Resource_DX12>(args->internal_state);
|
||||
auto internal_state = to_internal(args);
|
||||
GetFrameResources().descriptors[cmd].validate(cmd);
|
||||
GetDirectCommandList(cmd)->ExecuteIndirect(dispatchIndirectCommandSignature.Get(), 1, internal_state->resource.Get(), args_offset, nullptr, 0);
|
||||
}
|
||||
void GraphicsDevice_DX12::CopyResource(const GPUResource* pDst, const GPUResource* pSrc, CommandList cmd)
|
||||
{
|
||||
auto internal_state_src = static_pointer_cast<Resource_DX12>(pSrc->internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Resource_DX12>(pDst->internal_state);
|
||||
auto internal_state_src = to_internal(pSrc);
|
||||
auto internal_state_dst = to_internal(pDst);
|
||||
GetDirectCommandList(cmd)->CopyResource(internal_state_dst->resource.Get(), internal_state_src->resource.Get());
|
||||
}
|
||||
void GraphicsDevice_DX12::CopyTexture2D_Region(const Texture* pDst, uint32_t dstMip, uint32_t dstX, uint32_t dstY, const Texture* pSrc, uint32_t srcMip, CommandList cmd)
|
||||
{
|
||||
auto internal_state_src = static_pointer_cast<Texture_DX12>(pSrc->internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Texture_DX12>(pDst->internal_state);
|
||||
auto internal_state_src = to_internal(pSrc);
|
||||
auto internal_state_dst = to_internal(pDst);
|
||||
|
||||
D3D12_RESOURCE_DESC src_desc = internal_state_src->resource->GetDesc();
|
||||
D3D12_RESOURCE_DESC dst_desc = internal_state_dst->resource->GetDesc();
|
||||
@@ -4017,8 +4044,8 @@ using namespace DX12_Internal;
|
||||
else
|
||||
{
|
||||
// Contents will be transferred to device memory:
|
||||
auto internal_state_src = static_pointer_cast<Resource_DX12>(GetFrameResources().resourceBuffer[cmd].buffer.internal_state);
|
||||
auto internal_state_dst = static_pointer_cast<Resource_DX12>(buffer->internal_state);
|
||||
auto internal_state_src = std::static_pointer_cast<Resource_DX12>(GetFrameResources().resourceBuffer[cmd].buffer.internal_state);
|
||||
auto internal_state_dst = to_internal(buffer);
|
||||
|
||||
D3D12_RESOURCE_BARRIER barrier = {};
|
||||
barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
@@ -4054,7 +4081,7 @@ using namespace DX12_Internal;
|
||||
}
|
||||
void GraphicsDevice_DX12::QueryBegin(const GPUQuery* query, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Query_DX12>(query->internal_state);
|
||||
auto internal_state = to_internal(query);
|
||||
|
||||
switch (query->desc.Type)
|
||||
{
|
||||
@@ -4071,7 +4098,7 @@ using namespace DX12_Internal;
|
||||
}
|
||||
void GraphicsDevice_DX12::QueryEnd(const GPUQuery* query, CommandList cmd)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Query_DX12>(query->internal_state);
|
||||
auto internal_state = to_internal(query);
|
||||
|
||||
switch (query->desc.Type)
|
||||
{
|
||||
@@ -4091,7 +4118,7 @@ using namespace DX12_Internal;
|
||||
}
|
||||
bool GraphicsDevice_DX12::QueryRead(const GPUQuery* query, GPUQueryResult* result)
|
||||
{
|
||||
const auto& internal_state = static_pointer_cast<Query_DX12>(query->internal_state);
|
||||
auto internal_state = to_internal(query);
|
||||
|
||||
D3D12_RANGE range;
|
||||
range.Begin = (size_t)internal_state->query_index * sizeof(size_t);
|
||||
@@ -4146,14 +4173,14 @@ using namespace DX12_Internal;
|
||||
{
|
||||
barrierdesc.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
|
||||
barrierdesc.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
barrierdesc.UAV.pResource = barrier.memory.resource == nullptr ? nullptr : static_pointer_cast<Resource_DX12>(barrier.memory.resource->internal_state)->resource.Get();
|
||||
barrierdesc.UAV.pResource = barrier.memory.resource == nullptr ? nullptr : to_internal(barrier.memory.resource)->resource.Get();
|
||||
}
|
||||
break;
|
||||
case GPUBarrier::IMAGE_BARRIER:
|
||||
{
|
||||
barrierdesc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
barrierdesc.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
barrierdesc.Transition.pResource = static_pointer_cast<Texture_DX12>(barrier.image.texture->internal_state)->resource.Get();
|
||||
barrierdesc.Transition.pResource = to_internal(barrier.image.texture)->resource.Get();
|
||||
barrierdesc.Transition.StateBefore = _ConvertImageLayout(barrier.image.layout_before);
|
||||
barrierdesc.Transition.StateAfter = _ConvertImageLayout(barrier.image.layout_after);
|
||||
barrierdesc.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||
@@ -4163,7 +4190,7 @@ using namespace DX12_Internal;
|
||||
{
|
||||
barrierdesc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
barrierdesc.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
barrierdesc.Transition.pResource = static_pointer_cast<Resource_DX12>(barrier.buffer.buffer->internal_state)->resource.Get();
|
||||
barrierdesc.Transition.pResource = to_internal(barrier.buffer.buffer)->resource.Get();
|
||||
barrierdesc.Transition.StateBefore = _ConvertBufferState(barrier.buffer.state_before);
|
||||
barrierdesc.Transition.StateAfter = _ConvertBufferState(barrier.buffer.state_after);
|
||||
barrierdesc.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||
@@ -4200,7 +4227,7 @@ using namespace DX12_Internal;
|
||||
|
||||
void GraphicsDevice_DX12::EventBegin(const std::string& name, CommandList cmd)
|
||||
{
|
||||
PIXBeginEvent(GetDirectCommandList(cmd), 0xFF000000, wstring(name.begin(), name.end()).c_str());
|
||||
PIXBeginEvent(GetDirectCommandList(cmd), 0xFF000000, std::wstring(name.begin(), name.end()).c_str());
|
||||
}
|
||||
void GraphicsDevice_DX12::EventEnd(CommandList cmd)
|
||||
{
|
||||
@@ -4208,7 +4235,7 @@ using namespace DX12_Internal;
|
||||
}
|
||||
void GraphicsDevice_DX12::SetMarker(const std::string& name, CommandList cmd)
|
||||
{
|
||||
PIXSetMarker(GetDirectCommandList(cmd), 0xFFFF0000, wstring(name.begin(), name.end()).c_str());
|
||||
PIXSetMarker(GetDirectCommandList(cmd), 0xFFFF0000, std::wstring(name.begin(), name.end()).c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -318,6 +318,7 @@ namespace wiGraphics
|
||||
std::deque<std::pair<std::pair<VkBuffer, VmaAllocation>, uint64_t>> destroyer_buffers;
|
||||
std::deque<std::pair<VkBufferView, uint64_t>> destroyer_bufferviews;
|
||||
std::deque<std::pair<VkSampler, uint64_t>> destroyer_samplers;
|
||||
std::deque<std::pair<VkShaderModule, uint64_t>> destroyer_shadermodules;
|
||||
std::deque<std::pair<VkPipeline, uint64_t>> destroyer_pipelines;
|
||||
std::deque<std::pair<VkRenderPass, uint64_t>> destroyer_renderpasses;
|
||||
std::deque<std::pair<VkFramebuffer, uint64_t>> destroyer_framebuffers;
|
||||
|
||||
@@ -35,6 +35,10 @@ namespace wiNetwork
|
||||
}
|
||||
}
|
||||
};
|
||||
SocketInternal* to_internal(const Socket* param)
|
||||
{
|
||||
return static_cast<SocketInternal*>(param->internal_state.get());
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
@@ -86,7 +90,7 @@ namespace wiNetwork
|
||||
target.sin_addr.S_un.S_un_b.s_b3 = connection->ipaddress[2];
|
||||
target.sin_addr.S_un.S_un_b.s_b4 = connection->ipaddress[3];
|
||||
|
||||
const auto& socketinternal = std::static_pointer_cast<SocketInternal>(sock->internal_state);
|
||||
auto socketinternal = to_internal(sock);
|
||||
|
||||
int result = sendto(socketinternal->handle, (const char*)data, (int)dataSize, 0, (const sockaddr*)& target, sizeof(target));
|
||||
if (result == SOCKET_ERROR)
|
||||
@@ -112,7 +116,7 @@ namespace wiNetwork
|
||||
target.sin_port = htons(port);
|
||||
target.sin_addr.S_un.S_addr = htonl(INADDR_ANY);
|
||||
|
||||
const auto& socketinternal = std::static_pointer_cast<SocketInternal>(sock->internal_state);
|
||||
auto socketinternal = to_internal(sock);
|
||||
|
||||
int result = bind(socketinternal->handle, (const sockaddr*)& target, sizeof(target));
|
||||
if (result == SOCKET_ERROR)
|
||||
@@ -133,7 +137,7 @@ namespace wiNetwork
|
||||
{
|
||||
if (socket != nullptr && sock->IsValid())
|
||||
{
|
||||
const auto& socketinternal = std::static_pointer_cast<SocketInternal>(sock->internal_state);
|
||||
auto socketinternal = to_internal(sock);
|
||||
|
||||
fd_set readfds;
|
||||
FD_ZERO(&readfds);
|
||||
@@ -160,7 +164,7 @@ namespace wiNetwork
|
||||
{
|
||||
if (socket != nullptr && sock->IsValid())
|
||||
{
|
||||
const auto& socketinternal = std::static_pointer_cast<SocketInternal>(sock->internal_state);
|
||||
auto socketinternal = to_internal(sock);
|
||||
|
||||
sockaddr_in sender;
|
||||
int targetsize = sizeof(sender);
|
||||
|
||||
@@ -442,7 +442,7 @@ namespace wiRawInput
|
||||
}
|
||||
bool GetControllerState(wiInput::ControllerState* state, int index)
|
||||
{
|
||||
if (index < controllers.size() && controllers[index].handle && !controllers[index].is_xinput)
|
||||
if (index < (int)controllers.size() && controllers[index].handle && !controllers[index].is_xinput)
|
||||
{
|
||||
if (state != nullptr)
|
||||
{
|
||||
@@ -454,7 +454,7 @@ namespace wiRawInput
|
||||
}
|
||||
void SetControllerFeedback(const wiInput::ControllerFeedback& data, int index)
|
||||
{
|
||||
if (index < controllers.size() && controllers[index].handle && !controllers[index].is_xinput)
|
||||
if (index < (int)controllers.size() && controllers[index].handle && !controllers[index].is_xinput)
|
||||
{
|
||||
HANDLE hid_device = CreateFile(
|
||||
controllers[index].name.c_str(),
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates
|
||||
const int minor = 38;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 0;
|
||||
const int revision = 1;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user