CreateDxgiSurfaceRenderTarget Keep failling

Okay I am creating A d2dwindow that can render another surfaces so i did that

HR(D3D10CreateDevice
(
    NULL,
    D3D10_DRIVER_TYPE_HARDWARE,
    NULL,
    NULL,
    D3D10_SDK_VERSION,
    &D3dDevicePtr
));

HR(D3dDevicePtr->QueryInterface(__uuidof(IDXGIDevice), (void**)&DXGIDevicePtr));
D3dDevicePtr->Release();

and after that

IDXGISurface* DXGISurfacePtr;
ID2D1RenderTarget* SurfaceRTPtr;

//init the Surface
{
    DXGI_SURFACE_DESC Desc = { 500, 500, DXGI_FORMAT_R32G32B32A32_UINT , {1 , 0} };

    HR(DXGIDevicePtr->CreateSurface(&Desc, 1, DXGI_USAGE_RENDER_TARGET_OUTPUT, NULL, &DXGISurfacePtr));
    Surfaces.emplace_back(DXGISurfacePtr);
}

//init the RT
{
    FLOAT dpiX;
    FLOAT dpiY;
    D2dFacory->GetDesktopDpi(&dpiX, &dpiY);

    D2D1_RENDER_TARGET_PROPERTIES props =
        D2D1::RenderTargetProperties(
            D2D1_RENDER_TARGET_TYPE_DEFAULT,
            D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
            dpiX,
            dpiY
        );
    HR(D2dFacory->CreateDxgiSurfaceRenderTarget(DXGISurfacePtr, props, &SurfaceRTPtr));

    RTs.emplace_back(SurfaceRTPtr);
}

but the creating of rt keep failling i tried alot of values like tring every compination in D2D1_RENDER_TARGET_PROPERTIES but there is nothing

and i tried that too

    float dpiX;
    float dpiY;
    D2dFacory->GetDesktopDpi(&dpiX, &dpiY);

    D2D1_RENDER_TARGET_PROPERTIES Prop =
    {
        D2D1_RENDER_TARGET_TYPE_DEFAULT,
        {
            DXGI_FORMAT_R32G32B32A32_UINT,
            D2D1_ALPHA_MODE_STRAIGHT
        },
        dpiX,
        dpiY,
        D2D1_RENDER_TARGET_USAGE_NONE,
        D2D1_FEATURE_LEVEL_10
    };

    HR(D2dFacory->CreateDxgiSurfaceRenderTarget(DXGISurfacePtr, &Prop, &SurfaceRTPtr));

    RTs.emplace_back(SurfaceRTPtr);


from Recent Questions - Stack Overflow https://ift.tt/3ug7Edp
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation