diff options
| author | 2021-03-20 05:04:12 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:23 -0400 | |
| commit | f91859efd259995806c2944f7941b105b58300d3 (patch) | |
| tree | 489e587bcac6c0833c02378a106222c4db107c14 /src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp | |
| parent | shader: Implement ISCADD (imm) (diff) | |
| download | yuzu-f91859efd259995806c2944f7941b105b58300d3.tar.gz yuzu-f91859efd259995806c2944f7941b105b58300d3.tar.xz yuzu-f91859efd259995806c2944f7941b105b58300d3.zip | |
shader: Implement I2F
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp index 2aff673aa..757165626 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp | |||
| @@ -102,6 +102,14 @@ Id EmitConvertF64F32(EmitContext& ctx, Id value) { | |||
| 102 | return ctx.OpFConvert(ctx.F64[1], value); | 102 | return ctx.OpFConvert(ctx.F64[1], value); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | Id EmitConvertF16S8(EmitContext& ctx, Id value) { | ||
| 106 | return ctx.OpConvertSToF(ctx.F16[1], value); | ||
| 107 | } | ||
| 108 | |||
| 109 | Id EmitConvertF16S16(EmitContext& ctx, Id value) { | ||
| 110 | return ctx.OpConvertSToF(ctx.F16[1], value); | ||
| 111 | } | ||
| 112 | |||
| 105 | Id EmitConvertF16S32(EmitContext& ctx, Id value) { | 113 | Id EmitConvertF16S32(EmitContext& ctx, Id value) { |
| 106 | return ctx.OpConvertSToF(ctx.F16[1], value); | 114 | return ctx.OpConvertSToF(ctx.F16[1], value); |
| 107 | } | 115 | } |
| @@ -110,6 +118,14 @@ Id EmitConvertF16S64(EmitContext& ctx, Id value) { | |||
| 110 | return ctx.OpConvertSToF(ctx.F16[1], value); | 118 | return ctx.OpConvertSToF(ctx.F16[1], value); |
| 111 | } | 119 | } |
| 112 | 120 | ||
| 121 | Id EmitConvertF16U8(EmitContext& ctx, Id value) { | ||
| 122 | return ctx.OpConvertUToF(ctx.F16[1], value); | ||
| 123 | } | ||
| 124 | |||
| 125 | Id EmitConvertF16U16(EmitContext& ctx, Id value) { | ||
| 126 | return ctx.OpConvertUToF(ctx.F16[1], value); | ||
| 127 | } | ||
| 128 | |||
| 113 | Id EmitConvertF16U32(EmitContext& ctx, Id value) { | 129 | Id EmitConvertF16U32(EmitContext& ctx, Id value) { |
| 114 | return ctx.OpConvertUToF(ctx.F16[1], value); | 130 | return ctx.OpConvertUToF(ctx.F16[1], value); |
| 115 | } | 131 | } |
| @@ -118,6 +134,14 @@ Id EmitConvertF16U64(EmitContext& ctx, Id value) { | |||
| 118 | return ctx.OpConvertUToF(ctx.F16[1], value); | 134 | return ctx.OpConvertUToF(ctx.F16[1], value); |
| 119 | } | 135 | } |
| 120 | 136 | ||
| 137 | Id EmitConvertF32S8(EmitContext& ctx, Id value) { | ||
| 138 | return ctx.OpConvertSToF(ctx.F32[1], ctx.OpUConvert(ctx.U8, value)); | ||
| 139 | } | ||
| 140 | |||
| 141 | Id EmitConvertF32S16(EmitContext& ctx, Id value) { | ||
| 142 | return ctx.OpConvertSToF(ctx.F32[1], ctx.OpUConvert(ctx.U16, value)); | ||
| 143 | } | ||
| 144 | |||
| 121 | Id EmitConvertF32S32(EmitContext& ctx, Id value) { | 145 | Id EmitConvertF32S32(EmitContext& ctx, Id value) { |
| 122 | return ctx.OpConvertSToF(ctx.F32[1], value); | 146 | return ctx.OpConvertSToF(ctx.F32[1], value); |
| 123 | } | 147 | } |
| @@ -126,6 +150,14 @@ Id EmitConvertF32S64(EmitContext& ctx, Id value) { | |||
| 126 | return ctx.OpConvertSToF(ctx.F32[1], value); | 150 | return ctx.OpConvertSToF(ctx.F32[1], value); |
| 127 | } | 151 | } |
| 128 | 152 | ||
| 153 | Id EmitConvertF32U8(EmitContext& ctx, Id value) { | ||
| 154 | return ctx.OpConvertUToF(ctx.F32[1], ctx.OpUConvert(ctx.U8, value)); | ||
| 155 | } | ||
| 156 | |||
| 157 | Id EmitConvertF32U16(EmitContext& ctx, Id value) { | ||
| 158 | return ctx.OpConvertUToF(ctx.F32[1], ctx.OpUConvert(ctx.U16, value)); | ||
| 159 | } | ||
| 160 | |||
| 129 | Id EmitConvertF32U32(EmitContext& ctx, Id value) { | 161 | Id EmitConvertF32U32(EmitContext& ctx, Id value) { |
| 130 | return ctx.OpConvertUToF(ctx.F32[1], value); | 162 | return ctx.OpConvertUToF(ctx.F32[1], value); |
| 131 | } | 163 | } |
| @@ -134,6 +166,14 @@ Id EmitConvertF32U64(EmitContext& ctx, Id value) { | |||
| 134 | return ctx.OpConvertUToF(ctx.F32[1], value); | 166 | return ctx.OpConvertUToF(ctx.F32[1], value); |
| 135 | } | 167 | } |
| 136 | 168 | ||
| 169 | Id EmitConvertF64S8(EmitContext& ctx, Id value) { | ||
| 170 | return ctx.OpConvertSToF(ctx.F64[1], ctx.OpUConvert(ctx.U8, value)); | ||
| 171 | } | ||
| 172 | |||
| 173 | Id EmitConvertF64S16(EmitContext& ctx, Id value) { | ||
| 174 | return ctx.OpConvertSToF(ctx.F64[1], ctx.OpUConvert(ctx.U16, value)); | ||
| 175 | } | ||
| 176 | |||
| 137 | Id EmitConvertF64S32(EmitContext& ctx, Id value) { | 177 | Id EmitConvertF64S32(EmitContext& ctx, Id value) { |
| 138 | return ctx.OpConvertSToF(ctx.F64[1], value); | 178 | return ctx.OpConvertSToF(ctx.F64[1], value); |
| 139 | } | 179 | } |
| @@ -142,6 +182,14 @@ Id EmitConvertF64S64(EmitContext& ctx, Id value) { | |||
| 142 | return ctx.OpConvertSToF(ctx.F64[1], value); | 182 | return ctx.OpConvertSToF(ctx.F64[1], value); |
| 143 | } | 183 | } |
| 144 | 184 | ||
| 185 | Id EmitConvertF64U8(EmitContext& ctx, Id value) { | ||
| 186 | return ctx.OpConvertUToF(ctx.F64[1], ctx.OpUConvert(ctx.U8, value)); | ||
| 187 | } | ||
| 188 | |||
| 189 | Id EmitConvertF64U16(EmitContext& ctx, Id value) { | ||
| 190 | return ctx.OpConvertUToF(ctx.F64[1], ctx.OpUConvert(ctx.U16, value)); | ||
| 191 | } | ||
| 192 | |||
| 145 | Id EmitConvertF64U32(EmitContext& ctx, Id value) { | 193 | Id EmitConvertF64U32(EmitContext& ctx, Id value) { |
| 146 | return ctx.OpConvertUToF(ctx.F64[1], value); | 194 | return ctx.OpConvertUToF(ctx.F64[1], value); |
| 147 | } | 195 | } |