microsoft / angle

ANGLE: OpenGL ES to DirectX translation
Other
615 stars 166 forks source link

In DX9 mode, mPixelConstants overriding already set constants. #46

Closed comeradealexi closed 9 years ago

comeradealexi commented 9 years ago

When in the DX9 mode, I was having an issue where shader constants weren't being updated at all.

Tracked it down to this like in Renderer9.cpp on line 1929 in function applyUniforms(:

mDevice->SetPixelShaderConstantF(0, (float*)&mPixelConstants, sizeof(dx_PixelConstants) / sizeof(float[4]));

My uniform is being set in the applyUniformnfv function below at psRegisterIndex number 3, but applyUniforms( gets called afterwards which uses slot 0-3 meaning my information was getting overriden!

I've managed to fix the problem I was having by commenting out the line to update mPixelConstants, not sure what this indented to do though etc but thought I should let you all know what I found either way :)

coopp commented 9 years ago

Hi comeradealexi, Thanks for the info! This is very interesting. You must be writing a classic desktop application as DX9 isn't available for Windows Store applications. This repository has a focus on Windows Store, so we don't see many DX9 issues coming in. I want to make sure your issue gets some attention from Google as well as they use the DX9 path. Please post an issue here: https://code.google.com/p/angleproject/issues/list and the Google folks will be alerted.

I can do a bit of looking myself, in addition to the Google folks.

austinkinross commented 9 years ago

I suspect this issue is limited to our ANGLE repository on GitHub. In our version of ANGLE, we have some additional features that haven't been submitted to Google's version yet. One of these is called render-to-backbuffer, which is a performance improvement for D3D11 mode. Render-to-backbuffer adds a new (4th) entry to dx_PixelConstants, which is probably causing the issue you see.

Render-to-backbuffer has been heavily tested in D3D11-mode but not D3D9-mode. As Cooper says, this repository has a focus on D3D11 mode for Windows Store.

A (better) temporary fix to this issue for D3D9 mode would probably be to remove 'viewScale' from the dx_PixelConstants and dx_VertexConstants structs in RendererD3D.h. We'll investigate a full solution soon.

Thanks a lot for reporting this!

comeradealexi commented 9 years ago

Hi all! Thanks for the quick replies.

Yep, it is for a classic desktop application and in DirectX11 mode it works as intended. I'll give that a go austinkinross instead of just commenting it out.

Here is a link to the Google Code report for this bug: https://code.google.com/p/angleproject/issues/detail?id=1131&thanks=1131&ts=1440094893

austinkinross commented 9 years ago

Hi comeradealexi, I expect this to have been fixed in this commit on Sept 4th: https://github.com/MSOpenTech/angle/commit/33769f8f0c195a295a228167147a78773765fe9b. Please let us know if you are still experiencing problems!