简体   繁体   English

Direct2D 平铺限制?

[英]Direct2D tile limitation?

Is there a limitation on how much Direct2D tile size can grow? Direct2D 平铺大小可以增长多少有限制吗?

In D2D1_RENDERING_CONTROLS I can set the tiling of the Direct2D buffering.D2D1_RENDERING_CONTROLS我可以设置 Direct2D 缓冲的平铺。

            D2D1_RENDERING_CONTROLS r4c = {};
            m_d2dContext->GetRenderingControls(&r4c);
            if (r4c.tileSize.width < (UINT32)wi || r4c.tileSize.height < (UINT32)he)
            {
                r4c.tileSize.width = wi;
                r4c.tileSize.height = he;
                m_d2dContext->SetRenderingControls(r4c);
                m_d2dContext->GetRenderingControls(&r4c);
                nop();
            }

When it's up to 4K resolution, the rendering of an effect gets the whole texture at one pass:当分辨率达到 4K 时,效果的渲染一次获得整个纹理:

在此处输入图像描述

When I go up to 8K, then there's tiling, indicating that Direct2D passes the texture in more than one pass:当我 go 到 8K 时,出现了 tiling,说明 Direct2D 多遍传递纹理:

在此处输入图像描述

This is a killing for my custom HLSL effects that require the whole texture to operate, like this special lighting effect.这对于我需要整个纹理才能运行的自定义 HLSL 效果来说是一种杀戮,就像这种特殊的照明效果一样。

Is this an intended feature?这是预期的功能吗? A bug?一个错误? An undetected issue?一个未被发现的问题? Would I be forced to go to OpenGL rendering eventually?我最终会被迫 go 到 OpenGL 渲染吗?

This is not related to my GF card - I tested with an RTX 2070, the same error occurs.这与我的 GF 卡无关——我用 RTX 2070 测试过,出现同样的错误。

Edit: here is a full VS 2019 solution with a simple swirl effect.编辑: 是一个完整的 VS 2019 解决方案,具有简单的漩涡效果。

// When you try plain 1920x1080 or 3840x2160, ok
int wi = 7680;
int he = 4320;
// With the above, the swirling is tiled x4.

Edit: On EndDraw(), I have this in debug output:编辑:在 EndDraw() 上,我在调试 output 中有这个:

Exception thrown at 0x00007FFBE6324B89 in d2dbug.exe: Microsoft C++ exception: _com_error at memory location 0x000000EBC4D5CE58.
Exception thrown at 0x00007FFBE6324B89 in d2dbug.exe: Microsoft C++ exception: _com_error at memory location 0x000000EBC4D5CE58.
Exception thrown at 0x00007FFBE6324B89 in d2dbug.exe: Microsoft C++ exception: _com_error at memory location 0x000000EBC4D5CE58.

There is an answer from Microsoft.微软给出了答案。

I would recommend using a bitmap as the input to the effect rather than the image source.我建议使用 bitmap 作为效果的输入,而不是图像源。 Simply drawing the image source into that bitmap should work.只需将图像源绘制到 bitmap 中即可。 They could also create the bitmap from a WIC bitmap source using the D2D API CreateBitmapFromWicBitmap.他们还可以使用 D2D API CreateBitmapFromWicBitmap 从 WIC bitmap 源创建 bitmap。

This works, although the output of an effect returns a ID2D1Image which then has to be converted to a ID2D1Bitmap by the code here .虽然效果的 output 返回一个 ID2D1Image ,然后必须通过此处的代码将其转换为 ID2D1Bitmap ,但这是可行的。

I'm still discussing with them the performance issues that might occur when there are too many effects in the chain and each of them has to convert manually to an ID2D1Bitmap.我仍在与他们讨论当链中的效果过多并且每个效果都必须手动转换为 ID2D1Bitmap 时可能出现的性能问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM