Page MenuHomeWildfire Games

Merges UID from different types and unifies single type descriptor set creation
ClosedPublic

Authored by vladislavbelov on Sep 26 2023, 11:17 PM.

Details

Summary

One of preparations for compute shaders changes.

Test Plan
  • Apply the patch and compile the game
  • Install Vulkan SDK (if not installed)
  • Add the following lines to user.cfg:
renderer.backend.debugcontext = "true"
renderer.backend.debuglabels = "true"
renderer.backend.debugmessages = "true"
renderer.backend.debugscopedlabels = "true"
  • Run the game and resize a window
  • Make sure that there is no new warnings
  • Add the following line to user.cfg:
renderer.backend.vulkan.disabledescriptorindexing = "true"
  • Run the game and resize a window
  • Make sure that there is no new warnings

Do not forget to remove added lines as they might affect performance.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7337/display/redirect

vladislavbelov edited the test plan for this revision. (Show Details)Sep 26 2023, 11:18 PM
vladislavbelov edited the test plan for this revision. (Show Details)

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8426/display/redirect

vladislavbelov requested review of this revision.Sep 26 2023, 11:44 PM
phosit added a subscriber: phosit.Sep 27 2023, 6:42 PM

This diff weakens (syntactical) typesavety. (semanticly there is only uint32_t)

UID is to generic IMO. DeviceObjectUID might work.

I don't see where the upper bits are used as type, all UIDs are generated by GenerateNextUID which returns 1,2,3...
Why don't you use bitfields?

struct UID
{
	u32 type : 2;
	u32 id : 30;
};
source/renderer/backend/vulkan/Texture.cpp
341–345 ↗(On Diff #22328)

Removing this generates much duplication.
The constructor of CTexture might take a CDevice& which then is queried to get a UID.

343–344 ↗(On Diff #22328)

Why declare it at all.

vladislavbelov added a comment.EditedSep 27 2023, 6:58 PM

This diff weakens (syntactical) typesavety. (semanticly there is only uint32_t)

Yeah, because the UID should enumerate all resources created by a device.

UID is to generic IMO. DeviceObjectUID might work.

I don't mind DeviceObjectUID.

I don't see where the upper bits are used as type, all UIDs are generated by GenerateNextUID which returns 1,2,3...
Why don't you use bitfields?

I was thinking about adding types/categories (I've added todo) to UID and I'd like to add them but I haven't came up with a satisfying solution yet (though I haven't spent much time on it).

source/renderer/backend/vulkan/Texture.cpp
341–345 ↗(On Diff #22328)

Yeah, I was thinking about that. I have no objections to pass CDevice as a parameter (though it'd be inconsistent with other device objects).

Vulcan added a comment.Oct 1 2023, 8:46 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7356/display/redirect

Vulcan added a comment.Oct 1 2023, 8:52 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8445/display/redirect

phosit added a comment.Oct 2 2023, 6:34 PM

It's better if DeviceObjectUID is a class/struct so it's not implicitly convertible from/to an integer.

source/renderer/backend/vulkan/DeviceObjectUID.h
36–39 ↗(On Diff #22352)

"It's used to describe the type" no it's not, it might be in future.

source/renderer/backend/vulkan/Texture.cpp
338 ↗(On Diff #22352)

Can't be nullptr so it should be a reference.

It's better if DeviceObjectUID is a class/struct so it's not implicitly convertible from/to an integer.

Only via assignments (which we should avoid anyway). Constructors work for both:

using UID = uint32_t;
// or
struct UID
{
	uint32_t value;
};

UID uid{42};
source/renderer/backend/vulkan/Texture.cpp
338 ↗(On Diff #22352)

Technically it can. But yeah, I want references in the future for backend objects.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 9 2023, 8:35 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.