*/
void svga_surfaces_flush(struct svga_context *svga)
{
+ struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
unsigned i;
/* Emit buffered drawing commands.
/* Emit back-copy from render target view to texture.
*/
- for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ for (i = 0; i < svgascreen->max_color_buffers; i++) {
if (svga->curr.framebuffer.cbufs[i])
svga_propagate_surface(svga, svga->curr.framebuffer.cbufs[i]);
}
#include "util/u_inlines.h"
#include "svga_context.h"
+#include "svga_screen.h"
#include "svga_surface.h"
void svga_cleanup_framebuffer(struct svga_context *svga)
{
+ struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
struct pipe_framebuffer_state *curr = &svga->curr.framebuffer;
struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer;
- int i;
+ unsigned i;
- for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ for (i = 0; i < svgascreen->max_color_buffers; i++) {
pipe_surface_reference(&curr->cbufs[i], NULL);
pipe_surface_reference(&hw->cbufs[i], NULL);
}
case PIPE_CAP_TGSI_TEXCOORD:
return 0;
case PIPE_CAP_MAX_RENDER_TARGETS:
- /* The SVGA3D device always supports 4 targets at this time, regardless
- * of what querying SVGA3D_DEVCAP_MAX_RENDER_TARGETS might return.
- */
- return 4;
+ return svgascreen->max_color_buffers;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
case PIPE_CAP_QUERY_TIME_ELAPSED:
svgascreen->maxPointSize = MIN2(result.f, 80.0f);
}
+ /* The SVGA3D device always supports 4 targets at this time, regardless
+ * of what querying SVGA3D_DEVCAP_MAX_RENDER_TARGETS might return.
+ */
+ svgascreen->max_color_buffers = 4;
+
pipe_mutex_init(svgascreen->tex_mutex);
pipe_mutex_init(svgascreen->swc_mutex);
SVGA3dHardwareVersion hw_version;
float maxPointSize;
+ unsigned max_color_buffers;
struct {
boolean force_level_surface_view;
#include "svga_state.h"
#include "svga_cmd.h"
#include "svga_debug.h"
+#include "svga_screen.h"
/*
emit_framebuffer( struct svga_context *svga,
unsigned dirty )
{
+ struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
const struct pipe_framebuffer_state *curr = &svga->curr.framebuffer;
struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer;
boolean reemit = svga->rebind.rendertargets;
* dirty, to ensure that the resources are paged in.
*/
- for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) {
+ 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)
enum pipe_error
svga_reemit_framebuffer_bindings(struct svga_context *svga)
{
+ struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer;
unsigned i;
enum pipe_error ret;
assert(svga->rebind.rendertargets);
- for (i = 0; i < MIN2(PIPE_MAX_COLOR_BUFS, 8); ++i) {
+ 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]);
if (ret != PIPE_OK) {
void
svga_mark_surfaces_dirty(struct svga_context *svga)
{
+ struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
unsigned i;
- for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ for (i = 0; i < svgascreen->max_color_buffers; i++) {
if (svga->curr.framebuffer.cbufs[i])
svga_mark_surface_dirty(svga->curr.framebuffer.cbufs[i]);
}