Skip to content
Snippets Groups Projects

vkd3d-shader/msl: Implement Metal shader backend

Merged Feifan He requested to merge Feifan/vkd3d:msl-backend into master
3 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
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #include "vkd3d_shader_private.h"
20
21 int msl_compile(struct vsir_program *program, uint64_t config_flags,
22 const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
23 const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out,
24 struct vkd3d_shader_message_context *message_context)
25 {
26 // TODO
27 return VKD3D_OK;
  • Giovanni Mascellani
  • 45 struct vkd3d_shader_instruction_array instructions;
    46 struct vkd3d_shader_instruction *instruction;
    47 enum vkd3d_result ret = VKD3D_OK;
    48 struct vsir_program *program;
    49 void *code;
    50 int i;
    51
    52 program = gen->program;
    53 instructions = program->instructions;
    54
    55 for (i = 0; i < instructions.count && ret >= 0; ++i)
    56 {
    57 instruction = &instructions.elements[i];
    58 if ((ret = vkd3d_msl_handle_instruction(gen, instruction)) < 0)
    59 return ret;
    60 }
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on an outdated change in commit 8aaed51b
  • 38 struct vkd3d_msl_generator *gen, const struct vkd3d_shader_instruction *instruction)
    39 {
    40 return VKD3D_ERROR_NOT_IMPLEMENTED;
    41 }
    42
    43 static int vkd3d_msl_generator_generate(struct vkd3d_msl_generator *gen, struct vkd3d_shader_code *out)
    44 {
    45 struct vkd3d_shader_instruction_array instructions;
    46 struct vkd3d_shader_instruction *instruction;
    47 enum vkd3d_result ret = VKD3D_OK;
    48 struct vsir_program *program;
    49 void *code;
    50 int i;
    51
    52 program = gen->program;
    53 instructions = program->instructions;
  • Feifan He added 3 commits

    added 3 commits

    • e3490ce6 - vkd3d-shader/msl: Introduce VKD3D_SHADER_TARGET_MSL and msl_compile().
    • c962fa8f - vkd3d-shader/msl: Implement a framework of msl generator.
    • bdfaba2a - vkd3d-shader/ir: Keep structurized control flow for msl target.

    Compare with previous version

  • I think you should retain the msl_compile() function body you had in the first version of this MR. The only thing that it missed was returning the correct status code. My idea is that struct vkd3d_msl_generator should have a field like enum vkd3d_result result;, which is initially set to VKD3D_OK. Then vkd3d_msl_handle_instruction() sets it to VKD3D_ERROR_NOT_IMPLEMENTED as soon as it sees an instruction that is not implemented (which is, currently, any instruction), and then msl_compile() looks at that result to decide what to return. Once you start adding supported instruction, those won't set the result code (unless some other error happens), and incrementally programs start compiling when all their used instructions are supported.

  • Feifan He added 2 commits

    added 2 commits

    • 1197a449 - vkd3d-shader/msl: Implement a framework of msl generator.
    • 888f9027 - vkd3d-shader/ir: Keep structurized control flow for msl target.

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 46 commits

    added 46 commits

    • 888f9027...ab525f31 - 43 commits from branch wine:master
    • 23ba1a5e - vkd3d-shader: Introduce VKD3D_SHADER_TARGET_MSL.
    • 47981def - vkd3d-shader/msl: Generate comments for unhandled instructions.
    • 5df81049 - vkd3d-shader/msl: Call vsir_program_transform() before generating code.

    Compare with previous version

  • I ended up making some changes to this, including dropping some code that wasn't quite used yet. Please let me know if you have any questions or concerns about any of those changes.

  • Please register or sign in to reply
    Loading