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

vkd3d: Implement negative viewport height feature. #1611

Merged

Conversation

null77
Copy link
Contributor

@null77 null77 commented Jun 29, 2023

This mirrors a Vulkan feature and doesn't require any emulation.

@HansKristian-Work LMK if you'd prefer I de-duplicate the test code.

vbv.SizeInBytes = sizeof(quad);

set_viewport(&viewport, 0, context.render_target_desc.Height,
context.render_target_desc.Width, -(float)context.render_target_desc.Height, 0.0f, 1.0f);
Copy link
Owner

@HansKristian-Work HansKristian-Work Jun 30, 2023

Choose a reason for hiding this comment

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

I think a viewport test like this should test 4 draw calls targeting 4 quadrants to make sure the intended X / Y offsets end up where we expect.

Might as well throw InvertedViewportDepthFlipsZSupported in there and render different depths per quadrant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, done. PTAL

Copy link
Owner

@HansKristian-Work HansKristian-Work left a comment

Choose a reason for hiding this comment

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

Smol nits.

quads[4][4] =
{
{
{{0.0f, 1.0f, 1.0f, 1.0f}, {0.1f, 0.1f}},

Choose a reason for hiding this comment

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

There is flat TEXCOORD input here to PS, so it does not verify that Y-flip actually happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to a variable TEXCOORD Y.

float4 main(float4 position : SV_Position,
float2 texcoord : TEXCOORD) : SV_Target
{
return float4(position.xyz, texcoord.x);

Choose a reason for hiding this comment

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

Should be texcoord.y here I think, since that will be "flipped" when viewport is flipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, changed to output y.


for (i = 0; i < 4; i++)
{
ID3D12GraphicsCommandList_IASetVertexBuffers(command_list, 0, 1, &vbvs[i]);

Choose a reason for hiding this comment

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

I meant that we need 4 different RSSetViewports here rather than using the VBO to do the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, PTAL.

These features correspond to Vulkan-native functionality.
Copy link
Owner

@HansKristian-Work HansKristian-Work left a comment

Choose a reason for hiding this comment

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

Passes on both AMD and NV. LGTM.

@HansKristian-Work HansKristian-Work merged commit ea9335b into HansKristian-Work:master Jun 30, 2023
3 checks passed
@null77 null77 deleted the negative-viewport-height branch November 12, 2023 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants