shaderc: Fixed textureSize overloads. Issue #3020.

This commit is contained in:
Бранимир Караџић 2023-01-25 20:27:08 -08:00
parent bea82a1343
commit c645acdc03
1 changed files with 34 additions and 4 deletions

View File

@ -235,11 +235,28 @@ float bgfxShadow2DProj(BgfxSampler2DShadow _sampler, vec4 _coord)
return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, coord.xy, coord.z);
}
vec2 bgfxTextureSize(BgfxSampler2DShadow _sampler, int _lod)
{
vec2 result;
float numberOfMipMapLevels;
_sampler.m_texture.GetDimensions(_lod, result.x, result.y, numberOfMipMapLevels);
return result;
}
vec4 bgfxShadow2DArray(BgfxSampler2DArrayShadow _sampler, vec4 _coord)
{
return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xyz, _coord.w);
}
vec2 bgfxTextureSize(BgfxSampler2DArrayShadow _sampler, int _lod)
{
vec2 result;
float numberOfMipMapLevels;
float numberOfElements;
_sampler.m_texture.GetDimensions(_lod, result.x, result.y, numberOfElements, numberOfMipMapLevels);
return result;
}
vec4 bgfxTexture3D(BgfxSampler3D _sampler, vec3 _coord)
{
return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
@ -297,21 +314,24 @@ vec4 bgfxTexelFetchOffset(BgfxSampler2D _sampler, ivec2 _coord, int _lod, ivec2
vec2 bgfxTextureSize(BgfxSampler2D _sampler, int _lod)
{
vec2 result;
_sampler.m_texture.GetDimensions(result.x, result.y);
float numberOfMipMapLevels;
_sampler.m_texture.GetDimensions(_lod, result.x, result.y, numberOfMipMapLevels);
return result;
}
vec2 bgfxTextureSize(BgfxISampler2D _sampler, int _lod)
{
vec2 result;
_sampler.m_texture.GetDimensions(result.x, result.y);
float numberOfMipMapLevels;
_sampler.m_texture.GetDimensions(_lod, result.x, result.y, numberOfMipMapLevels);
return result;
}
vec2 bgfxTextureSize(BgfxUSampler2D _sampler, int _lod)
{
vec2 result;
_sampler.m_texture.GetDimensions(result.x, result.y);
float numberOfMipMapLevels;
_sampler.m_texture.GetDimensions(_lod, result.x, result.y, numberOfMipMapLevels);
return result;
}
@ -319,14 +339,17 @@ vec4 bgfxTextureGather0(BgfxSampler2D _sampler, vec2 _coord)
{
return _sampler.m_texture.GatherRed(_sampler.m_sampler, _coord);
}
vec4 bgfxTextureGather1(BgfxSampler2D _sampler, vec2 _coord)
{
return _sampler.m_texture.GatherGreen(_sampler.m_sampler, _coord);
}
vec4 bgfxTextureGather2(BgfxSampler2D _sampler, vec2 _coord)
{
return _sampler.m_texture.GatherBlue(_sampler.m_sampler, _coord);
}
vec4 bgfxTextureGather3(BgfxSampler2D _sampler, vec2 _coord)
{
return _sampler.m_texture.GatherAlpha(_sampler.m_sampler, _coord);
@ -336,14 +359,17 @@ vec4 bgfxTextureGatherOffset0(BgfxSampler2D _sampler, vec2 _coord, ivec2 _offset
{
return _sampler.m_texture.GatherRed(_sampler.m_sampler, _coord, _offset);
}
vec4 bgfxTextureGatherOffset1(BgfxSampler2D _sampler, vec2 _coord, ivec2 _offset)
{
return _sampler.m_texture.GatherGreen(_sampler.m_sampler, _coord, _offset);
}
vec4 bgfxTextureGatherOffset2(BgfxSampler2D _sampler, vec2 _coord, ivec2 _offset)
{
return _sampler.m_texture.GatherBlue(_sampler.m_sampler, _coord, _offset);
}
vec4 bgfxTextureGatherOffset3(BgfxSampler2D _sampler, vec2 _coord, ivec2 _offset)
{
return _sampler.m_texture.GatherAlpha(_sampler.m_sampler, _coord, _offset);
@ -353,14 +379,17 @@ vec4 bgfxTextureGather0(BgfxSampler2DArray _sampler, vec3 _coord)
{
return _sampler.m_texture.GatherRed(_sampler.m_sampler, _coord);
}
vec4 bgfxTextureGather1(BgfxSampler2DArray _sampler, vec3 _coord)
{
return _sampler.m_texture.GatherGreen(_sampler.m_sampler, _coord);
}
vec4 bgfxTextureGather2(BgfxSampler2DArray _sampler, vec3 _coord)
{
return _sampler.m_texture.GatherBlue(_sampler.m_sampler, _coord);
}
vec4 bgfxTextureGather3(BgfxSampler2DArray _sampler, vec3 _coord)
{
return _sampler.m_texture.GatherAlpha(_sampler.m_sampler, _coord);
@ -394,7 +423,8 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod)
vec3 bgfxTextureSize(BgfxSampler3D _sampler, int _lod)
{
vec3 result;
_sampler.m_texture.GetDimensions(result.x, result.y, result.z);
float numberOfMipMapLevels;
_sampler.m_texture.GetDimensions(_lod, result.x, result.y, result.z, numberOfMipMapLevels);
return result;
}