TINYGL: Rearrange access gl context access from/to frame buffer class

This commit is contained in:
Paweł Kołodziejski 2021-12-07 19:58:03 +01:00
parent d6aebf4eaa
commit 2368991ab6
No known key found for this signature in database
GPG key ID: 0BDADC9E74440FF7
13 changed files with 179 additions and 198 deletions

View file

@ -730,12 +730,12 @@ void tglDebug(int mode) {
void tglSetShadowMaskBuf(unsigned char *buf) { void tglSetShadowMaskBuf(unsigned char *buf) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = TinyGL::gl_get_context();
c->fb->shadow_mask_buf = buf; c->shadow_mask_buf = buf;
} }
void tglSetShadowColor(unsigned char r, unsigned char g, unsigned char b) { void tglSetShadowColor(unsigned char r, unsigned char g, unsigned char b) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = TinyGL::gl_get_context();
c->fb->shadow_color_r = r << 8; c->shadow_color_r = r << 8;
c->fb->shadow_color_g = g << 8; c->shadow_color_g = g << 8;
c->fb->shadow_color_b = b << 8; c->shadow_color_b = b << 8;
} }

View file

@ -400,10 +400,10 @@ void GLContext::gl_draw_triangle_fill(GLContext *c, GLVertex *p0, GLVertex *p1,
c->fb->fillTriangleDepthOnly(&p0->zp, &p1->zp, &p2->zp); c->fb->fillTriangleDepthOnly(&p0->zp, &p1->zp, &p2->zp);
} }
if (c->shadow_mode & 1) { if (c->shadow_mode & 1) {
assert(c->fb->shadow_mask_buf); assert(c->shadow_mask_buf);
c->fb->fillTriangleFlatShadowMask(&p0->zp, &p1->zp, &p2->zp); c->fb->fillTriangleFlatShadowMask(&p0->zp, &p1->zp, &p2->zp);
} else if (c->shadow_mode & 2) { } else if (c->shadow_mode & 2) {
assert(c->fb->shadow_mask_buf); assert(c->shadow_mask_buf);
c->fb->fillTriangleFlatShadow(&p0->zp, &p1->zp, &p2->zp); c->fb->fillTriangleFlatShadow(&p0->zp, &p1->zp, &p2->zp);
} else if (c->texture_2d_enabled && c->current_texture && c->current_texture->images[0].pixmap) { } else if (c->texture_2d_enabled && c->current_texture && c->current_texture->images[0].pixmap) {
#ifdef TINYGL_PROFILE #ifdef TINYGL_PROFILE

View file

@ -57,10 +57,10 @@ void tglGetIntegerv(int pname, int *params) {
*params = MAX_TEXTURE_STACK_DEPTH; *params = MAX_TEXTURE_STACK_DEPTH;
break; break;
case TGL_BLEND: case TGL_BLEND:
*params = c->fb->isBlendingEnabled(); *params = c->blending_enabled;
break; break;
case TGL_ALPHA_TEST: case TGL_ALPHA_TEST:
*params = c->fb->isAlphaTestEnabled(); *params = c->alpha_test_enabled;
break; break;
default: default:
error("tglGet: option not implemented"); error("tglGet: option not implemented");

View file

@ -95,7 +95,6 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
initSharedState(); initSharedState();
// lists // lists
exec_flag = 1; exec_flag = 1;
compile_flag = 0; compile_flag = 0;
print_flag = 0; print_flag = 0;
@ -179,10 +178,13 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
name_stack_size = 0; name_stack_size = 0;
// blending // blending
fb->enableBlending(false); blending_enabled = false;
// alpha test // alpha test
fb->enableAlphaTest(false); alpha_test_enabled = false;
// depth test
depth_test = false;
// matrix // matrix
matrix_mode = 0; matrix_mode = 0;
@ -230,9 +232,6 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
specbuf_used_counter = 0; specbuf_used_counter = 0;
specbuf_num_buffers = 0; specbuf_num_buffers = 0;
// depth test
depth_test = 0;
color_mask = (1 << 24) | (1 << 16) | (1 << 8) | (1 << 0); color_mask = (1 << 24) | (1 << 16) | (1 << 8) | (1 << 0);
const int kDrawCallMemory = 5 * 1024 * 1024; const int kDrawCallMemory = 5 * 1024 * 1024;

View file

@ -87,13 +87,12 @@ void GLContext::glopEnableDisable(GLParam *p) {
break; break;
case TGL_DEPTH_TEST: case TGL_DEPTH_TEST:
depth_test = v; depth_test = v;
fb->enableDepthTest(v);
break; break;
case TGL_ALPHA_TEST: case TGL_ALPHA_TEST:
fb->enableAlphaTest(v); alpha_test_enabled = v;
break; break;
case TGL_BLEND: case TGL_BLEND:
fb->enableBlending(v); blending_enabled = v;
break; break;
case TGL_POLYGON_OFFSET_FILL: case TGL_POLYGON_OFFSET_FILL:
if (v) if (v)
@ -136,20 +135,17 @@ void GLContext::glopEnableDisable(GLParam *p) {
} }
void GLContext::glopBlendFunc(GLParam *p) { void GLContext::glopBlendFunc(GLParam *p) {
TGLenum sfactor = p[1].i; source_blending_factor = p[1].i;
TGLenum dfactor = p[2].i; destination_blending_factor = p[2].i;
fb->setBlendingFactors(sfactor, dfactor);
} }
void GLContext::glopAlphaFunc(GLParam *p) { void GLContext::glopAlphaFunc(GLParam *p) {
TGLenum func = p[1].i; alpha_test_func = p[1].i;
float ref = p[2].f; alpha_test_ref_val = (int)(p[2].f * 255);
fb->setAlphaTestFunc(func, (int)(ref * 255));
} }
void GLContext::glopDepthFunc(GLParam *p) { void GLContext::glopDepthFunc(GLParam *p) {
TGLenum func = p[1].i; depth_func = p[1].i;
fb->setDepthFunc(func);
} }
void GLContext::glopShadeModel(GLParam *p) { void GLContext::glopShadeModel(GLParam *p) {
@ -200,8 +196,8 @@ void GLContext::glopColorMask(GLParam *p) {
color_mask = p[1].i; color_mask = p[1].i;
} }
void GLContext::glopDepthMask(TinyGL::GLParam *p) { void GLContext::glopDepthMask(GLParam *p) {
fb->enableDepthWrite(p[1].i); depth_write = p[1].i;
} }
} // end of namespace TinyGL } // end of namespace TinyGL

View file

@ -314,8 +314,8 @@ namespace TinyGL {
// This blit only supports tinting but it will fall back to simpleBlit // This blit only supports tinting but it will fall back to simpleBlit
// if flipping is required (or anything more complex than that, including rotationd and scaling). // if flipping is required (or anything more complex than that, including rotationd and scaling).
template <bool kDisableColoring, bool kDisableBlending, bool kEnableAlphaBlending> template <bool kDisableColoring, bool kDisableBlending, bool kEnableAlphaBlending>
FORCEINLINE void TinyGL::BlitImage::tglBlitRLE(int dstX, int dstY, int srcX, int srcY, int srcWidth, int srcHeight, float aTint, float rTint, float gTint, float bTint) { FORCEINLINE void BlitImage::tglBlitRLE(int dstX, int dstY, int srcX, int srcY, int srcWidth, int srcHeight, float aTint, float rTint, float gTint, float bTint) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
int clampWidth, clampHeight; int clampWidth, clampHeight;
int width = srcWidth, height = srcHeight; int width = srcWidth, height = srcHeight;
@ -404,8 +404,8 @@ FORCEINLINE void TinyGL::BlitImage::tglBlitRLE(int dstX, int dstY, int srcX, int
// This blit function is called when flipping is needed but transformation isn't. // This blit function is called when flipping is needed but transformation isn't.
template <bool kDisableBlending, bool kDisableColoring, bool kFlipVertical, bool kFlipHorizontal> template <bool kDisableBlending, bool kDisableColoring, bool kFlipVertical, bool kFlipHorizontal>
FORCEINLINE void TinyGL::BlitImage::tglBlitSimple(int dstX, int dstY, int srcX, int srcY, int srcWidth, int srcHeight, float aTint, float rTint, float gTint, float bTint) { FORCEINLINE void BlitImage::tglBlitSimple(int dstX, int dstY, int srcX, int srcY, int srcWidth, int srcHeight, float aTint, float rTint, float gTint, float bTint) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
int clampWidth, clampHeight; int clampWidth, clampHeight;
int width = srcWidth, height = srcHeight; int width = srcWidth, height = srcHeight;
@ -457,9 +457,9 @@ FORCEINLINE void TinyGL::BlitImage::tglBlitSimple(int dstX, int dstY, int srcX,
// This function is called when scale is needed: it uses a simple nearest // This function is called when scale is needed: it uses a simple nearest
// filter to scale the blit image before copying it to the screen. // filter to scale the blit image before copying it to the screen.
template <bool kDisableBlending, bool kDisableColoring, bool kFlipVertical, bool kFlipHorizontal> template <bool kDisableBlending, bool kDisableColoring, bool kFlipVertical, bool kFlipHorizontal>
FORCEINLINE void TinyGL::BlitImage::tglBlitScale(int dstX, int dstY, int width, int height, int srcX, int srcY, int srcWidth, int srcHeight, FORCEINLINE void BlitImage::tglBlitScale(int dstX, int dstY, int width, int height, int srcX, int srcY, int srcWidth, int srcHeight,
float aTint, float rTint, float gTint, float bTint) { float aTint, float rTint, float gTint, float bTint) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
int clampWidth, clampHeight; int clampWidth, clampHeight;
if (clipBlitImage(c, srcX, srcY, srcWidth, srcHeight, width, height, dstX, dstY, clampWidth, clampHeight) == false) if (clipBlitImage(c, srcX, srcY, srcWidth, srcHeight, width, height, dstX, dstY, clampWidth, clampHeight) == false)
@ -546,9 +546,9 @@ systems.
*/ */
template <bool kDisableBlending, bool kDisableColoring, bool kFlipVertical, bool kFlipHorizontal> template <bool kDisableBlending, bool kDisableColoring, bool kFlipVertical, bool kFlipHorizontal>
FORCEINLINE void TinyGL::BlitImage::tglBlitRotoScale(int dstX, int dstY, int width, int height, int srcX, int srcY, int srcWidth, int srcHeight, int rotation, FORCEINLINE void BlitImage::tglBlitRotoScale(int dstX, int dstY, int width, int height, int srcX, int srcY, int srcWidth, int srcHeight, int rotation,
int originX, int originY, float aTint, float rTint, float gTint, float bTint) { int originX, int originY, float aTint, float rTint, float gTint, float bTint) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
int clampWidth, clampHeight; int clampWidth, clampHeight;
if (clipBlitImage(c, srcX, srcY, srcWidth, srcHeight, width, height, dstX, dstY, clampWidth, clampHeight) == false) if (clipBlitImage(c, srcX, srcY, srcWidth, srcHeight, width, height, dstX, dstY, clampWidth, clampHeight) == false)
@ -710,8 +710,8 @@ void tglBlit(BlitImage *blitImage, const BlitTransform &transform) {
GLContext *c = gl_get_context(); GLContext *c = gl_get_context();
bool disableColor = transform._aTint == 1.0f && transform._bTint == 1.0f && transform._gTint == 1.0f && transform._rTint == 1.0f; bool disableColor = transform._aTint == 1.0f && transform._bTint == 1.0f && transform._gTint == 1.0f && transform._rTint == 1.0f;
bool disableTransform = transform._destinationRectangle.width() == 0 && transform._destinationRectangle.height() == 0 && transform._rotation == 0; bool disableTransform = transform._destinationRectangle.width() == 0 && transform._destinationRectangle.height() == 0 && transform._rotation == 0;
bool disableBlend = c->fb->isBlendingEnabled() == false; bool disableBlend = c->blending_enabled == false;
bool enableAlphaBlending = c->fb->isAlphaBlendingEnabled(); bool enableAlphaBlending = c->source_blending_factor == TGL_SRC_ALPHA && c->destination_blending_factor == TGL_ONE_MINUS_SRC_ALPHA;
if (enableAlphaBlending) { if (enableAlphaBlending) {
tglBlit<true>(blitImage, transform, disableColor, disableTransform, disableBlend); tglBlit<true>(blitImage, transform, disableColor, disableTransform, disableBlend);
@ -756,7 +756,7 @@ void tglBlitSetScissorRect(const Common::Rect &rect) {
gl_get_context()->_scissorRect = rect; gl_get_context()->_scissorRect = rect;
} }
void tglBlitResetScissorRect(void) { void tglBlitResetScissorRect() {
GLContext *c = gl_get_context(); GLContext *c = gl_get_context();
c->_scissorRect = c->renderRect; c->_scissorRect = c->renderRect;
} }

View file

@ -175,15 +175,15 @@ namespace Internal {
void tglCleanupImages(); // This function checks if any blit image is to be cleaned up and deletes it. void tglCleanupImages(); // This function checks if any blit image is to be cleaned up and deletes it.
// Documentation for those is the same as the one before, only those function are the one that actually execute the correct code path. // Documentation for those is the same as the one before, only those function are the one that actually execute the correct code path.
void tglBlit(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform); void tglBlit(BlitImage *blitImage, const BlitTransform &transform);
// Disables blending explicitly. // Disables blending explicitly.
void tglBlitNoBlend(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform); void tglBlitNoBlend(BlitImage *blitImage, const BlitTransform &transform);
// Disables blending, transforms and tinting. // Disables blending, transforms and tinting.
void tglBlitFast(TinyGL::BlitImage *blitImage, int x, int y); void tglBlitFast(BlitImage *blitImage, int x, int y);
void tglBlitZBuffer(TinyGL::BlitImage *blitImage, int x, int y); void tglBlitZBuffer(BlitImage *blitImage, int x, int y);
/** /**
@brief Sets up a scissor rectangle for blit calls: every blit call is affected by this rectangle. @brief Sets up a scissor rectangle for blit calls: every blit call is affected by this rectangle.

View file

@ -80,65 +80,22 @@ void memset_l(void *adr, int val, int count) {
*p++ = val; *p++ = val;
} }
FrameBuffer::FrameBuffer(int width, int height, const Graphics::PixelBuffer &frame_buffer) : _depthWrite(true), _enableScissor(false) { FrameBuffer::FrameBuffer(int width, int height, const Graphics::PixelFormat &format) {
this->xsize = width;
this->ysize = height;
this->cmode = frame_buffer.getFormat();
this->pixelbytes = this->cmode.bytesPerPixel;
this->linesize = (xsize * this->pixelbytes + 3) & ~3;
int size = this->xsize * this->ysize * sizeof(unsigned int);
this->_zbuf = (unsigned int *)gl_zalloc(size);
this->frame_buffer_allocated = 0;
this->pbuf = frame_buffer;
this->current_texture = NULL;
this->shadow_mask_buf = NULL;
this->buffer.pbuf = this->pbuf.getRawBuffer();
this->buffer.zbuf = this->_zbuf;
_blendingEnabled = false;
_alphaTestEnabled = false;
_depthTestEnabled = false;
_depthFunc = TGL_LESS;
_offsetStates = 0;
_offsetFactor = 0.0f;
_offsetUnits = 0.0f;
}
FrameBuffer::FrameBuffer(int width, int height, const Graphics::PixelFormat &format) : _depthWrite(true), _enableScissor(false) {
this->xsize = width; this->xsize = width;
this->ysize = height; this->ysize = height;
this->cmode = format; this->cmode = format;
this->pixelbytes = this->cmode.bytesPerPixel; this->pixelbytes = this->cmode.bytesPerPixel;
this->linesize = (xsize * this->pixelbytes + 3) & ~3; this->linesize = (xsize * this->pixelbytes + 3) & ~3;
int size = this->xsize * this->ysize * sizeof(unsigned int); this->buffer.zbuf = this->_zbuf = (unsigned int *)gl_zalloc(this->xsize * this->ysize * sizeof(unsigned int));
this->_zbuf = (unsigned int *)gl_zalloc(size);
byte *pixelBuffer = new byte[this->ysize * this->linesize];
this->pbuf.set(this->cmode, pixelBuffer);
this->frame_buffer_allocated = 1;
this->current_texture = NULL;
this->shadow_mask_buf = NULL;
this->pbuf.set(this->cmode, new byte[this->ysize * this->linesize]);
this->buffer.pbuf = this->pbuf.getRawBuffer(); this->buffer.pbuf = this->pbuf.getRawBuffer();
this->buffer.zbuf = this->_zbuf;
_blendingEnabled = false; _currentTexture = nullptr;
_alphaTestEnabled = false;
_depthTestEnabled = false;
_depthFunc = TGL_LESS;
_offsetStates = 0;
_offsetFactor = 0.0f;
_offsetUnits = 0.0f;
} }
FrameBuffer::~FrameBuffer() { FrameBuffer::~FrameBuffer() {
if (frame_buffer_allocated)
pbuf.free(); pbuf.free();
gl_free(_zbuf); gl_free(_zbuf);
} }
@ -329,12 +286,6 @@ void FrameBuffer::clearOffscreenBuffer(Buffer *buf) {
buf->used = false; buf->used = false;
} }
void FrameBuffer::setTexture(const Graphics::TexelBuffer *texture, unsigned int wraps, unsigned int wrapt) {
current_texture = texture;
wrapS = wraps;
wrapT = wrapt;
}
void getSurfaceRef(Graphics::Surface &surface) { void getSurfaceRef(Graphics::Surface &surface) {
GLContext *c = gl_get_context(); GLContext *c = gl_get_context();
assert(c->fb); assert(c->fb);

View file

@ -103,7 +103,6 @@ struct ZBufferPoint {
}; };
struct FrameBuffer { struct FrameBuffer {
FrameBuffer(int xsize, int ysize, const Graphics::PixelBuffer &frame_buffer);
FrameBuffer(int xsize, int ysize, const Graphics::PixelFormat &format); FrameBuffer(int xsize, int ysize, const Graphics::PixelFormat &format);
~FrameBuffer(); ~FrameBuffer();
@ -394,6 +393,21 @@ public:
surface.init(xsize, ysize, linesize, pbuf.getRawBuffer(), cmode); surface.init(xsize, ysize, linesize, pbuf.getRawBuffer(), cmode);
} }
void setScissorRectangle(const Common::Rect &rect) {
_clipRectangle = rect;
_enableScissor = true;
}
void resetScissorRectangle() {
_enableScissor = false;
}
void setShadowMaskBuf(byte *shadowBuffer) {
_shadowMaskBuf = shadowBuffer;
}
void setShadowRGB(int r, int g, int b) {
_shadowColorR = r;
_shadowColorG = g;
_shadowColorB = b;
}
void enableBlending(bool enable) { void enableBlending(bool enable) {
_blendingEnabled = enable; _blendingEnabled = enable;
} }
@ -433,11 +447,13 @@ public:
} }
void enableDepthWrite(bool enable) { void enableDepthWrite(bool enable) {
this->_depthWrite = enable; _depthWrite = enable;
} }
bool isAlphaBlendingEnabled() const { void setTexture(const Graphics::TexelBuffer *texture, unsigned int wraps, unsigned int wrapt) {
return _sourceBlendingFactor == TGL_SRC_ALPHA && _destinationBlendingFactor == TGL_ONE_MINUS_SRC_ALPHA; _currentTexture = texture;
_wrapS = wraps;
_wrapT = wrapt;
} }
private: private:
@ -449,10 +465,7 @@ private:
void blitOffscreenBuffer(Buffer *buffer); void blitOffscreenBuffer(Buffer *buffer);
void selectOffscreenBuffer(Buffer *buffer); void selectOffscreenBuffer(Buffer *buffer);
void clearOffscreenBuffer(Buffer *buffer); void clearOffscreenBuffer(Buffer *buffer);
public:
void setTexture(const Graphics::TexelBuffer *texture, unsigned int wraps, unsigned int wrapt);
private:
template <bool kInterpRGB, bool kInterpZ, bool kInterpST, bool kInterpSTZ, int kDrawLogic, bool kDepthWrite, bool enableAlphaTest, bool kEnableScissor, bool enableBlending> template <bool kInterpRGB, bool kInterpZ, bool kInterpST, bool kInterpSTZ, int kDrawLogic, bool kDepthWrite, bool enableAlphaTest, bool kEnableScissor, bool enableBlending>
void fillTriangle(ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint *p2); void fillTriangle(ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint *p2);
@ -486,16 +499,6 @@ private:
void fillLineFlat(ZBufferPoint *p1, ZBufferPoint *p2); void fillLineFlat(ZBufferPoint *p1, ZBufferPoint *p2);
void fillLineInterp(ZBufferPoint *p1, ZBufferPoint *p2); void fillLineInterp(ZBufferPoint *p1, ZBufferPoint *p2);
public:
void setScissorRectangle(const Common::Rect &rect) {
_clipRectangle = rect;
_enableScissor = true;
}
void resetScissorRectangle() {
_enableScissor = false;
}
private:
Common::Rect _clipRectangle; Common::Rect _clipRectangle;
bool _enableScissor; bool _enableScissor;
public: public:
@ -507,42 +510,13 @@ private:
Buffer buffer; Buffer buffer;
public:
unsigned char *shadow_mask_buf;
int shadow_color_r;
int shadow_color_g;
int shadow_color_b;
private:
int frame_buffer_allocated;
unsigned char *dctable; unsigned char *dctable;
int *ctable; int *ctable;
const Graphics::TexelBuffer *current_texture;
public: public:
int _textureSize; int _textureSize;
int _textureSizeMask; int _textureSizeMask;
private:
unsigned int wrapS, wrapT;
public:
FORCEINLINE bool isBlendingEnabled() const { return _blendingEnabled; }
FORCEINLINE void getBlendingFactors(int &sourceFactor, int &destinationFactor) const { sourceFactor = _sourceBlendingFactor; destinationFactor = _destinationBlendingFactor; }
FORCEINLINE bool isAlphaTestEnabled() const { return _alphaTestEnabled; }
private:
FORCEINLINE bool isDepthWriteEnabled() const { return _depthWrite; }
public:
FORCEINLINE int getDepthFunc() const { return _depthFunc; }
FORCEINLINE int getDepthWrite() const { return _depthWrite; }
FORCEINLINE int getAlphaTestFunc() const { return _alphaTestFunc; }
FORCEINLINE int getAlphaTestRefVal() const { return _alphaTestRefVal; }
FORCEINLINE int getDepthTestEnabled() const { return _depthTestEnabled; }
private:
FORCEINLINE int getOffsetStates() const { return _offsetStates; }
FORCEINLINE float getOffsetFactor() const { return _offsetFactor; }
FORCEINLINE float getOffsetUnits() const { return _offsetUnits; }
private: private:
template <bool kDepthWrite> template <bool kDepthWrite>
FORCEINLINE void putPixel(unsigned int pixelOffset, int color, int x, int y, unsigned int z); FORCEINLINE void putPixel(unsigned int pixelOffset, int color, int x, int y, unsigned int z);
@ -559,15 +533,22 @@ private:
void drawLine(const ZBufferPoint *p1, const ZBufferPoint *p2); void drawLine(const ZBufferPoint *p1, const ZBufferPoint *p2);
unsigned int *_zbuf; unsigned int *_zbuf;
bool _depthWrite;
Graphics::PixelBuffer pbuf; Graphics::PixelBuffer pbuf;
const Graphics::TexelBuffer *_currentTexture;
unsigned int _wrapS, _wrapT;
byte *_shadowMaskBuf;
int _shadowColorR;
int _shadowColorG;
int _shadowColorB;
bool _blendingEnabled; bool _blendingEnabled;
int _sourceBlendingFactor; int _sourceBlendingFactor;
int _destinationBlendingFactor; int _destinationBlendingFactor;
bool _alphaTestEnabled; bool _alphaTestEnabled;
bool _depthTestEnabled;
int _alphaTestFunc; int _alphaTestFunc;
int _alphaTestRefVal; int _alphaTestRefVal;
bool _depthTestEnabled;
bool _depthWrite;
int _depthFunc; int _depthFunc;
int _offsetStates; int _offsetStates;
float _offsetFactor; float _offsetFactor;

View file

@ -42,7 +42,7 @@ void GLContext::issueDrawCall(DrawCall *drawCall) {
#if TGL_DIRTY_RECT_SHOW #if TGL_DIRTY_RECT_SHOW
static void DebugDrawRectangle(Common::Rect rect, int r, int g, int b) { static void DebugDrawRectangle(Common::Rect rect, int r, int g, int b) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
if (rect.left < 0) if (rect.left < 0)
rect.left = 0; rect.left = 0;
@ -253,7 +253,7 @@ void GLContext::presentBufferSimple() {
} }
void presentBuffer() { void presentBuffer() {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
if (c->_enableDirtyRectangles) { if (c->_enableDirtyRectangles) {
c->presentBufferDirtyRects(); c->presentBufferDirtyRects();
} else { } else {
@ -281,8 +281,9 @@ bool DrawCall::operator==(const DrawCall &other) const {
} }
} }
RasterizationDrawCall::RasterizationDrawCall() : DrawCall(DrawCall_Rasterization) { RasterizationDrawCall::RasterizationDrawCall() : DrawCall(DrawCall_Rasterization) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
_vertexCount = c->vertex_cnt; _vertexCount = c->vertex_cnt;
_vertex = (GLVertex *) Internal::allocateFrame(_vertexCount * sizeof(GLVertex)); _vertex = (GLVertex *) Internal::allocateFrame(_vertexCount * sizeof(GLVertex));
_drawTriangleFront = c->draw_triangle_front; _drawTriangleFront = c->draw_triangle_front;
@ -302,7 +303,7 @@ void RasterizationDrawCall::computeDirtyRegion() {
} }
if (!clip_code) { if (!clip_code) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
int xmax = c->fb->xsize - 1; int xmax = c->fb->xsize - 1;
int ymax = c->fb->ysize - 1; int ymax = c->fb->ysize - 1;
int left = xmax, right = 0, top = ymax, bottom = 0; int left = xmax, right = 0, top = ymax, bottom = 0;
@ -328,7 +329,7 @@ void RasterizationDrawCall::computeDirtyRegion() {
} }
void RasterizationDrawCall::execute(bool restoreState) const { void RasterizationDrawCall::execute(bool restoreState) const {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
RasterizationDrawCall::RasterizationState backupState; RasterizationDrawCall::RasterizationState backupState;
if (restoreState) { if (restoreState) {
@ -336,13 +337,13 @@ void RasterizationDrawCall::execute(bool restoreState) const {
} }
applyState(_state); applyState(_state);
TinyGL::GLVertex *prevVertex = c->vertex; GLVertex *prevVertex = c->vertex;
int prevVertexCount = c->vertex_cnt; int prevVertexCount = c->vertex_cnt;
c->vertex = _vertex; c->vertex = _vertex;
c->vertex_cnt = _vertexCount; c->vertex_cnt = _vertexCount;
c->draw_triangle_front = (TinyGL::gl_draw_triangle_func)_drawTriangleFront; c->draw_triangle_front = (gl_draw_triangle_func)_drawTriangleFront;
c->draw_triangle_back = (TinyGL::gl_draw_triangle_func)_drawTriangleBack; c->draw_triangle_back = (gl_draw_triangle_func)_drawTriangleBack;
int n = c->vertex_n; int n = c->vertex_n;
int cnt = c->vertex_cnt; int cnt = c->vertex_cnt;
@ -429,13 +430,13 @@ void RasterizationDrawCall::execute(bool restoreState) const {
RasterizationDrawCall::RasterizationState RasterizationDrawCall::captureState() const { RasterizationDrawCall::RasterizationState RasterizationDrawCall::captureState() const {
RasterizationState state; RasterizationState state;
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
state.alphaTest = c->fb->isAlphaTestEnabled(); state.alphaTest = c->alpha_test_enabled;
c->fb->getBlendingFactors(state.sfactor, state.dfactor); state.sfactor = c->source_blending_factor;
state.enableBlending = c->fb->isBlendingEnabled(); state.dfactor = c->destination_blending_factor;
state.alphaFunc = c->fb->getAlphaTestFunc(); state.enableBlending = c->blending_enabled;
state.alphaRefValue = c->fb->getAlphaTestRefVal(); state.alphaFunc = c->alpha_test_func;
state.alphaRefValue = c->alpha_test_ref_val;
state.cullFaceEnabled = c->cull_face_enabled; state.cullFaceEnabled = c->cull_face_enabled;
state.beginType = c->begin_type; state.beginType = c->begin_type;
state.colorMask = c->color_mask; state.colorMask = c->color_mask;
@ -452,11 +453,14 @@ RasterizationDrawCall::RasterizationState RasterizationDrawCall::captureState()
state.texture = c->current_texture; state.texture = c->current_texture;
state.wrapS = c->texture_wrap_s; state.wrapS = c->texture_wrap_s;
state.wrapT = c->texture_wrap_t; state.wrapT = c->texture_wrap_t;
state.shadowMaskBuf = c->fb->shadow_mask_buf; state.shadowMaskBuf = c->shadow_mask_buf;
state.depthFunction = c->fb->getDepthFunc(); state.shadowColorR = c->shadow_color_r;
state.depthWrite = c->fb->getDepthWrite(); state.shadowColorG = c->shadow_color_g;
state.shadowColorB = c->shadow_color_b;
state.depthFunction = c->depth_func;
state.depthWrite = c->depth_write;
state.lightingEnabled = c->lighting_enabled; state.lightingEnabled = c->lighting_enabled;
state.depthTestEnabled = c->fb->getDepthTestEnabled(); state.depthTestEnabled = c->depth_test;
if (c->current_texture != nullptr) if (c->current_texture != nullptr)
state.textureVersion = c->current_texture->versionNumber; state.textureVersion = c->current_texture->versionNumber;
@ -467,9 +471,9 @@ RasterizationDrawCall::RasterizationState RasterizationDrawCall::captureState()
} }
void RasterizationDrawCall::applyState(const RasterizationDrawCall::RasterizationState &state) const { void RasterizationDrawCall::applyState(const RasterizationDrawCall::RasterizationState &state) const {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
c->fb->setBlendingFactors(state.sfactor, state.dfactor);
c->fb->enableBlending(state.enableBlending); c->fb->enableBlending(state.enableBlending);
c->fb->setBlendingFactors(state.sfactor, state.dfactor);
c->fb->enableAlphaTest(state.alphaTest); c->fb->enableAlphaTest(state.alphaTest);
c->fb->setAlphaTestFunc(state.alphaFunc, state.alphaRefValue); c->fb->setAlphaTestFunc(state.alphaFunc, state.alphaRefValue);
c->fb->setDepthFunc(state.depthFunction); c->fb->setDepthFunc(state.depthFunction);
@ -478,6 +482,25 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
c->fb->setOffsetStates(state.offsetStates); c->fb->setOffsetStates(state.offsetStates);
c->fb->setOffsetFactor(state.offsetFactor); c->fb->setOffsetFactor(state.offsetFactor);
c->fb->setOffsetUnits(state.offsetUnits); c->fb->setOffsetUnits(state.offsetUnits);
c->fb->setShadowMaskBuf(state.shadowMaskBuf);
c->fb->setShadowRGB(state.shadowColorB, state.shadowColorG, state.shadowColorB);
c->blending_enabled = state.enableBlending;
c->source_blending_factor = state.sfactor;
c->destination_blending_factor = state.dfactor;
c->alpha_test_enabled = state.alphaTest;
c->alpha_test_func = state.alphaFunc;
c->alpha_test_ref_val = state.alphaRefValue;
c->depth_test = state.depthTest;
c->depth_func = state.depthFunction;
c->depth_write = state.depthWrite;
c->offset_states = state.offsetStates;
c->offset_factor = state.offsetFactor;
c->offset_units = state.offsetUnits;
c->shadow_mask_buf = state.shadowMaskBuf;
c->shadow_color_r = state.shadowColorR;
c->shadow_color_g = state.shadowColorG;
c->shadow_color_b = state.shadowColorB;
c->lighting_enabled = state.lightingEnabled; c->lighting_enabled = state.lightingEnabled;
c->cull_face_enabled = state.cullFaceEnabled; c->cull_face_enabled = state.cullFaceEnabled;
@ -485,7 +508,6 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
c->color_mask = state.colorMask; c->color_mask = state.colorMask;
c->current_front_face = state.currentFrontFace; c->current_front_face = state.currentFrontFace;
c->current_shade_model = state.currentShadeModel; c->current_shade_model = state.currentShadeModel;
c->depth_test = state.depthTest;
c->polygon_mode_back = state.polygonModeBack; c->polygon_mode_back = state.polygonModeBack;
c->polygon_mode_front = state.polygonModeFront; c->polygon_mode_front = state.polygonModeFront;
c->shadow_mode = state.shadowMode; c->shadow_mode = state.shadowMode;
@ -493,14 +515,13 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
c->current_texture = state.texture; c->current_texture = state.texture;
c->texture_wrap_s = state.wrapS; c->texture_wrap_s = state.wrapS;
c->texture_wrap_t = state.wrapT; c->texture_wrap_t = state.wrapT;
c->fb->shadow_mask_buf = state.shadowMaskBuf;
memcpy(c->viewport.scale._v, state.viewportScaling, sizeof(c->viewport.scale._v)); memcpy(c->viewport.scale._v, state.viewportScaling, sizeof(c->viewport.scale._v));
memcpy(c->viewport.trans._v, state.viewportTranslation, sizeof(c->viewport.trans._v)); memcpy(c->viewport.trans._v, state.viewportTranslation, sizeof(c->viewport.trans._v));
} }
void RasterizationDrawCall::execute(const Common::Rect &clippingRectangle, bool restoreState) const { void RasterizationDrawCall::execute(const Common::Rect &clippingRectangle, bool restoreState) const {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = gl_get_context();
c->fb->setScissorRectangle(clippingRectangle); c->fb->setScissorRectangle(clippingRectangle);
execute(restoreState); execute(restoreState);
c->fb->resetScissorRectangle(); c->fb->resetScissorRectangle();
@ -521,11 +542,12 @@ bool RasterizationDrawCall::operator==(const RasterizationDrawCall &other) const
return false; return false;
} }
BlittingDrawCall::BlittingDrawCall(BlitImage *image, const BlitTransform &transform, BlittingMode blittingMode) : DrawCall(DrawCall_Blitting), _transform(transform), _mode(blittingMode), _image(image) { BlittingDrawCall::BlittingDrawCall(BlitImage *image, const BlitTransform &transform, BlittingMode blittingMode) : DrawCall(DrawCall_Blitting), _transform(transform), _mode(blittingMode), _image(image) {
tglIncBlitImageRef(image); tglIncBlitImageRef(image);
_blitState = captureState(); _blitState = captureState();
_imageVersion = tglGetBlitImageVersion(image); _imageVersion = tglGetBlitImageVersion(image);
if (TinyGL::gl_get_context()->_enableDirtyRectangles) { if (gl_get_context()->_enableDirtyRectangles) {
computeDirtyRegion(); computeDirtyRegion();
} }
} }
@ -570,23 +592,32 @@ void BlittingDrawCall::execute(const Common::Rect &clippingRectangle, bool resto
BlittingDrawCall::BlittingState BlittingDrawCall::captureState() const { BlittingDrawCall::BlittingState BlittingDrawCall::captureState() const {
BlittingState state; BlittingState state;
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = gl_get_context();
state.alphaTest = c->fb->isAlphaTestEnabled(); state.enableBlending = c->blending_enabled;
c->fb->getBlendingFactors(state.sfactor, state.dfactor); state.sfactor = c->source_blending_factor;
state.enableBlending = c->fb->isBlendingEnabled(); state.dfactor = c->destination_blending_factor;
state.alphaFunc = c->fb->getAlphaTestFunc(); state.alphaTest = c->alpha_test_enabled;
state.alphaRefValue = c->fb->getAlphaTestRefVal(); state.alphaFunc = c->alpha_test_func;
state.depthTestEnabled = c->fb->getDepthTestEnabled(); state.alphaRefValue = c->alpha_test_ref_val;
state.depthTestEnabled = c->depth_test;
return state; return state;
} }
void BlittingDrawCall::applyState(const BlittingState &state) const { void BlittingDrawCall::applyState(const BlittingState &state) const {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = gl_get_context();
c->fb->setBlendingFactors(state.sfactor, state.dfactor);
c->fb->enableBlending(state.enableBlending); c->fb->enableBlending(state.enableBlending);
c->fb->setBlendingFactors(state.sfactor, state.dfactor);
c->fb->enableAlphaTest(state.alphaTest); c->fb->enableAlphaTest(state.alphaTest);
c->fb->setAlphaTestFunc(state.alphaFunc, state.alphaRefValue); c->fb->setAlphaTestFunc(state.alphaFunc, state.alphaRefValue);
c->fb->enableDepthTest(state.depthTestEnabled); c->fb->enableDepthTest(state.depthTestEnabled);
c->blending_enabled = state.enableBlending;
c->source_blending_factor = state.sfactor;
c->destination_blending_factor = state.dfactor;
c->alpha_test_enabled = state.alphaTest;
c->alpha_test_func = state.alphaFunc;
c->alpha_test_ref_val = state.alphaRefValue;
c->depth_test = state.depthTestEnabled;
} }
void BlittingDrawCall::computeDirtyRegion() { void BlittingDrawCall::computeDirtyRegion() {
@ -615,7 +646,7 @@ void BlittingDrawCall::computeDirtyRegion() {
_transform._destinationRectangle.left + blitWidth + 1, _transform._destinationRectangle.left + blitWidth + 1,
_transform._destinationRectangle.top + blitHeight + 1 _transform._destinationRectangle.top + blitHeight + 1
); );
_dirtyRegion.clip(TinyGL::gl_get_context()->renderRect); _dirtyRegion.clip(gl_get_context()->renderRect);
} }
} }
@ -627,21 +658,22 @@ bool BlittingDrawCall::operator==(const BlittingDrawCall &other) const {
_imageVersion == tglGetBlitImageVersion(other._image); _imageVersion == tglGetBlitImageVersion(other._image);
} }
ClearBufferDrawCall::ClearBufferDrawCall(bool clearZBuffer, int zValue, bool clearColorBuffer, int rValue, int gValue, int bValue) ClearBufferDrawCall::ClearBufferDrawCall(bool clearZBuffer, int zValue, bool clearColorBuffer, int rValue, int gValue, int bValue)
: _clearZBuffer(clearZBuffer), _clearColorBuffer(clearColorBuffer), _zValue(zValue), _rValue(rValue), _gValue(gValue), _bValue(bValue), DrawCall(DrawCall_Clear) { : _clearZBuffer(clearZBuffer), _clearColorBuffer(clearColorBuffer), _zValue(zValue), _rValue(rValue), _gValue(gValue), _bValue(bValue), DrawCall(DrawCall_Clear) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = gl_get_context();
if (c->_enableDirtyRectangles) { if (c->_enableDirtyRectangles) {
_dirtyRegion = c->renderRect; _dirtyRegion = c->renderRect;
} }
} }
void ClearBufferDrawCall::execute(bool restoreState) const { void ClearBufferDrawCall::execute(bool restoreState) const {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = gl_get_context();
c->fb->clear(_clearZBuffer, _zValue, _clearColorBuffer, _rValue, _gValue, _bValue); c->fb->clear(_clearZBuffer, _zValue, _clearColorBuffer, _rValue, _gValue, _bValue);
} }
void ClearBufferDrawCall::execute(const Common::Rect &clippingRectangle, bool restoreState) const { void ClearBufferDrawCall::execute(const Common::Rect &clippingRectangle, bool restoreState) const {
TinyGL::GLContext *c = TinyGL::gl_get_context(); TinyGL::GLContext *c = gl_get_context();
Common::Rect clearRect = clippingRectangle.findIntersectingRect(getDirtyRegion()); Common::Rect clearRect = clippingRectangle.findIntersectingRect(getDirtyRegion());
c->fb->clearRegion(clearRect.left, clearRect.top, clearRect.width(), clearRect.height(), _clearZBuffer, _zValue, _clearColorBuffer, _rValue, _gValue, _bValue); c->fb->clearRegion(clearRect.left, clearRect.top, clearRect.width(), clearRect.height(), _clearZBuffer, _zValue, _clearColorBuffer, _rValue, _gValue, _bValue);
} }
@ -679,20 +711,20 @@ bool RasterizationDrawCall::RasterizationState::operator==(const RasterizationSt
alphaTest == other.alphaTest && alphaTest == other.alphaTest &&
alphaFunc == other.alphaFunc && alphaFunc == other.alphaFunc &&
alphaRefValue == other.alphaRefValue && alphaRefValue == other.alphaRefValue &&
depthTestEnabled == other.depthTestEnabled &&
texture == other.texture && texture == other.texture &&
textureVersion == texture->versionNumber &&
shadowMaskBuf == other.shadowMaskBuf && shadowMaskBuf == other.shadowMaskBuf &&
viewportTranslation[0] == other.viewportTranslation[0] && viewportTranslation[0] == other.viewportTranslation[0] &&
viewportTranslation[1] == other.viewportTranslation[1] && viewportTranslation[1] == other.viewportTranslation[1] &&
viewportTranslation[2] == other.viewportTranslation[2] && viewportTranslation[2] == other.viewportTranslation[2] &&
viewportScaling[0] == other.viewportScaling[0] && viewportScaling[0] == other.viewportScaling[0] &&
viewportScaling[1] == other.viewportScaling[1] && viewportScaling[1] == other.viewportScaling[1] &&
viewportScaling[2] == other.viewportScaling[2] && viewportScaling[2] == other.viewportScaling[2];
depthTestEnabled == other.depthTestEnabled &&
textureVersion == texture->versionNumber;
} }
void *Internal::allocateFrame(int size) { void *Internal::allocateFrame(int size) {
TinyGL::GLContext *c = TinyGL::gl_get_context(); GLContext *c = gl_get_context();
return c->_drawCallAllocator[c->_currentAllocatorIndex].allocate(size); return c->_drawCallAllocator[c->_currentAllocatorIndex].allocate(size);
} }

View file

@ -102,9 +102,9 @@ public:
void operator delete(void *p) { } void operator delete(void *p) { }
private: private:
void computeDirtyRegion(); void computeDirtyRegion();
typedef void (*gl_draw_triangle_func_ptr)(TinyGL::GLContext *c, TinyGL::GLVertex *p0, TinyGL::GLVertex *p1, TinyGL::GLVertex *p2); typedef void (*gl_draw_triangle_func_ptr)(GLContext *c, TinyGL::GLVertex *p0, TinyGL::GLVertex *p1, TinyGL::GLVertex *p2);
int _vertexCount; int _vertexCount;
TinyGL::GLVertex *_vertex; GLVertex *_vertex;
gl_draw_triangle_func_ptr _drawTriangleFront, _drawTriangleBack; gl_draw_triangle_func_ptr _drawTriangleFront, _drawTriangleBack;
struct RasterizationState { struct RasterizationState {
@ -116,6 +116,9 @@ private:
int depthFunction; int depthFunction;
int depthWrite; int depthWrite;
int shadowMode; int shadowMode;
int shadowColorR;
int shadowColorG;
int shadowColorB;
int texture2DEnabled; int texture2DEnabled;
int currentShadeModel; int currentShadeModel;
int polygonModeBack; int polygonModeBack;

View file

@ -265,6 +265,22 @@ struct GLContext {
FrameBuffer *fb; FrameBuffer *fb;
Common::Rect renderRect; Common::Rect renderRect;
// blending
bool blending_enabled;
int source_blending_factor;
int destination_blending_factor;
// alpha blending
bool alpha_test_enabled;
int alpha_test_func;
int alpha_test_ref_val;
// shadow
unsigned char *shadow_mask_buf;
int shadow_color_r;
int shadow_color_g;
int shadow_color_b;
// Internal texture size // Internal texture size
int _textureSize; int _textureSize;
@ -392,7 +408,10 @@ struct GLContext {
int (*gl_resize_viewport)(int *xsize, int *ysize); int (*gl_resize_viewport)(int *xsize, int *ysize);
// depth test // depth test
int depth_test; bool depth_test;
int depth_func;
bool depth_write;
int color_mask; int color_mask;
Common::Rect _scissorRect; Common::Rect _scissorRect;

View file

@ -244,13 +244,13 @@ void FrameBuffer::fillTriangle(ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint
switch (kDrawLogic) { switch (kDrawLogic) {
case DRAW_SHADOW_MASK: case DRAW_SHADOW_MASK:
pm1 = shadow_mask_buf + p0->y * xsize; pm1 = _shadowMaskBuf + p0->y * xsize;
break; break;
case DRAW_SHADOW: case DRAW_SHADOW:
pm1 = shadow_mask_buf + p0->y * xsize; pm1 = _shadowMaskBuf + p0->y * xsize;
r1 = shadow_color_r; r1 = _shadowColorR;
g1 = shadow_color_g; g1 = _shadowColorG;
b1 = shadow_color_b; b1 = _shadowColorB;
break; break;
case DRAW_DEPTH_ONLY: case DRAW_DEPTH_ONLY:
break; break;
@ -267,7 +267,7 @@ void FrameBuffer::fillTriangle(ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint
} }
if ((kInterpST || kInterpSTZ) && (kDrawLogic == DRAW_FLAT || kDrawLogic == DRAW_SMOOTH)) { if ((kInterpST || kInterpSTZ) && (kDrawLogic == DRAW_FLAT || kDrawLogic == DRAW_SMOOTH)) {
texture = current_texture; texture = _currentTexture;
fdzdx = (float)dzdx; fdzdx = (float)dzdx;
fndzdx = NB_INTERP * fdzdx; fndzdx = NB_INTERP * fdzdx;
ndszdx = NB_INTERP * dszdx; ndszdx = NB_INTERP * dszdx;
@ -543,7 +543,7 @@ void FrameBuffer::fillTriangle(ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint
zinv = (float)(1.0 / fz); zinv = (float)(1.0 / fz);
} }
for (int _a = 0; _a < NB_INTERP; _a++) { for (int _a = 0; _a < NB_INTERP; _a++) {
putPixelTextureMappingPerspective<kDepthWrite, kInterpRGB, kDrawLogic == DRAW_SMOOTH, kAlphaTestEnabled, kEnableScissor, kBlendingEnabled>(this, buf, texture, wrapS, wrapT, putPixelTextureMappingPerspective<kDepthWrite, kInterpRGB, kDrawLogic == DRAW_SMOOTH, kAlphaTestEnabled, kEnableScissor, kBlendingEnabled>(this, buf, texture, _wrapS, _wrapT,
pz, _a, x, y, z, t, s, r, g, b, a, dzdx, dsdx, dtdx, drdx, dgdx, dbdx, dadx); pz, _a, x, y, z, t, s, r, g, b, a, dzdx, dsdx, dtdx, drdx, dgdx, dbdx, dadx);
} }
pz += NB_INTERP; pz += NB_INTERP;
@ -565,7 +565,7 @@ void FrameBuffer::fillTriangle(ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint
} }
while (n >= 0) { while (n >= 0) {
putPixelTextureMappingPerspective<kDepthWrite, kInterpRGB, kDrawLogic == DRAW_SMOOTH, kAlphaTestEnabled, kEnableScissor, kBlendingEnabled>(this, buf, texture, wrapS, wrapT, putPixelTextureMappingPerspective<kDepthWrite, kInterpRGB, kDrawLogic == DRAW_SMOOTH, kAlphaTestEnabled, kEnableScissor, kBlendingEnabled>(this, buf, texture, _wrapS, _wrapT,
pz, 0, x, y, z, t, s, r, g, b, a, dzdx, dsdx, dtdx, drdx, dgdx, dbdx, dadx); pz, 0, x, y, z, t, s, r, g, b, a, dzdx, dsdx, dtdx, drdx, dgdx, dbdx, dadx);
pz += 1; pz += 1;
buf += 1; buf += 1;