mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-18 01:14:56 +00:00
shader_recompiler: Small instruction parsing refactor/bugfixes (#340)
* translator: Implemtn f32 to f16 convert * shader_recompiler: Add bit instructions * shader_recompiler: More data share instructions * shader_recompiler: Remove exec contexts, fix S_MOV_B64 * shader_recompiler: Split instruction parsing into categories * shader_recompiler: Better BFS search * shader_recompiler: Constant propagation pass for cmp_class_f32 * shader_recompiler: Partial readfirstlane implementation * shader_recompiler: Stub readlane/writelane only for non-compute * hack: Fix swizzle on RDR * Will properly fix this when merging this * clang format * address_space: Bump user area size to full * shader_recompiler: V_INTERP_MOV_F32 * Should work the same as spirv will emit flat decoration on demand * kernel: Add MAP_OP_MAP_FLEXIBLE * image_view: Attempt to apply storage swizzle on format * vk_scheduler: Barrier attachments on renderpass end * clang format * liverpool: cs state backup * shader_recompiler: More instructions and formats * vector_alu: Proper V_MBCNT_U32_B32 * shader_recompiler: Port some dark souls things * file_system: Implement sceKernelRename * more formats * clang format * resource_tracking_pass: Back to assert * translate: Tracedata * kernel: Remove tracy lock * Solves random crashes in Dark Souls * code: Review comments
This commit is contained in:
parent
ac6dc20c3b
commit
a7c9bfa5c5
66 changed files with 1349 additions and 904 deletions
|
@ -75,7 +75,7 @@ struct Buffer {
|
|||
static_assert(sizeof(Buffer) == 16); // 128bits
|
||||
|
||||
enum class ImageType : u64 {
|
||||
Buffer = 0,
|
||||
Invalid = 0,
|
||||
Color1D = 8,
|
||||
Color2D = 9,
|
||||
Color3D = 10,
|
||||
|
@ -88,8 +88,8 @@ enum class ImageType : u64 {
|
|||
|
||||
constexpr std::string_view NameOf(ImageType type) {
|
||||
switch (type) {
|
||||
case ImageType::Buffer:
|
||||
return "Buffer";
|
||||
case ImageType::Invalid:
|
||||
return "Invalid";
|
||||
case ImageType::Color1D:
|
||||
return "Color1D";
|
||||
case ImageType::Color2D:
|
||||
|
@ -179,6 +179,40 @@ struct Image {
|
|||
return base_address << 8;
|
||||
}
|
||||
|
||||
u32 DstSelect() const {
|
||||
return dst_sel_x | (dst_sel_y << 3) | (dst_sel_z << 6) | (dst_sel_w << 9);
|
||||
}
|
||||
|
||||
static char SelectComp(u32 sel) {
|
||||
switch (sel) {
|
||||
case 0:
|
||||
return '0';
|
||||
case 1:
|
||||
return '1';
|
||||
case 4:
|
||||
return 'R';
|
||||
case 5:
|
||||
return 'G';
|
||||
case 6:
|
||||
return 'B';
|
||||
case 7:
|
||||
return 'A';
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
std::string DstSelectName() const {
|
||||
std::string result = "[";
|
||||
u32 dst_sel = DstSelect();
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
result += SelectComp(dst_sel & 7);
|
||||
dst_sel >>= 3;
|
||||
}
|
||||
result += ']';
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 Pitch() const {
|
||||
return pitch + 1;
|
||||
}
|
||||
|
@ -290,6 +324,7 @@ enum class BorderColor : u64 {
|
|||
// Table 8.12 Sampler Resource Definition
|
||||
struct Sampler {
|
||||
union {
|
||||
u64 raw0;
|
||||
BitField<0, 3, ClampMode> clamp_x;
|
||||
BitField<3, 3, ClampMode> clamp_y;
|
||||
BitField<6, 3, ClampMode> clamp_z;
|
||||
|
@ -309,6 +344,7 @@ struct Sampler {
|
|||
BitField<60, 4, u64> perf_z;
|
||||
};
|
||||
union {
|
||||
u64 raw1;
|
||||
BitField<0, 14, u64> lod_bias;
|
||||
BitField<14, 6, u64> lod_bias_sec;
|
||||
BitField<20, 2, Filter> xy_mag_filter;
|
||||
|
@ -323,6 +359,10 @@ struct Sampler {
|
|||
BitField<62, 2, BorderColor> border_color_type;
|
||||
};
|
||||
|
||||
operator bool() const noexcept {
|
||||
return raw0 != 0 || raw1 != 0;
|
||||
}
|
||||
|
||||
float LodBias() const noexcept {
|
||||
return static_cast<float>(static_cast<int16_t>((lod_bias.Value() ^ 0x2000u) - 0x2000u)) /
|
||||
256.0f;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue