mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-26 17:27:06 +02:00
track nonuniform
This commit is contained in:
parent
7eb6c8306e
commit
42ee161dc3
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)};
|
||||
if (def.count > 1) {
|
||||
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 object{ctx.OpLoad(def.sampled_type, pointer)};
|
||||
if (IsNonUniformDescriptor(ctx, index))
|
||||
ctx.Decorate(idx, spv::Decoration::NonUniform);
|
||||
return object;
|
||||
} else {
|
||||
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)};
|
||||
if (def.count > 1) {
|
||||
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 object = ctx.OpLoad(def.sampled_type, ptr);
|
||||
const Id image = ctx.OpImage(def.image_type, object);
|
||||
if (IsNonUniformDescriptor(ctx, index))
|
||||
ctx.Decorate(idx, spv::Decoration::NonUniform);
|
||||
return image;
|
||||
}
|
||||
return ctx.OpImage(def.image_type, ctx.OpLoad(def.sampled_type, def.id));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <array>
|
||||
|
||||
#include <sirit/sirit.h>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
#include "shader_recompiler/backend/bindings.h"
|
||||
#include "shader_recompiler/frontend/ir/program.h"
|
||||
|
|
@ -366,6 +367,8 @@ public:
|
|||
Id load_const_func_u32x2{};
|
||||
Id load_const_func_u32x4{};
|
||||
|
||||
ankerl::unordered_dense::set<Id> non_uniform_ids;
|
||||
|
||||
private:
|
||||
void DefineCommonTypes(const Info& info);
|
||||
void DefineCommonConstants();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue