Skip to content
Snippets Groups Projects

vkd3d-shader: Implement scanning combined resource/sampler information.

Merged Henri Verbeet requested to merge hverbeet/vkd3d:for_upstream_0 into master
2 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
861 870 &semantic->resource.range, semantic->resource_type, VKD3D_SHADER_RESOURCE_DATA_FLOAT);
862 871 }
863 872
873 static void vkd3d_shader_scan_combined_sampler_usage(struct vkd3d_shader_scan_context *context,
874 const struct vkd3d_shader_register *resource, const struct vkd3d_shader_register *sampler)
875 {
876 struct vkd3d_shader_scan_combined_resource_sampler_info *info;
877 struct vkd3d_shader_combined_resource_sampler_info *s;
878 unsigned resource_space = 0, sampler_space = 0;
879 unsigned int resource_idx, sampler_idx, i;
880
881 if (!(info = context->combined_sampler_info))
882 return;
883
884 if (resource->type == VKD3DSPR_RESOURCE)
  • Giovanni Mascellani approved this merge request

    approved this merge request

    • Author Maintainer

      What could this be other than a resource register? And similarly for the sampler?

      For d3dbc sources, either VKD3DSPR_COMBINED_SAMPLER, or VKD3DSPR_TEXTURE before SM2. We may want to consider running this after normalise_combined_samplers() in the future, but at least for the moment that doesn't handle all texture instructions and shader models.

    • I think it would be useful to document this in the code with an assert(), or an if () WARN() if you don't like assert() enough.

    • Please register or sign in to reply
  • Alexandre Julliard approved this merge request

    approved this merge request

  • I'm currently out and haven't had a chance to properly look at this, but, how does this interact with resource arrays?

  • Author Maintainer

    I'm currently out and haven't had a chance to properly look at this, but, how does this interact with resource arrays?

    Resource arrays should work as long as they're not dynamically indexed. (And the ps_5_1 test exercises that path.) Dynamic indexing of resource arrays can't work with combined samplers; there's essentially no way to create the required combined samplers in either the OpenGL or Vulkan APIs, and it's not clear what that would even look like.

    There's perhaps an unresolved question of how to handle that if we do run into it in the scanner. The current behaviour is to return the base index for such accesses; an argument could be made for either not recording them at all, or e.g. setting some flag in the vkd3d_shader_combined_resource_sampler_info structure to indicate dynamic indexing is involved. Ultimately such shaders just aren't going to be usable with combined samplers though.

  • Makes sense. I'd mostly just advocate for documenting the answer in some form, even if that's "this function gives undefined results if dynamically indexed resource arrays are used". It's true that's not very useful to the consumer, though.

  • Please register or sign in to reply
    Loading