diff options
| author | 2021-06-11 01:11:59 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:35 -0400 | |
| commit | d52bacf6f035ddbc4b2333953709cbd3993e4817 (patch) | |
| tree | 3390a1bd1ae6ade6d3f5029d5e54223da51eb6b4 /src/shader_recompiler/backend | |
| parent | spirv/convert: Catch more broken signed operations on Nvidia OpenGL (diff) | |
| download | yuzu-d52bacf6f035ddbc4b2333953709cbd3993e4817.tar.gz yuzu-d52bacf6f035ddbc4b2333953709cbd3993e4817.tar.xz yuzu-d52bacf6f035ddbc4b2333953709cbd3993e4817.zip | |
spirv/convert: Catch more signed operations oversights
The sign bit on integers of size < 32 was not properly preserved in casts
Diffstat (limited to 'src/shader_recompiler/backend')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp index 2c4250a0c..fd42b7a16 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp | |||
| @@ -17,14 +17,14 @@ Id ExtractU16(EmitContext& ctx, Id value) { | |||
| 17 | 17 | ||
| 18 | Id ExtractS16(EmitContext& ctx, Id value) { | 18 | Id ExtractS16(EmitContext& ctx, Id value) { |
| 19 | if (ctx.profile.support_int16) { | 19 | if (ctx.profile.support_int16) { |
| 20 | return ctx.OpUConvert(ctx.S16, value); | 20 | return ctx.OpSConvert(ctx.S16, value); |
| 21 | } else { | 21 | } else { |
| 22 | return ctx.OpBitFieldSExtract(ctx.U32[1], value, ctx.u32_zero_value, ctx.Const(16u)); | 22 | return ctx.OpBitFieldSExtract(ctx.U32[1], value, ctx.u32_zero_value, ctx.Const(16u)); |
| 23 | } | 23 | } |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | Id ExtractU8(EmitContext& ctx, Id value) { | 26 | Id ExtractU8(EmitContext& ctx, Id value) { |
| 27 | if (ctx.profile.support_int16) { | 27 | if (ctx.profile.support_int8) { |
| 28 | return ctx.OpUConvert(ctx.U8, value); | 28 | return ctx.OpUConvert(ctx.U8, value); |
| 29 | } else { | 29 | } else { |
| 30 | return ctx.OpBitFieldUExtract(ctx.U32[1], value, ctx.u32_zero_value, ctx.Const(8u)); | 30 | return ctx.OpBitFieldUExtract(ctx.U32[1], value, ctx.u32_zero_value, ctx.Const(8u)); |
| @@ -42,7 +42,7 @@ Id ExtractS8(EmitContext& ctx, Id value) { | |||
| 42 | 42 | ||
| 43 | Id EmitConvertS16F16(EmitContext& ctx, Id value) { | 43 | Id EmitConvertS16F16(EmitContext& ctx, Id value) { |
| 44 | if (ctx.profile.support_int16) { | 44 | if (ctx.profile.support_int16) { |
| 45 | return ctx.OpUConvert(ctx.U32[1], ctx.OpConvertFToS(ctx.U16, value)); | 45 | return ctx.OpSConvert(ctx.U32[1], ctx.OpConvertFToS(ctx.U16, value)); |
| 46 | } else { | 46 | } else { |
| 47 | return ExtractS16(ctx, ctx.OpConvertFToS(ctx.U32[1], value)); | 47 | return ExtractS16(ctx, ctx.OpConvertFToS(ctx.U32[1], value)); |
| 48 | } | 48 | } |
| @@ -50,7 +50,7 @@ Id EmitConvertS16F16(EmitContext& ctx, Id value) { | |||
| 50 | 50 | ||
| 51 | Id EmitConvertS16F32(EmitContext& ctx, Id value) { | 51 | Id EmitConvertS16F32(EmitContext& ctx, Id value) { |
| 52 | if (ctx.profile.support_int16) { | 52 | if (ctx.profile.support_int16) { |
| 53 | return ctx.OpUConvert(ctx.U32[1], ctx.OpConvertFToS(ctx.U16, value)); | 53 | return ctx.OpSConvert(ctx.U32[1], ctx.OpConvertFToS(ctx.U16, value)); |
| 54 | } else { | 54 | } else { |
| 55 | return ExtractS16(ctx, ctx.OpConvertFToS(ctx.U32[1], value)); | 55 | return ExtractS16(ctx, ctx.OpConvertFToS(ctx.U32[1], value)); |
| 56 | } | 56 | } |
| @@ -58,7 +58,7 @@ Id EmitConvertS16F32(EmitContext& ctx, Id value) { | |||
| 58 | 58 | ||
| 59 | Id EmitConvertS16F64(EmitContext& ctx, Id value) { | 59 | Id EmitConvertS16F64(EmitContext& ctx, Id value) { |
| 60 | if (ctx.profile.support_int16) { | 60 | if (ctx.profile.support_int16) { |
| 61 | return ctx.OpUConvert(ctx.U32[1], ctx.OpConvertFToS(ctx.U16, value)); | 61 | return ctx.OpSConvert(ctx.U32[1], ctx.OpConvertFToS(ctx.U16, value)); |
| 62 | } else { | 62 | } else { |
| 63 | return ExtractS16(ctx, ctx.OpConvertFToS(ctx.U32[1], value)); | 63 | return ExtractS16(ctx, ctx.OpConvertFToS(ctx.U32[1], value)); |
| 64 | } | 64 | } |