Skip to content
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 @@ -23,18 +23,18 @@ public struct TextureHandle
internal TextureHandle(int handle, bool shared = false) { this.handle = new ResourceHandle(handle, RenderGraphResourceType.Texture, shared); }

/// <summary>
/// Cast to RTHandle
/// Cast to RenderTargetIdentifier
/// </summary>
/// <param name="texture">Input TextureHandle.</param>
/// <returns>Resource as a RTHandle.</returns>
public static implicit operator RTHandle(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;
/// <returns>Resource as a RenderTargetIdentifier.</returns>
public static implicit operator RenderTargetIdentifier(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : default(RenderTargetIdentifier);

/// <summary>
/// Cast to RenderTargetIdentifier
/// Cast to Texture
/// </summary>
/// <param name="texture">Input TextureHandle.</param>
/// <returns>Resource as a RenderTargetIdentifier.</returns>
public static implicit operator RenderTargetIdentifier(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : default(RenderTargetIdentifier);
/// <returns>Resource as a Texture.</returns>
public static implicit operator Texture(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;

/// <summary>
/// Cast to RenderTexture
Expand All @@ -43,6 +43,13 @@ public struct TextureHandle
/// <returns>Resource as a RenderTexture.</returns>
public static implicit operator RenderTexture(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;

/// <summary>
/// Cast to RTHandle
/// </summary>
/// <param name="texture">Input TextureHandle.</param>
/// <returns>Resource as a RTHandle.</returns>
public static implicit operator RTHandle(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;

/// <summary>
/// Return true if the handle is valid.
/// </summary>
Expand Down
26 changes: 13 additions & 13 deletions com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,13 @@ internal RTHandle(RTHandleSystem owner)
}

/// <summary>
/// Implicit conversion operator to RenderTexture
/// Implicit conversion operator to RenderTargetIdentifier
/// </summary>
/// <param name="handle">Input RTHandle</param>
/// <returns>RenderTexture representation of the RTHandle.</returns>
public static implicit operator RenderTexture(RTHandle handle)
/// <returns>RenderTargetIdentifier representation of the RTHandle.</returns>
public static implicit operator RenderTargetIdentifier(RTHandle handle)
{
// If RTHandle is null then conversion should give a null RenderTexture
if (handle == null)
return null;

Debug.Assert(handle.rt != null, "RTHandle was created using a regular Texture and is used as a RenderTexture");
return handle.rt;
return handle != null ? handle.nameID : default(RenderTargetIdentifier);
}

/// <summary>
Expand All @@ -92,13 +87,18 @@ public static implicit operator Texture(RTHandle handle)
}

/// <summary>
/// Implicit conversion operator to RenderTargetIdentifier
/// Implicit conversion operator to RenderTexture
/// </summary>
/// <param name="handle">Input RTHandle</param>
/// <returns>RenderTargetIdentifier representation of the RTHandle.</returns>
public static implicit operator RenderTargetIdentifier(RTHandle handle)
/// <returns>RenderTexture representation of the RTHandle.</returns>
public static implicit operator RenderTexture(RTHandle handle)
{
return handle != null ? handle.nameID : default(RenderTargetIdentifier);
// If RTHandle is null then conversion should give a null RenderTexture
if (handle == null)
return null;

Debug.Assert(handle.rt != null, "RTHandle was created using a regular Texture and is used as a RenderTexture");
return handle.rt;
}

internal void SetRenderTexture(RenderTexture rt)
Expand Down
8 changes: 8 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef __ACES__
#define __ACES__

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

/**
* https://github.com/ampas/aces-dev
*
Expand Down Expand Up @@ -1316,4 +1320,8 @@ half3 ODT_P3DCI_48nits(half3 oces)
return outputCV;
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // __ACES__
9 changes: 9 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_BSDF_INCLUDED
#define UNITY_BSDF_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"

// Note: All NDF and diffuse term have a version with and without divide by PI.
Expand Down Expand Up @@ -637,4 +641,9 @@ real3 D_KajiyaKay(real3 T, real3 H, real specularExponent)

return dirAttn * norm * PositivePow(sinTHSq, 0.5 * n);
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_BSDF_INCLUDED
8 changes: 8 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_COLOR_INCLUDED
#define UNITY_COLOR_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl"

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -731,4 +735,8 @@ half3 DecodeRGBM(half4 rgbm)
return rgbm.xyz * rgbm.w * kRGBMRange;
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_COLOR_INCLUDED
8 changes: 8 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_COMMON_INCLUDED
#define UNITY_COMMON_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

// Convention:

// Unity is Y up and left handed in world space
Expand Down Expand Up @@ -1341,4 +1345,8 @@ float SharpenAlpha(float alpha, float alphaClipTreshold)
// These clamping function to max of floating point 16 bit are use to prevent INF in code in case of extreme value
TEMPLATE_1_REAL(ClampToFloat16Max, value, return min(value, HALF_MAX))

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_COMMON_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_COMMON_LIGHTING_INCLUDED
#define UNITY_COMMON_LIGHTING_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

// Ligthing convention
// Light direction is oriented backward (-Z). i.e in shader code, light direction is -lightData.forward

Expand Down Expand Up @@ -455,4 +459,8 @@ bool IsMatchingLightLayer(uint lightLayers, uint renderingLayers)
return (lightLayers & renderingLayers) != 0;
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_COMMON_LIGHTING_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_COMMON_MATERIAL_INCLUDED
#define UNITY_COMMON_MATERIAL_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

//-----------------------------------------------------------------------------
// Define constants
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -329,4 +333,9 @@ real3 LerpWhiteTo(real3 b, real t)
real oneMinusT = 1.0 - t;
return real3(oneMinusT, oneMinusT, oneMinusT) + b * t;
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_COMMON_MATERIAL_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_ENTITY_LIGHTING_INCLUDED
#define UNITY_ENTITY_LIGHTING_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"

Expand Down Expand Up @@ -355,5 +359,8 @@ real3 SampleDirectionalLightmap(TEXTURE2D_LIGHTMAP_PARAM(lightmapTex, lightmapSa
return bakeDiffuseLighting;
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_ENTITY_LIGHTING_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_IMAGE_BASED_LIGHTING_INCLUDED
#define UNITY_IMAGE_BASED_LIGHTING_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl"
Expand Down Expand Up @@ -738,4 +742,8 @@ float InfluenceFadeNormalWeight(float3 normal, float3 centerToPos)
return saturate((-1.0f / 0.4f) * dot(normal, centerToPos) + (0.6f / 0.4f));
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_IMAGE_BASED_LIGHTING_INCLUDED
8 changes: 8 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_PACKING_INCLUDED
#define UNITY_PACKING_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

//-----------------------------------------------------------------------------
// Normal packing
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -581,4 +585,8 @@ float2 Unpack8ToFloat2(float f)
return float2(x, y);
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_PACKING_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_FIBONACCI_INCLUDED
#define UNITY_FIBONACCI_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

// Computes a point using the Fibonacci sequence of length N.
// Input: Fib[N - 1], Fib[N - 2], and the index 'i' of the point.
// Ref: Efficient Quadrature Rules for Illumination Integrals
Expand Down Expand Up @@ -295,4 +299,8 @@ real2 SampleSphereFibonacci(uint i, uint sampleCount)
return real2(1 - 2 * f.x, TWO_PI * f.y);
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_FIBONACCI_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_HAMMERSLEY_INCLUDED
#define UNITY_HAMMERSLEY_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

// Ref: http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
uint ReverseBits32(uint bits)
{
Expand Down Expand Up @@ -420,4 +424,8 @@ real2 Hammersley2d(uint i, uint sampleCount)
}
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_HAMMERSLEY_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_SAMPLING_INCLUDED
#define UNITY_SAMPLING_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

//-----------------------------------------------------------------------------
// Sample generator
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -305,4 +309,8 @@ void SampleCone(real2 u, real cosHalfAngle,
rcpPdf = TWO_PI * (1 - cosHalfAngle);
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif // UNITY_SAMPLING_INCLUDED
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef UNITY_SPACE_TRANSFORMS_INCLUDED
#define UNITY_SPACE_TRANSFORMS_INCLUDED

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (disable : 3205) // conversion of larger type to smaller
#endif

// Caution: For HDRP, adding a function in this file requires adding the appropriate #define in PickingSpaceTransforms.hlsl

// Return the PreTranslated ObjectToWorld Matrix (i.e matrix with _WorldSpaceCameraPos apply to it if we use camera relative rendering)
Expand Down Expand Up @@ -236,4 +240,8 @@ real3 TransformObjectToTangent(real3 dirOS, real3x3 tangentToWorld)
return TransformWorldToTangent(normalWS, tangentToWorld);
}

#if SHADER_API_MOBILE || SHADER_API_GLES || SHADER_API_GLES3
#pragma warning (enable : 3205) // conversion of larger type to smaller
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Here is the list of Material properties that you can access with the AOV API.
| **Normal** | Outputs the surface albedo. |
| **Albedo** | Outputs the surface normal. |
| **Smoothness** | Outputs the surface smoothness. |
| **Ambient Occlusion** | Outputs the ambient occlusion (N/A for AxF). |
| **Ambient Occlusion** | Outputs the ambient occlusion (N/A for AxF). **Note**: the ambient occlusion this outputs does not include ray-traced/screen-space ambient occlusion from the [Ambient Occlusion override](Override-Ambient-Occlusion.md). It only includes ambient occlusion from materials in the Scene. |
| **Specular** | Outputs the surface specularity. |
| **Alpha** | Outputs the surface alpha (pixel coverage). |

Expand Down
Loading