@@ -113,11 +113,12 @@ int32_t FloatToD3D11Fixed16p8(float f32) {
113
113
114
114
void GetHostViewportInfo (const RegisterFile& regs, float pixel_size_x,
115
115
float pixel_size_y, bool origin_bottom_left,
116
- float xy_max , bool allow_reverse_z,
116
+ float x_max, float y_max , bool allow_reverse_z,
117
117
ViewportInfo& viewport_info_out) {
118
118
assert_true (pixel_size_x >= 1 .0f );
119
119
assert_true (pixel_size_y >= 1 .0f );
120
- assert_true (xy_max >= 1 .0f );
120
+ assert_true (x_max >= 1 .0f );
121
+ assert_true (y_max >= 1 .0f );
121
122
122
123
// PA_CL_VTE_CNTL contains whether offsets and scales are enabled.
123
124
// http://www.x.org/docs/AMD/old/evergreen_3D_registers_v2.pdf
@@ -167,9 +168,9 @@ void GetHostViewportInfo(const RegisterFile& regs, float pixel_size_x,
167
168
// Keep the viewport in the positive quarter-plane for simplicity of
168
169
// clamping to the maximum supported bounds.
169
170
float cutoff_left = std::fmax (-viewport_left, 0 .0f );
170
- float cutoff_right = std::fmax (viewport_right - xy_max , 0 .0f );
171
+ float cutoff_right = std::fmax (viewport_right - x_max , 0 .0f );
171
172
viewport_left = std::fmax (viewport_left, 0 .0f );
172
- viewport_right = std::fmin (viewport_right, xy_max );
173
+ viewport_right = std::fmin (viewport_right, x_max );
173
174
viewport_width = viewport_right - viewport_left;
174
175
if (viewport_width > size_min) {
175
176
ndc_scale_x =
@@ -194,7 +195,7 @@ void GetHostViewportInfo(const RegisterFile& regs, float pixel_size_x,
194
195
// enabled, via the shader.
195
196
viewport_left = 0 .0f ;
196
197
viewport_width = std::min (
197
- float (xenos::kTexture2DCubeMaxWidthHeight ) * pixel_size_x, xy_max );
198
+ float (xenos::kTexture2DCubeMaxWidthHeight ) * pixel_size_x, x_max );
198
199
ndc_scale_x = (2 .0f * pixel_size_x) / viewport_width;
199
200
ndc_offset_x = viewport_offset_x * ndc_scale_x - 1 .0f ;
200
201
}
@@ -205,9 +206,9 @@ void GetHostViewportInfo(const RegisterFile& regs, float pixel_size_x,
205
206
viewport_top = viewport_offset_y * pixel_size_y - viewport_scale_y_abs;
206
207
float viewport_bottom = viewport_top + viewport_scale_y_abs * 2 .0f ;
207
208
float cutoff_top = std::fmax (-viewport_top, 0 .0f );
208
- float cutoff_bottom = std::fmax (viewport_bottom - xy_max , 0 .0f );
209
+ float cutoff_bottom = std::fmax (viewport_bottom - y_max , 0 .0f );
209
210
viewport_top = std::fmax (viewport_top, 0 .0f );
210
- viewport_bottom = std::fmin (viewport_bottom, xy_max );
211
+ viewport_bottom = std::fmin (viewport_bottom, y_max );
211
212
viewport_height = viewport_bottom - viewport_top;
212
213
if (viewport_height > size_min) {
213
214
ndc_scale_y =
@@ -227,7 +228,7 @@ void GetHostViewportInfo(const RegisterFile& regs, float pixel_size_x,
227
228
}
228
229
} else {
229
230
viewport_height = std::min (
230
- float (xenos::kTexture2DCubeMaxWidthHeight ) * pixel_size_y, xy_max );
231
+ float (xenos::kTexture2DCubeMaxWidthHeight ) * pixel_size_y, y_max );
231
232
ndc_scale_y = (2 .0f * pixel_size_y) / viewport_height;
232
233
ndc_offset_y = viewport_offset_y * ndc_scale_y - 1 .0f ;
233
234
}
0 commit comments