Skip to content
Snippets Groups Projects

vkd3d-shader/fx: Add support for parsing fx_2_0 sampler states.

Merged Nikolay Sivov requested to merge nsivov/vkd3d:fx_2_text_5 into master
1 unresolved thread

Signed-off-by: Nikolay Sivov nsivov@codeweavers.com

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
  • Nikolay Sivov mentioned in merge request !1417 (closed)

    mentioned in merge request !1417 (closed)

    • @@ -3820,8 +3905,11 @@ static void fx_parse_fx_2_technique(struct fx_parser *parser)
               parse_fx_start_indent(parser);
               for (uint32_t j = 0; j < pass.assignment_count; ++j)
               {
      +            struct fx_assignment entry;
      +
                   parse_fx_print_indent(parser);
      -            fx_parse_fx_2_assignment(parser);
      +            fx_parser_read_u32s(parser, &entry, sizeof(entry));
      +            fx_parse_fx_2_assignment(parser, &entry);
               }
               parse_fx_end_indent(parser);
       

      That seems like a bit of a separate change.

      +static void fx_2_parse_shader_blob(struct fx_parser *parser, const void *data, uint32_t data_size)

      fx_2_parse_shader_blob() looks pretty similar to fx_4_parse_shader_blob(), except for the source type, and the fact that fx_4_parse_shader_blob() does free "output".

      +static void fx_parse_fx_2_array_selector(struct fx_parser *parser, const uint8_t *data, uint32_t size)
      +{
      +    uint32_t name_size = 0, blob_size = 0;
      +    const char *name = NULL;
      +    const void *blob = NULL;
      +
      +    if (size > 4)
      +    {
      +        name_size = *(uint32_t *)data;
      +        size -= 4;
      +        name = (const char *)(data + 4);
      +        if (name_size <= size) size -= name_size;
      +    }
      +
      +    if (size)
      +    {
      +        blob = data + name_size + 4;
      +        blob_size = size;
      +    }
      +
      +    vkd3d_string_buffer_printf(&parser->buffer, "array \"%.*s\"\n", name_size, name);
      +    parse_fx_print_indent(parser);
      +    vkd3d_string_buffer_printf(&parser->buffer, "selector blob size %u\n", blob_size);
      +    fx_dump_blob(parser, blob, blob_size);
      +}

      Do the sizes here need bounds checking? Does the name string potentially need escaping?

    • Author Developer

      That seems like a bit of a separate change.

      Sure.

      fx_2_parse_shader_blob() looks pretty similar to fx_4_parse_shader_blob(), except for the source type, and the fact that fx_4_parse_shader_blob() does free "output".

      Yes, that should be reusable.

      Do the sizes here need bounds checking?

      The data structure here is:

      • overall size u32 ** string size u32 ** string data ** blob

      Earlier it's verified that 'data' is accessible up to 'size'. But I agree it's not looking great, probably I could use reading helpers here directly (I wanted to skip(size) for all cases uniformly).

      Does the name string potentially need escaping?

      In a sense of non-printable/control characters? I wouldn't bother unless we have a helper ready for that, because this string is a variable name, if it requires escaping than something is wrong.

    • Please register or sign in to reply
  • Do the sizes here need bounds checking?

    The data structure here is:

    • overall size u32 ** string size u32 ** string data ** blob

    Earlier it's verified that 'data' is accessible up to 'size'. But I agree it's not looking great, probably I could use reading helpers here directly (I wanted to skip(size) for all cases uniformly).

    But we don't verify that "name_size" is within the bounds of "data", right? Also, I don't think we verify that fx_parser_get_ptr() actually gave us a non-NULL "data" pointer?

    Does the name string potentially need escaping?

    In a sense of non-printable/control characters? I wouldn't bother unless we have a helper ready for that, because this string is a variable name, if it requires escaping than something is wrong.

    Yes, but that doesn't prevent anyone from constructing such input. We have spirv_parser_print_string_literal() in spirv.c that's probably close enough to what we'd want to do here.

  • Author Developer

    But we don't verify that "name_size" is within the bounds of "data", right?

    Why not? It's part of the 'data' and 'size' could be anything.

  • Nikolay Sivov added 38 commits

    added 38 commits

    • 6f506d37...a4f58be0 - 32 commits from branch wine:master
    • 82780450 - vkd3d-shader/fx: Add a helper to escape printed strings.
    • e9b397ae - vkd3d-shader/fx: Read fx_2_0 assignment data outside of its dumping helper.
    • 2f23890b - vkd3d-shader/fx: Add support for parsing fx_2_0 sampler states.
    • 5c34c660 - vkd3d-shader/fx: Add support for dumping fx_2_0 shader blobs.
    • b7b7fda1 - vkd3d-shader/fx: Dump complex state values blobs for fx_2_0.
    • 1729d5a7 - vkd3d-shader/fx: Support dumping parameter and array selector assignments for fx_2_0.

    Compare with previous version

  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 8 commits

    added 8 commits

    • 1729d5a7...fc4316f6 - 2 commits from branch wine:master
    • fb5d53bf - vkd3d-shader/fx: Add a helper to escape printed strings.
    • 3e864840 - vkd3d-shader/fx: Read fx_2_0 assignment data outside of its dumping helper.
    • 36e1a0ce - vkd3d-shader/fx: Add support for parsing fx_2_0 sampler states.
    • fb16ae23 - vkd3d-shader/fx: Add support for dumping fx_2_0 shader blobs.
    • ff759117 - vkd3d-shader/fx: Dump complex state value blobs for fx_2_0.
    • ba798903 - vkd3d-shader/fx: Support dumping parameter and array selector assignments for fx_2_0.

    Compare with previous version

  • merged

Please register or sign in to reply
Loading