Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4().

Merged Nikolay Sivov requested to merge nsivov/vkd3d:d3dcolor_to_ubyte4 into master
5 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
3295 struct hlsl_type *arg_type = arg->data_type;
3296 struct hlsl_ir_swizzle *swizzle;
3297 struct hlsl_ir_constant *c;
3298
3299 if (arg_type->class != HLSL_CLASS_VECTOR || arg_type->dimx != 4)
3300 {
3301 struct vkd3d_string_buffer *string;
3302
3303 if ((string = hlsl_type_to_string(ctx, arg_type)))
3304 {
3305 hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Wrong argument type '%s'.", string->buffer);
3306 hlsl_release_string_buffer(ctx, string);
3307 }
3308
3309 return false;
3310 }
  • Giovanni Mascellani
  • 7 [test]
    8 uniform 0 float4 -0.5 6.5 7.5 3.4
    9 draw quad
    10 probe all rgba (0.0, 6.0, 7.0, 3.0) 4
    11 uniform 0 float4 -1.5 6.5 7.5 3.4
    12 draw quad
    13 probe all rgba (-1.0, 6.0, 7.0, 3.0) 4
    14
    15 [pixel shader]
    16 float4 main(uniform float4 u) : sv_target
    17 {
    18 float a = trunc(u.r);
    19 int2 b = trunc(u.gb);
    20 float4 res = float4(b, a, u.a);
    21 return floor(res);
    22 }
    • Comment on lines +15 to +22

      I wonder what's the reason for such a complicated test. It seems that the tests for floor() already had something like that, but I don't completely understand what's the value.

    • Yeah, I didn't notice this for floor(), but I don't understand what this is proving?

    • Author Developer

      I think I took it from round() tests. If you mean what does calling floor/trunc/round on a result from floor/trunc/round, I don't know. Other calls were probably for scalar and shorter vectors.

    • I don't think I'd miss these tests if they were dropped, but I don't think they're going to harm us either.

    • Please register or sign in to reply
  • Nikolay Sivov added 2 commits

    added 2 commits

    • a3686bbb - vkd3d-shader/hlsl: Partially implement trunc().
    • a52f5d7a - vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4() function.

    Compare with previous version

  • Elizabeth Figura
    Elizabeth Figura @zfigura started a thread on commit a52f5d7a
  • 1 [require]
    2 shader model >= 4.0
    3
  • 3312 3312 if (!(arg = intrinsic_float_convert_arg(ctx, params, arg, loc)))
    3313 3313 return false;
    3314 3314
    3315 if (!(c = hlsl_new_constant(ctx, hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, 4), loc)))
    3316 return false;
    3317 c->value[0].f = 255.001953f;
    3318 c->value[1].f = 255.001953f;
    3319 c->value[2].f = 255.001953f;
    3320 c->value[3].f = 255.001953f;
    3321 list_add_tail(params->instrs, &c->node.entry);
    3315 if (arg_type->class == HLSL_CLASS_SCALAR)
    3316 {
    3317 if (!(c = hlsl_new_float_constant(ctx, 255.001953f, loc)))
    3318 return false;
    3319 list_add_tail(params->instrs, &c->node.entry);
  • Giovanni Mascellani approved this merge request

    approved this merge request

    • +        if (!(c = hlsl_new_constant(ctx, hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, 4), loc)))
      +            return false;
      +        c->value[0].f = 255.001953f;
      +        c->value[1].f = 255.001953f;
      +        c->value[2].f = 255.001953f;
      +        c->value[3].f = 255.001953f;

      "255.001953f" doesn't seem quite as readable/obvious as e.g. "255.0f + (0.5f / 256.0f)".

    • Author Developer

      Sure, pushed that as well.

    • Please register or sign in to reply
  • Nikolay Sivov added 1 commit

    added 1 commit

    • 472ecb6e - vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4() function.

    Compare with previous version

  • Nikolay Sivov added 16 commits

    added 16 commits

    • 472ecb6e...0ce55e8b - 14 commits from branch wine:master
    • b394af0f - vkd3d-shader/hlsl: Partially implement trunc().
    • 990ee75b - vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4() function.

    Compare with previous version

  • Nikolay Sivov added 27 commits

    added 27 commits

    • 990ee75b...8e0df3f7 - 25 commits from branch wine:master
    • 560f5350 - vkd3d-shader/hlsl: Partially implement trunc().
    • 3c777a65 - vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4() function.

    Compare with previous version

  • Elizabeth Figura approved this merge request

    approved this merge request

  • Nikolay Sivov added 15 commits

    added 15 commits

    • 3c777a65...af4bb037 - 13 commits from branch wine:master
    • f58c040b - vkd3d-shader/hlsl: Partially implement trunc().
    • 34e4ba59 - vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4() function.

    Compare with previous version

  • 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