Commit 0e22d3ac by Alexis Hetu Committed by Alexis Hétu

Implement GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MAX_TEXTURE_LOD_BIAS

- GL_MAX_PROGRAM_TEXEL_OFFSET and GL_MIN_PROGRAM_TEXEL_OFFSET were technically already properly implemented, since the spec mentions that the behavior outside of these limits is undefined, and SwiftShader has no actual hard limit for these parameters. - GL_MAX_TEXTURE_LOD_BIAS also has no hard limit in SwiftShader, other than the limit imposed on LOD itself, so that limit was used for GL_MAX_TEXTURE_LOD_BIAS. Change-Id: I60b15b7f7a0febbc3e6582caff6c6a414a5d4964 Reviewed-on: https://swiftshader-review.googlesource.com/11709Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent e8d42ae1
......@@ -98,6 +98,7 @@ namespace sw
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 64,
MIN_PROGRAM_TEXEL_OFFSET = -8,
MAX_PROGRAM_TEXEL_OFFSET = 7,
MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2, // Trilinear accesses lod+1
RENDERTARGETS = 8,
};
}
......
......@@ -2178,15 +2178,18 @@ template<typename T> bool Context::getIntegerv(GLenum pname, T *params) const
*params = MAX_FRAGMENT_UNIFORM_COMPONENTS;
return true;
case GL_MAX_PROGRAM_TEXEL_OFFSET:
UNIMPLEMENTED();
// Note: SwiftShader has no actual texel offset limit, so this limit can be modified if required.
// In any case, any behavior outside the specified range is valid since the spec mentions:
// (see OpenGL ES 3.0.5, 3.8.10.1 Scale Factor and Level of Detail, p.153) // "If any of the offset values are outside the range of the implementation-defined values
// MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, results of the texture lookup are
// undefined."
*params = MAX_PROGRAM_TEXEL_OFFSET;
return true;
case GL_MAX_SERVER_WAIT_TIMEOUT:
*params = 0;
return true;
case GL_MAX_TEXTURE_LOD_BIAS:
UNIMPLEMENTED();
*params = 2;
*params = MAX_TEXTURE_LOD_BIAS;
return true;
case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
*params = sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS;
......@@ -2216,7 +2219,11 @@ template<typename T> bool Context::getIntegerv(GLenum pname, T *params) const
*params = MAX_VERTEX_UNIFORM_COMPONENTS;
return true;
case GL_MIN_PROGRAM_TEXEL_OFFSET:
UNIMPLEMENTED();
// Note: SwiftShader has no actual texel offset limit, so this limit can be modified if required.
// In any case, any behavior outside the specified range is valid since the spec mentions:
// (see OpenGL ES 3.0.5, 3.8.10.1 Scale Factor and Level of Detail, p.153) // "If any of the offset values are outside the range of the implementation-defined values
// MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, results of the texture lookup are
// undefined."
*params = MIN_PROGRAM_TEXEL_OFFSET;
return true;
case GL_MINOR_VERSION:
......
......@@ -88,6 +88,7 @@ enum
MAX_FRAGMENT_INPUT_VECTORS = 15,
MIN_PROGRAM_TEXEL_OFFSET = sw::MIN_PROGRAM_TEXEL_OFFSET,
MAX_PROGRAM_TEXEL_OFFSET = sw::MAX_PROGRAM_TEXEL_OFFSET,
MAX_TEXTURE_LOD_BIAS = sw::MAX_TEXTURE_LOD,
MAX_DRAW_BUFFERS = sw::RENDERTARGETS,
MAX_COLOR_ATTACHMENTS = MAX(MAX_DRAW_BUFFERS, 8),
MAX_FRAGMENT_UNIFORM_BLOCKS = sw::MAX_FRAGMENT_UNIFORM_BLOCKS,
......
......@@ -72,7 +72,7 @@ namespace sw
texture.baseLevel = 0;
texture.maxLevel = 1000;
texture.maxLod = MIPMAP_LEVELS - 2; // Trilinear accesses lod+1
texture.maxLod = MAX_TEXTURE_LOD;
texture.minLod = 0;
}
......@@ -344,12 +344,12 @@ namespace sw
void Sampler::setMinLod(float minLod)
{
texture.minLod = clamp(minLod, 0.0f, (float)(MIPMAP_LEVELS - 2));
texture.minLod = clamp(minLod, 0.0f, (float)(MAX_TEXTURE_LOD));
}
void Sampler::setMaxLod(float maxLod)
{
texture.maxLod = clamp(maxLod, 0.0f, (float)(MIPMAP_LEVELS - 2));
texture.maxLod = clamp(maxLod, 0.0f, (float)(MAX_TEXTURE_LOD));
}
void Sampler::setFilterQuality(FilterType maximumFilterQuality)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment