Re: [Mesa3d-dev] R300 fog support and fp16 fix

2006-04-23 Thread Aapo Tahkola
On Sun, 23 Apr 2006 23:35:39 +0200
Ewald Snel <[EMAIL PROTECTED]> wrote:

> Hi Aapo,
> 
> Sorry for the late response ...
> 
> [...]
> 
> > What about vertex fog?
> > Could there be a way to route interpolated fog coords to the fog hardware
> > somehow? I dont mind about doing it with fragment programs but that might
> 
> I've tried to implement this, but it remains a bit buggy. The problem seems 
> to 
> be related to secondary color handling, which is broken even without using 
> fog.

Using secondary color alone doesnt currently work.

> 
> Attached is the result of my findings. It uses the alpha component of the 
> secondary color for fog, which I assume to be similar to what fglrx does from 
> examining the command stream packets using 'check_maps()'.

You forgot to emit fog coords.
demos/fogcoord seems to work if I invert fog coords.

-- 
Aapo Tahkola
Index: r300_maos.c
===
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r300/r300_maos.c,v
retrieving revision 1.32
diff -u -b -B -u -r1.32 r300_maos.c
--- r300_maos.c 23 Apr 2006 05:54:06 -  1.32
+++ r300_maos.c 23 Apr 2006 23:23:30 -
@@ -436,14 +436,12 @@
count);
}
 
-#if 0
if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_FOG )) {
-   CONFIGURE_AOS(  AOS_FORMAT_FLOAT,
-   VB->FogCoordPtr,
-   immd ? 4 : 
VB->FogCoordPtr->size,
+   CONFIGURE_AOS(i_fog, AOS_FORMAT_FLOAT,
+   VB->AttribPtr[VERT_ATTRIB_FOG],
+   immd ? 4 : 
VB->AttribPtr[VERT_ATTRIB_FOG].size,
count);
}
-#endif
 
r300->state.texture.tc_count = 0;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
@@ -581,8 +579,8 @@
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= 
R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
if(OutputsWritten & (1hw.vof.cmd[R300_VOF_CNTL_0] |= 
R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR1 ))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= 
R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
+   if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_FOG ))
+   r300->hw.vof.cmd[R300_VOF_CNTL_0] |= 
R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
 
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_TEX(i) 
))


Re: [Mesa3d-dev] R300 fog support and fp16 fix

2006-04-23 Thread Ewald Snel
Hi Aapo,

Sorry for the late response ...

[...]

> What about vertex fog?
> Could there be a way to route interpolated fog coords to the fog hardware
> somehow? I dont mind about doing it with fragment programs but that might

I've tried to implement this, but it remains a bit buggy. The problem seems to 
be related to secondary color handling, which is broken even without using 
fog.

Attached is the result of my findings. It uses the alpha component of the 
secondary color for fog, which I assume to be similar to what fglrx does from 
examining the command stream packets using 'check_maps()'.

bye,

Ewald
diff -ur Mesa.orig/src/mesa/drivers/dri/r300/r300_context.c Mesa/src/mesa/drivers/dri/r300/r300_context.c
--- Mesa.orig/src/mesa/drivers/dri/r300/r300_context.c	2006-04-23 11:16:42.0 +0200
+++ Mesa/src/mesa/drivers/dri/r300/r300_context.c	2006-04-23 22:40:40.0 +0200
@@ -77,7 +77,7 @@
 #define need_GL_ARB_vertex_buffer_object
 #define need_GL_ARB_vertex_program
 #define need_GL_EXT_blend_minmax
-//#define need_GL_EXT_fog_coord
+#define need_GL_EXT_fog_coord
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_blend_equation_separate
 #define need_GL_EXT_blend_func_separate
@@ -102,7 +102,7 @@
   {"GL_EXT_blend_func_separate",	GL_EXT_blend_func_separate_functions},
   {"GL_EXT_blend_minmax",		GL_EXT_blend_minmax_functions},
   {"GL_EXT_blend_subtract",		NULL},
-//  {"GL_EXT_fog_coord",			GL_EXT_fog_coord_functions },
+  {"GL_EXT_fog_coord",			GL_EXT_fog_coord_functions },
   {"GL_EXT_secondary_color", 		GL_EXT_secondary_color_functions},
   {"GL_EXT_stencil_wrap",		NULL},
   {"GL_EXT_texture_edge_clamp",		NULL},
diff -ur Mesa.orig/src/mesa/drivers/dri/r300/r300_fragprog.c Mesa/src/mesa/drivers/dri/r300/r300_fragprog.c
--- Mesa.orig/src/mesa/drivers/dri/r300/r300_fragprog.c	2006-03-29 18:51:25.0 +0200
+++ Mesa/src/mesa/drivers/dri/r300/r300_fragprog.c	2006-04-23 22:41:11.0 +0200
@@ -1411,6 +1411,21 @@
 	if (InputsRead & FRAG_BIT_COL1) {
 		cs->inputs[FRAG_ATTRIB_COL1].refcount = 0;
 		cs->inputs[FRAG_ATTRIB_COL1].reg = get_hw_temp(rp);
+/* Patch instructions to split the secondary color register */
+		for (fpi=mp->Base.Instructions;fpi->Opcode != OPCODE_END; fpi++) {
+			for (i=0;i<3;i++) {
+if (fpi->SrcReg[i].Index == FRAG_ATTRIB_COL1) {
+	int ws[4];
+	for (j=0;j<4;j++) {
+		ws[j] = GET_SWZ(fpi->SrcReg[i].Swizzle, j);
+		if (ws[j] == SWIZZLE_W)
+			ws[j] = SWIZZLE_ZERO;
+	}
+	fpi->SrcReg[i].Swizzle = MAKE_SWIZZLE4(ws[0], ws[1], ws[2], ws[3]);
+}
+			}
+}
+
 	}
 	InputsRead &= ~FRAG_BIT_COL1;
 
diff -ur Mesa.orig/src/mesa/drivers/dri/r300/r300_maos.c Mesa/src/mesa/drivers/dri/r300/r300_maos.c
--- Mesa.orig/src/mesa/drivers/dri/r300/r300_maos.c	2006-04-23 11:16:42.0 +0200
+++ Mesa/src/mesa/drivers/dri/r300/r300_maos.c	2006-04-23 22:40:40.0 +0200
@@ -581,8 +581,8 @@
 			r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
 		if(OutputsWritten & (1hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
 		if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR1 ))
 			r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
+		if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_FOG ))
+			r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
 
 		for(i=0;i < ctx->Const.MaxTextureUnits;i++)
 			if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_TEX(i) ))
diff -ur Mesa.orig/src/mesa/drivers/dri/r300/r300_state.c Mesa/src/mesa/drivers/dri/r300/r300_state.c
--- Mesa.orig/src/mesa/drivers/dri/r300/r300_state.c	2006-04-20 23:01:42.0 +0200
+++ Mesa/src/mesa/drivers/dri/r300/r300_state.c	2006-04-23 22:40:55.0 +0200
@@ -679,15 +679,8 @@
 			R300_STATECHANGE(r300, fogs);
 			r300->hw.fogs.cmd[R300_FOGS_STATE] =
 (r300->hw.fogs.cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) | R300_FOG_MODE_LINEAR;
-
-			if (ctx->Fog.Start == ctx->Fog.End) {
-fogScale.f = -1.0;
-fogStart.f = 1.0;
-			}
-			else {
-fogScale.f = 1.0 / (ctx->Fog.End-ctx->Fog.Start);
-fogStart.f = -ctx->Fog.Start / (ctx->Fog.End-ctx->Fog.Start);
-			}
+			fogScale.f = -1.0;
+			fogStart.f = 1.0;
 			break;
 		case GL_EXP:
 			R300_STATECHANGE(r300, fogs);
@@ -722,14 +715,8 @@
 	case GL_FOG_START:
 	case GL_FOG_END:
 		if (ctx->Fog.Mode == GL_LINEAR) {
-			if (ctx->Fog.Start == ctx->Fog.End) {
-fogScale.f = -1.0;
-fogStart.f = 1.0;
-			}
-			else {
-fogScale.f = 1.0 / (ctx->Fog.End-ctx->Fog.Start);
-fogStart.f = -ctx->Fog.Start / (ctx->Fog.End-ctx->Fog.Start);
-			}
+			fogScale.f = -1.0;
+			fo

[Mesa3d-dev] [Bug 6706] New: Various bugs cause r300 to hang(hw lock being held)

2006-04-23 Thread bugzilla-daemon
Please do not reply to this email: if you want to comment on the bug, go to
   
the URL shown below and enter yourcomments there. 
   
https://bugs.freedesktop.org/show_bug.cgi?id=6706  
 
   Summary: Various bugs cause r300 to hang(hw lock being held)
   Product: Mesa
   Version: unspecified
  Platform: PC
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Mesa core
AssignedTo: mesa3d-dev@lists.sourceforge.net
ReportedBy: [EMAIL PROTECTED]


In ideal world, xorg should be capable of taking it by force.
I think this functionality has been broken for ages though.

I have disabled hw locking when entering span functions for now.

This relates to bug #6085.

foobillard segfault:
0xb77d00c8 in lerp_rgba_2d (result=0x0, a=0.5, b=0.5, t00=0xbfe7315c "", 
t10=0xbfe73158 "", t01=0xbfe73154 "", t11=0xbfe73150 "")
at swrast/s_texfilter.c:172
172result[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]);
  
 
 
--   
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email 
 
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev