1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00
This commit is contained in:
Sergey Lipskiy 2017-01-15 18:46:04 +07:00
parent e83c3489a3
commit c5e2575722
5 changed files with 21 additions and 20 deletions

View File

@ -73,19 +73,10 @@ static int aAExpanded[] =
void Combiner_Init() {
CombinerInfo & cmbInfo = CombinerInfo::get();
cmbInfo.init();
// InitShaderCombiner();
if (cmbInfo.getCombinersNumber() == 0) {
cmbInfo.setPolygonMode(OGLRender::rsTexRect);
gDP.otherMode.cycleType = G_CYC_COPY;
cmbInfo.setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0));
gDP.otherMode.cycleType = G_CYC_FILL;
cmbInfo.setCombine(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE));
}
gDP.otherMode.cycleType = G_CYC_1CYCLE;
}
void Combiner_Destroy() {
// DestroyShaderCombiner();
CombinerInfo::get().destroy();
}
@ -115,6 +106,14 @@ void CombinerInfo::init()
m_combiners.clear();
}
if (m_combiners.empty()) {
setPolygonMode(OGLRender::rsTexRect);
gDP.otherMode.cycleType = G_CYC_COPY;
setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0));
gDP.otherMode.cycleType = G_CYC_FILL;
setCombine(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE));
}
m_shadowmapProgram.reset(gfxContext.createDepthFogShader());
m_monochromeProgram.reset(gfxContext.createMonochromeShader());
m_texrectCopyProgram.reset(gfxContext.createTexrectCopyShader());

View File

@ -966,6 +966,7 @@ void FrameBufferList::renderBuffer(u32 _address)
blitParams.dstWidth = wnd.getScreenWidth();
blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset();
blitParams.filter = filter;
blitParams.mask = graphics::blitMask::COLOR_BUFFER;
blitParams.tex[0] = pBufferTexture;
blitParams.combiner = CombinerInfo::get().getTexrectCopyProgram();
blitParams.readBuffer = readBuffer;
@ -1120,6 +1121,8 @@ bool FrameBuffer_CopyDepthBufferChunk(u32 address)
void FrameBuffer_CopyFromRDRAM(u32 _address, bool _bCFB)
{
// TODO fix me
return;
RDRAMtoColorBuffer::get().copyFromRDRAM(_address, _bCFB);
}

View File

@ -1674,7 +1674,8 @@ int CombinerProgramBuilder::compileCombiner(const CombinerKey & _key, Combiner &
else if (combinedAlphaABD(combine))
m_signExtendAlphaABD->write(ssShader);
m_alphaTest->write(ssShader);
if (g_cycleType < G_CYC_FILL)
m_alphaTest->write(ssShader);
ssShader << " color1 = ";
nInputs |= _compileCombiner(_color.stage[0], ColorInput, ssShader);
@ -1708,7 +1709,8 @@ int CombinerProgramBuilder::compileCombiner(const CombinerKey & _key, Combiner &
ssShader << " lowp vec4 cmbRes = vec4(color2, alpha2);" << std::endl;
}
else {
ssShader << " if (uCvgXAlpha != 0 && alpha1 < 0.125) discard;" << std::endl;
if (g_cycleType < G_CYC_FILL)
ssShader << " if (uCvgXAlpha != 0 && alpha1 < 0.125) discard;" << std::endl;
ssShader << " lowp vec4 cmbRes = vec4(color1, alpha1);" << std::endl;
}

View File

@ -82,7 +82,6 @@ void UnbufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParame
}
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::color, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
@ -103,10 +102,7 @@ void UnbufferedDrawer::drawRects(const graphics::Context::DrawRectParameters & _
glVertexAttribPointer(rectAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr);
}
{
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::color, true);
glVertexAttrib4fv(rectAttrib::color, _params.rectColor.data());
}
glVertexAttrib4fv(rectAttrib::color, _params.rectColor.data());
if (_params.combiner->usesTile(0)) {
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, true);
@ -154,7 +150,6 @@ void UnbufferedDrawer::drawLine(f32 _width, SPVertex * _vertices)
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::color, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);

View File

@ -534,8 +534,6 @@ void GraphicsDrawer::_updateTextures() const
void GraphicsDrawer::_updateStates(DrawingState _drawingState) const
{
// DisplayWindow & ogl = DisplayWindow::get();
CombinerInfo & cmbInfo = CombinerInfo::get();
cmbInfo.setPolygonMode(_drawingState);
cmbInfo.update();
@ -881,7 +879,7 @@ void GraphicsDrawer::drawRect(int _ulx, int _uly, int _lrx, int _lry, float *_pC
Context::DrawRectParameters rectParams;
rectParams.mode = drawmode::TRIANGLE_STRIP;
if (gDP.otherMode.cycleType == G_CYC_FILL)
std::copy_n(_pColor, sizeof(_pColor[0]) * 4, rectParams.rectColor.data());
std::copy_n(_pColor, 4, rectParams.rectColor.begin());
else
rectParams.rectColor.fill(0.0f);
rectParams.verticesCount = 4;
@ -1179,6 +1177,8 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
if (texParams.wrapS.isValid() || texParams.wrapT.isValid()) {
texParams.handle = ObjectHandle(cache.current[t]->glName);
texParams.target = cache.current[t]->frameBufferTexture == CachedTexture::fbMultiSample ?
target::TEXTURE_2D_MULTISAMPLE : target::TEXTURE_2D;
texParams.textureUnitIndex = textureIndices::Tex[t];
gfxContext.setTextureParameters(texParams);
}
@ -1193,6 +1193,8 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
if (gDP.otherMode.cycleType == G_CYC_COPY) {
Context::TexParameters texParams;
texParams.handle = ObjectHandle(cache.current[0]->glName);
texParams.target = cache.current[0]->frameBufferTexture == CachedTexture::fbMultiSample ?
target::TEXTURE_2D_MULTISAMPLE : target::TEXTURE_2D;
texParams.textureUnitIndex = textureIndices::Tex[0];
texParams.minFilter = textureParameters::FILTER_NEAREST;
texParams.magFilter = textureParameters::FILTER_NEAREST;