144
144
dst->Texture.Unit[i].Combine.ScaleShiftA = src->Texture.Unit[i].Combine.ScaleShiftA;
146
146
/* copy texture object bindings, not contents of texture objects */
147
_mesa_lock_context_textures(dst);
147
149
copy_texture_binding(src, &dst->Texture.Unit[i].Current1D,
148
150
src->Texture.Unit[i].Current1D);
149
151
copy_texture_binding(src, &dst->Texture.Unit[i].Current2D,
154
156
src->Texture.Unit[i].CurrentCubeMap);
155
157
copy_texture_binding(src, &dst->Texture.Unit[i].CurrentRect,
156
158
src->Texture.Unit[i].CurrentRect);
160
_mesa_unlock_context_textures(dst);
1737
img = _mesa_select_tex_image(ctx, texUnit, target, level);
1742
texObj = _mesa_select_tex_object(ctx, texUnit, target);
1743
_mesa_lock_texture(ctx, texObj);
1745
img = _mesa_select_tex_image(ctx, texObj, target, level);
1738
1746
if (!img || !img->TexFormat) {
1739
1747
/* undefined texture image */
1740
1748
if (pname == GL_TEXTURE_COMPONENTS)
1747
1755
isProxy = _mesa_is_proxy_texture(target);
1749
1757
switch (pname) {
1750
1758
case GL_TEXTURE_WIDTH:
1751
1759
*params = img->Width;
1753
1761
case GL_TEXTURE_HEIGHT:
1754
1762
*params = img->Height;
1756
1764
case GL_TEXTURE_DEPTH:
1757
1765
*params = img->Depth;
1759
1767
case GL_TEXTURE_INTERNAL_FORMAT:
1760
1768
*params = img->InternalFormat;
1762
1770
case GL_TEXTURE_BORDER:
1763
1771
*params = img->Border;
1765
1773
case GL_TEXTURE_RED_SIZE:
1766
1774
if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
1767
1775
*params = img->TexFormat->RedBits;
1771
1779
case GL_TEXTURE_GREEN_SIZE:
1772
1780
if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
1773
1781
*params = img->TexFormat->GreenBits;
1777
1785
case GL_TEXTURE_BLUE_SIZE:
1778
1786
if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
1779
1787
*params = img->TexFormat->BlueBits;
1783
1791
case GL_TEXTURE_ALPHA_SIZE:
1784
1792
if (img->_BaseFormat == GL_ALPHA ||
1785
1793
img->_BaseFormat == GL_LUMINANCE_ALPHA ||
1795
1803
*params = img->TexFormat->IntensityBits;
1796
1804
else /* intensity probably stored as rgb texture */
1797
1805
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
1799
1807
case GL_TEXTURE_LUMINANCE_SIZE:
1800
1808
if (img->_BaseFormat != GL_LUMINANCE &&
1801
1809
img->_BaseFormat != GL_LUMINANCE_ALPHA)
1804
1812
*params = img->TexFormat->LuminanceBits;
1805
1813
else /* luminance probably stored as rgb texture */
1806
1814
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
1808
1816
case GL_TEXTURE_INDEX_SIZE_EXT:
1809
1817
if (img->_BaseFormat == GL_COLOR_INDEX)
1810
1818
*params = img->TexFormat->IndexBits;
1814
1822
case GL_TEXTURE_DEPTH_SIZE_ARB:
1815
1823
if (ctx->Extensions.SGIX_depth_texture ||
1816
1824
ctx->Extensions.ARB_depth_texture)
1819
1827
_mesa_error(ctx, GL_INVALID_ENUM,
1820
1828
"glGetTexLevelParameter[if]v(pname)");
1822
1830
case GL_TEXTURE_STENCIL_SIZE_EXT:
1823
1831
if (ctx->Extensions.EXT_packed_depth_stencil) {
1824
1832
*params = img->TexFormat->StencilBits;
1827
1835
_mesa_error(ctx, GL_INVALID_ENUM,
1828
1836
"glGetTexLevelParameter[if]v(pname)");
1832
1840
/* GL_ARB_texture_compression */
1833
1841
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
1849
1857
_mesa_error(ctx, GL_INVALID_ENUM,
1850
1858
"glGetTexLevelParameter[if]v(pname)");
1853
1861
case GL_TEXTURE_COMPRESSED:
1854
1862
if (ctx->Extensions.ARB_texture_compression) {
1855
1863
*params = (GLint) img->IsCompressed;
1858
1866
_mesa_error(ctx, GL_INVALID_ENUM,
1859
1867
"glGetTexLevelParameter[if]v(pname)");
1863
1871
/* GL_ARB_texture_float */
1864
1872
case GL_TEXTURE_RED_TYPE_ARB:
1869
1877
_mesa_error(ctx, GL_INVALID_ENUM,
1870
1878
"glGetTexLevelParameter[if]v(pname)");
1873
1881
case GL_TEXTURE_GREEN_TYPE_ARB:
1874
1882
if (ctx->Extensions.ARB_texture_float) {
1875
1883
*params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE;
1878
1886
_mesa_error(ctx, GL_INVALID_ENUM,
1879
1887
"glGetTexLevelParameter[if]v(pname)");
1882
1890
case GL_TEXTURE_BLUE_TYPE_ARB:
1883
1891
if (ctx->Extensions.ARB_texture_float) {
1884
1892
*params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE;
1887
1895
_mesa_error(ctx, GL_INVALID_ENUM,
1888
1896
"glGetTexLevelParameter[if]v(pname)");
1891
1899
case GL_TEXTURE_ALPHA_TYPE_ARB:
1892
1900
if (ctx->Extensions.ARB_texture_float) {
1893
1901
*params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE;
1896
1904
_mesa_error(ctx, GL_INVALID_ENUM,
1897
1905
"glGetTexLevelParameter[if]v(pname)");
1900
1908
case GL_TEXTURE_LUMINANCE_TYPE_ARB:
1901
1909
if (ctx->Extensions.ARB_texture_float) {
1902
1910
*params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE;
1905
1913
_mesa_error(ctx, GL_INVALID_ENUM,
1906
1914
"glGetTexLevelParameter[if]v(pname)");
1909
1917
case GL_TEXTURE_INTENSITY_TYPE_ARB:
1910
1918
if (ctx->Extensions.ARB_texture_float) {
1911
1919
*params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE;
1914
1922
_mesa_error(ctx, GL_INVALID_ENUM,
1915
1923
"glGetTexLevelParameter[if]v(pname)");
1918
1926
case GL_TEXTURE_DEPTH_TYPE_ARB:
1919
1927
if (ctx->Extensions.ARB_texture_float) {
1920
1928
*params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE;
1923
1931
_mesa_error(ctx, GL_INVALID_ENUM,
1924
1932
"glGetTexLevelParameter[if]v(pname)");
1929
1937
_mesa_error(ctx, GL_INVALID_ENUM,
1930
1938
"glGetTexLevelParameter[if]v(pname)");
1942
_mesa_unlock_texture(ctx, texObj);
1939
1950
struct gl_texture_unit *texUnit;
1940
1951
struct gl_texture_object *obj;
1952
GLboolean error = GL_FALSE;
1941
1953
GET_CURRENT_CONTEXT(ctx);
1942
1954
ASSERT_OUTSIDE_BEGIN_END(ctx);
1970
_mesa_lock_texture(ctx, obj);
1958
1971
switch (pname) {
1959
1972
case GL_TEXTURE_MAG_FILTER:
1960
1973
*params = ENUM_TO_FLOAT(obj->MagFilter);
1962
1975
case GL_TEXTURE_MIN_FILTER:
1963
1976
*params = ENUM_TO_FLOAT(obj->MinFilter);
1965
1978
case GL_TEXTURE_WRAP_S:
1966
1979
*params = ENUM_TO_FLOAT(obj->WrapS);
1968
1981
case GL_TEXTURE_WRAP_T:
1969
1982
*params = ENUM_TO_FLOAT(obj->WrapT);
1971
1984
case GL_TEXTURE_WRAP_R:
1972
1985
*params = ENUM_TO_FLOAT(obj->WrapR);
1974
1987
case GL_TEXTURE_BORDER_COLOR:
1975
1988
params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
1976
1989
params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
1977
1990
params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
1978
1991
params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
1980
1993
case GL_TEXTURE_RESIDENT:
1982
1995
GLboolean resident;
1986
1999
resident = GL_TRUE;
1987
2000
*params = ENUM_TO_FLOAT(resident);
1990
2003
case GL_TEXTURE_PRIORITY:
1991
2004
*params = obj->Priority;
1993
2006
case GL_TEXTURE_MIN_LOD:
1994
2007
*params = obj->MinLod;
1996
2009
case GL_TEXTURE_MAX_LOD:
1997
2010
*params = obj->MaxLod;
1999
2012
case GL_TEXTURE_BASE_LEVEL:
2000
2013
*params = (GLfloat) obj->BaseLevel;
2002
2015
case GL_TEXTURE_MAX_LEVEL:
2003
2016
*params = (GLfloat) obj->MaxLevel;
2005
2018
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
2006
2019
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
2007
2020
*params = obj->MaxAnisotropy;
2011
2025
case GL_TEXTURE_COMPARE_SGIX:
2012
2026
if (ctx->Extensions.SGIX_shadow) {
2013
2027
*params = (GLfloat) obj->CompareFlag;
2017
2032
case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
2018
2033
if (ctx->Extensions.SGIX_shadow) {
2019
2034
*params = (GLfloat) obj->CompareOperator;
2023
2039
case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
2024
2040
if (ctx->Extensions.SGIX_shadow_ambient) {
2025
2041
*params = obj->ShadowAmbient;
2029
2046
case GL_GENERATE_MIPMAP_SGIS:
2030
2047
if (ctx->Extensions.SGIS_generate_mipmap) {
2031
2048
*params = (GLfloat) obj->GenerateMipmap;
2035
2053
case GL_TEXTURE_COMPARE_MODE_ARB:
2036
2054
if (ctx->Extensions.ARB_shadow) {
2037
2055
*params = (GLfloat) obj->CompareMode;
2041
2060
case GL_TEXTURE_COMPARE_FUNC_ARB:
2042
2061
if (ctx->Extensions.ARB_shadow) {
2043
2062
*params = (GLfloat) obj->CompareFunc;
2047
2067
case GL_DEPTH_TEXTURE_MODE_ARB:
2048
2068
if (ctx->Extensions.ARB_depth_texture) {
2049
2069
*params = (GLfloat) obj->DepthMode;
2053
2074
case GL_TEXTURE_LOD_BIAS:
2054
2075
if (ctx->Extensions.EXT_texture_lod_bias) {
2055
2076
*params = obj->LodBias;
2060
; /* silence warnings */
2062
/* If we get here, pname was an unrecognized enum */
2063
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)",
2086
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)",
2089
_mesa_unlock_texture(ctx, obj);