Home | History | Annotate | Download | only in libGL

Lines Matching refs:mState

54 	mState.depthClearValue = 1.0f;
55 mState.stencilClearValue = 0;
57 mState.cullFaceEnabled = false;
58 mState.cullMode = GL_BACK;
59 mState.frontFace = GL_CCW;
60 mState.depthTestEnabled = false;
61 mState.depthFunc = GL_LESS;
62 mState.blendEnabled = false;
63 mState.sourceBlendRGB = GL_ONE;
64 mState.sourceBlendAlpha = GL_ONE;
65 mState.destBlendRGB = GL_ZERO;
66 mState.destBlendAlpha = GL_ZERO;
67 mState.blendEquationRGB = GL_FUNC_ADD;
68 mState.blendEquationAlpha = GL_FUNC_ADD;
69 mState.blendColor.red = 0;
70 mState.blendColor.green = 0;
71 mState.blendColor.blue = 0;
72 mState.blendColor.alpha = 0;
73 mState.stencilTestEnabled = false;
74 mState.stencilFunc = GL_ALWAYS;
75 mState.stencilRef = 0;
76 mState.stencilMask = -1;
77 mState.stencilWritemask = -1;
78 mState.stencilBackFunc = GL_ALWAYS;
79 mState.stencilBackRef = 0;
80 mState.stencilBackMask = - 1;
81 mState.stencilBackWritemask = -1;
82 mState.stencilFail = GL_KEEP;
83 mState.stencilPassDepthFail = GL_KEEP;
84 mState.stencilPassDepthPass = GL_KEEP;
85 mState.stencilBackFail = GL_KEEP;
86 mState.stencilBackPassDepthFail = GL_KEEP;
87 mState.stencilBackPassDepthPass = GL_KEEP;
88 mState.polygonOffsetFillEnabled = false;
89 mState.polygonOffsetFactor = 0.0f;
90 mState.polygonOffsetUnits = 0.0f;
91 mState.sampleAlphaToCoverageEnabled = false;
92 mState.sampleCoverageEnabled = false;
93 mState.sampleCoverageValue = 1.0f;
94 mState.sampleCoverageInvert = false;
95 mState.scissorTestEnabled = false;
96 mState.ditherEnabled = true;
97 mState.generateMipmapHint = GL_DONT_CARE;
98 mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
99 mState.colorLogicOpEnabled = false;
100 mState.logicalOperation = GL_COPY;
102 mState.lineWidth = 1.0f;
104 mState.viewportX = 0;
105 mState.viewportY = 0;
106 mState.viewportWidth = 0;
107 mState.viewportHeight = 0;
108 mState.zNear = 0.0f;
109 mState.zFar = 1.0f;
111 mState.scissorX = 0;
112 mState.scissorY = 0;
113 mState.scissorWidth = 0;
114 mState.scissorHeight = 0;
116 mState.colorMaskRed = true;
117 mState.colorMaskGreen = true;
118 mState.colorMaskBlue = true;
119 mState.colorMaskAlpha = true;
120 mState.depthMask = true;
141 mState.activeSampler = 0;
150 mState.currentProgram = 0;
152 mState.packAlignment = 4;
153 mState.unpackAlignment = 4;
181 mState.vertexAttribute[sw::Color0].mCurrentValue[0] = 1.0f;
182 mState.vertexAttribute[sw::Color0].mCurrentValue[1] = 1.0f;
183 mState.vertexAttribute[sw::Color0].mCurrentValue[2] = 1.0f;
184 mState.vertexAttribute[sw::Color0].mCurrentValue[3] = 1.0f;
185 mState.vertexAttribute[sw::Normal].mCurrentValue[0] = 0.0f;
186 mState.vertexAttribute[sw::Normal].mCurrentValue[1] = 0.0f;
187 mState.vertexAttribute[sw::Normal].mCurrentValue[2] = 1.0f;
188 mState.vertexAttribute[sw::Normal].mCurrentValue[3] = 0.0f;
189 mState.vertexAttribute[sw::TexCoord0].mCurrentValue[0] = 0.0f;
190 mState.vertexAttribute[sw::TexCoord0].mCurrentValue[1] = 0.0f;
191 mState.vertexAttribute[sw::TexCoord0].mCurrentValue[2] = 0.0f;
192 mState.vertexAttribute[sw::TexCoord0].mCurrentValue[3] = 1.0f;
193 mState.vertexAttribute[sw::TexCoord1].mCurrentValue[0] = 0.0f;
194 mState.vertexAttribute[sw::TexCoord1].mCurrentValue[1] = 0.0f;
195 mState.vertexAttribute[sw::TexCoord1].mCurrentValue[2] = 0.0f;
196 mState.vertexAttribute[sw::TexCoord1].mCurrentValue[3] = 1.0f;
206 if(mState.currentProgram != 0)
208 Program *programObject = mResourceManager->getProgram(mState.currentProgram);
213 mState.currentProgram = 0;
235 mState.samplerTexture[type][sampler] = nullptr;
241 mState.vertexAttribute[i].mBoundBuffer = nullptr;
246 mState.activeQuery[i] = nullptr;
249 mState.arrayBuffer = nullptr;
250 mState.elementArrayBuffer = nullptr;
251 mState.renderbuffer = nullptr;
271 mState.viewportX = 0;
272 mState.viewportY = 0;
273 mState.viewportWidth = surface->getWidth();
274 mState.viewportHeight = surface->getHeight();
276 mState.scissorX = 0;
277 mState.scissorY = 0;
278 mState.scissorWidth = surface->getWidth();
279 mState.scissorHeight = surface->getHeight();
325 mState.colorClearValue.red = red;
326 mState.colorClearValue.green = green;
327 mState.colorClearValue.blue = blue;
328 mState.colorClearValue.alpha = alpha;
333 mState.depthClearValue = depth;
338 mState.stencilClearValue = stencil;
343 mState.cullFaceEnabled = enabled;
348 return mState.cullFaceEnabled;
353 mState.cullMode = mode;
358 if(mState.frontFace != front)
360 mState.frontFace = front;
367 if(mState.depthTestEnabled != enabled)
369 mState.depthTestEnabled = enabled;
376 return mState.depthTestEnabled;
381 if(mState.depthFunc != depthFunc)
383 mState.depthFunc = depthFunc;
390 mState.zNear = zNear;
391 mState.zFar = zFar;
396 if(mState.blendEnabled != enabled)
398 mState.blendEnabled = enabled;
405 return mState.blendEnabled;
410 if(mState.sourceBlendRGB != sourceRGB ||
411 mState.sourceBlendAlpha != sourceAlpha ||
412 mState.destBlendRGB != destRGB ||
413 mState.destBlendAlpha != destAlpha)
415 mState.sourceBlendRGB = sourceRGB;
416 mState.destBlendRGB = destRGB;
417 mState.sourceBlendAlpha = sourceAlpha;
418 mState.destBlendAlpha = destAlpha;
425 if(mState.blendColor.red != red ||
426 mState.blendColor.green != green ||
427 mState.blendColor.blue != blue ||
428 mState.blendColor.alpha != alpha)
430 mState.blendColor.red = red;
431 mState.blendColor.green = green;
432 mState.blendColor.blue = blue;
433 mState.blendColor.alpha = alpha;
440 if(mState.blendEquationRGB != rgbEquation ||
441 mState.blendEquationAlpha != alphaEquation)
443 mState.blendEquationRGB = rgbEquation;
444 mState.blendEquationAlpha = alphaEquation;
451 if(mState.stencilTestEnabled != enabled)
453 mState.stencilTestEnabled = enabled;
460 return mState.stencilTestEnabled;
465 if(mState.stencilFunc != stencilFunc ||
466 mState.stencilRef != stencilRef ||
467 mState.stencilMask != stencilMask)
469 mState.stencilFunc = stencilFunc;
470 mState.stencilRef = (stencilRef > 0) ? stencilRef : 0;
471 mState.stencilMask = stencilMask;
478 if(mState.stencilBackFunc != stencilBackFunc ||
479 mState.stencilBackRef != stencilBackRef ||
480 mState.stencilBackMask != stencilBackMask)
482 mState.stencilBackFunc = stencilBackFunc;
483 mState.stencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0;
484 mState.stencilBackMask = stencilBackMask;
491 if(mState.stencilWritemask != stencilWritemask)
493 mState.stencilWritemask = stencilWritemask;
500 if(mState.stencilBackWritemask != stencilBackWritemask)
502 mState.stencilBackWritemask = stencilBackWritemask;
509 if(mState.stencilFail != stencilFail ||
510 mState.stencilPassDepthFail != stencilPassDepthFail ||
511 mState.stencilPassDepthPass != stencilPassDepthPass)
513 mState.stencilFail = stencilFail;
514 mState.stencilPassDepthFail = stencilPassDepthFail;
515 mState.stencilPassDepthPass = stencilPassDepthPass;
522 if(mState.stencilBackFail != stencilBackFail ||
523 mState.stencilBackPassDepthFail != stencilBackPassDepthFail ||
524 mState.stencilBackPassDepthPass != stencilBackPassDepthPass)
526 mState.stencilBackFail = stencilBackFail;
527 mState.stencilBackPassDepthFail = stencilBackPassDepthFail;
528 mState.stencilBackPassDepthPass = stencilBackPassDepthPass;
535 if(mState.polygonOffsetFillEnabled != enabled)
537 mState.polygonOffsetFillEnabled = enabled;
544 return mState.polygonOffsetFillEnabled;
549 if(mState.polygonOffsetFactor != factor ||
550 mState.polygonOffsetUnits != units)
552 mState.polygonOffsetFactor = factor;
553 mState.polygonOffsetUnits = units;
560 if(mState.sampleAlphaToCoverageEnabled != enabled)
562 mState.sampleAlphaToCoverageEnabled = enabled;
569 return mState.sampleAlphaToCoverageEnabled;
574 if(mState.sampleCoverageEnabled != enabled)
576 mState.sampleCoverageEnabled = enabled;
583 return mState.sampleCoverageEnabled;
588 if(mState.sampleCoverageValue != value ||
589 mState.sampleCoverageInvert != invert)
591 mState.sampleCoverageValue = value;
592 mState.sampleCoverageInvert = invert;
599 mState.scissorTestEnabled = enabled;
604 return mState.scissorTestEnabled;
609 if(mState.ditherEnabled != enabled)
611 mState.ditherEnabled = enabled;
618 return mState.ditherEnabled;
623 mState.lineWidth = width;
629 mState.generateMipmapHint = hint;
634 mState.fragmentShaderDerivativeHint = hint;
642 mState.viewportX = x;
643 mState.viewportY = y;
644 mState.viewportWidth = width;
645 mState.viewportHeight = height;
650 mState.scissorX = x;
651 mState.scissorY = y;
652 mState.scissorWidth = width;
653 mState
658 if(mState.colorMaskRed != red || mState.colorMaskGreen != green ||
659 mState.colorMaskBlue != blue || mState.colorMaskAlpha != alpha)
661 mState.colorMaskRed = red;
662 mState.colorMaskGreen = green;
663 mState.colorMaskBlue = blue;
664 mState.colorMaskAlpha = alpha;
671 if(mState.depthMask != mask)
673 mState.depthMask = mask;
680 mState.activeSampler = active;
685 return mState.readFramebuffer;
690 return mState.drawFramebuffer;
695 return mState.renderbuffer.name();
700 return mState.arrayBuffer.name();
710 queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED];
713 queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE];
729 mState.vertexAttribute[attribNum].mArrayEnabled = enabled;
734 return mState.vertexAttribute[attribNum];
740 mState.vertexAttribute[attribNum].mBoundBuffer = boundBuffer;
741 mState.vertexAttribute[attribNum].mSize = size;
742 mState.vertexAttribute[attribNum].mType = type;
743 mState.vertexAttribute[attribNum].mNormalized = normalized;
744 mState.vertexAttribute[attribNum].mStride = stride;
745 mState.vertexAttribute[attribNum].mPointer = pointer;
750 return mState.vertexAttribute[attribNum].mPointer;
755 return mState.vertexAttribute;
760 mState.packAlignment = alignment;
765 return mState.packAlignment;
770 mState.unpackAlignment = alignment;
775 return mState.unpackAlignment;
919 return getFramebuffer(mState.readFramebuffer);
924 return getFramebuffer(mState.drawFramebuffer);
931 mState.arrayBuffer = getBuffer(buffer);
938 mState.elementArrayBuffer = getBuffer(buffer);
945 mState.samplerTexture[TEXTURE_2D][mState.activeSampler] = getTexture(texture);
952 mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler] = getTexture(texture);
962 mState.readFramebuffer = framebuffer;
972 mState.drawFramebuffer = framebuffer;
979 mState.renderbuffer = getRenderbuffer(renderbuffer);
984 GLuint priorProgram = mState.currentProgram;
985 mState.currentProgram = program; // Must switch before trying to delete, otherwise it only gets flagged.
1023 if(mState.activeQuery[i])
1057 mState.activeQuery[qType] = queryObject;
1079 Query *queryObject = mState.activeQuery[qType];
1088 mState.activeQuery[qType] = nullptr;
1099 Renderbuffer *renderbufferObject = mState.renderbuffer;
1135 return mState.arrayBuffer;
1140 return mState.elementArrayBuffer;
1145 return mResourceManager->getProgram(mState.currentProgram);
1152 return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D));
1156 return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, PROXY_TEXTURE_2D));
1165 return static_cast<TextureCubeMap*>(getSamplerTexture(mState.activeSampler, TEXTURE_CUBE));
1170 GLuint texid = mState.samplerTexture[type][sampler].name();
1183 return mState.samplerTexture[type][sampler];
1191 case GL_SAMPLE_COVERAGE_INVERT: *params = mState.sampleCoverageInvert; break;
1192 case GL_DEPTH_WRITEMASK: *params = mState.depthMask; break;
1194 params[0] = mState.colorMaskRed;
1195 params[1] = mState.colorMaskGreen;
1196 params[2] = mState.colorMaskBlue;
1197 params[3] = mState.colorMaskAlpha;
1199 case GL_CULL_FACE: *params = mState.cullFaceEnabled; break;
1200 case GL_POLYGON_OFFSET_FILL: *params = mState.polygonOffsetFillEnabled; break;
1201 case GL_SAMPLE_ALPHA_TO_COVERAGE: *params = mState.sampleAlphaToCoverageEnabled; break;
1202 case GL_SAMPLE_COVERAGE: *params = mState.sampleCoverageEnabled; break;
1203 case GL_SCISSOR_TEST: *params = mState.scissorTestEnabled; break;
1204 case GL_STENCIL_TEST: *params = mState.stencilTestEnabled; break;
1205 case GL_DEPTH_TEST: *params = mState.depthTestEnabled; break;
1206 case GL_BLEND: *params = mState.blendEnabled; break;
1207 case GL_DITHER: *params = mState.ditherEnabled; break;
1223 case GL_LINE_WIDTH: *params = mState.lineWidth; break;
1224 case GL_SAMPLE_COVERAGE_VALUE: *params = mState.sampleCoverageValue; break;
1225 case GL_DEPTH_CLEAR_VALUE: *params = mState.depthClearValue; break;
1226 case GL_POLYGON_OFFSET_FACTOR: *params = mState.polygonOffsetFactor; break;
1227 case GL_POLYGON_OFFSET_UNITS: *params = mState.polygonOffsetUnits; break;
1237 params[0] = mState.zNear;
1238 params[1] = mState.zFar;
1241 params[0] = mState.colorClearValue.red;
1242 params[1] = mState.colorClearValue.green;
1243 params[2] = mState.colorClearValue.blue;
1244 params[3] = mState.colorClearValue.alpha;
1247 params[0] = mState.blendColor.red;
1248 params[1] = mState.blendColor.green;
1249 params[2] = mState.blendColor.blue;
1250 params[3] = mState.blendColor.alpha;
1295 case GL_ARRAY_BUFFER_BINDING: *params = mState.arrayBuffer.name(); break;
1296 case GL_ELEMENT_ARRAY_BUFFER_BINDING: *params = mState.elementArrayBuffer.name(); break;
1298 case GL_DRAW_FRAMEBUFFER_BINDING: *params = mState.drawFramebuffer; break;
1299 case GL_READ_FRAMEBUFFER_BINDING: *params = mState.readFramebuffer; break;
1300 case GL_RENDERBUFFER_BINDING: *params = mState.renderbuffer.name(); break;
1301 case GL_CURRENT_PROGRAM: *params = mState.currentProgram; break;
1302 case GL_PACK_ALIGNMENT: *params = mState.packAlignment; break;
1303 case GL_UNPACK_ALIGNMENT: *params = mState.unpackAlignment; break;
1304 case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; break;
1305 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: *params = mState.fragmentShaderDerivativeHint; break;
1306 case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); break;
1307 case GL_STENCIL_FUNC: *params = mState.stencilFunc; break;
1308 case GL_STENCIL_REF: *params = mState.stencilRef; break;
1309 case GL_STENCIL_VALUE_MASK: *params = mState.stencilMask; break;
1310 case GL_STENCIL_BACK_FUNC: *params = mState.stencilBackFunc; break;
1311 case GL_STENCIL_BACK_REF: *params = mState.stencilBackRef; break;
1312 case GL_STENCIL_BACK_VALUE_MASK: *params = mState.stencilBackMask; break;
1313 case GL_STENCIL_FAIL: *params = mState.stencilFail; break;
1314 case GL_STENCIL_PASS_DEPTH_FAIL: *params = mState.stencilPassDepthFail; break;
1315 case GL_STENCIL_PASS_DEPTH_PASS: *params = mState.stencilPassDepthPass; break;
1316 case GL_STENCIL_BACK_FAIL: *params = mState.stencilBackFail; break;
1317 case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mState.stencilBackPassDepthFail; break;
1318 case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mState.stencilBackPassDepthPass; break;
1319 case GL_DEPTH_FUNC: *params = mState.depthFunc; break;
1320 case GL_BLEND_SRC_RGB: *params = mState.sourceBlendRGB; break;
1321 case GL_BLEND_SRC_ALPHA: *params = mState.sourceBlendAlpha; break;
1322 case GL_BLEND_DST_RGB: *params = mState.destBlendRGB; break;
1323 case GL_BLEND_DST_ALPHA: *params = mState.destBlendAlpha; break;
1324 case GL_BLEND_EQUATION_RGB: *params = mState.blendEquationRGB; break;
1325 case GL_BLEND_EQUATION_ALPHA: *params = mState.blendEquationAlpha; break;
1326 case GL_STENCIL_WRITEMASK: *params = mState.stencilWritemask; break;
1327 case GL_STENCIL_BACK_WRITEMASK: *params = mState.stencilBackWritemask; break;
1328 case GL_STENCIL_CLEAR_VALUE: *params = mState.stencilClearValue; break;
1384 params[0] = mState.viewportX;
1385 params[1] = mState.viewportY;
1386 params[2] = mState.viewportWidth;
1387 params[3] = mState.viewportHeight;
1390 params[0] = mState.scissorX;
1391 params[1] = mState.scissorY;
1392 params[2] = mState.scissorWidth;
1393 params[3] = mState.scissorHeight;
1395 case GL_CULL_FACE_MODE: *params = mState.cullMode; break;
1396 case GL_FRONT_FACE: *params = mState.frontFace; break;
1453 if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
1459 *params = mState.samplerTexture[TEXTURE_2D][mState.activeSampler].name();
1464 if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
1470 *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].name();
1668 float zNear = clamp01(mState.zNear);
1669 float zFar = clamp01(mState.zFar);
1671 viewport.x0 = mState.viewportX;
1672 viewport.y0 = mState.viewportY;
1673 viewport.width = mState.viewportWidth;
1674 viewport.height = mState.viewportHeight;
1680 if(mState.scissorTestEnabled)
1682 sw::Rect scissor = {mState.scissorX, mState.scissorY, mState.scissorX + mState.scissorWidth, mState.scissorY + mState.scissorHeight};
1711 if(mState.cullFaceEnabled)
1713 device->setCullMode(es2sw::ConvertCullMode(mState.cullMode, mState.frontFace));
1722 if(mState.depthTestEnabled)
1725 device->setDepthCompare(es2sw::ConvertDepthComparison(mState.depthFunc));
1737 if(mState.blendEnabled)
1742 device->setBlendConstant(es2sw::ConvertColor(mState.blendColor));
1744 device->setSourceBlendFactor(es2sw::ConvertBlendFunc(mState.sourceBlendRGB));
1745 device->setDestBlendFactor(es2sw::ConvertBlendFunc(mState.destBlendRGB));
1746 device->setBlendOperation(es2sw::ConvertBlendOp(mState.blendEquationRGB));
1748 device->setSourceBlendFactorAlpha(es2sw::ConvertBlendFunc(mState.sourceBlendAlpha));
1749 device->setDestBlendFactorAlpha(es2sw::ConvertBlendFunc(mState.destBlendAlpha));
1750 device->setBlendOperationAlpha(es2sw::ConvertBlendOp(mState.blendEquationAlpha));
1762 if(mState.colorLogicOpEnabled)
1765 device->setLogicalOperation(es2sw::ConvertLogicalOperation(mState.logicalOperation));
1777 if(mState.stencilTestEnabled && framebuffer->hasStencil())
1782 if(mState.stencilWritemask != mState.stencilBackWritemask ||
1783 mState.stencilRef != mState.stencilBackRef ||
1784 mState.stencilMask != mState.stencilBackMask)
1794 if(mState.frontFace == GL_CCW)
1796 device->setStencilWriteMask(mState.stencilWritemask);
1797 device->setStencilCompare(es2sw::ConvertStencilComparison(mState.stencilFunc));
1799 device->setStencilReference((mState.stencilRef < (GLint)maxStencil) ? mState.stencilRef : maxStencil);
1800 device->setStencilMask(mState.stencilMask);
1802 device->setStencilFailOperation(es2sw::ConvertStencilOp(mState.stencilFail));
1803 device->setStencilZFailOperation(es2sw::ConvertStencilOp(mState.stencilPassDepthFail));
1804 device->setStencilPassOperation(es2sw::ConvertStencilOp(mState.stencilPassDepthPass));
1806 device->setStencilWriteMaskCCW(mState.stencilBackWritemask);
1807 device->setStencilCompareCCW(es2sw::ConvertStencilComparison(mState.stencilBackFunc));
1809 mState.stencilBackRef < (GLint)maxStencil) ? mState.stencilBackRef : maxStencil);
1810 device->setStencilMaskCCW(mState.stencilBackMask);
1812 device->setStencilFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilBackFail));
1813 device->setStencilZFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilBackPassDepthFail));
1814 device->setStencilPassOperationCCW(es2sw::ConvertStencilOp(mState.stencilBackPassDepthPass));
1818 device->setStencilWriteMaskCCW(mState.stencilWritemask);
1819 device->setStencilCompareCCW(es2sw::ConvertStencilComparison(mState.stencilFunc));
1821 device->setStencilReferenceCCW((mState.stencilRef < (GLint)maxStencil) ? mState.stencilRef : maxStencil);
1822 device->setStencilMaskCCW(mState.stencilMask);
1824 device->setStencilFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilFail));
1825 device->setStencilZFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilPassDepthFail));
1826 device->setStencilPassOperationCCW(es2sw::ConvertStencilOp(mState.stencilPassDepthPass));
1828 device->setStencilWriteMask(mState.stencilBackWritemask);
1829 device->setStencilCompare(es2sw::ConvertStencilComparison(mState.stencilBackFunc));
1831 device->setStencilReference((mState.stencilBackRef < (GLint)maxStencil) ? mState.stencilBackRef : maxStencil);
1832 device->setStencilMask(mState.stencilBackMask);
1834 device->setStencilFailOperation(es2sw::ConvertStencilOp(mState.stencilBackFail));
1835 device->setStencilZFailOperation(es2sw::ConvertStencilOp(mState.stencilBackPassDepthFail));
1836 device->setStencilPassOperation(es2sw::ConvertStencilOp(mState.stencilBackPassDepthPass));
1850 device->setColorWriteMask(0, es2sw::ConvertColorMask(mState.colorMaskRed, mState.colorMaskGreen, mState.colorMaskBlue, mState.colorMaskAlpha));
1851 device->setDepthWriteEnable(mState.depthMask);
1858 if(mState.polygonOffsetFillEnabled)
1863 device->setSlopeDepthBias(mState.polygonOffsetFactor);
1864 float depthBias = ldexp(mState.polygonOffsetUnits, -(int)(depthbuffer->getDepthSize()));
1879 if(mState.sampleAlphaToCoverageEnabled)
1888 if(mState.sampleCoverageEnabled)
1891 if(mState.sampleCoverageValue != 0)
1902 if((i + 1) * mState.sampleCoverageValue >= threshold)
1910 if(mState.sampleCoverageInvert)
1977 GLenum err = mIndexDataManager->prepareIndexData(type, count, mState.elementArrayBuffer, indices, indexInfo);
2183 GLsizei outputPitch = ComputePitch(width, format, type, mState.packAlignment);
2391 float depth = clamp01(mState.depthClearValue);
2392 int stencil = mState.stencilClearValue & 0x000000FF;
2396 unsigned int rgbaMask = (mState.colorMaskRed ? 0x1 : 0) |
2397 (mState.colorMaskGreen ? 0x2 : 0) |
2398 (mState.colorMaskBlue ? 0x4 : 0) |
2399 (mState.colorMaskAlpha ? 0x8 : 0);
2403 device->clearColor(mState.colorClearValue.red, mState.colorClearValue.green, mState.colorClearValue.blue, mState.colorClearValue.alpha, rgbaMask);
2409 if(mState.depthMask != 0)
2417 if(mState.stencilWritemask != 0)
2419 device->clearStencil(stencil, mState.stencilWritemask);
2426 if(!mState.currentProgram)
2478 if(!mState.currentProgram)
2483 if(!indices && !mState.elementArrayBuffer)
2632 if(mState.arrayBuffer.name() == buffer)
2634 mState.arrayBuffer = nullptr;
2637 if(mState.elementArrayBuffer.name() == buffer)
2639 mState.elementArrayBuffer = nullptr;
2644 if(mState.vertexAttribute[attribute].mBoundBuffer.name() == buffer)
2646 mState.vertexAttribute[attribute].mBoundBuffer = nullptr;
2660 if(mState.samplerTexture[type][sampler].name() == texture)
2662 mState.samplerTexture[type][sampler] = nullptr;
2690 if(mState.readFramebuffer == framebuffer)
2695 if(mState.drawFramebuffer == framebuffer)
2706 if(mState.renderbuffer.name() == renderbuffer)
2731 return mState.cullFaceEnabled && mState.cullMode == GL_FRONT_AND_BACK && isTriangleMode(drawMode);
2757 mState.vertexAttribute[index].mCurrentValue[0] = x;
2758 mState.vertexAttribute[index].mCurrentValue[1] = y;
2759 mState.vertexAttribute[index].mCurrentValue[2] = z;
2760 mState.vertexAttribute[index].mCurrentValue[3] = w;
2822 if(mState.scissorTestEnabled) // Only write to parts of the destination framebuffer which pass the scissor test
2824 if(destRect.x0 < mState.scissorX)
2826 int xDiff = mState.scissorX - destRect.x0;
2827 destScissoredRect.x0 = mState.scissorX;
2831 if(destRect.x1 > mState.scissorX + mState.scissorWidth)
2833 int xDiff = destRect.x1 - (mState.scissorX + mState.scissorWidth);
2834 destScissoredRect.x1 = mState.scissorX + mState.scissorWidth;
2838 if(destRect.y0 < mState.scissorY)
2840 int yDiff = mState.scissorY - destRect.y0;
2841 destScissoredRect.y0 = mState.scissorY;
2845 if(destRect.y1 > mState.scissorY + mState.scissorHeight)
2847 int yDiff = destRect.y1 - (mState.scissorY + mState.scissorHeight);
2848 destScissoredRect.y1 = mState.scissorY + mState.scissorHeight;
3045 case GL_TEXTURE: return texture[mState.activeSampler]; break;
3216 envEnable[mState.activeSampler] = enable;
3359 memcpy(clientAttribute, mState.vertexAttribute, sizeof(mState.vertexAttribute));
3368 GLint size = mState.vertexAttribute[i].mSize;
3369 GLenum type = mState.vertexAttribute[i].mType;
3370 GLboolean normalized = mState.vertexAttribute[i].mNormalized;
3371 GLsizei stride = mState.vertexAttribute[i].mStride;
3372 const GLvoid *pointer = mState.vertexAttribute[i].mPointer;
3374 size_t length = count * mState.vertexAttribute[i].stride();
3376 if(mState.vertexAttribute[i].mArrayEnabled)
3394 memcpy(mState.vertexAttribute, clientAttribute, sizeof(mState.vertexAttribute));
3409 return mState.activeSampler;
3433 v.C.x = mState.vertexAttribute[sw::Color0].mCurrentValue[0];
3434 v.C.y = mState.vertexAttribute[sw::Color0].mCurrentValue[1];
3435 v.C.z = mState.vertexAttribute[sw::Color0].mCurrentValue[2];
3436 v.C.w = mState.vertexAttribute[sw::Color0].mCurrentValue[3];
3437 v.N.x = mState.vertexAttribute[sw::Normal].mCurrentValue[0];
3438 v.N.y = mState.vertexAttribute[sw::Normal].mCurrentValue[1];
3439 v.N.z = mState.vertexAttribute[sw::Normal].mCurrentValue[2];
3440 v.N.w = mState.vertexAttribute[sw::Normal].mCurrentValue[3];
3441 v.T0.x = mState.vertexAttribute[sw::TexCoord0].mCurrentValue[0];
3442 v.T0.y = mState.vertexAttribute[sw::TexCoord0].mCurrentValue[1];
3443 v.T0.z = mState.vertexAttribute[sw::TexCoord0].mCurrentValue[2];
3444 v.T0.w = mState.vertexAttribute[sw::TexCoord0].mCurrentValue[3];
3445 v.T1.x = mState.vertexAttribute[sw::TexCoord1].mCurrentValue[0];
3446 v.T1.y = mState.vertexAttribute[sw::TexCoord1].mCurrentValue[1];
3447 v.T1.z = mState.vertexAttribute[sw::TexCoord1].mCurrentValue[2];
3448 v.T1.w = mState.vertexAttribute[sw::TexCoord1].mCurrentValue[3];
3471 mState.vertexAttribute[i].mArrayEnabled = false;
3480 mState.vertexAttribute[sw::Position].mArrayEnabled = true;
3481 mState.vertexAttribute[sw::Normal].mArrayEnabled = true;
3482 mState.vertexAttribute[sw::Color0].mArrayEnabled = true;
3483 mState.vertexAttribute[sw::TexCoord0].mArrayEnabled = true;
3484 mState.vertexAttribute[sw::TexCoord1].mArrayEnabled = true;
3539 if(mState.colorLogicOpEnabled != colorLogicOpEnabled)
3541 mState.colorLogicOpEnabled = colorLogicOpEnabled;
3548 return mState.colorLogicOpEnabled;
3553 if(mState.logicalOperation != logicalOperation)
3555 mState.logicalOperation = logicalOperation;