From: randrianasulu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Small demagic patch for nv04 plus two tables for discussion
Date: Wed, 15 Sep 2010 20:01:43 +0400 [thread overview]
Message-ID: <201009152001.43514.randrianasulu@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 575 bytes --]
Hello all!
Unfortunately, this patch creates too-long lines, but i really prefer symbolic
names, when they defined everywhere else.
Studying texture combiners, i created two tables, they probably has some
errors, but I want to be pointed at errors before i even start to code, so
please comment on them:
sources:
[1] http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml
[2] http://www.gamecareerguide.com/features/19981009/multitexturing_01.htm
[3] IRC talk
[4]
http://people.freedesktop.org/~idr/2007Q4-VGP351/20071106%20-%20Texture%20mapping,
%20part%203.pdf
[-- Attachment #2: 0001-nv0x-demagic-nv04_state_raster.c-and-nv04_state_tex..patch --]
[-- Type: text/x-diff, Size: 6648 bytes --]
From f8726c6e190466d91b588c1ad7409da506663218 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianasulu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 15 Sep 2010 19:40:16 +0400
Subject: [PATCH] nv0x: demagic nv04_state_raster.c and nv04_state_tex.c
Unfortunately, lines go over 80 char limit
---
src/mesa/drivers/dri/nouveau/nv04_state_raster.c | 30 +++++++++++-----------
src/mesa/drivers/dri/nouveau/nv04_state_tex.c | 22 ++++++++--------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index c191571..51aacba 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -176,13 +176,13 @@ nv04_emit_control(GLcontext *ctx, int emit)
if (ctx->Depth.Mask)
ctrl0 |= NV04_MULTITEX_TRIANGLE_CONTROL0_Z_WRITE;
- ctrl0 |= get_comparison_op(ctx->Depth.Func) << 16;
+ ctrl0 |= get_comparison_op(ctx->Depth.Func) << NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FUNC_SHIFT;
/* Alpha test. */
if (ctx->Color.AlphaEnabled)
ctrl0 |= NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_ENABLE;
- ctrl0 |= get_comparison_op(ctx->Color.AlphaFunc) << 8 |
+ ctrl0 |= get_comparison_op(ctx->Color.AlphaFunc) << NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_FUNC_SHIFT |
FLOAT_TO_UBYTE(ctx->Color.AlphaRef);
/* Stencil test. */
@@ -192,13 +192,13 @@ nv04_emit_control(GLcontext *ctx, int emit)
if (ctx->Stencil.Enabled)
ctrl1 |= NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_ENABLE;
- ctrl1 |= get_comparison_op(ctx->Stencil.Function[0]) << 4 |
- ctx->Stencil.Ref[0] << 8 |
- ctx->Stencil.ValueMask[0] << 16 |
- ctx->Stencil.WriteMask[0] << 24;
+ ctrl1 |= get_comparison_op(ctx->Stencil.Function[0]) << NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_FUNC_SHIFT |
+ ctx->Stencil.Ref[0] << NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_REF_SHIFT |
+ ctx->Stencil.ValueMask[0] << NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_READ_SHIFT |
+ ctx->Stencil.WriteMask[0] << NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_WRITE_SHIFT;
- ctrl2 |= get_stencil_op(ctx->Stencil.ZPassFunc[0]) << 8 |
- get_stencil_op(ctx->Stencil.ZFailFunc[0]) << 4 |
+ ctrl2 |= get_stencil_op(ctx->Stencil.ZPassFunc[0]) << NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZPASS_SHIFT |
+ get_stencil_op(ctx->Stencil.ZFailFunc[0]) << NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZFAIL_SHIFT |
get_stencil_op(ctx->Stencil.FailFunc[0]);
BEGIN_RING(chan, fahrenheit, NV04_MULTITEX_TRIANGLE_CONTROL0, 3);
@@ -209,7 +209,7 @@ nv04_emit_control(GLcontext *ctx, int emit)
} else {
int cull_mode = ctx->Polygon.CullFaceMode;
int front_face = ctx->Polygon.FrontFace;
- uint32_t ctrl = 1 << 30 |
+ uint32_t ctrl = 1 << 30 /* Probably Z buffer format */ |
NV04_TEXTURED_TRIANGLE_CONTROL_ORIGIN;
/* Dithering. */
@@ -232,13 +232,13 @@ nv04_emit_control(GLcontext *ctx, int emit)
if (ctx->Depth.Mask)
ctrl |= NV04_TEXTURED_TRIANGLE_CONTROL_Z_WRITE;
- ctrl |= get_comparison_op(ctx->Depth.Func) << 16;
+ ctrl |= get_comparison_op(ctx->Depth.Func) << NV04_TEXTURED_TRIANGLE_CONTROL_Z_FUNC_SHIFT;
/* Alpha test. */
if (ctx->Color.AlphaEnabled)
ctrl |= NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_ENABLE;
- ctrl |= get_comparison_op(ctx->Color.AlphaFunc) << 8 |
+ ctrl |= get_comparison_op(ctx->Color.AlphaFunc) << NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_FUNC_SHIFT |
FLOAT_TO_UBYTE(ctx->Color.AlphaRef);
BEGIN_RING(chan, fahrenheit, NV04_TEXTURED_TRIANGLE_CONTROL, 1);
@@ -263,8 +263,8 @@ nv04_emit_blend(GLcontext *ctx, int emit)
NV04_MULTITEX_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE;
/* Alpha blending. */
- blend |= get_blend_func(ctx->Color.BlendDstRGB) << 28 |
- get_blend_func(ctx->Color.BlendSrcRGB) << 24;
+ blend |= get_blend_func(ctx->Color.BlendDstRGB) << NV04_MULTITEX_TRIANGLE_BLEND_DST_SHIFT |
+ get_blend_func(ctx->Color.BlendSrcRGB) << NV04_MULTITEX_TRIANGLE_BLEND_SRC_SHIFT;
if (ctx->Color.BlendEnabled)
blend |= NV04_MULTITEX_TRIANGLE_BLEND_BLEND_ENABLE;
@@ -295,8 +295,8 @@ nv04_emit_blend(GLcontext *ctx, int emit)
NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE;
/* Alpha blending. */
- blend |= get_blend_func(ctx->Color.BlendDstRGB) << 28 |
- get_blend_func(ctx->Color.BlendSrcRGB) << 24;
+ blend |= get_blend_func(ctx->Color.BlendDstRGB) << NV04_TEXTURED_TRIANGLE_BLEND_DST_SHIFT |
+ get_blend_func(ctx->Color.BlendSrcRGB) << NV04_TEXTURED_TRIANGLE_BLEND_SRC_SHIFT<;
if (ctx->Color.BlendEnabled)
blend |= NV04_TEXTURED_TRIANGLE_BLEND_BLEND_ENABLE;
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 6d8762b..80b70ee 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -106,25 +106,25 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
t->LodBias, 0, 15);
}
- format |= get_wrap_mode(t->WrapT) << 28 |
- get_wrap_mode(t->WrapS) << 24 |
- ti->HeightLog2 << 20 |
- ti->WidthLog2 << 16 |
- lod_max << 12 |
+ format |= get_wrap_mode(t->WrapT) << NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSV_SHIFT |
+ get_wrap_mode(t->WrapS) << NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSU_SHIFT |
+ ti->HeightLog2 << NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT |
+ ti->WidthLog2 << NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT |
+ lod_max << NV04_MULTITEX_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT |
get_tex_format(ti);
- filter |= log2i(t->MaxAnisotropy) << 31 |
- nvgl_filter_mode(t->MagFilter) << 28 |
- log2i(t->MaxAnisotropy) << 27 |
- nvgl_filter_mode(t->MinFilter) << 24 |
- lod_bias << 16;
+ filter |= log2i(t->MaxAnisotropy) << NV04_MULTITEX_TRIANGLE_FILTER_ANISOTROPIC_MAGNIFY_ENABLE |
+ nvgl_filter_mode(t->MagFilter) << NV04_MULTITEX_TRIANGLE_FILTER_MAGNIFY_SHIFT |
+ log2i(t->MaxAnisotropy) << NV04_MULTITEX_TRIANGLE_FILTER_ANISOTROPIC_MINIFY_ENABLE |
+ nvgl_filter_mode(t->MinFilter) << NV04_MULTITEX_TRIANGLE_FILTER_MINIFY_SHIFT |
+ lod_bias << NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_LODBIAS_SHIFT;
} else {
s = &to_nv04_context(ctx)->dummy_texture;
format |= NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_REPEAT |
NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_REPEAT |
- 1 << 12 |
+ 1 << NV04_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT |
NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8;
filter |= NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST |
--
1.7.0.2
[-- Attachment #3: gl_blend_table.html --]
[-- Type: text/html, Size: 795 bytes --]
[-- Attachment #4: texture_environment_combiners_NV_ATI_ARB.html --]
[-- Type: text/html, Size: 2609 bytes --]
[-- Attachment #5: Type: text/plain, Size: 181 bytes --]
_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
reply other threads:[~2010-09-15 16:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201009152001.43514.randrianasulu@gmail.com \
--to=randrianasulu-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.