struct pipe_vertex_element vtxelt[PIPE_ATTRIB_MAX];
};
-static inline struct nv30_context *
+static INLINE struct nv30_context *
nv30_context(struct pipe_context *pipe)
{
return (struct nv30_context *)pipe;
+++ /dev/null
-#ifndef __NV30_DMA_H__
-#define __NV30_DMA_H__
-
-#include "pipe/nouveau/nouveau_winsys.h"
-
-#define OUT_RING(data) do { \
- (*nv30->nvws->channel->pushbuf->cur++) = (data); \
-} while(0)
-
-#define OUT_RINGp(src,size) do { \
- memcpy(nv30->nvws->channel->pushbuf->cur, (src), (size) * 4); \
- nv30->nvws->channel->pushbuf->cur += (size); \
-} while(0)
-
-#define OUT_RINGf(data) do { \
- union { float v; uint32_t u; } c; \
- c.v = (data); \
- OUT_RING(c.u); \
-} while(0)
-
-#define BEGIN_RING(obj,mthd,size) do { \
- if (nv30->nvws->channel->pushbuf->remaining < ((size) + 1)) \
- nv30->nvws->push_flush(nv30->nvws->channel, ((size) + 1)); \
- OUT_RING((nv30->obj->subc << 13) | ((size) << 18) | (mthd)); \
- nv30->nvws->channel->pushbuf->remaining -= ((size) + 1); \
-} while(0)
-
-#define BEGIN_RING_NI(obj,mthd,size) do { \
- BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
-} while(0)
-
-#define FIRE_RING() do { \
- nv30->nvws->push_flush(nv30->nvws->channel, 0); \
-} while(0)
-
-#define OUT_RELOC(bo,data,flags,vor,tor) do { \
- nv30->nvws->push_reloc(nv30->nvws->channel, \
- nv30->nvws->channel->pushbuf->cur++, \
- (struct nouveau_bo *)(bo), \
- (data), (flags), (vor), (tor)); \
-} while(0)
-
-/* Raw data + flags depending on FB/TT buffer */
-#define OUT_RELOCd(bo,data,flags,vor,tor) do { \
- OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor)); \
-} while(0)
-
-/* FB/TT object handle */
-#define OUT_RELOCo(bo,flags) do { \
- OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
- nv30->nvws->channel->vram->handle, \
- nv30->nvws->channel->gart->handle); \
-} while(0)
-
-/* Low 32-bits of offset */
-#define OUT_RELOCl(bo,delta,flags) do { \
- OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0); \
-} while(0)
-
-/* High 32-bits of offset */
-#define OUT_RELOCh(bo,delta,flags) do { \
- OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0); \
-} while(0)
-
-#endif
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/tgsi/util/tgsi_parse.h"
struct tgsi_parse_context parse;
struct nv30_fpc *fpc = NULL;
- fpc = calloc(1, sizeof(struct nv30_fpc));
+ fpc = CALLOC(1, sizeof(struct nv30_fpc));
if (!fpc)
return;
fpc->fp = fp;
assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
assert(fpc->nr_imm < MAX_IMM);
- for (i = 0; i < imm->Immediate.Size; i++)
+ for (i = 0; i < 4; i++)
vals[i] = imm->u.ImmediateFloat32[i].Float;
fpc->imm[fpc->nr_imm++] = constant(fpc, -1, vals);
}
#include "nv30_context.h"
-static inline int log2i(int i)
+static INLINE int log2i(int i)
{
int r = 0;
nv30mt->level[l].pitch = (nv30mt->level[l].pitch + 63) & ~63;
nv30mt->level[l].image_offset =
- calloc(nr_faces, sizeof(unsigned));
+ CALLOC(nr_faces, sizeof(unsigned));
width = MAX2(1, width >> 1);
height = MAX2(1, height >> 1);
#include "pipe/p_context.h"
+#include "pipe/p_util.h"
#include "nv30_context.h"
{
struct nv30_query *q;
- q = calloc(1, sizeof(struct nv30_query));
+ q = CALLOC(1, sizeof(struct nv30_query));
q->type = query_type;
return (struct pipe_query *)q;
BEGIN_RING(rankine, NV34TCL_DEPTH_FUNC, 3);
OUT_RINGp ((uint32_t *)&hw->depth, 3);
- BEGIN_RING(rankine, NV34TCL_STENCIL_FRONT_ENABLE, 16);
- OUT_RINGp ((uint32_t *)&hw->stencil.front, 8);
+ BEGIN_RING(rankine, NV34TCL_STENCIL_BACK_ENABLE, 16);
OUT_RINGp ((uint32_t *)&hw->stencil.back, 8);
+ OUT_RINGp ((uint32_t *)&hw->stencil.front, 8);
BEGIN_RING(rankine, NV34TCL_ALPHA_FUNC_ENABLE, 3);
OUT_RINGp ((uint32_t *)&hw->alpha.enabled, 3);
}
{
struct nv30_vertex_program *vp;
- vp = calloc(1, sizeof(struct nv30_vertex_program));
+ vp = CALLOC(1, sizeof(struct nv30_vertex_program));
vp->pipe = cso;
return (void *)vp;
{
struct nv30_fragment_program *fp;
- fp = calloc(1, sizeof(struct nv30_fragment_program));
+ fp = CALLOC(1, sizeof(struct nv30_fragment_program));
fp->pipe = cso;
return (void *)fp;
case PIPE_FORMAT_TYPE_UNORM:
return NV34TCL_VERTEX_ARRAY_FORMAT_TYPE_UBYTE;
default:
- assert(0);
+ NOUVEAU_ERR("Unknown format 0x%08x\n", format);
+ return NV40TCL_VTXFMT_TYPE_FLOAT;
}
}
{
struct nv30_context *nv30 = nv30_context(pipe);
unsigned nr;
+ boolean ret;
- assert(nv30_vbo_validate_state(nv30, NULL, 0));
+ ret = nv30_vbo_validate_state(nv30, NULL, 0);
+ if (!ret) {
+ NOUVEAU_ERR("state validate failed\n");
+ return FALSE;
+ }
BEGIN_RING(rankine, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (nvgl_primitive(mode));
{
struct nv30_context *nv30 = nv30_context(pipe);
struct pipe_winsys *ws = pipe->winsys;
+ boolean ret;
void *map;
- assert(nv30_vbo_validate_state(nv30, NULL, 0));
+ ret = nv30_vbo_validate_state(nv30, NULL, 0);
+ if (!ret) {
+ NOUVEAU_ERR("state validate failed\n");
+ return FALSE;
+ }
map = ws->buffer_map(ws, ib, PIPE_BUFFER_USAGE_CPU_READ);
- if (!ib)
- assert(0);
+ if (!ib) {
+ NOUVEAU_ERR("failed mapping ib\n");
+ return FALSE;
+ }
BEGIN_RING(rankine, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (nvgl_primitive(mode));
nv30_draw_elements_u32(nv30, map, start, count);
break;
default:
- assert(0);
+ NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size);
break;
}
{
struct nv30_context *nv30 = nv30_context(pipe);
unsigned nr, type;
+ boolean ret;
switch (ib_size) {
case 2:
type = NV40TCL_IDXBUF_FORMAT_TYPE_U32;
break;
default:
- assert(0);
+ NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size);
+ return FALSE;
}
- assert(nv30_vbo_validate_state(nv30, ib, type));
+ ret = nv30_vbo_validate_state(nv30, ib, type);
+ if (!ret) {
+ NOUVEAU_ERR("failed state validation\n");
+ return FALSE;
+ }
BEGIN_RING(rankine, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (nvgl_primitive(mode));
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
- if (indexSize != 1) {
+/* if (indexSize != 1) {
nv30_draw_elements_vbo(pipe, indexBuffer, indexSize,
mode, start, count);
- } else {
+ } else */{
nv30_draw_elements_inline(pipe, indexBuffer, indexSize,
mode, start, count);
}
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/tgsi/util/tgsi_parse.h"
tgsi_parse_free(&p);
if (nr_imm) {
- vpc->imm = calloc(nr_imm, sizeof(struct nv30_sreg));
+ vpc->imm = CALLOC(nr_imm, sizeof(struct nv30_sreg));
assert(vpc->imm);
}
struct tgsi_parse_context parse;
struct nv30_vpc *vpc = NULL;
- vpc = calloc(1, sizeof(struct nv30_vpc));
+ vpc = CALLOC(1, sizeof(struct nv30_vpc));
if (!vpc)
return;
vpc->vp = vp;