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

[UR] Support platform dependant typedefs #705

Closed

Conversation

veselypeta
Copy link
Contributor

@veselypeta veselypeta commented Jul 11, 2023

This PR will enable platform dependent types to be defined as part of the UR specification. The supported platform types are: "Windows", "Linux" & "Darwin". This is useful to model platform specific types in UR such as a file descriptor.

TODO

  • Document new syntax on typedef value in YaML.md
  • Introduce validation checks for new yaml syntax
  • Clean up code generation
  • See if windows.h has to be included since we refer to HANDLE

Closes #704

scripts/core/common.yml Outdated Show resolved Hide resolved
scripts/templates/api.h.mako Outdated Show resolved Hide resolved
scripts/templates/api.h.mako Outdated Show resolved Hide resolved
scripts/templates/api.py.mako Outdated Show resolved Hide resolved
scripts/templates/api.py.mako Outdated Show resolved Hide resolved
scripts/core/common.yml Outdated Show resolved Hide resolved
@veselypeta veselypeta force-pushed the petr/704/platform-dependant-types branch from a01d624 to ab75ef2 Compare July 11, 2023 15:20
@@ -490,6 +495,14 @@ typedef struct ur_rect_region_t {

} ur_rect_region_t;

///////////////////////////////////////////////////////////////////////////////

Choose a reason for hiding this comment

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

this is a good approach.

@veselypeta veselypeta marked this pull request as ready for review July 12, 2023 07:45
@@ -32,6 +32,11 @@ from templates import helper as th
// standard headers
#include <stdint.h>
#include <stddef.h>
#if defined(_WIN32)
#define NOMINMAX
#include "windows.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

windows.h is a bit notorious for being a big nasty mess, as noted by the need for NOMINMAX. I have a feeling HANDLE is actually defined in a different header, I'm gonna poke around on a Windows machine to see if we can avoid including windows.h.

Copy link
Contributor

Choose a reason for hiding this comment

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

At the very least we should #define WIN32_LEAN_AND_MEAN before including windows.h.

@veselypeta veselypeta force-pushed the petr/704/platform-dependant-types branch from 6e9c995 to 7b47297 Compare July 12, 2023 12:37
- an ISO-C standard identifier
- a list of objects
- `if` must be by one of {`Linux`, `Windows`, `Darwin`}
- `else` must be None
Copy link
Contributor

@kbenzie kbenzie Jul 12, 2023

Choose a reason for hiding this comment

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

maybe empry instead of None?

Copy link
Contributor

Choose a reason for hiding this comment

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

also this doesn't say if and else should be mutually exclusive, it doesn't make sense to have when both at the same time.

@veselypeta veselypeta force-pushed the petr/704/platform-dependant-types branch from 24ce983 to 9d03fe4 Compare July 13, 2023 08:41
@veselypeta
Copy link
Contributor Author

Bindless images will implement this with pNext chains using void * instead of windows specific HANDLE type which will alleviate the need for ifdef on platforms.

@veselypeta veselypeta closed this Jul 13, 2023
@veselypeta veselypeta deleted the petr/704/platform-dependant-types branch July 31, 2023 14:09
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.

Allow for platform dependant type defintions
4 participants