spirv: Handle small storage buffer loads on devices with no support
This commit is contained in:
		| @@ -952,13 +952,13 @@ void EmitContext::DefineStorageBuffers(const Info& info, u32& binding) { | |||||||
|  |  | ||||||
|     const IR::Type used_types{profile.support_descriptor_aliasing ? info.used_storage_buffer_types |     const IR::Type used_types{profile.support_descriptor_aliasing ? info.used_storage_buffer_types | ||||||
|                                                                   : IR::Type::U32}; |                                                                   : IR::Type::U32}; | ||||||
|     if (True(used_types & IR::Type::U8)) { |     if (profile.support_int8 && True(used_types & IR::Type::U8)) { | ||||||
|         DefineSsbos(*this, storage_types.U8, &StorageDefinitions::U8, info, binding, U8, |         DefineSsbos(*this, storage_types.U8, &StorageDefinitions::U8, info, binding, U8, | ||||||
|                     sizeof(u8)); |                     sizeof(u8)); | ||||||
|         DefineSsbos(*this, storage_types.S8, &StorageDefinitions::S8, info, binding, S8, |         DefineSsbos(*this, storage_types.S8, &StorageDefinitions::S8, info, binding, S8, | ||||||
|                     sizeof(u8)); |                     sizeof(u8)); | ||||||
|     } |     } | ||||||
|     if (True(used_types & IR::Type::U16)) { |     if (profile.support_int16 && True(used_types & IR::Type::U16)) { | ||||||
|         DefineSsbos(*this, storage_types.U16, &StorageDefinitions::U16, info, binding, U16, |         DefineSsbos(*this, storage_types.U16, &StorageDefinitions::U16, info, binding, U16, | ||||||
|                     sizeof(u16)); |                     sizeof(u16)); | ||||||
|         DefineSsbos(*this, storage_types.S16, &StorageDefinitions::S16, info, binding, S16, |         DefineSsbos(*this, storage_types.S16, &StorageDefinitions::S16, info, binding, S16, | ||||||
|   | |||||||
| @@ -124,7 +124,7 @@ void EmitWriteGlobal128(EmitContext& ctx, Id address, Id value) { | |||||||
| } | } | ||||||
|  |  | ||||||
| Id EmitLoadStorageU8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | Id EmitLoadStorageU8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | ||||||
|     if (ctx.profile.support_descriptor_aliasing) { |     if (ctx.profile.support_int8 && ctx.profile.support_descriptor_aliasing) { | ||||||
|         return ctx.OpUConvert(ctx.U32[1], |         return ctx.OpUConvert(ctx.U32[1], | ||||||
|                               LoadStorage(ctx, binding, offset, ctx.U8, ctx.storage_types.U8, |                               LoadStorage(ctx, binding, offset, ctx.U8, ctx.storage_types.U8, | ||||||
|                                           sizeof(u8), &StorageDefinitions::U8)); |                                           sizeof(u8), &StorageDefinitions::U8)); | ||||||
| @@ -135,7 +135,7 @@ Id EmitLoadStorageU8(EmitContext& ctx, const IR::Value& binding, const IR::Value | |||||||
| } | } | ||||||
|  |  | ||||||
| Id EmitLoadStorageS8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | Id EmitLoadStorageS8(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | ||||||
|     if (ctx.profile.support_descriptor_aliasing) { |     if (ctx.profile.support_int8 && ctx.profile.support_descriptor_aliasing) { | ||||||
|         return ctx.OpSConvert(ctx.U32[1], |         return ctx.OpSConvert(ctx.U32[1], | ||||||
|                               LoadStorage(ctx, binding, offset, ctx.S8, ctx.storage_types.S8, |                               LoadStorage(ctx, binding, offset, ctx.S8, ctx.storage_types.S8, | ||||||
|                                           sizeof(s8), &StorageDefinitions::S8)); |                                           sizeof(s8), &StorageDefinitions::S8)); | ||||||
| @@ -146,7 +146,7 @@ Id EmitLoadStorageS8(EmitContext& ctx, const IR::Value& binding, const IR::Value | |||||||
| } | } | ||||||
|  |  | ||||||
| Id EmitLoadStorageU16(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | Id EmitLoadStorageU16(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | ||||||
|     if (ctx.profile.support_descriptor_aliasing) { |     if (ctx.profile.support_int16 && ctx.profile.support_descriptor_aliasing) { | ||||||
|         return ctx.OpUConvert(ctx.U32[1], |         return ctx.OpUConvert(ctx.U32[1], | ||||||
|                               LoadStorage(ctx, binding, offset, ctx.U16, ctx.storage_types.U16, |                               LoadStorage(ctx, binding, offset, ctx.U16, ctx.storage_types.U16, | ||||||
|                                           sizeof(u16), &StorageDefinitions::U16)); |                                           sizeof(u16), &StorageDefinitions::U16)); | ||||||
| @@ -157,7 +157,7 @@ Id EmitLoadStorageU16(EmitContext& ctx, const IR::Value& binding, const IR::Valu | |||||||
| } | } | ||||||
|  |  | ||||||
| Id EmitLoadStorageS16(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | Id EmitLoadStorageS16(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset) { | ||||||
|     if (ctx.profile.support_descriptor_aliasing) { |     if (ctx.profile.support_int16 && ctx.profile.support_descriptor_aliasing) { | ||||||
|         return ctx.OpSConvert(ctx.U32[1], |         return ctx.OpSConvert(ctx.U32[1], | ||||||
|                               LoadStorage(ctx, binding, offset, ctx.S16, ctx.storage_types.S16, |                               LoadStorage(ctx, binding, offset, ctx.S16, ctx.storage_types.S16, | ||||||
|                                           sizeof(s16), &StorageDefinitions::S16)); |                                           sizeof(s16), &StorageDefinitions::S16)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user