Merge branch 'master' of git+ssh://geckosenator@git.freedesktop.org/git/mesa/mesa

This commit is contained in:
Sean D'Epagnier 2007-02-16 17:46:11 -07:00
commit 43c6b2f67f
16 changed files with 332 additions and 69 deletions

View file

@ -9,7 +9,7 @@ all: full subset
FULL = \
main.doxy \
math.doxy \
array_cache.doxy \
vbo.doxy \
glapi.doxy \
shader.doxy \
swrast.doxy \

View file

@ -23,7 +23,7 @@ PROJECT_NAME = Mesa
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 6.2
PROJECT_NUMBER = 6.5
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View file

@ -1,5 +1,5 @@
doxygen tnl_dd.doxy
doxygen array_cache.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
@ -10,7 +10,7 @@ doxygen shader.doxy
echo Building again, to resolve tags
doxygen tnl_dd.doxy
doxygen array_cache.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy

View file

@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = swrast.tag

View file

@ -7,7 +7,7 @@
<div class="qindex">
<a class="qindex" href="../main/index.html">core</a> |
<a class="qindex" href="../glapi/index.html">glapi</a> |
<a class="qindex" href="../array_cache/index.html">array_cache</a> |
<a class="qindex" href="../vbo/index.html">vbo</a> |
<a class="qindex" href="../math/index.html">math</a> |
<a class="qindex" href="../shader/index.html">shader</a> |
<a class="qindex" href="../swrast/index.html">swrast</a> |

View file

@ -40,7 +40,7 @@ SKIP_FUNCTION_MACROS = YES
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES = tnl_dd.tag=../tnl_dd \
array_cache.tag=../array_cache \
vbo.tag=../vbo \
glapi.tag=../glapi \
math.tag=../math \
shader.tag=../shader \

View file

@ -45,5 +45,5 @@ TAGFILES = tnl_dd.tag=../tnl_dd \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=../array_cache
vbo.tag=../vbo
GENERATE_TAGFILE = math.tag

View file

@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = swrast.tag

View file

@ -44,5 +44,5 @@ TAGFILES = main.tag=../core \
tnl_dd.tag=../tnl_dd \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = swrast.tag

View file

@ -45,5 +45,5 @@ TAGFILES = tnl_dd.tag=../tnl_dd \
math.tag=../math \
swrast.tag=../swrast \
tnl.tag=../tnl \
array_cache.tag=../array_cache
vbo.tag=../vbo
GENERATE_TAGFILE = swrast_setup.tag

View file

@ -46,5 +46,5 @@ TAGFILES = tnl_dd.tag=../tnl \
shader.tag=../shader \
swrast.tag=../swrast \
swrast_setup.tag=swrast_setup \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = tnl.tag

View file

@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = tnl_dd.tag

View file

@ -5,11 +5,11 @@
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa array_cache"
PROJECT_NAME = "Mesa vbo"
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/mesa/array_cache/
INPUT = ../src/mesa/vbo/
FILE_PATTERNS = *.c \
*.h
RECURSIVE = NO
@ -24,7 +24,7 @@ FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
HTML_OUTPUT = array_cache
HTML_OUTPUT = vbo
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
@ -47,4 +47,4 @@ TAGFILES = main.tag=../core \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
tnl_dd.tag=../tnl_dd
GENERATE_TAGFILE = array_cache.tag
GENERATE_TAGFILE = vbo.tag

View file

@ -34,6 +34,29 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h"
#include "colormac.h"
static void nv10ViewportScale(nouveauContextPtr nmesa)
{
GLcontext *ctx = nmesa->glCtx;
GLuint w = ctx->Viewport.Width;
GLuint h = ctx->Viewport.Height;
GLfloat max_depth = (ctx->Viewport.Near + ctx->Viewport.Far) * 0.5;
switch (ctx->DrawBuffer->_DepthBuffer->DepthBits) {
case 16:
max_depth *= 32767.0;
break;
case 24:
max_depth *= 16777215.0;
break;
}
BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_SCALE_X, 4);
OUT_RING_CACHEf ((((GLfloat) w) * 0.5) - 2048.0);
OUT_RING_CACHEf ((((GLfloat) h) * 0.5) - 2048.0);
OUT_RING_CACHEf (max_depth);
OUT_RING_CACHEf (0.0);
}
static void nv10AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
@ -98,16 +121,27 @@ static void nv10ClearColor(GLcontext *ctx, const GLfloat color[4])
static void nv10ClearDepth(GLcontext *ctx, GLclampd d)
{
/* FIXME: check if 16 or 24/32 bits depth buffer */
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8));
switch (ctx->DrawBuffer->_DepthBuffer->DepthBits) {
case 16:
nmesa->clear_value = (uint32_t)(d*0x7FFF);
break;
case 24:
nmesa->clear_value = ((nmesa->clear_value&0x000000FF) |
(((uint32_t)(d*0xFFFFFF))<<8));
break;
}
}
static void nv10ClearStencil(GLcontext *ctx, GLint s)
{
/* FIXME: not valid for 16 bits depth buffer (0 stencil bits) */
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF));
if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 24) {
nmesa->clear_value = ((nmesa->clear_value&0xFFFFFF00)|
(s&0x000000FF));
}
}
static void nv10ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation)
@ -164,9 +198,17 @@ static void nv10DepthMask(GLcontext *ctx, GLboolean flag)
static void nv10DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
GLfloat depth_scale = 16777216.0;
if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 16) {
depth_scale = 32768.0;
}
BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2);
OUT_RING_CACHEf(nearval);
OUT_RING_CACHEf(farval);
OUT_RING_CACHEf(nearval * depth_scale);
OUT_RING_CACHEf(farval * depth_scale);
nv10ViewportScale(nmesa);
}
/** Specify the current buffer for writing */
@ -616,8 +658,10 @@ static void nv10WindowMoved(nouveauContextPtr nmesa)
OUT_RING(0);
BEGIN_RING_CACHE(NvSub3D,
NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 2);
NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING_CACHE(((w+x-1) << 16) | x | 0x08000800);
BEGIN_RING_CACHE(NvSub3D,
NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1);
OUT_RING_CACHE(((h+y-1) << 16) | y | 0x08000800);
for (i=1; i<8; i++) {
BEGIN_RING_CACHE(NvSub3D,
@ -628,18 +672,7 @@ static void nv10WindowMoved(nouveauContextPtr nmesa)
OUT_RING_CACHE(0);
}
/* viewport transform */
BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4);
OUT_RING_CACHEf ((GLfloat) x);
OUT_RING_CACHEf ((GLfloat) (y+h));
OUT_RING_CACHEf (0.0);
OUT_RING_CACHEf (0.0);
BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_SCALE_X, 4);
OUT_RING_CACHEf ((((GLfloat) w) * 0.5) - 2048.0);
OUT_RING_CACHEf ((((GLfloat) h) * 0.5) - 2048.0);
OUT_RING_CACHEf (16777215.0 * 0.5);
OUT_RING_CACHEf (0.0);
nv10ViewportScale(nmesa);
}
/* Initialise any card-specific non-GL related state */
@ -700,6 +733,13 @@ static GLboolean nv10BindBuffers(nouveauContextPtr nmesa, int num_color,
OUT_RING_CACHE(color[0]->offset);
OUT_RING_CACHE(depth ? depth->offset : color[0]->offset);
/* Always set to bottom left of buffer */
BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4);
OUT_RING_CACHEf (0.0);
OUT_RING_CACHEf ((GLfloat) h);
OUT_RING_CACHEf (0.0);
OUT_RING_CACHEf (0.0);
return GL_TRUE;
}

View file

@ -41,8 +41,8 @@ static void nv20AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
CLAMPED_FLOAT_TO_UBYTE(ubRef, ref);
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2);
OUT_RING_CACHE(func); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */
OUT_RING_CACHE(ubRef); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */
OUT_RING_CACHE(func);
OUT_RING_CACHE(ubRef);
}
static void nv20BlendColor(GLcontext *ctx, const GLfloat color[4])
@ -76,6 +76,11 @@ static void nv20BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfac
OUT_RING_CACHE((dfactorA<<16) | dfactorRGB);
}
static void nv20Clear(GLcontext *ctx, GLbitfield mask)
{
/* TODO */
}
static void nv20ClearColor(GLcontext *ctx, const GLfloat color[4])
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
@ -297,7 +302,11 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state)
// case GL_POST_COLOR_MATRIX_COLOR_TABLE:
// case GL_POST_CONVOLUTION_COLOR_TABLE:
// case GL_RESCALE_NORMAL:
// case GL_SCISSOR_TEST:
case GL_SCISSOR_TEST:
/* No enable bit, nv20Scissor will adjust to max range */
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
break;
// case GL_SEPARABLE_2D:
case GL_STENCIL_TEST:
// TODO BACK and FRONT ?
@ -511,9 +520,22 @@ static void nv20PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
}
/** Set the scale and units used to calculate depth values */
void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
static void nv20PolygonOffset(GLcontext *ctx, GLfloat factor, GLfloat units)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR, 2);
OUT_RING_CACHEf(factor);
OUT_RING_CACHEf(units);
}
/** Set the polygon stippling pattern */
void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
static void nv20PolygonStipple(GLcontext *ctx, const GLubyte *mask )
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_PATTERN(0), 32);
OUT_RING_CACHEp(mask, 32);
}
/* Specifies the current buffer for reading */
void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
/** Set rasterization mode */
@ -522,6 +544,22 @@ void (*RenderMode)(GLcontext *ctx, GLenum mode );
/** Define the scissor box */
static void nv20Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
/* There's no scissor enable bit, so adjust the scissor to cover the
* maximum draw buffer bounds
*/
if (!ctx->Scissor.Enabled) {
x = y = 0;
w = h = 4095;
} else {
x += nmesa->drawX;
y += nmesa->drawY;
}
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SCISSOR_X2_X1, 2);
OUT_RING_CACHE(((x+w-1) << 16) | x);
OUT_RING_CACHE(((y+h-1) << 16) | y);
}
/** Select flat or smooth shading */
@ -576,22 +614,103 @@ void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
void (*TexParameter)(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params);
void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
/** Set the viewport */
static void nv20Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
static void nv20TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
{
/* TODO: Where do the VIEWPORT_XFRM_* regs come in? */
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2);
OUT_RING_CACHE((w << 16) | x);
OUT_RING_CACHE((h << 16) | y);
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_TX_MATRIX(unit, 0), 16);
/*XXX: This SHOULD work.*/
OUT_RING_CACHEp(mat->m, 16);
}
/* Update anything that depends on the window position/size */
static void nv20WindowMoved(nouveauContextPtr nmesa)
{
GLcontext *ctx = nmesa->glCtx;
GLfloat *v = nmesa->viewport.m;
GLuint w = ctx->Viewport.Width;
GLuint h = ctx->Viewport.Height;
GLuint x = ctx->Viewport.X + nmesa->drawX;
GLuint y = ctx->Viewport.Y + nmesa->drawY;
int i;
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2);
OUT_RING_CACHE((w << 16) | x);
OUT_RING_CACHE((h << 16) | y);
BEGIN_RING_SIZE(NvSub3D, 0x02b4, 1);
OUT_RING(0);
BEGIN_RING_CACHE(NvSub3D,
NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING_CACHE((4095 << 16) | 0);
BEGIN_RING_CACHE(NvSub3D,
NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1);
OUT_RING_CACHE((4095 << 16) | 0);
for (i=1; i<8; i++) {
BEGIN_RING_CACHE(NvSub3D,
NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 1);
OUT_RING_CACHE(0);
BEGIN_RING_CACHE(NvSub3D,
NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(i), 1);
OUT_RING_CACHE(0);
}
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
/* TODO: recalc viewport scale coefs */
}
/* Initialise any card-specific non-GL related state */
static GLboolean nv20InitCard(nouveauContextPtr nmesa)
{
return GL_TRUE;
nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D);
BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SET_OBJECT1, 2);
OUT_RING(NvDmaFB); /* 184 dma_object1 */
OUT_RING(NvDmaFB); /* 188 dma_object2 */
BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SET_OBJECT3, 2);
OUT_RING(NvDmaFB); /* 194 dma_object3 */
OUT_RING(NvDmaFB); /* 198 dma_object4 */
BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SET_OBJECT8, 1);
OUT_RING(NvDmaFB); /* 1a8 dma_object8 */
BEGIN_RING_SIZE(NvSub3D, 0x17e0, 3);
OUT_RINGf(0.0);
OUT_RINGf(0.0);
OUT_RINGf(1.0);
BEGIN_RING_SIZE(NvSub3D, 0x1e6c, 1);
OUT_RING(0x0db6);
BEGIN_RING_SIZE(NvSub3D, 0x0290, 1);
OUT_RING(0x00100001);
BEGIN_RING_SIZE(NvSub3D, 0x09fc, 1);
OUT_RING(0);
BEGIN_RING_SIZE(NvSub3D, 0x1d80, 1);
OUT_RING(1);
BEGIN_RING_SIZE(NvSub3D, 0x09f8, 1);
OUT_RING(4);
BEGIN_RING_SIZE(NvSub3D, 0x17ec, 3);
OUT_RINGf(0.0);
OUT_RINGf(1.0);
OUT_RINGf(0.0);
BEGIN_RING_SIZE(NvSub3D, 0x1d88, 1);
OUT_RING(3);
/* FIXME: More dma objects to setup ? */
BEGIN_RING_SIZE(NvSub3D, 0x1e98, 1);
OUT_RING(0);
BEGIN_RING_SIZE(NvSub3D, 0x120, 3);
OUT_RING(0);
OUT_RING(1);
OUT_RING(2);
return GL_TRUE;
}
/* Update buffer offset/pitch/format */
@ -599,26 +718,57 @@ static GLboolean nv20BindBuffers(nouveauContextPtr nmesa, int num_color,
nouveau_renderbuffer **color,
nouveau_renderbuffer *depth)
{
return GL_TRUE;
}
GLuint x, y, w, h;
GLuint pitch, format, depth_pitch;
/* Update anything that depends on the window position/size */
static void nv20WindowMoved(nouveauContextPtr nmesa)
{
w = color[0]->mesa.Width;
h = color[0]->mesa.Height;
x = nmesa->drawX;
y = nmesa->drawY;
if (num_color != 1)
return GL_FALSE;
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 6);
OUT_RING_CACHE((w << 16) | x);
OUT_RING_CACHE((h << 16) | y);
depth_pitch = (depth ? depth->pitch : color[0]->pitch);
pitch = (depth_pitch<<16) | color[0]->pitch;
format = 0x128;
if (color[0]->mesa._ActualFormat != GL_RGBA8) {
format = 0x123; /* R5G6B5 color buffer */
}
OUT_RING_CACHE(format);
OUT_RING_CACHE(pitch);
OUT_RING_CACHE(color[0]->offset);
OUT_RING_CACHE(depth ? depth->offset : color[0]->offset);
if (depth) {
BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LMA_DEPTH_BUFFER_PITCH, 2);
/* TODO: use a different buffer */
OUT_RING(depth->pitch);
OUT_RING(depth->offset);
}
/* Always set to bottom left of buffer */
BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4);
OUT_RING_CACHEf (0.0);
OUT_RING_CACHEf ((GLfloat) h);
OUT_RING_CACHEf (0.0);
OUT_RING_CACHEf (0.0);
return GL_TRUE;
}
void nv20InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
nmesa->hw_func.InitCard = nv20InitCard;
nmesa->hw_func.BindBuffers = nv20BindBuffers;
nmesa->hw_func.WindowMoved = nv20WindowMoved;
func->AlphaFunc = nv20AlphaFunc;
func->BlendColor = nv20BlendColor;
func->BlendEquationSeparate = nv20BlendEquationSeparate;
func->BlendFuncSeparate = nv20BlendFuncSeparate;
func->Clear = nv20Clear;
func->ClearColor = nv20ClearColor;
func->ClearDepth = nv20ClearDepth;
func->ClearStencil = nv20ClearStencil;
@ -641,22 +791,21 @@ void nv20InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
func->PointParameterfv = nv20PointParameterfv;
func->PointSize = nv20PointSize;
func->PolygonMode = nv20PolygonMode;
#if 0
func->PolygonOffset = nv20PolygonOffset;
func->PolygonStipple = nv20PolygonStipple;
func->ReadBuffer = nv20ReadBuffer;
func->RenderMode = nv20RenderMode;
#endif
/* func->ReadBuffer = nv20ReadBuffer;*/
/* func->RenderMode = nv20RenderMode;*/
func->Scissor = nv20Scissor;
func->ShadeModel = nv20ShadeModel;
func->StencilFuncSeparate = nv20StencilFuncSeparate;
func->StencilMaskSeparate = nv20StencilMaskSeparate;
func->StencilOpSeparate = nv20StencilOpSeparate;
#if 0
func->TexGen = nv20TexGen;
func->TexParameter = nv20TexParameter;
/* func->TexGen = nv20TexGen;*/
/* func->TexParameter = nv20TexParameter;*/
func->TextureMatrix = nv20TextureMatrix;
#endif
func->Viewport = nv20Viewport;
nmesa->hw_func.InitCard = nv20InitCard;
nmesa->hw_func.BindBuffers = nv20BindBuffers;
nmesa->hw_func.WindowMoved = nv20WindowMoved;
}

View file

@ -293,7 +293,11 @@ static void nv50Enable(GLcontext *ctx, GLenum cap, GLboolean state)
// case GL_POST_COLOR_MATRIX_COLOR_TABLE:
// case GL_POST_CONVOLUTION_COLOR_TABLE:
// case GL_RESCALE_NORMAL:
// case GL_SCISSOR_TEST:
case GL_SCISSOR_TEST:
/* No enable bit, nv50Scissor will adjust to max range */
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
break;
// case GL_SEPARABLE_2D:
case GL_STENCIL_TEST:
// TODO BACK and FRONT ?
@ -416,6 +420,21 @@ void (*RenderMode)(GLcontext *ctx, GLenum mode );
static void nv50Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
/* There's no scissor enable bit, so adjust the scissor to cover the
* maximum draw buffer bounds
*/
if (!ctx->Scissor.Enabled) {
x = y = 0;
w = h = 8191;
} else {
x += nmesa->drawX;
y += nmesa->drawY;
}
BEGIN_RING_CACHE(NvSub3D, NV50_TCL_PRIMITIVE_3D_SCISSOR_WIDTH_XPOS, 2);
OUT_RING_CACHE(((w) << 16) | x);
OUT_RING_CACHE(((h) << 16) | y);
}
/** Select flat or smooth shading */
@ -503,10 +522,65 @@ static void nv50TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
static void nv50WindowMoved(nouveauContextPtr nmesa)
{
GLcontext *ctx = nmesa->glCtx;
GLfloat *v = nmesa->viewport.m;
GLuint w = ctx->Viewport.Width;
GLuint h = ctx->Viewport.Height;
GLuint x = ctx->Viewport.X + nmesa->drawX;
GLuint y = ctx->Viewport.Y + nmesa->drawY;
int i;
BEGIN_RING_CACHE(NvSub3D,
NV50_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 2);
OUT_RING_CACHE((8191 << 16) | 0);
OUT_RING_CACHE((8191 << 16) | 0);
for (i=1; i<8; i++) {
BEGIN_RING_CACHE(NvSub3D,
NV50_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 2);
OUT_RING_CACHE(0);
OUT_RING_CACHE(0);
}
ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
ctx->Scissor.Width, ctx->Scissor.Height);
}
static GLboolean nv50InitCard(nouveauContextPtr nmesa)
{
int i,j;
nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D);
BEGIN_RING_SIZE(NvSub3D, 0x1558, 1);
OUT_RING(1);
BEGIN_RING_SIZE(NvSub3D, NV50_TCL_PRIMITIVE_3D_SET_OBJECT_1(0), 8);
for (i=0; i<8; i++) {
OUT_RING(NvDmaFB);
}
BEGIN_RING_SIZE(NvSub3D, NV50_TCL_PRIMITIVE_3D_SET_OBJECT_0(0), 12);
for (i=0; i<12; i++) {
OUT_RING(NvDmaFB);
}
BEGIN_RING_SIZE(NvSub3D, 0x121c, 1);
OUT_RING(1);
for (i=0; i<8; i++) {
BEGIN_RING_SIZE(NvSub3D, 0x0200 + (i*0x20), 5);
for (j=0; j<5; j++) {
OUT_RING(0);
}
}
BEGIN_RING_SIZE(NvSub3D, 0x0fe0, 5);
OUT_RING(0);
OUT_RING(0);
OUT_RING(0x16);
OUT_RING(0);
OUT_RING(0);
return GL_FALSE;
}