Esempio n. 1
0
DepthStencilView::DepthStencilView(DeviceContext& context)
{
    // get the currently bound depth stencil view from the context
    ID3D::DepthStencilView* rawPtr = nullptr;
    context.GetUnderlying()->OMGetRenderTargets(0, nullptr, &rawPtr);
    _underlying = moveptr(rawPtr);
}
Esempio n. 2
0
 IndexBuffer::IndexBuffer(DeviceContext& context)
 {
     ID3D::Buffer* rawPtr = nullptr;
     DXGI_FORMAT fmt = DXGI_FORMAT_UNKNOWN;
     unsigned offset = 0;
     context.GetUnderlying()->IAGetIndexBuffer(&rawPtr, &fmt, &offset);
     _underlying = moveptr(rawPtr);
 }
Esempio n. 3
0
    void    ConstantBuffer::Update(DeviceContext& context, const void* data, size_t byteCount)
    {
        // context.GetUnderlying()->UpdateSubresource(
        //     _underlying, 0, nullptr, data, byteCount, byteCount);

        D3D11_MAPPED_SUBRESOURCE result;
        ID3D::DeviceContext* devContext = context.GetUnderlying();
        HRESULT hresult = devContext->Map(_underlying.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &result);
        if (SUCCEEDED(hresult) && result.pData) {
            XlCopyMemory(result.pData, data, byteCount);
            devContext->Unmap(_underlying.get(), 0);
        }
    }