[GPU] Another attempt to fix memleaks caused by depth_bias_slope_scaled
This commit is contained in:
parent
3d4bdc9023
commit
8c44649f01
|
@ -597,6 +597,19 @@ inline T sat_sub(T a, T b) {
|
|||
}
|
||||
return T(result);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T roundToNearestOrderOfMagnitude(T value) {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
const double order = std::pow(10, std::floor(std::log10(std::fabs(value))));
|
||||
const double rounded = std::round(value / order) * order;
|
||||
|
||||
return static_cast<T>(rounded);
|
||||
}
|
||||
|
||||
namespace divisors {
|
||||
union IDivExtraInfo {
|
||||
uint32_t value_;
|
||||
|
|
|
@ -95,6 +95,8 @@ void GetPreferredFacePolygonOffset(const RegisterFile& regs,
|
|||
!pa_su_sc_mode_cntl.cull_front) {
|
||||
scale = regs[XE_GPU_REG_PA_SU_POLY_OFFSET_FRONT_SCALE].f32;
|
||||
offset = regs[XE_GPU_REG_PA_SU_POLY_OFFSET_FRONT_OFFSET].f32;
|
||||
|
||||
scale = roundToNearestOrderOfMagnitude(scale);
|
||||
}
|
||||
if (pa_su_sc_mode_cntl.poly_offset_back_enable &&
|
||||
!pa_su_sc_mode_cntl.cull_back && !scale && !offset) {
|
||||
|
|
Loading…
Reference in New Issue