Skip to content

Conversation

@Hymenium
Copy link

@Hymenium Hymenium commented Oct 20, 2025

Following #52 and #50, this PR updates sokol_gp to the latest sokol headers and migrates image usage to the new views API with minimal changes.

What's changed:

  • Sokol headers (/thirdparty/) : Updated to current Sokol master (floooh/sokol@8c06b5e) .
  • Images -> Views: API now expects texture views instead of raw images. As before, views (and images) must be managed by the caller. Checks and asserts follow the current style.
  • Helper: Added sgp_make_texture_view_from_image() to create a simple 2D texture view from an image.
  • Sizing: View size is computed using the view (mip base considered for future-proofing).
  • Internals: Using public sokol functions for image size, but the previous _sg_lookup_image path is left in comments for reference.
  • Samples: Updated samples that used images to use views. Everything tested compiles and seem to run as expected on Windows (11) using GLCORE or D3D11 (HTML sample not tested).

Breaking changes:

  • Functions that previous took sg_image now expect sg_view.
  • For covenience: sg_view v = sgp_make_texture_view_from_image(img, label); and v can be passed to the new API.

Rationale:
Aligns sokol_gp with the new views API, without taking on managing the views internally.

Testing:

  • Platform: Windows 11
  • Backends: GLCORE, D3D11
  • Status: All samples run as expected (except sample-shell.html not tested).

Documentation:
Not updated in this PR. Migration is straightforward (replace images with views), and the new helper can be recommend for most existing workflows

Migration example:
Before:
sg_image img = ...;
sgp_set_image(ch, image);

After:
sg_image img = ...;
sg_view view = sgp_make_texture_view_from_image(img, "label");
sgp_set_view(ch, view);

@Hymenium
Copy link
Author

This PR should solve the issues in #51 and #53.

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.

1 participant