Skip to content
Snippets Groups Projects

hlsl: Some fixes caught by Wine tests.

Merged Elizabeth Figura requested to merge zfigura/vkd3d:pr7 into master
1 unresolved thread

Merge request reports

Checking pipeline status.

Approved by

Merged by Alexandre JulliardAlexandre Julliard 1 year ago (Aug 2, 2023 12:24pm UTC)

Merge details

  • Changes merged into master with 9a80ff28.
  • Did not delete the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
2455 2454
2456 2455 put_u32(&buffer, D3DSIO_END);
2457 2456
2458 if (!(ret = buffer.status))
2457 if (buffer.status)
2458 ctx->result = buffer.status;
2459
2460 if (!ctx->result)
2459 2461 {
2460 2462 out->code = buffer.data;
2461 2463 out->size = buffer.size;
2462 2464 }
2463 return ret;
2465 return ctx->result;
  • Comment on lines -2458 to +2465

    Wouldn't we be leaking buffer.data in case ctx->result != 0, but buffer.status = 0 ?

  • Author Developer

    Wouldn't we be leaking buffer.data in case ctx->result != 0, but buffer.status = 0 ?

    Yes, in fact we're leaking it either way; if allocation fails the existing memory is not freed, so this was already a problem. I'll add a patch to fix it.

  • Please register or sign in to reply
  • Elizabeth Figura added 3 commits

    added 3 commits

    • 2f7f2ea9 - vkd3d-shader/d3dbc: Free vkd3d_bytecode_buffer data on failure.
    • 49ee10f3 - vkd3d-shader/d3dbc: Return ctx->result from hlsl_sm1_write().
    • df291572 - vkd3d-shader/tpf: Check buffer->status in add_section().

    Compare with previous version

  • Francisco Casas approved this merge request

    approved this merge request

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • @@ -2627,7 +2627,8 @@ bool hlsl_sm4_usage_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_semant
         return true;
     }
     
    -static void add_section(struct dxbc_writer *dxbc, uint32_t tag, struct vkd3d_bytecode_buffer *buffer)
    +static void add_section(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc,
    +        uint32_t tag, struct vkd3d_bytecode_buffer *buffer)
     {
         /* Native D3DDisassemble() expects at least the sizes of the ISGN and OSGN
          * sections to be aligned. Without this, the sections themselves will be
    @@ -2635,6 +2636,9 @@ static void add_section(struct dxbc_writer *dxbc, uint32_t tag, struct vkd3d_byt
         size_t size = bytecode_align(buffer);
     
         dxbc_writer_add_section(dxbc, tag, buffer->data, size);
    +
    +    if (buffer->status < 0)
    +        ctx->result = buffer->status;
     }
     
     static void write_sm4_signature(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc, bool output)

    I'll approve this, but I don't think this is quite right; ultimately we'd like to push hlsl_ctx out of e.g. write_sm4_shdr(), instead of into things like add_section().

  • Henri Verbeet approved this merge request

    approved this merge request

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading