projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dri/nouveau: Kill a bunch of ternary operators.
[mesa.git]
/
src
/
mesa
/
drivers
/
dri
/
i915
/
intel_tris.c
diff --git
a/src/mesa/drivers/dri/i915/intel_tris.c
b/src/mesa/drivers/dri/i915/intel_tris.c
index e99baf8e0e6e5151a6e5a5246871658d9e043941..b9a8aeb12f29787e5c6e24c3e04e0c3d66ff0196 100644
(file)
--- a/
src/mesa/drivers/dri/i915/intel_tris.c
+++ b/
src/mesa/drivers/dri/i915/intel_tris.c
@@
-52,13
+52,11
@@
#include "intel_buffers.h"
#include "intel_reg.h"
#include "intel_span.h"
#include "intel_buffers.h"
#include "intel_reg.h"
#include "intel_span.h"
-#include "intel_tex.h"
-#include "intel_chipset.h"
#include "i830_context.h"
#include "i830_reg.h"
#include "i830_context.h"
#include "i830_reg.h"
-static void intelRenderPrimitive(
GL
context * ctx, GLenum prim);
-static void intelRasterPrimitive(
GL
context * ctx, GLenum rprim,
+static void intelRenderPrimitive(
struct gl_
context * ctx, GLenum prim);
+static void intelRasterPrimitive(
struct gl_
context * ctx, GLenum rprim,
GLuint hwprim);
static void
GLuint hwprim);
static void
@@
-68,7
+66,7
@@
intel_flush_inline_primitive(struct intel_context *intel)
assert(intel->prim.primitive != ~0);
assert(intel->prim.primitive != ~0);
-/*
_mesa_
printf("/\n"); */
+/* printf("/\n"); */
if (used < 8)
goto do_discard;
if (used < 8)
goto do_discard;
@@
-95,13
+93,12
@@
static void intel_start_inline(struct intel_context *intel, uint32_t prim)
intel->no_batch_wrap = GL_TRUE;
intel->no_batch_wrap = GL_TRUE;
- /*
_mesa_
printf("%s *", __progname);*/
+ /*printf("%s *", __progname);*/
/* Emit a slot which will be filled with the inline primitive
* command later.
*/
/* Emit a slot which will be filled with the inline primitive
* command later.
*/
- BEGIN_BATCH(2);
- OUT_BATCH(0);
+ BEGIN_BATCH(1);
assert((intel->batch->dirty_state & (1<<1)) == 0);
assert((intel->batch->dirty_state & (1<<1)) == 0);
@@
-113,7
+110,7
@@
static void intel_start_inline(struct intel_context *intel, uint32_t prim)
ADVANCE_BATCH();
intel->no_batch_wrap = GL_FALSE;
ADVANCE_BATCH();
intel->no_batch_wrap = GL_FALSE;
-/*
_mesa_
printf(">"); */
+/* printf(">"); */
}
static void intel_wrap_inline(struct intel_context *intel)
}
static void intel_wrap_inline(struct intel_context *intel)
@@
-135,7
+132,7
@@
static GLuint *intel_extend_inline(struct intel_context *intel, GLuint dwords)
if (intel_batchbuffer_space(intel->batch) < sz)
intel_wrap_inline(intel);
if (intel_batchbuffer_space(intel->batch) < sz)
intel_wrap_inline(intel);
-/*
_mesa_
printf("."); */
+/* printf("."); */
intel->vtbl.assert_not_dirty(intel);
intel->vtbl.assert_not_dirty(intel);
@@
-182,8
+179,8
@@
uint32_t *intel_get_prim_space(struct intel_context *intel, unsigned int count)
/* Start a new VB */
if (intel->prim.vb == NULL)
intel->prim.vb = malloc(INTEL_VB_SIZE);
/* Start a new VB */
if (intel->prim.vb == NULL)
intel->prim.vb = malloc(INTEL_VB_SIZE);
- intel->prim.vb_bo = dr
i
_bo_alloc(intel->bufmgr, "vb",
- INTEL_VB_SIZE, 4);
+ intel->prim.vb_bo = dr
m_intel
_bo_alloc(intel->bufmgr, "vb",
+
INTEL_VB_SIZE, 4);
intel->prim.start_offset = 0;
intel->prim.current_offset = 0;
}
intel->prim.start_offset = 0;
intel->prim.current_offset = 0;
}
@@
-200,8
+197,8
@@
uint32_t *intel_get_prim_space(struct intel_context *intel, unsigned int count)
/** Dispatches the accumulated primitive to the batchbuffer. */
void intel_flush_prim(struct intel_context *intel)
{
/** Dispatches the accumulated primitive to the batchbuffer. */
void intel_flush_prim(struct intel_context *intel)
{
- dr
i
_bo *aper_array[2];
- dr
i
_bo *vb_bo;
+ dr
m_intel
_bo *aper_array[2];
+ dr
m_intel
_bo *vb_bo;
unsigned int offset, count;
BATCH_LOCALS;
unsigned int offset, count;
BATCH_LOCALS;
@@
-215,12
+212,12
@@
void intel_flush_prim(struct intel_context *intel)
* flush triggered by emit_state doesn't loop back to flush_prim again.
*/
vb_bo = intel->prim.vb_bo;
* flush triggered by emit_state doesn't loop back to flush_prim again.
*/
vb_bo = intel->prim.vb_bo;
- dr
i
_bo_reference(vb_bo);
+ dr
m_intel
_bo_reference(vb_bo);
count = intel->prim.count;
intel->prim.count = 0;
offset = intel->prim.start_offset;
intel->prim.start_offset = intel->prim.current_offset;
count = intel->prim.count;
intel->prim.count = 0;
offset = intel->prim.start_offset;
intel->prim.start_offset = intel->prim.current_offset;
- if (
!intel->gen >=
3)
+ if (
intel->gen <
3)
intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128);
intel->prim.flush = NULL;
intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128);
intel->prim.flush = NULL;
@@
-254,7
+251,7
@@
void intel_flush_prim(struct intel_context *intel)
BEGIN_BATCH(5);
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(1) | 1);
BEGIN_BATCH(5);
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(1) | 1);
- assert((offset &
!
S0_VB_OFFSET_MASK) == 0);
+ assert((offset &
~
S0_VB_OFFSET_MASK) == 0);
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, offset);
OUT_BATCH((intel->vertex_size << S1_VERTEX_WIDTH_SHIFT) |
(intel->vertex_size << S1_VERTEX_PITCH_SHIFT));
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, offset);
OUT_BATCH((intel->vertex_size << S1_VERTEX_WIDTH_SHIFT) |
(intel->vertex_size << S1_VERTEX_PITCH_SHIFT));
@@
-273,7
+270,7
@@
void intel_flush_prim(struct intel_context *intel)
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
/* S0 */
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
/* S0 */
- assert((offset &
!
S0_VB_OFFSET_MASK_830) == 0);
+ assert((offset &
~
S0_VB_OFFSET_MASK_830) == 0);
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
offset | (intel->vertex_size << S0_VB_PITCH_SHIFT_830) |
S0_VB_ENABLE_830);
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
offset | (intel->vertex_size << S0_VB_PITCH_SHIFT_830) |
S0_VB_ENABLE_830);
@@
-299,7
+296,7
@@
void intel_flush_prim(struct intel_context *intel)
intel->no_batch_wrap = GL_FALSE;
intel->no_batch_wrap = GL_FALSE;
- dr
i
_bo_unreference(vb_bo);
+ dr
m_intel
_bo_unreference(vb_bo);
}
/**
}
/**
@@
-318,9
+315,9
@@
void intel_finish_vb(struct intel_context *intel)
if (intel->prim.vb_bo == NULL)
return;
if (intel->prim.vb_bo == NULL)
return;
- dr
i
_bo_subdata(intel->prim.vb_bo, 0, intel->prim.start_offset,
- intel->prim.vb);
- dr
i
_bo_unreference(intel->prim.vb_bo);
+ dr
m_intel
_bo_subdata(intel->prim.vb_bo, 0, intel->prim.start_offset,
+
intel->prim.vb);
+ dr
m_intel
_bo_unreference(intel->prim.vb_bo);
intel->prim.vb_bo = NULL;
}
intel->prim.vb_bo = NULL;
}
@@
-430,7
+427,7
@@
intel_draw_point(struct intel_context *intel, intelVertexPtr v0)
static void
intel_atten_point(struct intel_context *intel, intelVertexPtr v0)
{
static void
intel_atten_point(struct intel_context *intel, intelVertexPtr v0)
{
-
GL
context *ctx = &intel->ctx;
+
struct gl_
context *ctx = &intel->ctx;
GLfloat psz[4], col[4], restore_psz, restore_alpha;
_tnl_get_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
GLfloat psz[4], col[4], restore_psz, restore_alpha;
_tnl_get_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
@@
-491,9
+488,9
@@
intel_wpos_triangle(struct intel_context *intel,
__memcpy(v1_wpos, v1, size);
__memcpy(v2_wpos, v2, size);
__memcpy(v1_wpos, v1, size);
__memcpy(v2_wpos, v2, size);
- v0_wpos[1] = -v0_wpos[1] + intel->
driDrawable->h
;
- v1_wpos[1] = -v1_wpos[1] + intel->
driDrawable->h
;
- v2_wpos[1] = -v2_wpos[1] + intel->
driDrawable->h
;
+ v0_wpos[1] = -v0_wpos[1] + intel->
ctx.DrawBuffer->Height
;
+ v1_wpos[1] = -v1_wpos[1] + intel->
ctx.DrawBuffer->Height
;
+ v2_wpos[1] = -v2_wpos[1] + intel->
ctx.DrawBuffer->Height
;
intel_draw_triangle(intel, v0, v1, v2);
intel_draw_triangle(intel, v0, v1, v2);
@@
-512,8
+509,8
@@
intel_wpos_line(struct intel_context *intel,
__memcpy(v0_wpos, v0, size);
__memcpy(v1_wpos, v1, size);
__memcpy(v0_wpos, v0, size);
__memcpy(v1_wpos, v1, size);
- v0_wpos[1] = -v0_wpos[1] + intel->
driDrawable->h
;
- v1_wpos[1] = -v1_wpos[1] + intel->
driDrawable->h
;
+ v0_wpos[1] = -v0_wpos[1] + intel->
ctx.DrawBuffer->Height
;
+ v1_wpos[1] = -v1_wpos[1] + intel->
ctx.DrawBuffer->Height
;
intel_draw_line(intel, v0, v1);
}
intel_draw_line(intel, v0, v1);
}
@@
-527,7
+524,7
@@
intel_wpos_point(struct intel_context *intel, intelVertexPtr v0)
GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
__memcpy(v0_wpos, v0, size);
GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
__memcpy(v0_wpos, v0, size);
- v0_wpos[1] = -v0_wpos[1] + intel->
driDrawable->h
;
+ v0_wpos[1] = -v0_wpos[1] + intel->
ctx.DrawBuffer->Height
;
intel_draw_point(intel, v0);
}
intel_draw_point(intel, v0);
}
@@
-606,7
+603,6
@@
static struct
#define DO_POINTS 1
#define DO_FULL_QUAD 1
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
@@
-788,7
+784,7
@@
static void
intel_fallback_tri(struct intel_context *intel,
intelVertex * v0, intelVertex * v1, intelVertex * v2)
{
intel_fallback_tri(struct intel_context *intel,
intelVertex * v0, intelVertex * v1, intelVertex * v2)
{
-
GL
context *ctx = &intel->ctx;
+
struct gl_
context *ctx = &intel->ctx;
SWvertex v[3];
if (0)
SWvertex v[3];
if (0)
@@
-809,7
+805,7
@@
static void
intel_fallback_line(struct intel_context *intel,
intelVertex * v0, intelVertex * v1)
{
intel_fallback_line(struct intel_context *intel,
intelVertex * v0, intelVertex * v1)
{
-
GL
context *ctx = &intel->ctx;
+
struct gl_
context *ctx = &intel->ctx;
SWvertex v[2];
if (0)
SWvertex v[2];
if (0)
@@
-828,7
+824,7
@@
static void
intel_fallback_point(struct intel_context *intel,
intelVertex * v0)
{
intel_fallback_point(struct intel_context *intel,
intelVertex * v0)
{
-
GL
context *ctx = &intel->ctx;
+
struct gl_
context *ctx = &intel->ctx;
SWvertex v[1];
if (0)
SWvertex v[1];
if (0)
@@
-881,7
+877,7
@@
intel_fallback_point(struct intel_context *intel,
static void
static void
-intelRenderClippedPoly(
GL
context * ctx, const GLuint * elts, GLuint n)
+intelRenderClippedPoly(
struct gl_
context * ctx, const GLuint * elts, GLuint n)
{
struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
{
struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@
-905,7
+901,7
@@
intelRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n)
}
static void
}
static void
-intelRenderClippedLine(
GL
context * ctx, GLuint ii, GLuint jj)
+intelRenderClippedLine(
struct gl_
context * ctx, GLuint ii, GLuint jj)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@
-913,7
+909,7
@@
intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj)
}
static void
}
static void
-intelFastRenderClippedPoly(
GL
context * ctx, const GLuint * elts, GLuint n)
+intelFastRenderClippedPoly(
struct gl_
context * ctx, const GLuint * elts, GLuint n)
{
struct intel_context *intel = intel_context(ctx);
const GLuint vertsize = intel->vertex_size;
{
struct intel_context *intel = intel_context(ctx);
const GLuint vertsize = intel->vertex_size;
@@
-940,7
+936,7
@@
intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n)
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED)
void
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED)
void
-intelChooseRenderState(
GL
context * ctx)
+intelChooseRenderState(
struct gl_
context * ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
@@
-1053,7
+1049,7
@@
static const GLenum reduced_prim[GL_POLYGON + 1] = {
static void
static void
-intelRunPipeline(
GL
context * ctx)
+intelRunPipeline(
struct gl_
context * ctx)
{
struct intel_context *intel = intel_context(ctx);
{
struct intel_context *intel = intel_context(ctx);
@@
-1083,7
+1079,7
@@
intelRunPipeline(GLcontext * ctx)
}
static void
}
static void
-intelRenderStart(
GL
context * ctx)
+intelRenderStart(
struct gl_
context * ctx)
{
struct intel_context *intel = intel_context(ctx);
{
struct intel_context *intel = intel_context(ctx);
@@
-1093,7
+1089,7
@@
intelRenderStart(GLcontext * ctx)
}
static void
}
static void
-intelRenderFinish(
GL
context * ctx)
+intelRenderFinish(
struct gl_
context * ctx)
{
struct intel_context *intel = intel_context(ctx);
{
struct intel_context *intel = intel_context(ctx);
@@
-1110,7
+1106,7
@@
intelRenderFinish(GLcontext * ctx)
* primitive.
*/
static void
* primitive.
*/
static void
-intelRasterPrimitive(
GL
context * ctx, GLenum rprim, GLuint hwprim)
+intelRasterPrimitive(
struct gl_
context * ctx, GLenum rprim, GLuint hwprim)
{
struct intel_context *intel = intel_context(ctx);
{
struct intel_context *intel = intel_context(ctx);
@@
-1133,7
+1129,7
@@
intelRasterPrimitive(GLcontext * ctx, GLenum rprim, GLuint hwprim)
/*
*/
static void
/*
*/
static void
-intelRenderPrimitive(
GL
context * ctx, GLenum prim)
+intelRenderPrimitive(
struct gl_
context * ctx, GLenum prim)
{
struct intel_context *intel = intel_context(ctx);
{
struct intel_context *intel = intel_context(ctx);
@@
-1180,6
+1176,8
@@
static char *fallbackStrings[] = {
[17] = "Logic op",
[18] = "Smooth polygon",
[19] = "Smooth point",
[17] = "Logic op",
[18] = "Smooth polygon",
[19] = "Smooth point",
+ [20] = "point sprite coord origin",
+ [21] = "depth/color drawing offset",
};
};
@@
-1203,14
+1201,14
@@
getFallbackString(GLuint bit)
void
intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode)
{
void
intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode)
{
-
GL
context *ctx = &intel->ctx;
+
struct gl_
context *ctx = &intel->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
const GLbitfield oldfallback = intel->Fallback;
if (mode) {
intel->Fallback |= bit;
if (oldfallback == 0) {
TNLcontext *tnl = TNL_CONTEXT(ctx);
const GLbitfield oldfallback = intel->Fallback;
if (mode) {
intel->Fallback |= bit;
if (oldfallback == 0) {
- intel
F
lush(ctx);
+ intel
_f
lush(ctx);
if (INTEL_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "ENTER FALLBACK %x: %s\n",
bit, getFallbackString(bit));
if (INTEL_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "ENTER FALLBACK %x: %s\n",
bit, getFallbackString(bit));
@@
-1255,7
+1253,7
@@
union fi
void
void
-intelInitTriFuncs(
GL
context * ctx)
+intelInitTriFuncs(
struct gl_
context * ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;