Merge branch 'main' into ime-fixes-again

This commit is contained in:
Valdis Bogdāns 2026-02-02 23:41:11 +02:00 committed by GitHub
commit fef9912088
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 20 deletions

View File

@ -14,12 +14,6 @@
namespace Libraries::Kernel { namespace Libraries::Kernel {
constexpr int PthreadInheritSched = 4;
constexpr int ORBIS_KERNEL_PRIO_FIFO_DEFAULT = 700;
constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 256;
constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 767;
extern PthreadAttr PthreadAttrDefault; extern PthreadAttr PthreadAttrDefault;
void _thread_cleanupspecific(); void _thread_cleanupspecific();
@ -231,7 +225,7 @@ int PS4_SYSV_ABI posix_pthread_create_name_np(PthreadT* thread, const PthreadAtt
new_thread->attr = *(*attr); new_thread->attr = *(*attr);
new_thread->attr.cpusetsize = 0; new_thread->attr.cpusetsize = 0;
} }
if (new_thread->attr.sched_inherit == PthreadInheritSched) { if (curthread != nullptr && new_thread->attr.sched_inherit == PthreadInheritSched) {
if (True(curthread->attr.flags & PthreadAttrFlags::ScopeSystem)) { if (True(curthread->attr.flags & PthreadAttrFlags::ScopeSystem)) {
new_thread->attr.flags |= PthreadAttrFlags::ScopeSystem; new_thread->attr.flags |= PthreadAttrFlags::ScopeSystem;
} else { } else {

View File

@ -24,6 +24,12 @@ class SymbolsResolver;
namespace Libraries::Kernel { namespace Libraries::Kernel {
constexpr int PthreadInheritSched = 4;
constexpr int ORBIS_KERNEL_PRIO_FIFO_DEFAULT = 700;
constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 256;
constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 767;
struct Pthread; struct Pthread;
enum class PthreadMutexFlags : u32 { enum class PthreadMutexFlags : u32 {

View File

@ -24,9 +24,9 @@ static constexpr std::array<PthreadPrio, 3> ThrPriorities = {{
}}; }};
PthreadAttr PthreadAttrDefault = { PthreadAttr PthreadAttrDefault = {
.sched_policy = SchedPolicy::Fifo, .sched_policy = SchedPolicy::Other,
.sched_inherit = 0, .sched_inherit = PthreadInheritSched,
.prio = 0, .prio = ORBIS_KERNEL_PRIO_FIFO_DEFAULT,
.suspend = false, .suspend = false,
.flags = PthreadAttrFlags::ScopeSystem, .flags = PthreadAttrFlags::ScopeSystem,
.stackaddr_attr = nullptr, .stackaddr_attr = nullptr,

View File

@ -564,13 +564,12 @@ void EmitContext::DefineVertexBlock() {
const bool needs_clip_distance_emulation = l_stage == LogicalStage::Vertex && const bool needs_clip_distance_emulation = l_stage == LogicalStage::Vertex &&
stage == Stage::Vertex && stage == Stage::Vertex &&
profile.needs_clip_distance_emulation; profile.needs_clip_distance_emulation;
if (!needs_clip_distance_emulation) { const auto has_clip_distance_outputs = info.stores.GetAny(IR::Attribute::ClipDistance);
if (info.stores.GetAny(IR::Attribute::ClipDistance)) { if (has_clip_distance_outputs && !needs_clip_distance_emulation) {
const Id type{TypeArray(F32[1], ConstU32(8U))}; const Id type{TypeArray(F32[1], ConstU32(8U))};
const Id initializer{ConstantComposite(type, zero)}; const Id initializer{ConstantComposite(type, zero)};
clip_distances = DefineVariable(type, spv::BuiltIn::ClipDistance, clip_distances = DefineVariable(type, spv::BuiltIn::ClipDistance, spv::StorageClass::Output,
spv::StorageClass::Output, initializer); initializer);
}
} }
if (info.stores.GetAny(IR::Attribute::CullDistance)) { if (info.stores.GetAny(IR::Attribute::CullDistance)) {
const Id type{TypeArray(F32[1], ConstU32(8U))}; const Id type{TypeArray(F32[1], ConstU32(8U))};
@ -603,7 +602,9 @@ void EmitContext::DefineOutputs() {
Name(output_attr_array, "out_attrs"); Name(output_attr_array, "out_attrs");
} }
} else { } else {
const auto has_clip_distance_outputs = info.stores.GetAny(IR::Attribute::ClipDistance); const bool needs_clip_distance_emulation =
stage == Stage::Vertex && profile.needs_clip_distance_emulation &&
info.stores.GetAny(IR::Attribute::ClipDistance);
u32 num_attrs = 0u; u32 num_attrs = 0u;
for (u32 i = 0; i < IR::NumParams; i++) { for (u32 i = 0; i < IR::NumParams; i++) {
const IR::Attribute param{IR::Attribute::Param0 + i}; const IR::Attribute param{IR::Attribute::Param0 + i};
@ -612,14 +613,14 @@ void EmitContext::DefineOutputs() {
} }
const u32 num_components = info.stores.NumComponents(param); const u32 num_components = info.stores.NumComponents(param);
const Id id{ const Id id{
DefineOutput(F32[num_components], i + (has_clip_distance_outputs ? 1 : 0))}; DefineOutput(F32[num_components], i + (needs_clip_distance_emulation ? 1 : 0))};
Name(id, fmt::format("out_attr{}", i)); Name(id, fmt::format("out_attr{}", i));
output_params[i] = output_params[i] =
GetAttributeInfo(AmdGpu::NumberFormat::Float, id, num_components, true); GetAttributeInfo(AmdGpu::NumberFormat::Float, id, num_components, true);
++num_attrs; ++num_attrs;
} }
if (has_clip_distance_outputs) { if (needs_clip_distance_emulation) {
clip_distances = Id{DefineOutput(F32[MaxEmulatedClipDistances], 0)}; clip_distances = Id{DefineOutput(F32[MaxEmulatedClipDistances], 0)};
output_params[num_attrs] = GetAttributeInfo( output_params[num_attrs] = GetAttributeInfo(
AmdGpu::NumberFormat::Float, clip_distances, MaxEmulatedClipDistances, true); AmdGpu::NumberFormat::Float, clip_distances, MaxEmulatedClipDistances, true);

View File

@ -1015,6 +1015,10 @@ bool Rasterizer::IsMapped(VAddr addr, u64 size) {
// There is no memory, so not mapped. // There is no memory, so not mapped.
return false; return false;
} }
if (static_cast<u64>(addr) > std::numeric_limits<u64>::max() - size) {
// Memory range wrapped the address space, cannot be mapped.
return false;
}
const auto range = decltype(mapped_ranges)::interval_type::right_open(addr, addr + size); const auto range = decltype(mapped_ranges)::interval_type::right_open(addr, addr + size);
Common::RecursiveSharedLock lock{mapped_ranges_mutex}; Common::RecursiveSharedLock lock{mapped_ranges_mutex};