gallium: add flags parameter to pipe_screen::context_create
[mesa.git] / src / gallium / tests / graw / tri-instanced.c
index 55bc3a551da1cf56864acffb06cca18154f77ec9..2065c11f68de7155e7c8d5dacd94d6945987f7f1 100644 (file)
@@ -80,23 +80,21 @@ static ushort indices[3] = { 0, 2, 1 };
 
 static void set_viewport( float x, float y,
                           float width, float height,
-                          float near, float far)
+                          float zNear, float zFar)
 {
-   float z = far;
+   float z = zFar;
    float half_width = (float)width / 2.0f;
    float half_height = (float)height / 2.0f;
-   float half_depth = ((float)far - (float)near) / 2.0f;
+   float half_depth = ((float)zFar - (float)zNear) / 2.0f;
    struct pipe_viewport_state vp;
 
    vp.scale[0] = half_width;
    vp.scale[1] = half_height;
    vp.scale[2] = half_depth;
-   vp.scale[3] = 1.0f;
 
    vp.translate[0] = half_width + x;
    vp.translate[1] = half_height + y;
    vp.translate[2] = half_depth + z;
-   vp.translate[3] = 0.0f;
 
    ctx->set_viewport_states( ctx, 0, 1, &vp );
 }
@@ -137,7 +135,7 @@ static void set_vertices( void )
    vbuf[0].buffer_offset = 0;
    vbuf[0].buffer = pipe_buffer_create_with_data(ctx,
                                                  PIPE_BIND_VERTEX_BUFFER,
-                                                 PIPE_USAGE_STATIC,
+                                                 PIPE_USAGE_DEFAULT,
                                                  sizeof(vertices),
                                                  vertices);
 
@@ -146,7 +144,7 @@ static void set_vertices( void )
    vbuf[1].buffer_offset = 0;
    vbuf[1].buffer = pipe_buffer_create_with_data(ctx,
                                                  PIPE_BIND_VERTEX_BUFFER,
-                                                 PIPE_USAGE_STATIC,
+                                                 PIPE_USAGE_DEFAULT,
                                                  sizeof(inst_data),
                                                  inst_data);
 
@@ -155,7 +153,7 @@ static void set_vertices( void )
    /* index data */
    ibuf.buffer = pipe_buffer_create_with_data(ctx,
                                               PIPE_BIND_INDEX_BUFFER,
-                                              PIPE_USAGE_STATIC,
+                                              PIPE_USAGE_DEFAULT,
                                               sizeof(indices),
                                               indices);
    ibuf.offset = 0;
@@ -248,7 +246,7 @@ static void init( void )
       exit(1);
    }
    
-   ctx = screen->context_create(screen, NULL);
+   ctx = screen->context_create(screen, NULL, 0);
    if (ctx == NULL)
       exit(3);