vkd3d-shader/msl: Implement Metal shader backend
Merge request reports
Activity
- libs/vkd3d-shader/msl.c 0 → 100644
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; changed this line in version 2 of the diff
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 } 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; changed this line in version 2 of the diff
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 thatstruct vkd3d_msl_generator
should have a field likeenum vkd3d_result result;
, which is initially set toVKD3D_OK
. Thenvkd3d_msl_handle_instruction()
sets it toVKD3D_ERROR_NOT_IMPLEMENTED
as soon as it sees an instruction that is not implemented (which is, currently, any instruction), and thenmsl_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.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.
Toggle commit list-
888f9027...ab525f31 - 43 commits from branch