mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
Special casing texture2DLod for SM 2.0 targets
tex2Dlod and related functions are not supported in shader model 2.0 (or D3D11 feature level 9_x). This commit just aliases them to a straight texture lookup, which doesn't do the same thing but at least it won't fail to compile.
This commit is contained in:
parent
121cc748c2
commit
b234364df9
1 changed files with 11 additions and 3 deletions
|
@ -199,7 +199,6 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord)
|
||||||
|
|
||||||
# define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg)
|
# define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg)
|
||||||
# define texture2D(_sampler, _coord) tex2D(_sampler, _coord)
|
# define texture2D(_sampler, _coord) tex2D(_sampler, _coord)
|
||||||
# define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) )
|
|
||||||
# define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
|
# define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
|
||||||
|
|
||||||
# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg)
|
# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg)
|
||||||
|
@ -208,11 +207,20 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord)
|
||||||
|
|
||||||
# define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg)
|
# define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg)
|
||||||
# define texture3D(_sampler, _coord) tex3D(_sampler, _coord)
|
# define texture3D(_sampler, _coord) tex3D(_sampler, _coord)
|
||||||
# define texture3DLod(_sampler, _coord, _level) tex3Dlod(_sampler, vec4( (_coord).xyz, _level) )
|
|
||||||
|
|
||||||
# define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg])
|
# define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg])
|
||||||
# define textureCube(_sampler, _coord) texCUBE(_sampler, _coord)
|
# define textureCube(_sampler, _coord) texCUBE(_sampler, _coord)
|
||||||
|
|
||||||
|
# if BGFX_SHADER_LANGUAGE_HLSL == 2
|
||||||
|
# define texture2DLod(_sampler, _coord, _level) tex2D(_sampler, (_coord).xy)
|
||||||
|
# define texture3DLod(_sampler, _coord, _level) tex3D(_sampler, (_coord).xyz)
|
||||||
|
# define textureCubeLod(_sampler, _coord, _level) texCUBE(_sampler, (_coord).xyz)
|
||||||
|
# else
|
||||||
|
# define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) )
|
||||||
|
# define texture3DLod(_sampler, _coord, _level) tex3Dlod(_sampler, vec4( (_coord).xyz, _level) )
|
||||||
# define textureCubeLod(_sampler, _coord, _level) texCUBElod(_sampler, vec4( (_coord).xyz, _level) )
|
# define textureCubeLod(_sampler, _coord, _level) texCUBElod(_sampler, vec4( (_coord).xyz, _level) )
|
||||||
|
# endif
|
||||||
|
|
||||||
# endif //
|
# endif //
|
||||||
|
|
||||||
vec2 vec2_splat(float _x) { return vec2(_x, _x); }
|
vec2 vec2_splat(float _x) { return vec2(_x, _x); }
|
||||||
|
|
Loading…
Reference in a new issue