* We need to reemit non-null surface bindings, even when they are not
* dirty, to ensure that the resources are paged in.
*/
-
+
for (i = 0; i < svgascreen->max_color_buffers; i++) {
if (curr->cbufs[i] != hw->cbufs[i] ||
(reemit && hw->cbufs[i])) {
if (svga->curr.nr_fbs++ > MAX_RT_PER_BATCH)
return PIPE_ERROR_OUT_OF_MEMORY;
- ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, curr->cbufs[i]);
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i,
+ curr->cbufs[i]);
if (ret != PIPE_OK)
return ret;
-
+
pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]);
}
}
-
if (curr->zsbuf != hw->zsbuf ||
(reemit && hw->zsbuf)) {
ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_DEPTH, curr->zsbuf);
if (curr->zsbuf &&
curr->zsbuf->format == PIPE_FORMAT_S8_UINT_Z24_UNORM) {
- ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, curr->zsbuf);
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL,
+ curr->zsbuf);
if (ret != PIPE_OK)
return ret;
}
if (ret != PIPE_OK)
return ret;
}
-
+
pipe_surface_reference(&hw->zsbuf, curr->zsbuf);
}
for (i = 0; i < svgascreen->max_color_buffers; i++) {
if (hw->cbufs[i]) {
- ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, hw->cbufs[i]);
+ ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i,
+ hw->cbufs[i]);
if (ret != PIPE_OK) {
return ret;
}
}
-struct svga_tracked_state svga_hw_framebuffer =
+struct svga_tracked_state svga_hw_framebuffer =
{
"hw framebuffer state",
SVGA_NEW_FRAME_BUFFER,
-/***********************************************************************
+/***********************************************************************
*/
static enum pipe_error
float fx = viewport->scale[0] * -1.0f + viewport->translate[0];
float fy = flip * viewport->scale[1] * -1.0f + viewport->translate[1];
- float fw = viewport->scale[0] * 2.0f;
- float fh = flip * viewport->scale[1] * 2.0f;
+ float fw = viewport->scale[0] * 2.0f;
+ float fh = flip * viewport->scale[1] * 2.0f;
memset( &prescale, 0, sizeof(prescale) );
prescale.translate[3] = 0;
prescale.enabled = TRUE;
-
-
if (fw < 0) {
prescale.scale[0] *= -1.0f;
prescale.translate[0] += -fw;
fw = -fw;
- fx = viewport->scale[0] * 1.0f + viewport->translate[0];
+ fx = viewport->scale[0] * 1.0f + viewport->translate[0];
}
if (fh < 0.0) {
if (fx < 0) {
prescale.translate[0] += fx;
- prescale.scale[0] *= fw / (fw + fx);
+ prescale.scale[0] *= fw / (fw + fx);
fw += fx;
fx = 0.0f;
}
else {
prescale.translate[1] += fy;
}
- prescale.scale[1] *= fh / (fh + fy);
+ prescale.scale[1] *= fh / (fh + fy);
fh += fy;
fy = 0.0f;
}
if (fx + fw > fb_width) {
- prescale.scale[0] *= fw / (fb_width - fx);
+ prescale.scale[0] *= fw / (fb_width - fx);
prescale.translate[0] -= fx * (fw / (fb_width - fx));
prescale.translate[0] += fx;
fw = fb_width - fx;
-
}
if (fy + fh > fb_height) {
goto out;
}
-
/* D3D viewport is integer space. Convert fx,fy,etc. to
* integers.
*
rect.w,
rect.h);
-
/* Finally, to get GL rasterization rules, need to tweak the
* screen-space coordinates slightly relative to D3D which is
* what hardware implements natively.
prescale.scale[2] = 0.5; /* D3D clip space */
}
-
range_min = viewport->scale[2] * -1.0f + viewport->translate[2];
range_max = viewport->scale[2] * 1.0f + viewport->translate[2];
*/
if (range_min > range_max) {
float range_tmp;
- range_tmp = range_min;
- range_min = range_max;
+ range_tmp = range_min;
+ range_min = range_max;
range_max = range_tmp;
- prescale.scale[2] = -prescale.scale[2];
+ prescale.scale[2] = -prescale.scale[2];
}
if (prescale.enabled) {
/* Adjust prescale to take into account the fact that it is
* going to be applied prior to the perspective divide and
* viewport transformation.
- *
+ *
* Vwin = H(Vc/Vc.w) + J
*
* We want to tweak Vwin with scale and translation from above,
}
if (svga->state.hw_clear.depthrange.zmin != range_min ||
- svga->state.hw_clear.depthrange.zmax != range_max)
- {
+ svga->state.hw_clear.depthrange.zmax != range_max) {
ret = SVGA3D_SetZRange(svga->swc, range_min, range_max );
if(ret != PIPE_OK)
return ret;
}
-struct svga_tracked_state svga_hw_viewport =
+struct svga_tracked_state svga_hw_viewport =
{
"hw viewport state",
( SVGA_NEW_FRAME_BUFFER |
rect.y = scissor->miny;
rect.w = scissor->maxx - scissor->minx; /* + 1 ?? */
rect.h = scissor->maxy - scissor->miny; /* + 1 ?? */
-
+
return SVGA3D_SetScissorRect(svga->swc, &rect);
}
-struct svga_tracked_state svga_hw_scissor =
+struct svga_tracked_state svga_hw_scissor =
{
"hw scissor state",
SVGA_NEW_SCISSOR,
}
-struct svga_tracked_state svga_hw_clip_planes =
+struct svga_tracked_state svga_hw_clip_planes =
{
"hw viewport state",
SVGA_NEW_CLIP,