#include "util/u_box.h"
#include "util/u_debug.h"
+#include "util/u_debug_image.h"
#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_inlines.h"
-static INLINE boolean
+static inline boolean
graw_util_create_window(struct graw_info *info,
int width, int height,
int num_cbufs, bool zstencil_buf)
int i;
memset(info, 0, sizeof(*info));
+ memset(&resource_temp, 0, sizeof(resource_temp));
/* It's hard to say whether window or screen should be created
* first. Different environments would prefer one or the other.
return FALSE;
}
- info->ctx = info->screen->context_create(info->screen, NULL);
+ info->ctx = info->screen->context_create(info->screen, NULL, 0);
if (info->ctx == NULL) {
debug_printf("graw: Failed to create context\n");
return FALSE;
}
-static INLINE void
+static inline void
graw_util_default_state(struct graw_info *info, boolean depth_test)
{
{
}
-static INLINE void
+static inline void
graw_util_viewport(struct graw_info *info,
float x, float y,
float width, float height,
- float near, float far)
+ float zNear, float zFar)
{
- float z = near;
+ float z = zNear;
float half_width = width / 2.0f;
float half_height = height / 2.0f;
- float half_depth = (far - near) / 2.0f;
+ float half_depth = (zFar - zNear) / 2.0f;
struct pipe_viewport_state vp;
vp.scale[0] = half_width;
}
-static INLINE void
+static inline void
graw_util_flush_front(const struct graw_info *info)
{
info->screen->flush_frontbuffer(info->screen, info->color_buf[0],
}
-static INLINE struct pipe_resource *
+static inline struct pipe_resource *
graw_util_create_tex2d(const struct graw_info *info,
int width, int height, enum pipe_format format,
const void *data)
struct pipe_resource temp, *tex;
struct pipe_box box;
+ memset(&temp, 0, sizeof(temp));
temp.target = PIPE_TEXTURE_2D;
temp.format = format;
temp.width0 = width;
u_box_2d(0, 0, width, height, &box);
- info->ctx->transfer_inline_write(info->ctx,
- tex,
- 0,
- PIPE_TRANSFER_WRITE,
- &box,
- data,
- row_stride,
- image_bytes);
+ info->ctx->texture_subdata(info->ctx,
+ tex,
+ 0,
+ PIPE_TRANSFER_WRITE,
+ &box,
+ data,
+ row_stride,
+ image_bytes);
/* Possibly read back & compare against original data:
*/
}
-static INLINE void *
+static inline void *
graw_util_create_simple_sampler(const struct graw_info *info,
unsigned wrap_mode,
unsigned img_filter)
}
-static INLINE struct pipe_sampler_view *
+static inline struct pipe_sampler_view *
graw_util_create_simple_sampler_view(const struct graw_info *info,
struct pipe_resource *texture)
{
memset(&sv_temp, 0, sizeof(sv_temp));
sv_temp.format = texture->format;
sv_temp.texture = texture;
- sv_temp.swizzle_r = PIPE_SWIZZLE_RED;
- sv_temp.swizzle_g = PIPE_SWIZZLE_GREEN;
- sv_temp.swizzle_b = PIPE_SWIZZLE_BLUE;
- sv_temp.swizzle_a = PIPE_SWIZZLE_ALPHA;
+ sv_temp.swizzle_r = PIPE_SWIZZLE_X;
+ sv_temp.swizzle_g = PIPE_SWIZZLE_Y;
+ sv_temp.swizzle_b = PIPE_SWIZZLE_Z;
+ sv_temp.swizzle_a = PIPE_SWIZZLE_W;
sv = info->ctx->create_sampler_view(info->ctx, texture, &sv_temp);