forked from suyu/suyu
texture_pass: Refactor texture handle retrieval
This commit is contained in:
parent
40e7d78179
commit
9bb429999e
1 changed files with 7 additions and 7 deletions
|
@ -355,21 +355,21 @@ TextureInst MakeInst(Environment& env, IR::Block* block, IR::Inst& inst) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureType ReadTextureType(Environment& env, const ConstBufferAddr& cbuf) {
|
u32 GetTextureHandle(Environment& env, const ConstBufferAddr& cbuf) {
|
||||||
const u32 secondary_index{cbuf.has_secondary ? cbuf.secondary_index : cbuf.index};
|
const u32 secondary_index{cbuf.has_secondary ? cbuf.secondary_index : cbuf.index};
|
||||||
const u32 secondary_offset{cbuf.has_secondary ? cbuf.secondary_offset : cbuf.offset};
|
const u32 secondary_offset{cbuf.has_secondary ? cbuf.secondary_offset : cbuf.offset};
|
||||||
const u32 lhs_raw{env.ReadCbufValue(cbuf.index, cbuf.offset) << cbuf.shift_left};
|
const u32 lhs_raw{env.ReadCbufValue(cbuf.index, cbuf.offset) << cbuf.shift_left};
|
||||||
const u32 rhs_raw{env.ReadCbufValue(secondary_index, secondary_offset)
|
const u32 rhs_raw{env.ReadCbufValue(secondary_index, secondary_offset)
|
||||||
<< cbuf.secondary_shift_left};
|
<< cbuf.secondary_shift_left};
|
||||||
return env.ReadTextureType(lhs_raw | rhs_raw);
|
return lhs_raw | rhs_raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureType ReadTextureType(Environment& env, const ConstBufferAddr& cbuf) {
|
||||||
|
return env.ReadTextureType(GetTextureHandle(env, cbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturePixelFormat ReadTexturePixelFormat(Environment& env, const ConstBufferAddr& cbuf) {
|
TexturePixelFormat ReadTexturePixelFormat(Environment& env, const ConstBufferAddr& cbuf) {
|
||||||
const u32 secondary_index{cbuf.has_secondary ? cbuf.secondary_index : cbuf.index};
|
return env.ReadTexturePixelFormat(GetTextureHandle(env, cbuf));
|
||||||
const u32 secondary_offset{cbuf.has_secondary ? cbuf.secondary_offset : cbuf.offset};
|
|
||||||
const u32 lhs_raw{env.ReadCbufValue(cbuf.index, cbuf.offset)};
|
|
||||||
const u32 rhs_raw{env.ReadCbufValue(secondary_index, secondary_offset)};
|
|
||||||
return env.ReadTexturePixelFormat(lhs_raw | rhs_raw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Descriptors {
|
class Descriptors {
|
||||||
|
|
Loading…
Reference in a new issue