OSDN Git Service

Merge freedesktop/master into otc-private/master
[android-x86/external-mesa.git] / src / gallium / drivers / freedreno / a2xx / fd2_rasterizer.c
@@ -1,7 +1,7 @@
 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
 
 /*
- * Copyright (C) 2012 Rob Clark <robclark@freedesktop.org>
+ * Copyright (C) 2012-2013 Rob Clark <robclark@freedesktop.org>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 #include "util/u_string.h"
 #include "util/u_memory.h"
 
-#include "freedreno_rasterizer.h"
-#include "freedreno_context.h"
-#include "freedreno_util.h"
+#include "fd2_rasterizer.h"
+#include "fd2_context.h"
+#include "fd2_util.h"
 
 
-static enum adreno_pa_su_sc_draw
-polygon_mode(unsigned mode)
-{
-       switch (mode) {
-       case PIPE_POLYGON_MODE_POINT:
-               return PC_DRAW_POINTS;
-       case PIPE_POLYGON_MODE_LINE:
-               return PC_DRAW_LINES;
-       case PIPE_POLYGON_MODE_FILL:
-               return PC_DRAW_TRIANGLES;
-       default:
-               DBG("invalid polygon mode: %u", mode);
-               return 0;
-       }
-}
-
-static void *
-fd_rasterizer_state_create(struct pipe_context *pctx,
+void *
+fd2_rasterizer_state_create(struct pipe_context *pctx,
                const struct pipe_rasterizer_state *cso)
 {
-       struct fd_rasterizer_stateobj *so;
+       struct fd2_rasterizer_stateobj *so;
        float psize_min, psize_max;
 
-       so = CALLOC_STRUCT(fd_rasterizer_stateobj);
+       so = CALLOC_STRUCT(fd2_rasterizer_stateobj);
        if (!so)
                return NULL;
 
@@ -97,8 +81,8 @@ fd_rasterizer_state_create(struct pipe_context *pctx,
 
        so->pa_su_sc_mode_cntl =
                A2XX_PA_SU_SC_MODE_CNTL_VTX_WINDOW_OFFSET_ENABLE |
-               A2XX_PA_SU_SC_MODE_CNTL_FRONT_PTYPE(polygon_mode(cso->fill_front)) |
-               A2XX_PA_SU_SC_MODE_CNTL_BACK_PTYPE(polygon_mode(cso->fill_back));
+               A2XX_PA_SU_SC_MODE_CNTL_FRONT_PTYPE(fd_polygon_mode(cso->fill_front)) |
+               A2XX_PA_SU_SC_MODE_CNTL_BACK_PTYPE(fd_polygon_mode(cso->fill_back));
 
        if (cso->cull_face & PIPE_FACE_FRONT)
                so->pa_su_sc_mode_cntl |= A2XX_PA_SU_SC_MODE_CNTL_CULL_FRONT;
@@ -127,25 +111,3 @@ fd_rasterizer_state_create(struct pipe_context *pctx,
 
        return so;
 }
-
-static void
-fd_rasterizer_state_bind(struct pipe_context *pctx, void *hwcso)
-{
-       struct fd_context *ctx = fd_context(pctx);
-       ctx->rasterizer = hwcso;
-       ctx->dirty |= FD_DIRTY_RASTERIZER;
-}
-
-static void
-fd_rasterizer_state_delete(struct pipe_context *pctx, void *hwcso)
-{
-       FREE(hwcso);
-}
-
-void
-fd_rasterizer_init(struct pipe_context *pctx)
-{
-       pctx->create_rasterizer_state = fd_rasterizer_state_create;
-       pctx->bind_rasterizer_state = fd_rasterizer_state_bind;
-       pctx->delete_rasterizer_state = fd_rasterizer_state_delete;
-}