s/Tungsten Graphics/VMware/
[mesa.git] / src / mesa / drivers / dri / i965 / brw_curbe.c
index 8f196f4830b8136993fa4f6a7d5305ebb71ef598..9e556fb6361822d81a566a2b9f1bd5f82feafdb2 100644 (file)
@@ -1,8 +1,8 @@
 /*
  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
- Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
+ Intel funded Tungsten Graphics to
  develop this 3D driver.
+
  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
  "Software"), to deal in the Software without restriction, including
  distribute, sublicense, and/or sell copies of the Software, and to
  permit persons to whom the Software is furnished to do so, subject to
  the following conditions:
+
  The above copyright notice and this permission notice (including the
  next paragraph) shall be included in all copies or substantial
  portions of the Software.
+
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
  **********************************************************************/
  /*
   * Authors:
-  *   Keith Whitwell <keith@tungstengraphics.com>
+  *   Keith Whitwell <keithw@vmware.com>
   */
 
 
  */
 static void calculate_curbe_offsets( struct brw_context *brw )
 {
-   struct gl_context *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->ctx;
    /* CACHE_NEW_WM_PROG */
    const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
-   
+
    /* BRW_NEW_VERTEX_PROGRAM */
-   const GLuint nr_vp_regs = (brw->vs.prog_data->nr_params + 15) / 16;
+   const GLuint nr_vp_regs = (brw->vs.prog_data->base.nr_params + 15) / 16;
    GLuint nr_clip_regs = 0;
    GLuint total_regs;
 
@@ -88,7 +88,7 @@ static void calculate_curbe_offsets( struct brw_context *brw )
     * the fragment and vertex program
     * api's.  It's not clear what happens
     * when both VP and FP want to use 128
-    * parameters, though. 
+    * parameters, though.
     */
    assert(total_regs <= 32);
 
@@ -102,7 +102,7 @@ static void calculate_curbe_offsets( struct brw_context *brw )
 
       GLuint reg = 0;
 
-      /* Calculate a new layout: 
+      /* Calculate a new layout:
        */
       reg = 0;
       brw->curbe.wm_start = reg;
@@ -146,8 +146,6 @@ const struct brw_tracked_state brw_curbe_offsets = {
  */
 void brw_upload_cs_urb_state(struct brw_context *brw)
 {
-   struct intel_context *intel = &brw->intel;
-
    BEGIN_BATCH(2);
    /* It appears that this is the state packet for the CS unit, ie. the
     * urb entries detailed here are housed in the CS range from the
@@ -182,8 +180,7 @@ static GLfloat fixed_plane[6][4] = {
 static void
 brw_upload_constant_buffer(struct brw_context *brw)
 {
-   struct intel_context *intel = &brw->intel;
-   struct gl_context *ctx = &intel->ctx;
+   struct gl_context *ctx = &brw->ctx;
    const GLuint sz = brw->curbe.total_size;
    const GLuint bufsz = sz * 16 * sizeof(GLfloat);
    GLfloat *buf;
@@ -207,15 +204,7 @@ brw_upload_constant_buffer(struct brw_context *brw)
       }
    }
 
-
-   /* When using the old VS backend, the clipplanes are actually delivered to
-    * both CLIP and VS units.  VS uses them to calculate the outcode bitmasks.
-    *
-    * When using the new VS backend, it is responsible for setting up its own
-    * clipplane constants if it needs them.  This results in a slight waste of
-    * of curbe space, but the advantage is that the new VS backend can use its
-    * general-purpose uniform layout code to store the clipplanes.
-    */
+   /* clipper constants */
    if (brw->curbe.clip_size) {
       GLuint offset = brw->curbe.clip_start * 16;
       GLuint j;
@@ -248,13 +237,13 @@ brw_upload_constant_buffer(struct brw_context *brw)
    if (brw->curbe.vs_size) {
       GLuint offset = brw->curbe.vs_start * 16;
 
-      for (i = 0; i < brw->vs.prog_data->nr_params; i++) {
-         buf[offset + i] = *brw->vs.prog_data->param[i];
+      for (i = 0; i < brw->vs.prog_data->base.nr_params; i++) {
+         buf[offset + i] = *brw->vs.prog_data->base.param[i];
       }
    }
 
    if (0) {
-      for (i = 0; i < sz*16; i+=4) 
+      for (i = 0; i < sz*16; i+=4)
         printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
                buf[i+0], buf[i+1], buf[i+2], buf[i+3]);
 
@@ -288,7 +277,7 @@ brw_upload_constant_buffer(struct brw_context *brw)
         /* Allocate a single page for CURBE entries for this batchbuffer.
          * They're generally around 64b.
          */
-        brw->curbe.curbe_bo = drm_intel_bo_alloc(brw->intel.bufmgr, "CURBE",
+        brw->curbe.curbe_bo = drm_intel_bo_alloc(brw->bufmgr, "CURBE",
                                                  4096, 1 << 6);
         brw->curbe.curbe_next_offset = 0;
         drm_intel_gem_bo_map_gtt(brw->curbe.curbe_bo);
@@ -334,12 +323,6 @@ emit:
    ADVANCE_BATCH();
 }
 
-/* This tracked state is unique in that the state it monitors varies
- * dynamically depending on the parameters tracked by the fragment and
- * vertex programs.  This is the template used as a starting point,
- * each context will maintain a copy of this internally and update as
- * required.
- */
 const struct brw_tracked_state brw_constant_buffer = {
    .dirty = {
       .mesa = _NEW_PROGRAM_CONSTANTS,
@@ -349,7 +332,7 @@ const struct brw_tracked_state brw_constant_buffer = {
               BRW_NEW_PSP | /* Implicit - hardware requires this, not used above */
               BRW_NEW_CURBE_OFFSETS |
               BRW_NEW_BATCH),
-      .cache = (CACHE_NEW_WM_PROG) 
+      .cache = (CACHE_NEW_WM_PROG)
    },
    .emit = brw_upload_constant_buffer,
 };