Skip to content
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

GE:Bugfix of some backend. #12538

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions GPU/Directx9/DrawEngineDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

namespace DX9 {

const D3DPRIMITIVETYPE glprim[8] = {
const D3DPRIMITIVETYPE d3d9prim[8] = {
D3DPT_POINTLIST,
D3DPT_LINELIST,
D3DPT_LINESTRIP,
Expand Down Expand Up @@ -499,19 +499,19 @@ void DrawEngineDX9::DoFlush() {
device_->SetVertexDeclaration(pHardwareVertexDecl);
if (vb_ == NULL) {
if (useElements) {
device_->DrawIndexedPrimitiveUP(glprim[prim], 0, maxIndex + 1, D3DPrimCount(glprim[prim], vertexCount), decIndex, D3DFMT_INDEX16, decoded, dec_->GetDecVtxFmt().stride);
device_->DrawIndexedPrimitiveUP(d3d9prim[prim], 0, maxIndex + 1, D3DPrimCount(d3d9prim[prim], vertexCount), decIndex, D3DFMT_INDEX16, decoded, dec_->GetDecVtxFmt().stride);
} else {
device_->DrawPrimitiveUP(glprim[prim], D3DPrimCount(glprim[prim], vertexCount), decoded, dec_->GetDecVtxFmt().stride);
device_->DrawPrimitiveUP(d3d9prim[prim], D3DPrimCount(d3d9prim[prim], vertexCount), decoded, dec_->GetDecVtxFmt().stride);
}
} else {
device_->SetStreamSource(0, vb_, 0, dec_->GetDecVtxFmt().stride);

if (useElements) {
device_->SetIndices(ib_);

device_->DrawIndexedPrimitive(glprim[prim], 0, 0, maxIndex + 1, 0, D3DPrimCount(glprim[prim], vertexCount));
device_->DrawIndexedPrimitive(d3d9prim[prim], 0, 0, maxIndex + 1, 0, D3DPrimCount(d3d9prim[prim], vertexCount));
} else {
device_->DrawPrimitive(glprim[prim], 0, D3DPrimCount(glprim[prim], vertexCount));
device_->DrawPrimitive(d3d9prim[prim], 0, D3DPrimCount(d3d9prim[prim], vertexCount));
}
}
}
Expand Down Expand Up @@ -568,9 +568,9 @@ void DrawEngineDX9::DoFlush() {

device_->SetVertexDeclaration(transformedVertexDecl_);
if (drawIndexed) {
device_->DrawIndexedPrimitiveUP(glprim[prim], 0, maxIndex, D3DPrimCount(glprim[prim], numTrans), inds, D3DFMT_INDEX16, drawBuffer, sizeof(TransformedVertex));
device_->DrawIndexedPrimitiveUP(d3d9prim[prim], 0, maxIndex, D3DPrimCount(d3d9prim[prim], numTrans), inds, D3DFMT_INDEX16, drawBuffer, sizeof(TransformedVertex));
} else {
device_->DrawPrimitiveUP(glprim[prim], D3DPrimCount(glprim[prim], numTrans), drawBuffer, sizeof(TransformedVertex));
device_->DrawPrimitiveUP(d3d9prim[prim], D3DPrimCount(d3d9prim[prim], numTrans), drawBuffer, sizeof(TransformedVertex));
}
} else if (result.action == SW_CLEAR) {
u32 clearColor = result.color;
Expand Down
2 changes: 1 addition & 1 deletion GPU/Directx9/ShaderManagerDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void ShaderManagerDX9::VSUpdateUniforms(u64 dirtyUniforms) {
flippedMatrix[12] = -flippedMatrix[12];
}

ConvertProjMatrixToD3D(flippedMatrix, invertedX, invertedY);
ConvertProjMatrixToD3D(flippedMatrix, invertedX, !invertedY);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. If this is correct, I'd rather reverse the check inside the function rather than invert this value. This is the only call, and the argument inside and variable outside are both named invertedY.

I dislike the idea of them having opposite meanings - we should either inverse the check inside the func, or change one of the names, or reverse the way the variable is initially set here.

-[Unknown]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more, is it a problem that this invert is in non-GL specific code?

if (useBufferedRendering)
ySign = -ySign;
float flippedMatrix[16];
if (!throughmode) {
memcpy(&flippedMatrix, gstate.projMatrix, 16 * sizeof(float));
const bool invertedY = useBufferedRendering ? (gstate_c.vpHeight < 0) : (gstate_c.vpHeight > 0);

(though I thought we used top down, or basically upside down, in GL buffers except the backbuffer...)

-[Unknown]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that looks really broken...


VSSetMatrix(CONST_VS_PROJ, flippedMatrix.getReadPtr());
}
Expand Down