Skip to content

vkd3d-shader/tpf: Replace sm4 register structs with vkd3d-shader register structs, part 1.

Francisco Casas requested to merge fcasas/vkd3d:use_vkd3d_reg_part into master

Recap:

I implemented relative addressing in !229 (closed), but I was suggested to handle register indexes by moving all the registers to the heap, which I did in my nonconst-offsets-6 branch. A part of this implementation required !269 (closed), but I was asked to try to turn the sm4 register structs into the vkd3d-shader register structs instead, to get closer to a common low level IR.

This is the first part of that transformation. The whole thing is in my use_vkd3d_reg_4 branch.

This is built on top of !225 (merged) (the first two patches), so it may be good to get that upstream first.


This patch series aims to do the following replacements:

struct sm4_register -> struct vkd3d_shader_register
struct sm4_dst_register -> struct vkd3d_shader_dst_param
struct sm4_src_register -> struct vkd3d_shader_src_param

to get us closer to a common level IR and simplify the implementation of relative-addressing.

To achieve this, the fields in the sm4 register structs are replaced with fields in the vkd3d-shader structs or removed altogether, one at the time.

As can be seen when looking at the whole branch, it is possible to do this transformation without having to add additional fields to struct vkd3d_shader_register, by restricting each register type to a single enum vkd3d_sm4_dimension (and its src registers to a single enum vkd3d_sm4_swizzle_type) by default.

The only exception we need so far is for sampler registers: They always have dimension NONE, except when used as arguments of gather instructions, in which case they have dimension VEC4 and SCALAR swizzle. This, and similar exceptions we may find in the future, can be handled using the opcode_info, as in 7/8 81e17506.

Edited by Francisco Casas

Merge request reports

Loading