Example #1
0
static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, GLenum gl_level) {
    IWineD3DVolumeImpl *This     = (IWineD3DVolumeImpl *)iface;
    const PixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format);

    if(GL_SUPPORT(EXT_TEXTURE3D)) {
        TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
                GL_TEXTURE_3D,
                gl_level,
                formatEntry->glInternal,
                This->currentDesc.Width,
                This->currentDesc.Height,
                This->currentDesc.Depth,
                0,
                formatEntry->glFormat,
                formatEntry->glType,
                This->resource.allocatedMemory);
        GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D,
                    gl_level,
                    formatEntry->glInternal,
                    This->currentDesc.Width,
                    This->currentDesc.Height,
                    This->currentDesc.Depth,
                    0,
                    formatEntry->glFormat,
                    formatEntry->glType,
                    This->resource.allocatedMemory));
        checkGLcall("glTexImage3D");
    } else
        WARN("This OpenGL implementation doesn't support 3D textures\n");
    
    return WINED3D_OK;

}
Example #2
0
void GL_SelectTexture(int tmu)
{
	if (gl_state.locked)
	{
		gl_state.newTmu = tmu;
		return;
	}

	if (tmu == gl_state.currentTmu)
		return;

	int tex;
	if (GL_SUPPORT(QGL_ARB_MULTITEXTURE))
	{
		// ARB_multitexture
		tex = GL_TEXTURE0_ARB + tmu;
		glActiveTextureARB(tex);
		glClientActiveTextureARB(tex);	// affects gl[Enable|Disable]ClientState(GL_TEXTURE_COORD_ARRAY) and glTexCoordPointer() only
	}
	else
	{
		// SGIS_multitexture
		tex = GL_TEXTURE0_SGIS + tmu;
		glSelectTextureSGIS(tex);
		glSelectTextureCoordSetSGIS(tex);
	}

	gl_state.currentTmu = tmu;
}
Example #3
0
void GL_TexMipBias(float f)
{
	if (!GL_SUPPORT(QGL_EXT_TEXTURE_LOD_BIAS))
		return;

	if (gl_state.locked)
	{
		gl_state.newMipBias[gl_state.newTmu] = f;
		return;
	}
	if (gl_state.mipBias[gl_state.newTmu] == f) return;
	gl_state.mipBias[gl_state.newTmu] = f;
	glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, f);
}
Example #4
0
void GL_CheckGLSL()
{
	GUseGLSL = false;

	if (!GL_SUPPORT(QGL_2_0)) return;

#ifdef FORCE_GLSL_VERSION
	char *Version = (char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
	if (!Version) return;

	int VerMajor = atoi(Version);
	int VerMinor = 0;
	if (char *s = strchr(Version, '.'))
	{
		VerMinor = atoi(s+1);
	}
	int CombinedVer = VerMajor * 100 + VerMinor;
//	printf("GL: %s (%d:%d) -- %d %d\n", Version, VerMajor, VerMinor, CombinedVer, FORCE_GLSL_VERSION);
	if (CombinedVer < FORCE_GLSL_VERSION) return;	// GLSL version is too low
#endif // FORCE_GLSL_VERSION

	GUseGLSL = true;
}
Example #5
0
void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info) {
    if(!GL_SUPPORT(ARB_MULTITEXTURE)) {
        TRACE("Applying GL_ARB_multitexture emulation hooks\n");
        gl_info->glActiveTextureARB         = wine_glActiveTextureARB;
        gl_info->glClientActiveTextureARB   = wine_glClientActiveTextureARB;
        gl_info->glMultiTexCoord1fARB       = wine_glMultiTexCoord1fARB;
        gl_info->glMultiTexCoord1fvARB      = wine_glMultiTexCoord1fvARB;
        gl_info->glMultiTexCoord2fARB       = wine_glMultiTexCoord2fARB;
        gl_info->glMultiTexCoord2fvARB      = wine_glMultiTexCoord2fvARB;
        gl_info->glMultiTexCoord3fARB       = wine_glMultiTexCoord3fARB;
        gl_info->glMultiTexCoord3fvARB      = wine_glMultiTexCoord3fvARB;
        gl_info->glMultiTexCoord4fARB       = wine_glMultiTexCoord4fARB;
        gl_info->glMultiTexCoord4fvARB      = wine_glMultiTexCoord4fvARB;
        gl_info->glMultiTexCoord2svARB      = wine_glMultiTexCoord2svARB;
        gl_info->glMultiTexCoord4svARB      = wine_glMultiTexCoord4svARB;
        if(old_multitex_glGetIntegerv) {
            FIXME("GL_ARB_multitexture glGetIntegerv hook already applied\n");
        } else {
            old_multitex_glGetIntegerv = glGetIntegerv;
            glGetIntegerv = wine_glGetIntegerv;
        }
        if(old_multitex_glGetFloatv) {
            FIXME("GL_ARB_multitexture glGetGloatv hook already applied\n");
        } else {
            old_multitex_glGetFloatv = glGetFloatv;
            glGetFloatv = wine_glGetFloatv;
        }
        if(old_multitex_glGetDoublev) {
            FIXME("GL_ARB_multitexture glGetDoublev hook already applied\n");
        } else {
            old_multitex_glGetDoublev = glGetDoublev;
            glGetDoublev = wine_glGetDoublev;
        }
        gl_info->supported[ARB_MULTITEXTURE] = TRUE;
    }

    if(!GL_SUPPORT(EXT_FOG_COORD)) {
        /* This emulation isn't perfect. There are a number of potential problems, but they should
         * not matter in practise:
         *
         * Fog vs fragment shader: If we are using GL_ARB_fragment_program with the fog option, the
         * glDisable(GL_FOG) here won't matter. However, if we have GL_ARB_fragment_program, it is pretty
         * unlikely that we don't have GL_EXT_fog_coord. Besides, we probably have GL_ARB_vertex_program
         * too, which would allow fog coord emulation in a fixed function vertex pipeline replacement.
         *
         * Fog vs texture: We apply the fog in the vertex color. An app could set up texturing settings which
         * ignore the vertex color, thus effectively disabing our fog. However, in D3D this type of fog is
         * a per-vertex fog too, so the apps shouldn't do that.
         *
         * Fog vs lighting: The app could in theory use D3DFOG_NONE table and D3DFOG_NONE vertex fog with
         * untransformed vertices. That enables lighting and fog coords at the same time, and the lighting
         * calculations could affect the already blended in fog color. There's nothing we can do against that,
         * but most apps using fog color do their own lighting too and often even use RHW vertices. So live
         * with it.
         */
        TRACE("Applying GL_ARB_fog_coord emulation hooks\n");

        /* This probably means that the implementation doesn't advertise the extension, but implicitly supports
         * it via the GL core version, or someone messed around in the extension table in directx.c. Add version-
         * dependent loading for this extension if we ever hit this situation
         */
        if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {
            FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n");
            FIXME("The fog coord emulation will most likely fail\n");
        } else if(GL_SUPPORT(ARB_FRAGMENT_SHADER)) {
            FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n");
            FIXME("The fog coord emulation will most likely fail\n");
        }

        if(old_fogcoord_glFogi) {
            FIXME("GL_EXT_fogcoord glFogi hook already applied\n");
        } else {
            old_fogcoord_glFogi = glFogi;
            glFogi = wine_glFogi;
        }
        if(old_fogcoord_glFogiv) {
            FIXME("GL_EXT_fogcoord glFogiv hook already applied\n");
        } else {
            old_fogcoord_glFogiv = glFogiv;
            glFogiv = wine_glFogiv;
        }
        if(old_fogcoord_glFogf) {
            FIXME("GL_EXT_fogcoord glFogf hook already applied\n");
        } else {
            old_fogcoord_glFogf = glFogf;
            glFogf = wine_glFogf;
        }
        if(old_fogcoord_glFogfv) {
            FIXME("GL_EXT_fogcoord glFogfv hook already applied\n");
        } else {
            old_fogcoord_glFogfv = glFogfv;
            glFogfv = wine_glFogfv;
        }
        if(old_fogcoord_glEnable) {
            FIXME("GL_EXT_fogcoord glEnable hook already applied\n");
        } else {
            old_fogcoord_glEnable = glEnableWINE;
            glEnableWINE = wine_glEnable;
        }
        if(old_fogcoord_glDisable) {
            FIXME("GL_EXT_fogcoord glDisable hook already applied\n");
        } else {
            old_fogcoord_glDisable = glDisableWINE;
            glDisableWINE = wine_glDisable;
        }

        if(old_fogcoord_glVertex4f) {
            FIXME("GL_EXT_fogcoord glVertex4f hook already applied\n");
        } else {
            old_fogcoord_glVertex4f = glVertex4f;
            glVertex4f = wine_glVertex4f;
        }
        if(old_fogcoord_glVertex4fv) {
            FIXME("GL_EXT_fogcoord glVertex4fv hook already applied\n");
        } else {
            old_fogcoord_glVertex4fv = glVertex4fv;
            glVertex4fv = wine_glVertex4fv;
        }
        if(old_fogcoord_glVertex3f) {
            FIXME("GL_EXT_fogcoord glVertex3f hook already applied\n");
        } else {
            old_fogcoord_glVertex3f = glVertex3f;
            glVertex3f = wine_glVertex3f;
        }
        if(old_fogcoord_glVertex3fv) {
            FIXME("GL_EXT_fogcoord glVertex3fv hook already applied\n");
        } else {
            old_fogcoord_glVertex3fv = glVertex3fv;
            glVertex3fv = wine_glVertex3fv;
        }

        if(old_fogcoord_glColor4f) {
            FIXME("GL_EXT_fogcoord glColor4f hook already applied\n");
        } else {
            old_fogcoord_glColor4f = glColor4f;
            glColor4f = wine_glColor4f;
        }
        if(old_fogcoord_glColor4fv) {
            FIXME("GL_EXT_fogcoord glColor4fv hook already applied\n");
        } else {
            old_fogcoord_glColor4fv = glColor4fv;
            glColor4fv = wine_glColor4fv;
        }
        if(old_fogcoord_glColor3f) {
            FIXME("GL_EXT_fogcoord glColor3f hook already applied\n");
        } else {
            old_fogcoord_glColor3f = glColor3f;
            glColor3f = wine_glColor3f;
        }
        if(old_fogcoord_glColor3fv) {
            FIXME("GL_EXT_fogcoord glColor3fv hook already applied\n");
        } else {
            old_fogcoord_glColor3fv = glColor3fv;
            glColor3fv = wine_glColor3fv;
        }
        if(old_fogcoord_glColor4ub) {
            FIXME("GL_EXT_fogcoord glColor4ub hook already applied\n");
        } else {
            old_fogcoord_glColor4ub = glColor4ub;
            glColor4ub = wine_glColor4ub;
        }

        if(old_fogcoord_glFogCoordfEXT) {
            FIXME("GL_EXT_fogcoord glFogCoordfEXT hook already applied\n");
        } else {
            old_fogcoord_glFogCoordfEXT = gl_info->glFogCoordfEXT;
            gl_info->glFogCoordfEXT = wine_glFogCoordfEXT;
        }
        if(old_fogcoord_glFogCoordfvEXT) {
            FIXME("GL_EXT_fogcoord glFogCoordfvEXT hook already applied\n");
        } else {
            old_fogcoord_glFogCoordfvEXT = gl_info->glFogCoordfvEXT;
            gl_info->glFogCoordfvEXT = wine_glFogCoordfvEXT;
        }
        if(old_fogcoord_glFogCoorddEXT) {
            FIXME("GL_EXT_fogcoord glFogCoorddEXT hook already applied\n");
        } else {
            old_fogcoord_glFogCoorddEXT = gl_info->glFogCoorddEXT;
            gl_info->glFogCoorddEXT = wine_glFogCoorddEXT;
        }
        if(old_fogcoord_glFogCoorddvEXT) {
            FIXME("GL_EXT_fogcoord glFogCoorddvEXT hook already applied\n");
        } else {
            old_fogcoord_glFogCoorddvEXT = gl_info->glFogCoorddvEXT;
            gl_info->glFogCoorddvEXT = wine_glFogCoorddvEXT;
        }
        gl_info->supported[EXT_FOG_COORD] = TRUE;
    }
}