Skip to content

[VFX] Mobile fixes #5149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool GetMeshAndElementIndex(inout AttributesMesh input, inout AttributesElement
uv.x = texCoord;
#endif

uv.y = float((id & 2) >> 1);
uv.y = (id & 2) * 0.5f;
const float2 vOffsets = float2(0.0f, uv.y - 0.5f);

#if VFX_STRIPS_SWAP_UV
Expand All @@ -73,7 +73,7 @@ bool GetMeshAndElementIndex(inout AttributesMesh input, inout AttributesElement

#else
uv.x = float(id & 1);
uv.y = float((id & 2) >> 1);
uv.y = (id & 2) * 0.5f;
const float2 vOffsets = uv.xy - 0.5f;
#endif
#elif VFX_PRIMITIVE_TRIANGLE
Expand Down
2 changes: 2 additions & 0 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- GPU hang on some initialize dispatch during dichotomy (platform specific)
- Compilation error undeclared identifier 'Infinity' [Case 1328592](https://issuetracker.unity3d.com/product/unity/issues/guid/1328592/)
- Exposed Parameter placement can be moved after sanitize
- Fix rendering artifacts on some mobile devices [Case 1149057](https://issuetracker.unity3d.com/product/unity/issues/guid/1149057/)
- Fix compilation failure on OpenGLES [Case 1348666](https://issuetracker.unity3d.com/product/unity/issues/guid/1348666/)

## [11.0.0] - 2020-10-21
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ VFX_VARYING_PS_INPUTS vert(uint id : SV_VertexID, vs_input i)

float3 offsets = (float3)0;
offsets.x = float(id & 1);
offsets.y = float((id & 2) >> 1);
offsets.z = float((id & 6) >> 2);
offsets.y = (id & 2) * 0.5f;
offsets.z = (id & 4) * 0.25f;
offsets -= 0.5f;

${VFXLoadSize}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void geom(point uint intStream[1] : TEXCOORD0,inout TriangleStream<VFX_VARYING_P
#if VFX_PRIMITIVE_QUAD

o.VFX_VARYING_UV.x = float(id & 1);
o.VFX_VARYING_UV.y = float((id & 2) >> 1);
o.VFX_VARYING_UV.y = (id & 2) * 0.5f;
const float2 vOffsets = o.VFX_VARYING_UV.xy - 0.5f;

#elif VFX_PRIMITIVE_TRIANGLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ VFX_VARYING_PS_INPUTS vert(uint id : SV_VertexID, vs_input i)
o.VFX_VARYING_UV.x = texCoord;
#endif

o.VFX_VARYING_UV.y = float((id & 2) >> 1);
o.VFX_VARYING_UV.y = (id & 2) * 0.5f;
const float2 vOffsets = float2(0.0f,o.VFX_VARYING_UV.y - 0.5f);

#if VFX_STRIPS_SWAP_UV
Expand All @@ -72,7 +72,7 @@ VFX_VARYING_PS_INPUTS vert(uint id : SV_VertexID, vs_input i)

#else
o.VFX_VARYING_UV.x = float(id & 1);
o.VFX_VARYING_UV.y = float((id & 2) >> 1);
o.VFX_VARYING_UV.y = (id & 2) * 0.5f;
const float2 vOffsets = o.VFX_VARYING_UV.xy - 0.5f;
#endif

Expand Down
8 changes: 8 additions & 0 deletions com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ struct VFXSamplerCube
SamplerState s;
};

#if SHADER_AVAILABLE_CUBEARRAY
struct VFXSamplerCubeArray
{
TextureCubeArray t;
SamplerState s;
};
#endif

#if !VFX_WORLD_SPACE && !VFX_LOCAL_SPACE
#error VFXCommon.hlsl should be included after space defines
Expand Down Expand Up @@ -120,10 +122,12 @@ float4 SampleTexture(VFXSamplerCube s, float3 coords)
return SAMPLE_TEXTURECUBE(s.t, s.s, coords);
}

#if SHADER_AVAILABLE_CUBEARRAY
float4 SampleTexture(VFXSamplerCubeArray s, float3 coords, float slice)
{
return SAMPLE_TEXTURECUBE_ARRAY(s.t, s.s, coords, slice);
}
#endif

float4 SampleTexture(VFXSampler2D s, float2 coords, float level)
{
Expand All @@ -145,10 +149,12 @@ float4 SampleTexture(VFXSamplerCube s, float3 coords, float level)
return SAMPLE_TEXTURECUBE_LOD(s.t, s.s, coords, level);
}

#if SHADER_AVAILABLE_CUBEARRAY
float4 SampleTexture(VFXSamplerCubeArray s, float3 coords, float slice, float level)
{
return SAMPLE_TEXTURECUBE_ARRAY_LOD(s.t, s.s, coords, slice, level);
}
#endif

float4 LoadTexture(VFXSampler2D s, int3 pixelCoords)
{
Expand Down Expand Up @@ -263,13 +269,15 @@ VFXSamplerCube GetVFXSampler(TextureCube t, SamplerState s)
return vfxSampler;
}

#if SHADER_AVAILABLE_CUBEARRAY
VFXSamplerCubeArray GetVFXSampler(TextureCubeArray t, SamplerState s)
{
VFXSamplerCubeArray vfxSampler;
vfxSampler.t = t;
vfxSampler.s = s;
return vfxSampler;
}
#endif

uint ConvertFloatToSortableUint(float f)
{
Expand Down