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

Pass constant size arrays by reference #191

Merged
merged 1 commit into from
Mar 8, 2019
Merged

Pass constant size arrays by reference #191

merged 1 commit into from
Mar 8, 2019

Conversation

kvark
Copy link
Collaborator

@kvark kvark commented Mar 8, 2019

Note: this is a breaking change!
Some related reading: https://lkml.org/lkml/2015/9/3/428
This has been plaguing WebRender on gfx-rs port running Windows/Vulkan.

@kvark kvark requested a review from MaikKlein March 8, 2019 05:20
@MaikKlein
Copy link
Member

Interesting, thanks for the catch!

I also leave here the current implementation for it in radv. Indeed it is just used as a pointer.

void radv_CmdSetBlendConstants(
	VkCommandBuffer                             commandBuffer,
	const float                                 blendConstants[4])
{
	RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
	struct radv_cmd_state *state = &cmd_buffer->state;

	if (!memcmp(state->dynamic.blend_constants, blendConstants, sizeof(float) * 4))
		return;

	memcpy(state->dynamic.blend_constants, blendConstants, sizeof(float) * 4);

	state->dirty |= RADV_CMD_DIRTY_DYNAMIC_BLEND_CONSTANTS;
}

@MaikKlein
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Mar 8, 2019
191: Pass constant size arrays by reference r=MaikKlein a=kvark

Note: this is a breaking change!
Some related reading: https://lkml.org/lkml/2015/9/3/428
This has been plaguing WebRender on gfx-rs port running Windows/Vulkan.

Co-authored-by: Dzmitry Malyshau <[email protected]>
@bors
Copy link
Contributor

bors bot commented Mar 8, 2019

@bors bors bot merged commit 7aa30a6 into ash-rs:master Mar 8, 2019
@kvark
Copy link
Collaborator Author

kvark commented Mar 8, 2019 via email

@MaikKlein
Copy link
Member

There are currently a few breaking changes in place, I'll push a new version after #183 is merged, which should be today. (hopefully)

@kvark
Copy link
Collaborator Author

kvark commented Mar 8, 2019 via email

bors bot added a commit to gfx-rs/gfx that referenced this pull request Mar 12, 2019
2693: [vk] Pass blend constant value by reference r=kvark a=zakorgy

The related conversation is here: ash-rs/ash#191
Also updates ash version
PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: GL, Vulkan, Metal, DX12, DX11
- [ ] `rustfmt` run on changed code

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/gfx-rs/gfx/2693)
<!-- Reviewable:end -->


Co-authored-by: Zakor Gyula <[email protected]>
aloucks added a commit to aloucks/ash that referenced this pull request Mar 13, 2019
All instances of HashMap and HashSet have been replaced with
BTreeMap and BTreeSet. Repeated generation of vk.rs results
in the same output given the same vk.xml and generator.

Note that this commit still contains the struct generation bug
introduced in PR ash-rs#191. All structs with fixed sized arrays
are currently generated as slices.
@kvark kvark deleted the array branch March 14, 2019 13:54
bors bot added a commit that referenced this pull request Mar 15, 2019
193: Fix struct generation with constant size arrays r=MaikKlein a=aloucks

PR #191 introduced a bug into the generator where constant sized array struct fields were generated as slices. This PR adds a flag to `type_tokens` that will revert that behavior while still generating FFI function signatures with pointers instead of fixed sized arrays (e.g. for `set_blend_constants`).

In addition, all instances of `HashMap` and `HashSet` have been replaced with `BTreeMap` and `BTreeSet`, which makes the generation of `vk.rs` idempotent for the same `vk.xml` input. This should obviate the need for #130 and make it much easier to see how changes to the generator or `vk.xml` affect the generated output.



Co-authored-by: Aaron Loucks <[email protected]>
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.

3 participants