mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-27 08:37:07 +02:00
track nonuniform
This commit is contained in:
parent
12f9de00aa
commit
cbfdb6eb7c
2 changed files with 11 additions and 4 deletions
|
|
@ -195,10 +195,12 @@ Id Texture(EmitContext& ctx, IR::TextureInstInfo info, [[maybe_unused]] const IR
|
||||||
const TextureDefinition& def{ctx.textures.at(info.descriptor_index)};
|
const TextureDefinition& def{ctx.textures.at(info.descriptor_index)};
|
||||||
if (def.count > 1) {
|
if (def.count > 1) {
|
||||||
auto const idx = index.IsImmediate() ? ctx.Const(index.U32()) : ctx.Def(index);
|
auto const idx = index.IsImmediate() ? ctx.Const(index.U32()) : ctx.Def(index);
|
||||||
|
if (!ctx.non_uniform_ids.contains(idx) && IsNonUniformDescriptor(ctx, index)) {
|
||||||
|
ctx.Decorate(idx, spv::Decoration::NonUniform);
|
||||||
|
ctx.non_uniform_ids.insert(idx);
|
||||||
|
}
|
||||||
const Id pointer{ctx.OpAccessChain(def.pointer_type, def.id, idx)};
|
const Id pointer{ctx.OpAccessChain(def.pointer_type, def.id, idx)};
|
||||||
const Id object{ctx.OpLoad(def.sampled_type, pointer)};
|
const Id object{ctx.OpLoad(def.sampled_type, pointer)};
|
||||||
if (IsNonUniformDescriptor(ctx, index))
|
|
||||||
ctx.Decorate(idx, spv::Decoration::NonUniform);
|
|
||||||
return object;
|
return object;
|
||||||
} else {
|
} else {
|
||||||
return ctx.OpLoad(def.sampled_type, def.id);
|
return ctx.OpLoad(def.sampled_type, def.id);
|
||||||
|
|
@ -218,11 +220,13 @@ Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, const IR::Value& ind
|
||||||
const TextureDefinition& def{ctx.textures.at(info.descriptor_index)};
|
const TextureDefinition& def{ctx.textures.at(info.descriptor_index)};
|
||||||
if (def.count > 1) {
|
if (def.count > 1) {
|
||||||
auto const idx = index.IsImmediate() ? ctx.Const(index.U32()) : ctx.Def(index);
|
auto const idx = index.IsImmediate() ? ctx.Const(index.U32()) : ctx.Def(index);
|
||||||
|
if (!ctx.non_uniform_ids.contains(idx) && IsNonUniformDescriptor(ctx, index)) {
|
||||||
|
ctx.Decorate(idx, spv::Decoration::NonUniform);
|
||||||
|
ctx.non_uniform_ids.insert(idx);
|
||||||
|
}
|
||||||
const Id ptr = ctx.OpAccessChain(def.pointer_type, def.id, idx);
|
const Id ptr = ctx.OpAccessChain(def.pointer_type, def.id, idx);
|
||||||
const Id object = ctx.OpLoad(def.sampled_type, ptr);
|
const Id object = ctx.OpLoad(def.sampled_type, ptr);
|
||||||
const Id image = ctx.OpImage(def.image_type, object);
|
const Id image = ctx.OpImage(def.image_type, object);
|
||||||
if (IsNonUniformDescriptor(ctx, index))
|
|
||||||
ctx.Decorate(idx, spv::Decoration::NonUniform);
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
return ctx.OpImage(def.image_type, ctx.OpLoad(def.sampled_type, def.id));
|
return ctx.OpImage(def.image_type, ctx.OpLoad(def.sampled_type, def.id));
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include <sirit/sirit.h>
|
#include <sirit/sirit.h>
|
||||||
|
#include <ankerl/unordered_dense.h>
|
||||||
|
|
||||||
#include "shader_recompiler/backend/bindings.h"
|
#include "shader_recompiler/backend/bindings.h"
|
||||||
#include "shader_recompiler/frontend/ir/program.h"
|
#include "shader_recompiler/frontend/ir/program.h"
|
||||||
|
|
@ -366,6 +367,8 @@ public:
|
||||||
Id load_const_func_u32x2{};
|
Id load_const_func_u32x2{};
|
||||||
Id load_const_func_u32x4{};
|
Id load_const_func_u32x4{};
|
||||||
|
|
||||||
|
ankerl::unordered_dense::set<Id> non_uniform_ids;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DefineCommonTypes(const Info& info);
|
void DefineCommonTypes(const Info& info);
|
||||||
void DefineCommonConstants();
|
void DefineCommonConstants();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue