733
734 // first see if the fragment shader extension is available
735 if (!fragShaderAvailable) {
736 return JNI_FALSE;
737 }
738
739 // next see if the lcdshader system property has been enabled
740 isLCDShaderEnabled =
741 JNU_GetStaticFieldByName(env, NULL,
742 "sun/java2d/opengl/OGLSurfaceData",
743 "isLCDShaderEnabled", "Z").z;
744 if (!isLCDShaderEnabled) {
745 J2dRlsTraceLn(J2D_TRACE_INFO,
746 "OGLContext_IsLCDShaderSupportAvailable: disabled via flag");
747 return JNI_FALSE;
748 }
749
750 // finally, check to see if the hardware supports the required number
751 // of texture units
752 j2d_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &maxTexUnits);
753 if (maxTexUnits < 4) {
754 J2dRlsTraceLn1(J2D_TRACE_INFO,
755 "OGLContext_IsLCDShaderSupportAvailable: not enough tex units (%d)",
756 maxTexUnits);
757 }
758
759 J2dRlsTraceLn(J2D_TRACE_INFO,
760 "OGLContext_IsLCDShaderSupportAvailable: LCD text shader supported");
761
762 return JNI_TRUE;
763 }
764
765 /**
766 * Returns JNI_TRUE only if all of the following conditions are met:
767 * - the GL_ARB_fragment_shader extension is available
768 * - the BufferedImageOp shader codepath has been enabled via the
769 * system property
770 */
771 static jboolean
772 OGLContext_IsBIOpShaderSupportAvailable(JNIEnv *env,
773 jboolean fragShaderAvailable)
|
733
734 // first see if the fragment shader extension is available
735 if (!fragShaderAvailable) {
736 return JNI_FALSE;
737 }
738
739 // next see if the lcdshader system property has been enabled
740 isLCDShaderEnabled =
741 JNU_GetStaticFieldByName(env, NULL,
742 "sun/java2d/opengl/OGLSurfaceData",
743 "isLCDShaderEnabled", "Z").z;
744 if (!isLCDShaderEnabled) {
745 J2dRlsTraceLn(J2D_TRACE_INFO,
746 "OGLContext_IsLCDShaderSupportAvailable: disabled via flag");
747 return JNI_FALSE;
748 }
749
750 // finally, check to see if the hardware supports the required number
751 // of texture units
752 j2d_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &maxTexUnits);
753 if (maxTexUnits < 2) {
754 J2dRlsTraceLn1(J2D_TRACE_INFO,
755 "OGLContext_IsLCDShaderSupportAvailable: not enough tex units (%d)",
756 maxTexUnits);
757 }
758
759 J2dRlsTraceLn(J2D_TRACE_INFO,
760 "OGLContext_IsLCDShaderSupportAvailable: LCD text shader supported");
761
762 return JNI_TRUE;
763 }
764
765 /**
766 * Returns JNI_TRUE only if all of the following conditions are met:
767 * - the GL_ARB_fragment_shader extension is available
768 * - the BufferedImageOp shader codepath has been enabled via the
769 * system property
770 */
771 static jboolean
772 OGLContext_IsBIOpShaderSupportAvailable(JNIEnv *env,
773 jboolean fragShaderAvailable)
|