Emuforums.com

Go Back   Emuforums.com > Xbox Emulation > Cxbx Official Discussion
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

View Poll Results: Would you like Cxbx ported to OpenGL?
Yes, that would be a good idea for completion's sake. 17 51.52%
No, we're better off just sticking to Direct3D, or port to Direct3D 9 or later 10 30.30%
I don't care what you do, just get more games working! 6 18.18%
Voters: 33. You may not vote on this poll

Reply
 
Thread Tools Display Modes
Old April 20th, 2008, 03:56   #1
blueshogun96
Last Xbox Emu Author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Seattle, WA, USA
Posts: 5,843
OpenGL port (opinions wanted)

For those of you that remember, this question/issue has come up more than once. I have multiple reasons for asking this and I'd like your feedback on it.

1. The more Caustik and I work in Cxbx, the more we realize that Direct3D 8.1 isn't going to to cut it for completion's sake. We've both [not too long ago] have come to the conclusion that Cxbx is going to need to be ported over to a more advanced graphics API to be able to handle certain Xbox exclusive features that don't exist in Direct3D 8.x. Caustik prefers to port to Direct3D 9, I prefer to use OpenGL. For those of you that are familiar with the NV2x architecture (the Xbox GPU is an NV2A aka a GeForce3/4 Ti on steroids for those who didn't know) or even that of the NV1x, you'll soon notice that the registers are very OpenGL oriented. I know that Cxbx uses HLE, so why worry about the hardware level registers? Since Direct3D on Xbox is a superset of the PC version, Microsoft decided to add new D3D functions for the Xbox and take advantages of certain features that PC standard Direct3D lacks and OpenGL has. If you'd like to see for yourself, here's a list of known NV20 registers. These were copied and pasted from the nouveau (an open source NVIDIA GPU driver for UNIX) cvs repository. Be warned, the list is massive and these are just the registers that handle the T&L HAL. The entire register set is much larger than this (larger than many CPUs)

Code:
/*
Unknown NV20 commands:

NV20_TCL_PRIMITIVE_3D      [0x1d78/4] = 0x00000001 | UNKNOWN = 00000001
	Appears always just after NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR and
	_UNITS, and nowhere else. The parameter is always 0x1.
	FACTOR and UNITS are always followed by 0x1d78 in dumps nv20 nv25 nv25gl nv28pq,
	but there are exceptions in dumps nv28 and nv28sgl offset tests.
*/

#define NV20_SWIZZLED_SURFACE				0x0000009e
#define NV20_SWIZZLED_SURFACE_SET_OBJECT0		0x00000180
#define NV20_SWIZZLED_SURFACE_SET_OBJECT1		0x00000184
#define NV20_SWIZZLED_SURFACE_FORMAT			0x00000300
#define NV20_SWIZZLED_SURFACE_FORMAT_HEIGHT		31:24
#define NV20_SWIZZLED_SURFACE_FORMAT_WIDTH		23:16
#define NV20_SWIZZLED_SURFACE_FORMAT_COLOR		15:0
#define NV20_SWIZZLED_SURFACE_OFFSET			0x00000304

#define NV20_TCL_PRIMITIVE_SET_MAIN_OBJECT				0x00000000

#define NV20_TCL_PRIMITIVE_3D						0x00000097

#define NV20_TCL_PRIMITIVE_3D_NOP					0x00000100 //data=0
#define NV20_TCL_PRIMITIVE_3D_FIRE_INTERRUPT				0x00000100 //data=interrupt routine ID
#define NV20_TCL_PRIMITIVE_3D_NOTIFY					0x00000104
#define NV20_TCL_PRIMITIVE_3D_WAIT_MAKESPACE				0x00000110
#define NV20_TCL_PRIMITIVE_3D_MAIN_TILES_INDICES			0x00000120
#define NV20_TCL_PRIMITIVE_3D_ASK_FOR_IDLE				0x0000012C
#define NV20_TCL_PRIMITIVE_3D_STALL_PIPELINE				0x00000130
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT0				0x00000180
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT1				0x00000184
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT2				0x00000188
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT2A				0x00000190
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT3				0x00000194
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT4				0x00000198
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT5				0x0000019c
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT6				0x000001a0
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT7				0x000001a4
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT8				0x000001a8
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT9				0x000001ac
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT10				0x000001b0
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ				0x00000200
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_VERT				0x00000204
#define NV20_TCL_PRIMITIVE_3D_BUFFER_FORMAT				0x00000208
#define NV20_TCL_PRIMITIVE_3D_BUFFER_PITCH				0x0000020c
#define NV20_TCL_PRIMITIVE_3D_COLOR_OFFSET				0x00000210
#define NV20_TCL_PRIMITIVE_3D_DEPTH_OFFSET				0x00000214
#define NV20_TCL_PRIMITIVE_3D_LMA_DEPTH_BUFFER_PITCH			0x0000022c
#define NV20_TCL_PRIMITIVE_3D_LMA_DEPTH_BUFFER_OFFSET			0x00000230
#define NV20_TCL_PRIMITIVE_3D_W_YUV_FPZ_FLAGS				0x00000290
#define NV20_TCL_PRIMITIVE_3D_LIGHT_CONTROL				0x00000294
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_CONTROL			0x00000298
#define NV20_TCL_PRIMITIVE_3D_FOG_MODE					0x0000029c
#define NV20_TCL_PRIMITIVE_3D_FOG_COORD_DIST				0x000002a0
#define NV20_TCL_PRIMITIVE_3D_FOG_ENABLE				0x000002a4
#define NV20_TCL_PRIMITIVE_3D_FOG_COLOR					0x000002a8
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_MODE			0x000002b4	//0/1=accept/reject pixels inside scissors union
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(n)			(0x000002c0+(n<<2))
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(n)			(0x000002e0+(n<<2))
#define NV20_TCL_PRIMITIVE_3D_SET_OBJECT_UNKNOWN			0x000002fc
#define NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE				0x00000300
#define NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE				0x00000304
#define NV20_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE				0x00000308
#define NV20_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE				0x0000030c
#define NV20_TCL_PRIMITIVE_3D_DITHER_ENABLE				0x00000310
#define NV20_TCL_PRIMITIVE_3D_LIGHTING_ENABLE				0x00000314
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETERS_ENABLE			0x00000318
#define NV20_TCL_PRIMITIVE_3D_POINT_SMOOTH_ENABLE			0x0000031c
#define NV20_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE			0x00000320
#define NV20_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE			0x00000324
#define NV20_TCL_PRIMITIVE_3D_VERTEX_BLEND_ENABLE			0x00000328
#define NV20_TCL_PRIMITIVE_3D_STENCIL_ENABLE				0x0000032c
#define NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE		0x00000330
#define NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE		0x00000334
#define NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE		0x00000338
#define NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC				0x0000033c
#define NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF				0x00000340
#define NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC				0x00000344
#define NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_DST				0x00000348
#define NV20_TCL_PRIMITIVE_3D_BLEND_COLOR				0x0000034c
#define NV20_TCL_PRIMITIVE_3D_BLEND_EQUATION				0x00000350
#define NV20_TCL_PRIMITIVE_3D_DEPTH_FUNC				0x00000354
#define NV20_TCL_PRIMITIVE_3D_COLOR_MASK				0x00000358
#define NV20_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE			0x0000035c
#define NV20_TCL_PRIMITIVE_3D_STENCIL_MASK				0x00000360
#define NV20_TCL_PRIMITIVE_3D_STENCIL_FUNC_FUNC				0x00000364
#define NV20_TCL_PRIMITIVE_3D_STENCIL_FUNC_REF				0x00000368
#define NV20_TCL_PRIMITIVE_3D_STENCIL_FUNC_MASK				0x0000036c
#define NV20_TCL_PRIMITIVE_3D_STENCIL_OP_FAIL				0x00000370
#define NV20_TCL_PRIMITIVE_3D_STENCIL_OP_ZFAIL				0x00000374
#define NV20_TCL_PRIMITIVE_3D_STENCIL_OP_ZPASS				0x00000378
#define NV20_TCL_PRIMITIVE_3D_SHADE_MODEL				0x0000037c
#define NV20_TCL_PRIMITIVE_3D_LINE_WIDTH				0x00000380
#define NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR			0x00000384
#define NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_UNITS			0x00000388
#define NV20_TCL_PRIMITIVE_3D_POLYGON_MODE_FRONT			0x0000038c
#define NV20_TCL_PRIMITIVE_3D_POLYGON_MODE_BACK				0x00000390
#define NV20_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR				0x00000394
#define NV20_TCL_PRIMITIVE_3D_DEPTH_RANGE_FAR				0x00000398
#define NV20_TCL_PRIMITIVE_3D_CULL_FACE					0x0000039c
#define NV20_TCL_PRIMITIVE_3D_FRONT_FACE				0x000003a0
#define NV20_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE				0x000003a4
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_FRONT_R			0x000003a8
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_FRONT_G			0x000003ac
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_FRONT_B			0x000003b0
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_FRONT_A			0x000003b4
#define NV20_TCL_PRIMITIVE_3D_SEPARATE_SPECULAR_ENABLE			0x000003b8
#define NV20_TCL_PRIMITIVE_3D_ENABLED_LIGHTS				0x000003bc
#define NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(n)			(0x000003c0+(n<<2))
#define NV20_TCL_PRIMITIVE_3D_TX_MATRIX_ENABLE(n)			(0x00000420+(n<<2))
#define NV20_TCL_PRIMITIVE_3D_POINT_SIZE				0x0000043c
#define NV20_TCL_PRIMITIVE_3D_MODELVIEW_MATRIX				0x00000480
#define NV20_TCL_PRIMITIVE_3D_INVERSE_MODELVIEW_MATRIX			0x00000580
#define NV20_TCL_PRIMITIVE_3D_PROJECTION_MATRIX				0x00000680
#define NV20_TCL_PRIMITIVE_3D_TX_MATRIX(n)				(0x000006c0+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_A(n)				(0x00000840+(n<<4))
#define NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_B(n)				(0x00000844+(n<<4))
#define NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_C(n)				(0x00000848+(n<<4))
#define NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_D(n)				(0x0000084c+(n<<4))
#define NV20_TCL_PRIMITIVE_3D_FOG_EQUATION_CONSTANT			0x000009c0
#define NV20_TCL_PRIMITIVE_3D_FOG_EQUATION_LINEAR			0x000009c4
#define NV20_TCL_PRIMITIVE_3D_FOG_EQUATION_QUADRATIC			0x000009c8
#define NV20_TCL_PRIMITIVE_3D_FRONT_MATERIAL_SHININESS_A		0x000009e0
#define NV20_TCL_PRIMITIVE_3D_FRONT_MATERIAL_SHININESS_B		0x000009e4
#define NV20_TCL_PRIMITIVE_3D_FRONT_MATERIAL_SHININESS_C		0x000009e8
#define NV20_TCL_PRIMITIVE_3D_FRONT_MATERIAL_SHININESS_D		0x000009ec
#define NV20_TCL_PRIMITIVE_3D_FRONT_MATERIAL_SHININESS_E		0x000009f0
#define NV20_TCL_PRIMITIVE_3D_FRONT_MATERIAL_SHININESS_F		0x000009f4
#define NV20_TCL_PRIMITIVE_3D_SWATHWIDTH				0x000009f8

#define NV20_TCL_PRIMITIVE_3D_POINT_SPRITE				0x00000a1c

#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_OX				0x00000a20 /* x offset */
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_OY				0x00000a24 /* y offset */
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_DEPTH_AVG_S			0x00000a28 /* (depth range near + far)/2 * 16777214 */
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_UNKNOWN_A			0x00000a2c /* 0.0 if DEPTH_AVG_S == 0.0, otherwise 16777215.0 */
/* see tests draw_pixels, line_stipple and logic_op for where DEPTH_AVG_S=0.0 */

#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_A				0x00000a30
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_B				0x00000a34
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_C				0x00000a38
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_D				0x00000a3c
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_E				0x00000a40
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_F				0x00000a44
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_G				0x00000a48
#define NV20_TCL_PRIMITIVE_3D_POINT_PARAMETER_H				0x00000a4c

#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_PX_DIV2				0x00000af0 /* width/2 */
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_PY_DIV2				0x00000af4 /* -height/2 */
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_DEPTH_HALF_S			0x00000af8 /* (depth range far - near)/2 * 16777214 */
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_UNKNOWN_B			0x00000afc /* always 65535.0 */

#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_INST0				0x00000b00
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_INST1				0x00000b04
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_INST2				0x00000b08
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_INST3				0x00000b0c
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST_X				0x00000b80
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST_Y				0x00000b84
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST_Z				0x00000b88
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST_W				0x00000b8c

#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R	0x00000a10
#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_G	0x00000a14
#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_B	0x00000a18

#define NV20_TCL_PRIMITIVE_3D_TX_OFFSET(n)				(0x00001b00+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_FORMAT(n)				(0x00001b04+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_WRAP(n)				(0x00001b08+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_ENABLE(n)				(0x00001b0c+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_NPOT_PITCH(n)				(0x00001b10+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_FILTER(n)				(0x00001b14+(n<<6))
/*#define NV20_TCL_PRIMITIVE_3D_TX_UNK_B(n)				(0x00001b18+(n<<6))*/
#define NV20_TCL_PRIMITIVE_3D_TX_NPOT_SIZE(n)				(0x00001b1c+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_PALETTE_OFFSET(n)			(0x00001b20+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_TX_BORDER_COLOR(n)			(0x00001b24+(n<<6))

//									0x00001d78
//									0x00001d7c
//									0x00001d84
#define NV20_TCL_PRIMITIVE_3D_RC_ENABLE					0x00001e60

#define NV20_TCL_PRIMITIVE_3D_TX_SHADER_OP				0x000001e70
#define NV20_TCL_PRIMITIVE_3D_TX_SHADER_CULL_MODE			0x0000017f8
#define NV20_TCL_PRIMITIVE_3D_TX_SHADER_PREVIOUS			0x000001e78

#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_CONST_ID			0x00001ea4

#define NV20_TCL_PRIMITIVE_3D_RC_IN_ALPHA(n)				(0x00000260+(n<<2))	/* input combiners, portion alpha */
#define NV20_TCL_PRIMITIVE_3D_RC_IN_RGB(n)				(0x00000ac0+(n<<2))	/* input combiners, portion rgb */
#define NV20_TCL_PRIMITIVE_3D_RC_CONSTANT_COLOR0(n)			(0x00000a60+(n<<2))	/* constant color 0 */
#define NV20_TCL_PRIMITIVE_3D_RC_CONSTANT_COLOR1(n)			(0x00000a80+(n<<2))	/* constant color 1 */
#define NV20_TCL_PRIMITIVE_3D_RC_OUT_ALPHA(n)				(0x00000aa0+(n<<2))	/* output combiners, portion alpha */
#define NV20_TCL_PRIMITIVE_3D_RC_OUT_RGB(n)				(0x00001e40+(n<<2))	/* output combiners, portion rgb */
#define NV20_TCL_PRIMITIVE_3D_RC_COLOR0					0x00001e20	/* combiners, constant colors */
#define NV20_TCL_PRIMITIVE_3D_RC_COLOR1					0x00001e24
#define NV20_TCL_PRIMITIVE_3D_RC_FINAL0					0x00000288	/* final combiner, variables A-D */
#define NV20_TCL_PRIMITIVE_3D_RC_FINAL1					0x0000028c	/* final combiner, variables E-G */

#define NV20_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(n)			(0x0000105c+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_POSITION_Y(n)			(0x00001060+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_POSITION_Z(n)			(0x00001064+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_HALF_VECTOR_X(n)			(0x00001028+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_HALF_VECTOR_Y(n)			(0x0000102c+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_HALF_VECTOR_Z(n)			(0x00001030+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_DIRECTION_X(n)			(0x00001034+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_DIRECTION_Y(n)			(0x00001038+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_DIRECTION_Z(n)			(0x0000103c+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_R(n)	(0x00001000+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_G(n)	(0x00001004+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_B(n)	(0x00001008+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_R(n)	(0x0000100c+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_G(n)	(0x00001010+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_B(n)	(0x00001014+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_R(n)	(0x00001018+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_G(n)	(0x0000101c+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_B(n)	(0x00001020+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_BACK_SIDE_PRODUCT_AMBIENT(n)	(0x00000c00+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_BACK_SIDE_PRODUCT_DIFFUSE(n)	(0x00000c0c+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_BACK_SIDE_PRODUCT_SPECULAR(n)	(0x00000c18+(n<<6))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(n)		(0x00001068+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(n)		(0x0000106c+(n<<7))
#define NV20_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(n)		(0x00001070+(n<<7))

/* These commands seem right on NV28, calculations by pq. Note: d = sqrt(dirX^2 + dirY^2 + dirZ^2) */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(n)			(0x00001040+(n<<7)) /* unknown */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(n)			(0x00001044+(n<<7)) /* unknown */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(n)			(0x00001048+(n<<7)) /* unknown */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(n)			(0x0000104c+(n<<7)) /* 1/( cos(cutoff)-1 ) * dirX/d */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_Y(n)			(0x00001050+(n<<7)) /* 1/( cos(cutoff)-1 ) * dirY/d */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_Z(n)			(0x00001054+(n<<7)) /* 1/( cos(cutoff)-1 ) * dirZ/d */
#define NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(n)			(0x00001058+(n<<7)) /* 1 + 1/( cos(cutoff)-1 ) */

#define NV20_TCL_PRIMITIVE_3D_BACK_MATERIAL_SHININESS_A			0x00001e28
#define NV20_TCL_PRIMITIVE_3D_BACK_MATERIAL_SHININESS_B			0x00001e2c
#define NV20_TCL_PRIMITIVE_3D_BACK_MATERIAL_SHININESS_C			0x00001e30
#define NV20_TCL_PRIMITIVE_3D_BACK_MATERIAL_SHININESS_D			0x00001e34
#define NV20_TCL_PRIMITIVE_3D_BACK_MATERIAL_SHININESS_E			0x00001e38
#define NV20_TCL_PRIMITIVE_3D_BACK_MATERIAL_SHININESS_F			0x00001e3c

#define NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_ENABLE			0x0000147c
#define NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_PATTERN(n)		(0x00001480+(n<<2))
#define NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_PATTERN__SIZE		32

#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_3F_X				0x00001500
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_3F_Y				0x00001504
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_3F_Z				0x00001508
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_4F_X				0x00001518
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_4F_Y				0x0000151c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_4F_Z				0x00001520
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_4F_W				0x00001524
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_4I_XY				0x00001528
#define NV20_TCL_PRIMITIVE_3D_VERTEX_POS_4I_ZW				0x0000152c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_NOR_3F_X				0x00001530
#define NV20_TCL_PRIMITIVE_3D_VERTEX_NOR_3F_Y				0x00001534
#define NV20_TCL_PRIMITIVE_3D_VERTEX_NOR_3F_Z				0x00001538
#define NV20_TCL_PRIMITIVE_3D_VERTEX_NOR_3I_XY				0x00001540
#define NV20_TCL_PRIMITIVE_3D_VERTEX_NOR_3I_Z				0x00001544
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_4F_R				0x00001550
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_4F_G				0x00001554
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_4F_B				0x00001558
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_4F_A				0x0000155c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_3F_R				0x00001560
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_3F_G				0x00001564
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_3F_B				0x00001568
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL_4I				0x0000156c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL2_3F_R				0x00001580
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL2_3F_G				0x00001584
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL2_3F_B				0x00001588
#define NV20_TCL_PRIMITIVE_3D_VERTEX_COL2_3I				0x0000158c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_2F_S				0x00001590
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_2F_T				0x00001594
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_2I				0x00001598
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_4F_S				0x000015a0
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_4F_T				0x000015a4
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_4F_R				0x000015a8
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_4F_Q				0x000015ac
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_4I_ST				0x000015b0
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX0_4I_RQ				0x000015b4
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_2F_S				0x000015b8
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_2F_T				0x000015bc
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_2I				0x000015c0
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_4F_S				0x000015c8
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_4F_T				0x000015cc
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_4F_R				0x000015d0
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_4F_Q				0x000015d4
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_4I_ST				0x000015d8
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX1_4I_RQ				0x000015dc
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_2F_S				0x000015e0
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_2F_T				0x000015e4
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_2I				0x000015e8
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_4F_S				0x000015f0
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_4F_T				0x000015f4
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_4F_R				0x000015f8
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_4F_Q				0x000015fc
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_4I_ST				0x00001600
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX2_4I_RQ				0x00001604
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_2F_S				0x00001608
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_2F_T				0x0000160c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_2I				0x00001610
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_4F_S				0x00001620
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_4F_T				0x00001624
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_4F_R				0x00001628
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_4F_Q				0x0000162c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_4I_ST				0x00001630
#define NV20_TCL_PRIMITIVE_3D_VERTEX_TX3_4I_RQ				0x00001634
#define NV20_TCL_PRIMITIVE_3D_VERTEX_FOG_1F				0x00001698
#define NV20_TCL_PRIMITIVE_3D_EDGE_FLAG					0x000016bc

#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR0_POS			0x00001720
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR1_WGH			0x00001724
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR2_NOR			0x00001728
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR3_COL			0x0000172c
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR4_COL2			0x00001730
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR5_FOG			0x00001734
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR6				0x00001738
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR7				0x0000173c
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR8_TX0			0x00001740
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR9_TX1			0x00001744
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR10_TX2			0x00001748
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR11_TX3			0x0000174c
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR12_TX4			0x00001750
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR13_TX5			0x00001754
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR14_TX6			0x00001758
#define NV20_TCL_PRIMITIVE_3D_VB_POINTER_ATTR15_TX7			0x0000175c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(i)				(0x00001760 + (i * 0x04))
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR__SIZE				16
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR0_POS				0x00001760
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR1_WGH				0x00001764
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR2_NOR				0x00001768
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR3_COL				0x0000176c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR4_COL2				0x00001770
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR5_FOG				0x00001774
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR6				0x00001778
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR7				0x0000177c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR8_TX0				0x00001780
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR9_TX1				0x00001784
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR10_TX2				0x00001788
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR11_TX3				0x0000178c
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR12_TX4				0x00001790
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR13_TX5				0x00001794
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR14_TX6				0x00001798
#define NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR15_TX7				0x0000179c

#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R	0x000017a0
#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_G	0x000017a4
#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_B	0x000017a8
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_BACK_A			0x000017ac
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_BACK_R			0x000017b0
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_BACK_G			0x000017b4
#define NV20_TCL_PRIMITIVE_3D_COLOR_MATERIAL_BACK_B			0x000017b8
#define NV20_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE			0x000017bc
#define NV20_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_OP				0x000017c0
#define NV20_TCL_PRIMITIVE_3D_LIGHT_MODEL_TWO_SIDE_ENABLE		0x000017c4
//									0x000017cc
#define NV20_TCL_PRIMITIVE_3D_BEGIN_END					0x000017fc

#define NV20_TCL_PRIMITIVE_3D_INDEX_DATA				0x00001800
#define NV20_TCL_PRIMITIVE_3D_VB_VERTEX_BATCH				0x00001810
#define NV20_TCL_PRIMITIVE_3D_VERTEX_DATA				0x00001818
//									0x00001c18
#define NV20_TCL_PRIMITIVE_3D_SCISSOR_X2_X1				0x00001c30
#define NV20_TCL_PRIMITIVE_3D_SCISSOR_Y2_Y1				0x00001c50
#define NV20_TCL_PRIMITIVE_3D_ACTIVATE_COLORS				0x00001d6c
#define NV20_TCL_PRIMITIVE_3D_MULTISAMPLE				0x00001d7c	//bit0:MultiSampleAntiAliasing bits31-16:MultiSampleMask
#define NV20_TCL_PRIMITIVE_3D_CULL_ENABLE				0x00001d84	//bit0:OcclusionCullEnable bit1:StencilCullEnable
#define NV20_TCL_PRIMITIVE_3D_PARAMETER_A				0x00001d8c	//connects with MMIO 0x00401A88 (useful to pass parameters to interrupt routines)
#define NV20_TCL_PRIMITIVE_3D_PARAMETER_B				0x00001d90	//connects with MMIO 0x0040186C (useful to pass parameters to interrupt routines)
#define NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH				0x00001d8c
#define NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB				0x00001d90
#define NV20_TCL_PRIMITIVE_3D_CLEAR_WHICH_BUFFERS			0x00001d94	//used to trigger clear operation (Parameters A & B are then considered depth & color values)
#define NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_HORIZ				0x00001d98
#define NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_VERT				0x00001d9c
#define NV20_TCL_PRIMITIVE_3D_SHADOW_FUNC_FUNC				0x00001e6c
#define NV20_TCL_PRIMITIVE_3D_TX_SHADER_DOTMAPPING			0x00001e74 	//(0 means [0,255]argb from texture=>[0.0,1.0](r,g,b))
#define NV20_TCL_PRIMITIVE_3D_SHADER_TYPE				0x00001e94
#define 	SHADER_TYPE_INTERNAL	4
#define 	SHADER_TYPE_EXTERNAL	6
#define NV20_TCL_PRIMITIVE_3D_SHADER_SUBTYPE				0x00001e98
#define		SHADER_SUBTYPE_REGULAR	0 						//not allowed to write into constants: faster
#define NV20_TCL_PRIMITIVE_3D_VP_UPLOAD_FROM_ID				0x00001e9C
#define NV20_TCL_PRIMITIVE_3D_VP_PROGRAM_START_ID			0x00001ea0
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X				0x00001f00
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_Y				0x00001f04
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_Z				0x00001f08
#define NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_W				0x00001f0c
Big, isn't it?

I know Direct3D can do most of this stuff easily, but OpenGL supports all of this. As far as the shaders go, we can always use the NVparse library by NVIDIA as long as we stick to shader model 1.x. We're not using 2.x or later (and Xbox doesn't use it either) so that's not a big deal.

2. Some want Cxbx to run on Linux. Porting to OpenGL alone isn't going to be enough, but it can help some. Then the other DirectX related things (such as DirectSound and XInput) would have to be ported too. But judging by Caustik's latest changes with the SVN (in his branch), he's leaning toward the UNIX idea too.

3. NVIDIA's drivers have been breaking alot of things lately and not just with certain DX9 games. Direct3D 8.x support has gone downhill too with speed issues (noteably with vsync enabled). I'm not saying OpenGL is the solution to all our problems, but it can solve some. As far as speed goes, it can make us or break us depending on the implementation.

So, having stating stated my reasons, share yours.
__________________

Official Website of Shogun3D's RyuAwai!

Shogun3D Game Development Blog

Zengjük a Dalt: Manliest Song Ever!
blueshogun96 is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old April 20th, 2008, 09:54   #2
chesso
Registered User
 
Join Date: Jan 2003
Posts: 152
nice, I didn't know someone was still working on cxbx.. keep up the hard work!

from my point of view, you should use the API that lets you replicate the complete feature set in the easiest way. so that would be OpenGL from your introduction. but hey, we still didn't get the "why D3D should be better" side of the question (I'm waiting for it, I like tech-discussions!!)
chesso is offline   Reply With Quote
Old April 20th, 2008, 17:17   #3
RiotingPacifist
Registered User
 
Join Date: Apr 2008
Location: uk
Posts: 5
Id stick with DirectX, porting DirectX to openGL is hard. if you decide to go with openGL it would be worth looking at wine as theyve managed to get DirectX 7,8 and even some 9 working fairly well under openGL (by no means perfect)

Theyre also under a GPL(able) license so your free to use their code. You could even give them support for directx 8.xbox when your done (not sure though as their very picky about legality of code, due to having a large litigious company not wanting them to succeed)

Quote:
Originally Posted by chesso View Post
but hey, we still didn't get the "why D3D should be better" side of the question (I'm waiting for it, I like tech-discussions!!)
I cant give you the technical side of it but basically D3D is what the xbox uses, it is in theory easier to just add what's missing to D3D instead of convert the entire thing (but by using wines work this may be a moo point).

normal directx 8.1 -> wine opengl/normal directx
extra xbox stuff -> custom coded opengl/directx sutff

TBH i think just sticking to whichever is easiest to code for is best for now, just keep the code clean enough that it could be ported latter.
RiotingPacifist is offline   Reply With Quote
Old April 20th, 2008, 17:32   #4
Hard core Rikki
Moving into the beat
 
Hard core Rikki's Avatar
 
Join Date: May 2004
Location: Perpetual Hawaii
Posts: 11,298
8.1 ??? Definitely bad. DX9 much nicer, and would leave room to add DX10 features after time passes (and everyone in the planet owns DX10-capable cards and switches to Vista)

Depends on the feasability of the porting and render requirements...
OGL2 would be nice news anyway, at least for crosscompatibility
__________________

Hard core Rikki is offline   Reply With Quote
Old April 20th, 2008, 17:42   #5
RiotingPacifist
Registered User
 
Join Date: Apr 2008
Location: uk
Posts: 5
Quote:
Originally Posted by Hard core Rikki View Post
8.1 ??? Definitely bad. DX9 much nicer, and would leave room to add DX10 features after time passes (and everyone in the planet owns DX10-capable cards and switches to Vista)
wouldnt the games need to use DX9/10 for any benifit, my guess is that turok was so easy to port because it only used standard 8.1, the extra xbox features probably come in somewhere less impressive than directx 9, so unless somebody starts doing the cool sort of stuff people are doing for N64 emulators, support for anything more than 9 wont make any difference . but then IANAP (i am not a programer) so i may be wrong
RiotingPacifist is offline   Reply With Quote
Old April 20th, 2008, 19:44   #6
blueshogun96
Last Xbox Emu Author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Seattle, WA, USA
Posts: 5,843
Quote:
Originally Posted by chesso View Post
we still didn't get the "why D3D should be better" side of the question (I'm waiting for it, I like tech-discussions!!)
lol, sorry. I forgot to compare/contrast the two. I was going to post that as part of my first post, but I forgot

Anyway, let's look at the pros and cons for each.

Direct3D
Pros:
  • Easier to implement overall
  • Natively supports YUV surfaces/textures
  • Tends to be more compatible and Direct3D drivers are usually good for most cards (IMO)

Cons:
  • Lacks many basic features the NV2A supports
  • Less portable to other OSes

OpenGL
Pros:
  • Supports most features of the NV2A
  • More portable to other OSes
  • More control over pixel and texture alignments (if needed)

Cons:
  • Harder to implement
  • No native support for surfaces (but can use texture rectangle instead)
  • No native support for YUV textures, must be done manually
  • Immediate mode is a big no-no!
  • OpenGL is great in all, but good OpenGL drivers are not easy to come by for many cards/OSes and even NVIDIA's OpenGL drivers have gone downhill (IMO) -_-

That's my take on things. Everyone has their preferences, I just like the OpenGL idea better atm.
__________________

Official Website of Shogun3D's RyuAwai!

Shogun3D Game Development Blog

Zengjük a Dalt: Manliest Song Ever!
blueshogun96 is offline   Reply With Quote
Old April 20th, 2008, 19:55   #7
PCXL-Fan
Heroes Might&amp; Magic Champ
 
PCXL-Fan's Avatar
 
Join Date: Oct 2007
Location: Utterly destroying the soul of Gladiator@ with my box of tasty Cheesy Puff potato chips
Posts: 4,713
Well there is no garauntee that directx will come out with these features in the future. And as the attachment rate for new Microsoft OS's decreases (a trend we are already seeing) then even if they were to come out with a directx with these needed features in Windows 7 or 8 there likely won't be as many people buying them.

And M$ has now developed the habit of making future versions of directx exclusive to newer OS's.
__________________
Quote:
Originally Posted by Exodus
Yes, I like anime, Street Fighter, Japanese music and download video game music. Yes, I know... I've changed.
gamersat678's Bug Reporter ||| cottonvibe's pcsx2 guide for noobs ||| GSdx plugin ||| DirectX End-User Runtime Web Installer
PCXL-Fan is offline   Reply With Quote
Old April 20th, 2008, 20:00   #8
blueshogun96
Last Xbox Emu Author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Seattle, WA, USA
Posts: 5,843
Quote:
Originally Posted by RiotingPacifist View Post
wouldnt the games need to use DX9/10 for any benifit, my guess is that turok was so easy to port because it only used standard 8.1, the extra xbox features probably come in somewhere less impressive than directx 9, so unless somebody starts doing the cool sort of stuff people are doing for N64 emulators, support for anything more than 9 wont make any difference . but then IANAP (i am not a programer) so i may be wrong
Trust me, Turok wasn't easy. Compared to other games, maybe. Turok did use features not standard to PC Direct3D such as PushBuffers. If you play Turok on Cxbx you'll notice that it's not fully emulated. Level 6 does not render and the screen goes black whenever a rocket is fired or a jet engine is running (same with the flamethrower). Just so you all know, this is where Cxbx has to resort to using LLE to emulate that. I believe that porting to Direct3D 10 wouldn't be necessary either. There's nothing really to gain from it. It sounds cool, but there's no need to limit this emulator to Vista and the GeForce 8 series and above.

Quote:
Originally Posted by RiotingPacifist View Post
Id stick with DirectX, porting DirectX to openGL is hard.
Not really, if you know how to use both of them fluently. I see very little difficulty at all in doing so. For instance, There are many ways to emulate D3D's vertex buffers using OpenGL (and they aren't hard either) as well as index buffers. With surfaces we can always use GL_NV_texture_rectangle or GL_ARB_texture_rectangle to emulate that functionality. As far as matrices, it would be a pain to have to convert row major matrices to column major matrices, but the glTransposeMatrixARB extension handles that all for us. The shaders shouldn't be a problem either because we can always just use the NVparse library and that does most of the work for us (but we'll need to patch the shaders like we do for Direct3D regardless). Porting to OpenGL is easy as long as you know both of them well enough.

Personally I do like the idea of seeing games like Halo run using OpenGL instead of Direct3D, but that's not the biggest issue here. I've written a basic DirectX 3.0 wrapper using OpenGL before and it worked to a certain extent (because I didn't finish it). But knowing that Direct3D 8.x is more advanced than 3.0, I know some of it won't be a cake walk.

Quote:
Originally Posted by RiotingPacifist
it is in theory easier to just add what's missing to D3D instead of convert the entire thing
There are some features that can't be implemented in Direct3D at all (not even 10) such as front and backfill modes and many more. Some things when using Direct3D will just have to remain missing.

Quote:
Originally Posted by Hard core Rikki View Post
8.1 ??? Definitely bad. DX9 much nicer, and would leave room to add DX10 features after time passes (and everyone in the planet owns DX10-capable cards and switches to Vista)

Depends on the feasability of the porting and render requirements...
OGL2 would be nice news anyway, at least for crosscompatibility
Another reason (which I stated earlier) is to eliminate the Direct3D 8.x issues I'm having. I don't know if it's Direct3D altogether, but it's definetly something wrong with NVIDIA's drivers. For instance, Panzer Dragoon ran fine with decent framerates on my PC (which is more than enough to handle it) until I updated my drivers. Now instead of 60fps, I get 5-6fps. They've been causing games on Cxbx to slow down significantly for me (Turok still works fine though). I'm quite sure that some good robust OpenGL code can fix that. OpenGL performs better on my PC and better performance is a plus when you're working on it.
__________________

Official Website of Shogun3D's RyuAwai!

Shogun3D Game Development Blog

Zengjük a Dalt: Manliest Song Ever!

Last edited by blueshogun96; April 20th, 2008 at 20:25.. Reason: Automerged Doublepost
blueshogun96 is offline   Reply With Quote
Old April 20th, 2008, 21:39   #9
shadow_tj
Emu author
 
shadow_tj's Avatar
 
Join Date: Jul 2003
Location: Netherlands
Posts: 905
my opinion.. stick on directx...

for porting options.. cxbx is not even a 90% done..
but when yah making a switch. option to switch between opengl and directx..
it would be a nice extra feature.. also for the older gpu`s
shadow_tj is offline   Reply With Quote
Old April 20th, 2008, 21:57   #10
PCXL-Fan
Heroes Might&amp; Magic Champ
 
PCXL-Fan's Avatar
 
Join Date: Oct 2007
Location: Utterly destroying the soul of Gladiator@ with my box of tasty Cheesy Puff potato chips
Posts: 4,713
Okay i know practically nothing on the subject of graphics apis, but would it be possible to make an emulator that uses both APIs at once?
__________________
Quote:
Originally Posted by Exodus
Yes, I like anime, Street Fighter, Japanese music and download video game music. Yes, I know... I've changed.
gamersat678's Bug Reporter ||| cottonvibe's pcsx2 guide for noobs ||| GSdx plugin ||| DirectX End-User Runtime Web Installer
PCXL-Fan is offline   Reply With Quote
Old April 20th, 2008, 21:58   #11
Hard core Rikki
Moving into the beat
 
Hard core Rikki's Avatar
 
Join Date: May 2004
Location: Perpetual Hawaii
Posts: 11,298
Quote:
Originally Posted by PCXL-Fan View Post
would it be possible to make a hybrid that uses both APIs?
Short answer: no.
__________________

Hard core Rikki is offline   Reply With Quote
Old April 21st, 2008, 00:22   #12
blueshogun96
Last Xbox Emu Author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Seattle, WA, USA
Posts: 5,843
@PCXL, you mean mean an emulator that can allow you to choose what API you want to use? That can be done, but as far as using both at the same time, no.
__________________

Official Website of Shogun3D's RyuAwai!

Shogun3D Game Development Blog

Zengjük a Dalt: Manliest Song Ever!
blueshogun96 is offline   Reply With Quote
Old April 21st, 2008, 15:22   #13
zomby
Registered User
 
zomby's Avatar
 
Join Date: Aug 2003
Location: Quebec, Canada
Posts: 101
Myself I'd stick to Direct3D for now... it's easier to do a 1:1 translation of whatever is the same. When the emu gets to a point where things run better, the OpenGL alternative could be interesting. Unless someone has the time and skill to develop the OpenGL part in parallel to the Direct3D one. Then we could have the choice of both API's a lot earlier in the process.
zomby is offline   Reply With Quote
Old April 21st, 2008, 17:19   #14
Devil Master
Registered User
 
Join Date: Jul 2006
Location: Somewhere
Posts: 250
I'd suggest to stick to Direct3D for a simple reason: I'm a fan of stereoscopic 3D and I have an Xbox. Stereoscopic 3D (as per the nVidia standards) is easier to achieve with Direct3D than it is with OpenGL. The current stereoscopic polarized displays don't even support OpenGL. An Xbox emulator with support for stereoscopy (which almost comes naturally in Direct3D) would get my interest; an emulator with no stereoscopy support (which would almost surely be the case with OpenGL) would not.
Devil Master is offline   Reply With Quote
Old April 22nd, 2008, 01:19   #15
blueshogun96
Last Xbox Emu Author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Seattle, WA, USA
Posts: 5,843
Quote:
Originally Posted by Devil Master View Post
I'd suggest to stick to Direct3D for a simple reason: I'm a fan of stereoscopic 3D and I have an Xbox. Stereoscopic 3D (as per the nVidia standards) is easier to achieve with Direct3D than it is with OpenGL. The current stereoscopic polarized displays don't even support OpenGL. An Xbox emulator with support for stereoscopy (which almost comes naturally in Direct3D) would get my interest; an emulator with no stereoscopy support (which would almost surely be the case with OpenGL) would not.
Ok, so what you're saying is that only emulators that support Stereo3D interest you? The OpenGL port suggestion is merely for completion and possibly portability. I found this article from NVIDIA about using their stereo 3D drivers and programming Stereo3D apps for both Direct3D and OpenGL I don't know a whole lot about stereo3d myself, but I do know that they do work in OpenGL. I accidentally installed NVIDIA's stereo3D driver and got that 3D glasses effect in all OpenGL applications while Direct3D was unaffected.

Don't get me wrong, I like Stereo3D, but we can't limit the possibilities of an emulator for one feature.
__________________

Official Website of Shogun3D's RyuAwai!

Shogun3D Game Development Blog

Zengjük a Dalt: Manliest Song Ever!
blueshogun96 is offline   Reply With Quote
Old April 22nd, 2008, 04:54   #16
snickothemule
Hello Cudie Pie!
 
snickothemule's Avatar
 
Join Date: Apr 2008
Location: Coffs Harbour, Australia
Posts: 4,876
i think that OpenGL would be the go. You have a very good understanding of the workings of the Xbox and you seem to be comfortable with going with OpenGl. Ultimately you should work in an environment which you are most comfortable with. Perhaps simultaneously Caustik could work on Direct3D9?

Whatever you choose to follow, it will end up ace anyway. You guys who develop these Xbox emulators are nothing short of genius.
snickothemule is offline   Reply With Quote
Old April 22nd, 2008, 04:57   #17
Coolsvilleman
Emulation to the max!
 
Coolsvilleman's Avatar
 
Join Date: Jan 2004
Location: Canada
Posts: 2,560
Your right about OpenGL. Those registers do look very OpenGL friendly. I havent played with D3D but I have with opengl and it seems a good choice to port to it.
__________________
Q6600 Core 2 Quad || Soundblaster X-Fi Extreme HD || e-VGA 8800GTX || 4096mb 4-4-4-12-2T Dual-Channel RAM || MSI P6N Diamond || 2x 320GB Hardrive || 5.1 Speakers || Remote control || 8x USB 2.0 || DVD/CD ±RW Drive || 1x IEEE1394

www.coolsvilleman.homedns.org Normally down. E-mail me for a DVD @ coolsvilleman@gmail.com
Coolsvilleman is offline   Reply With Quote
Old April 22nd, 2008, 07:11   #18
mudlord
Banned
 
Join Date: Feb 2007
Location: Lost.
Posts: 1,761
My opinion? Go with OGL.
mudlord is offline   Reply With Quote
Old April 22nd, 2008, 07:19   #19
shadow_tj
Emu author
 
shadow_tj's Avatar
 
Join Date: Jul 2003
Location: Netherlands
Posts: 905
For developing the core functions of Cxbx... dev them on Directx.
When yah wanne do extra options make them nito a plugin system.

manny emulators, like the first psone emulators has plugin options for graphics and sound.


for example do something like this

Directx 8 Plugin
Directx 9 Plugin
Directx 10 Plugin
Opengl 1.2 Plugin
Opengl 2.0 Plgin
Software Render

Then yah got all the possible options. but the user can choose wich one fits best on his system config
shadow_tj is offline   Reply With Quote
Old April 22nd, 2008, 10:31   #20
chesso
Registered User
 
Join Date: Jan 2003
Posts: 152
Quote:
Originally Posted by shadow_tj View Post
For developing the core functions of Cxbx... dev them on Directx.
When yah wanne do extra options make them nito a plugin system.

manny emulators, like the first psone emulators has plugin options for graphics and sound.


for example do something like this

Directx 8 Plugin
Directx 9 Plugin
Directx 10 Plugin
Opengl 1.2 Plugin
Opengl 2.0 Plgin
Software Render

Then yah got all the possible options. but the user can choose wich one fits best on his system config
and who's gonna code all this stuff?
chesso is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 12:20.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.