DirectX Firefox插件渲染工件 [英] DirectX Firefox Plugin rendering artifacts

查看:135
本文介绍了DirectX Firefox插件渲染工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速解答:对于那些通过Google访问此页面并寻找 解决相同问题的方法,请尝试 此快速修复(由Goz建议)- 将 D3DCREATE_FPU_PRESERVE 添加到 CreateDevice()上的行为标志 称呼.那为我清除了!

QUICK ANSWER: For those of you who reach this page via Google looking for a solution to the same problem, try this quick fix (suggested by Goz) - Add D3DCREATE_FPU_PRESERVE to the behavior flags on your CreateDevice() call. That cleared it up for me!

我正在创建一个基于DirectX 9的NPAPI插件.在Chrome和Opera中,它似乎运行良好,但是在Firefox中,我得到了奇怪的渲染工件.初始化DirectX后(无需进行渲染即可显示该工件),Firefox UI的全部或部分将变为黑色.调整窗口大小(IE:启动重绘)可以清除工件,并且插件在那时似乎可以正常工作,但这显然不是理想的功能".我发现网上有其他人提到了这个问题,大多数人声称它始于Firefox3.只有

I'm creating a DirectX 9-based NPAPI plugin. It seems to be working well in Chrome and Opera, but in Firefox I get strange rendering artifacts. Upon initializing DirectX (no rendering needs to be done for the artifact to appear) all or parts of the Firefox UI will turn black. Resizing the window (IE: Initiating a repaint) clears up the artifacts and the plugin seems to work properly at that point, but this is obviously not a desirable "feature". I have found that several others online have mentioned this issue, most claiming that it began with Firefox 3. Only one post mentions any solution being found, but the author doesn't seem to keen on divulging how.

有人知道这个问题和可能的解决方案吗?在链接的文章中,它似乎与DX的初始化方式有关,但是我还没有找到一种可以防止该问题的组合.

Is anyone familiar with this issue and a possible solution? From the linked post it would seem to be related to the way DX is initialized, but I've yet to find a combination that prevents the issue.

这是我正在使用的DX初始化代码(为清楚起见,删除了错误处理):

This is the DX Initialization code I'm using (Error Handling removed for clarity):

RECT rc;
GetClientRect(pluginHwnd, &rc);

D3DPRESENT_PARAMETERS d3d9PresentParams;
ZeroMemory(&d3d9PresentParams, sizeof(D3DPRESENT_PARAMETERS));    

d3d9PresentParams.hDeviceWindow = pluginHwnd;
d3d9PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3d9PresentParams.Flags = D3DPRESENTFLAG_DEVICECLIP; // Failed attempt to solve FF issue
d3d9PresentParams.EnableAutoDepthStencil = FALSE; // No depth testing
d3d9PresentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Use Vsync

d3d9PresentParams.MultiSampleType = D3DMULTISAMPLE_NONE; // Don't care about Multisampling
d3d9PresentParams.MultiSampleQuality = 0;

d3d9PresentParams.BackBufferCount = 1; 
d3d9PresentParams.BackBufferWidth = rc.right - rc.left; 
d3d9PresentParams.BackBufferHeight = rc.bottom - rc.top;  
d3d9PresentParams.BackBufferFormat = D3DFMT_UNKNOWN; // Use the same color format as windows 

d3d9PresentParams.Windowed = TRUE; // Explicitly windowed
d3d9PresentParams.FullScreen_RefreshRateInHz = 0;

d3d9->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pluginHwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3d9PresentParams, &d3d9Device );

推荐答案

我唯一想到的就是在设备创建时设置"D3DCREATE_NOWINDOWCHANGES"行为标志.

The only thing I can think of off the top of my head is setting the "D3DCREATE_NOWINDOWCHANGES" behaviour flag on device creation.

您可以尝试将backbufferwidth和height设置为0,并使其从窗口继承信息.

You could try setting backbufferwidth and height to 0 and let it inherit the info from the window.

也可能值得尝试设置D3DCREATE_FPU_PRESERVE标志和D3DCREATE_MULTITHREADED.

Might also be worth trying setting the D3DCREATE_FPU_PRESERVE flag and D3DCREATE_MULTITHREADED.

这篇关于DirectX Firefox插件渲染工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆