-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[d3d9] fix opCompositeExtract out of bound #3390
[d3d9] fix opCompositeExtract out of bound #3390
Conversation
Can you explain why this is nessecary? Fixed function code isn't easy to understand. The commit message should be |
7a9ea84
to
1016177
Compare
@DadSchoorse Yep! As mentioned in #3293 (comment) we have out of bound during compilation to spirv. Disassembling the shader shows that the var is float[4]
In the fixed function we trying to get the last element. So, all I've changed relates to array size. |
src/d3d9/d3d9_fixed_function.cpp
Outdated
@@ -1115,6 +1115,7 @@ namespace dxvk { | |||
default: | |||
case (DXVK_TSS_TCI_PASSTHRU >> TCIOffset): | |||
transformed = m_vs.in.TEXCOORD[inputIndex & 0xFF]; | |||
count = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, TCI_PASSTHRU
doesn't set count = 4
because it's meant to use the size of the texcoord passed in.
Is this required to close the other issue? If so I imagine there is something else going on, but this is definitely not the right solution!
https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturetransformflags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you hitting a case here where count == 0
? Curious... That might be the D3DTTFF_DISABLE
case that is missing some handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. I'm hitting count == 7.
Which is more than texcoord size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For case if we have count
smaller than 4 can suggest this:
count = 4; | |
count = std::min(count, static_cast<uint32_t>(4)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more way is to prevent D3DTTFF_DISABLE
if we have count >= 4
here. Obviously, it doesn't make sense to do opCompositeExtract
if we don't opCompositeInsert
(which won't do if count >= 4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count == 7 && texcoordCount == 0
Good for you ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If texcoordCount == 0, we probably want to treat it as NINED3DTSS_TCI_DISABLE
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sry, what is NINED3DTSS_TCI_DISABLE
?
are you talking about D3DTTFF_DISABLE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had a look at what Gallium Nine (see link above) did and it disabled it in that case. So I imagine that's probably what we should do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Pls, check if it's what you meant :)
Once we solve what is going on with that random |
f3f2a2f
to
e0847b9
Compare
Closes: doitsujin#3293 Signed-by: Oleksii Bozhenko <oleksii.bozhenko@globallogic.com>
e0847b9
to
e833072
Compare
Closes: #3293
Signed-by: Oleksii Bozhenko oleksii.bozhenko@globallogic.com