Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

api: Added SDL_CreateTemporaryProperties() for more-efficient throwaway props.#14440

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
icculus wants to merge1 commit intolibsdl-org:main
base:main
Choose a base branch
Loading
fromicculus:sdl3-temporary-properties

Conversation

@icculus
Copy link
Collaborator

This is an attempt at a limited-but-lower-overhead Properties object that could be useful for throwaway SDL_PropertiesID...namely, the type we use forSDL_Create*WithProperties functions.

And example of updating testyuv.c to use it:

diff --git a/test/testyuv.c b/test/testyuv.cindex 81ed2b734..93b11f6ef 100644--- a/test/testyuv.c+++ b/test/testyuv.c@@ -619,12 +619,16 @@ int main(int argc, char **argv)      output[0] = SDL_CreateTextureFromSurface(renderer, original);     output[1] = SDL_CreateTextureFromSurface(renderer, converted);-    props = SDL_CreateProperties();-    SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, yuv_colorspace);-    SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, yuv_format);-    SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STREAMING);-    SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, original->w);-    SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, original->h);+    {+        const SDL_TemporaryPropertyItem texture_prop_items[] = {+            { SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, SDL_PROPERTY_TYPE_NUMBER, { .n = yuv_colorspace } },+            { SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, SDL_PROPERTY_TYPE_NUMBER, { .n = yuv_format } },+            { SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, SDL_PROPERTY_TYPE_NUMBER, { .n = SDL_TEXTUREACCESS_STREAMING } },+            { SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, SDL_PROPERTY_TYPE_NUMBER, { .n = original->w } },+            { SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, SDL_PROPERTY_TYPE_NUMBER, { .n = original->h } }+        };+        props = SDL_CreateTemporaryProperties(texture_prop_items, SDL_arraysize(texture_prop_items));+    }     output[2] = SDL_CreateTextureWithProperties(renderer, props);     SDL_DestroyProperties(props);     if (!output[0] || !output[1] || !output[2]) {

If following the rules for these objects (read-only, thread unsafe, etc), they could be used in other situations, as they can be used anywhere an SDL_PropertiesID is expected.

Fixes#14436.

@slouken
Copy link
Collaborator

Let's hold this for 3.6

icculus reacted with thumbs up emoji

@sloukenslouken added this to the3.6.0 milestoneNov 10, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

3.6.0

Development

Successfully merging this pull request may close these issues.

Proliferation & performance of SDL_properties

2 participants

@icculus@slouken

[8]ページ先頭

©2009-2025 Movatter.jp