mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-19 15:09:57 +00:00
glasm: Add MS sampler types
This commit is contained in:
parent
5710e90150
commit
0f795603fc
2 changed files with 8 additions and 5 deletions
|
@ -279,6 +279,8 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
|
||||||
header += "OPTION NV_internal;"
|
header += "OPTION NV_internal;"
|
||||||
"OPTION NV_shader_storage_buffer;"
|
"OPTION NV_shader_storage_buffer;"
|
||||||
"OPTION NV_gpu_program_fp64;";
|
"OPTION NV_gpu_program_fp64;";
|
||||||
|
// TODO: Enable only when MS is used
|
||||||
|
header += "OPTION NV_texture_multisample;";
|
||||||
if (info.uses_int64_bit_atomics) {
|
if (info.uses_int64_bit_atomics) {
|
||||||
header += "OPTION NV_shader_atomic_int64;";
|
header += "OPTION NV_shader_atomic_int64;";
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ std::string Image(EmitContext& ctx, IR::TextureInstInfo info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view TextureType(IR::TextureInstInfo info) {
|
std::string_view TextureType(IR::TextureInstInfo info, bool is_ms = false) {
|
||||||
if (info.is_depth) {
|
if (info.is_depth) {
|
||||||
switch (info.type) {
|
switch (info.type) {
|
||||||
case TextureType::Color1D:
|
case TextureType::Color1D:
|
||||||
|
@ -88,9 +88,9 @@ std::string_view TextureType(IR::TextureInstInfo info) {
|
||||||
return "ARRAY1D";
|
return "ARRAY1D";
|
||||||
case TextureType::Color2D:
|
case TextureType::Color2D:
|
||||||
case TextureType::Color2DRect:
|
case TextureType::Color2DRect:
|
||||||
return "2D";
|
return is_ms ? "2DMS" : "2D";
|
||||||
case TextureType::ColorArray2D:
|
case TextureType::ColorArray2D:
|
||||||
return "ARRAY2D";
|
return is_ms ? "ARRAY2DMS" : "ARRAY2D";
|
||||||
case TextureType::Color3D:
|
case TextureType::Color3D:
|
||||||
return "3D";
|
return "3D";
|
||||||
case TextureType::ColorCube:
|
case TextureType::ColorCube:
|
||||||
|
@ -510,15 +510,16 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
|
||||||
const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms) {
|
const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms) {
|
||||||
const auto info{inst.Flags<IR::TextureInstInfo>()};
|
const auto info{inst.Flags<IR::TextureInstInfo>()};
|
||||||
const auto sparse_inst{PrepareSparse(inst)};
|
const auto sparse_inst{PrepareSparse(inst)};
|
||||||
|
const bool is_multisample{ms.type != Type::Void};
|
||||||
const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""};
|
const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""};
|
||||||
const std::string_view type{TextureType(info)};
|
const std::string_view type{TextureType(info, is_multisample)};
|
||||||
const std::string texture{Texture(ctx, info, index)};
|
const std::string texture{Texture(ctx, info, index)};
|
||||||
const std::string offset_vec{Offset(ctx, offset)};
|
const std::string offset_vec{Offset(ctx, offset)};
|
||||||
const auto [coord_vec, coord_alloc]{Coord(ctx, coord)};
|
const auto [coord_vec, coord_alloc]{Coord(ctx, coord)};
|
||||||
const Register ret{ctx.reg_alloc.Define(inst)};
|
const Register ret{ctx.reg_alloc.Define(inst)};
|
||||||
if (info.type == TextureType::Buffer) {
|
if (info.type == TextureType::Buffer) {
|
||||||
ctx.Add("TXF.F{} {},{},{},{}{};", sparse_mod, ret, coord_vec, texture, type, offset_vec);
|
ctx.Add("TXF.F{} {},{},{},{}{};", sparse_mod, ret, coord_vec, texture, type, offset_vec);
|
||||||
} else if (ms.type != Type::Void) {
|
} else if (is_multisample) {
|
||||||
ctx.Add("MOV.S {}.w,{};"
|
ctx.Add("MOV.S {}.w,{};"
|
||||||
"TXFMS.F{} {},{},{},{}{};",
|
"TXFMS.F{} {},{},{},{}{};",
|
||||||
coord_vec, ms, sparse_mod, ret, coord_vec, texture, type, offset_vec);
|
coord_vec, ms, sparse_mod, ret, coord_vec, texture, type, offset_vec);
|
||||||
|
|
Loading…
Reference in a new issue