Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Implement SampleBias().

Merged Nikolay Sivov requested to merge nsivov/vkd3d:samplebias into master
4 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
3842 struct vkd3d_string_buffer *string;
3844 3843
3845 if (!(load = hlsl_new_resource_load(ctx, &load_params, loc)))
3846 return false;
3847 list_add_tail(instrs, &load->node.entry);
3848 return true;
3844 if ((string = hlsl_type_to_string(ctx, object_type)))
3845 hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
3846 "Type '%s' does not have methods.", string->buffer);
3847 hlsl_release_string_buffer(ctx, string);
3848 return false;
3849 }
3850
3851 if (!strcmp(name, "Load")
3852 && object_type->sampler_dim != HLSL_SAMPLER_DIM_CUBE
3853 && object_type->sampler_dim != HLSL_SAMPLER_DIM_CUBEARRAY)
  • Comment on lines +3852 to +3853

    Not necessarily for this MR since it's pre-existing, just a comment: here I'd prefer a positive logic for choosing which object types are allowed, much like Gather. Also I wouldn't dislike some more systematic organization like intrinsic_functions.

  • Author Developer

    I'd move type checks in the helpers first. For function pointers, I don't know if it matters. Anyway, this is unrelated.

  • Please register or sign in to reply
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on an outdated change in commit f89e581c
  • 3831 3831 return true;
    3832 3832 }
    3833 3833
    3834 static bool add_sample_bias_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *object,
    3835 const char *name, const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on an outdated change in commit f89e581c
  • 3832 3832 }
    3833 3833
    3834 static bool add_sample_bias_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *object,
    3835 const char *name, const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
    3836 {
    3837 const struct hlsl_type *object_type = object->data_type;
    3838 struct hlsl_resource_load_params load_params = {.type = HLSL_RESOURCE_SAMPLE_LOD_BIAS};
    3839 const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
    3840 const unsigned int offset_dim = hlsl_offset_dim_count(object_type->sampler_dim);
    3841 const struct hlsl_type *sampler_type;
    3842 struct hlsl_ir_resource_load *load;
    3843
    3844 if (params->args_count < 3 || params->args_count > 4 + !!offset_dim)
    3845 {
    3846 hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
    3847 "Wrong number of arguments to method 'SampleLevel': expected from 3 to %u, but got %u.",
  • Nikolay Sivov added 1 commit

    added 1 commit

    • 2687c07e - vkd3d-shader/hlsl: Implement SampleBias() method.

    Compare with previous version

  • Nikolay Sivov added 1 commit

    added 1 commit

    • c543dfbc - vkd3d-shader/hlsl: Implement SampleBias() method.

    Compare with previous version

  • Elizabeth Figura approved this merge request

    approved this merge request

  • The documentation says that the bias value should be a floating-point number between -16.0 and 15.99. When the value is constant, the native compiler checks for this and clamps the value. I don't think this is important enough to block the request.

  • Francisco Casas approved this merge request

    approved this merge request

  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on commit c543dfbc
  • 3873 3878 && object_type->sampler_dim != HLSL_SAMPLER_DIM_2DMS
    3874 3879 && object_type->sampler_dim != HLSL_SAMPLER_DIM_2DMSARRAY)
    3875 3880 {
    3876 return add_sample_level_method_call(ctx, instrs, object, name, params, loc);
    3881 return add_sample_lod_method_call(ctx, instrs, object, name, params, loc);
    3882 }
    3883 else if (!strcmp(name, "SampleBias")
    3884 && object_type->sampler_dim != HLSL_SAMPLER_DIM_2DMS
    3885 && object_type->sampler_dim != HLSL_SAMPLER_DIM_2DMSARRAY)
    3886 {
    3887 return add_sample_lod_method_call(ctx, instrs, object, name, params, loc);
  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Alexandre Julliard added 13 commits

    added 13 commits

    • c543dfbc...4fe4784e - 11 commits from branch wine:master
    • c166ab97 - vkd3d-shader/hlsl: Add separate helpers to generate object methods.
    • af4bb037 - vkd3d-shader/hlsl: Implement SampleBias() method.

    Compare with previous version

  • Please register or sign in to reply
    Loading