Skip to content
Snippets Groups Projects

vkd3d-shader/glsl: Implement some instructions, part 14.

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
962 case VKD3D_SHADER_COMPONENT_INT:
963 vkd3d_string_buffer_printf(image_data, "ivec4(");
964 break;
965 default:
966 vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
967 "Internal compiler error: Unhandled component type %#x.", component_type);
968 /* fall through */
969 case VKD3D_SHADER_COMPONENT_FLOAT:
970 vkd3d_string_buffer_printf(image_data, "vec4(");
971 break;
972 }
973 }
974 shader_glsl_print_src(image_data, gen, &ins->src[1], VKD3DSP_WRITEMASK_ALL,
975 vkd3d_data_type_from_component_type(component_type));
976 if (ins->src[1].reg.dimension == VSIR_DIMENSION_SCALAR)
977 vkd3d_string_buffer_printf(image_data, ", 0, 0, 0)");
  • Comment on lines +976 to +977

    The reasoning here is that when the source is scalar we assume that the UAV type has a single component and the zeros are going to be dropped, but we need to write them anyway because GLSL wants them, right?

    BTW, you usually mark unsigned int constants with the suffix u, but not here. Not sure whether because you forgot it or because for zero you don't really care.

  • Please register or sign in to reply
  • Giovanni Mascellani approved this merge request

    approved this merge request

    • Author Maintainer

      The reasoning here is that when the source is scalar we assume that the UAV type has a single component and the zeros are going to be dropped, but we need to write them anyway because GLSL wants them, right?

      Pretty much, yes.

      BTW, you usually mark unsigned int constants with the suffix u, but not here. Not sure whether because you forgot it or because for zero you don't really care.

      In a certain sense the choice for signed zeroes arbitrary, but note that these zeroes are part of either a uvec4, a ivec4, or a vec4. We're deliberately using GLSL's implicit conversion rules here.

    • In a certain sense the choice for signed zeroes arbitrary, but note that these zeroes are part of either a uvec4, a ivec4, or a vec4. We're deliberately using GLSL's implicit conversion rules here.

      Sure, I have no objections on the code. I just wrote that note because I wasn't sure whether you wanted to keep some kind of style convention and had forgot or it was irrelevant for you.

    • Please register or sign in to reply
  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 18 commits

    added 18 commits

    • 3307cd78...080f25c5 - 13 commits from branch wine:master
    • 845d6f91 - vkd3d-shader/ir: Remove VKD3DSIH_DCL_UAV_TYPED instructions.
    • afb1a261 - vkd3d-shader/glsl: Use VKD3D_SHADER_ERROR_GLSL_UNSUPPORTED for unsupported CBV descriptor arrays.
    • 8e47ecbd - vkd3d-shader/glsl: Use the semantic index for shader_out_* declarations.
    • fb17ba18 - vkd3d-shader/glsl: Implement VKD3DSIH_STORE_UAV_TYPED.
    • bf71b137 - vkd3d-shader/glsl: Implement support for compute shaders.

    Compare with previous version

  • Please register or sign in to reply
    Loading