Skip to content
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

Supported shader barycentric coords on OpenGL, Vulkan and Metal #3090

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions 3rdparty/glslang/glslang/HLSL/hlslParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9524,6 +9524,8 @@ bool HlslParseContext::isInputBuiltIn(const TQualifier& qualifier) const
case EbvSampleMask:
case EbvSamplePosition:
case EbvViewportIndex:
case EbvBaryCoordEXT:
case EbvBaryCoordNoPerspEXT:
return language == EShLangFragment;
case EbvGlobalInvocationId:
case EbvLocalInvocationIndex:
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/glslang/glslang/HLSL/hlslScanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ void HlslScanContext::fillInKeywordMap()
(*SemanticMap)["SV_DEPTHGREATEREQUAL"] = EbvFragDepthGreater;
(*SemanticMap)["SV_DEPTHLESSEQUAL"] = EbvFragDepthLesser;
(*SemanticMap)["SV_STENCILREF"] = EbvFragStencilRef;
(*SemanticMap)["SV_BARYCENTRICS"] = EbvBaryCoordEXT;
(*SemanticMap)["SV_BARYCENTRICS1"] = EbvBaryCoordNoPerspEXT;
}

void HlslScanContext::deleteKeywordMap()
Expand Down
61 changes: 32 additions & 29 deletions 3rdparty/spirv-cross/spirv_msl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12721,7 +12721,7 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
else
quals = member_location_attribute_qualifier(type, index);

if (builtin == BuiltInBaryCoordKHR || builtin == BuiltInBaryCoordNoPerspKHR)
if (builtin == BuiltInBaryCoordKHR)
{
if (has_member_decoration(type.self, index, DecorationFlat) ||
has_member_decoration(type.self, index, DecorationCentroid) ||
Expand All @@ -12739,35 +12739,38 @@ string CompilerMSL::member_attribute_qualifier(const SPIRType &type, uint32_t in
// FragCoord builtin; it's always noperspective on Metal.
if (!type_is_integral(mbr_type) && (!is_builtin || builtin != BuiltInFragCoord))
{
if (has_member_decoration(type.self, index, DecorationFlat))
if (builtin != BuiltInBaryCoordKHR && builtin != BuiltInBaryCoordNoPerspKHR)
{
if (!quals.empty())
quals += ", ";
quals += "flat";
}
else if (has_member_decoration(type.self, index, DecorationCentroid))
{
if (!quals.empty())
quals += ", ";
if (has_member_decoration(type.self, index, DecorationNoPerspective))
quals += "centroid_no_perspective";
else
quals += "centroid_perspective";
}
else if (has_member_decoration(type.self, index, DecorationSample))
{
if (!quals.empty())
quals += ", ";
if (has_member_decoration(type.self, index, DecorationNoPerspective))
quals += "sample_no_perspective";
else
quals += "sample_perspective";
}
else if (has_member_decoration(type.self, index, DecorationNoPerspective))
{
if (!quals.empty())
quals += ", ";
quals += "center_no_perspective";
if (has_member_decoration(type.self, index, DecorationFlat))
{
if (!quals.empty())
quals += ", ";
quals += "flat";
}
else if (has_member_decoration(type.self, index, DecorationCentroid))
{
if (!quals.empty())
quals += ", ";
if (has_member_decoration(type.self, index, DecorationNoPerspective))
quals += "centroid_no_perspective";
else
quals += "centroid_perspective";
}
else if (has_member_decoration(type.self, index, DecorationSample))
{
if (!quals.empty())
quals += ", ";
if (has_member_decoration(type.self, index, DecorationNoPerspective))
quals += "sample_no_perspective";
else
quals += "sample_perspective";
}
else if (has_member_decoration(type.self, index, DecorationNoPerspective))
{
if (!quals.empty())
quals += ", ";
quals += "center_no_perspective";
}
}
}

Expand Down
53 changes: 29 additions & 24 deletions bindings/bf/bgfx.bf
Original file line number Diff line number Diff line change
Expand Up @@ -1051,121 +1051,126 @@ public static class bgfx
/// </summary>
FragmentOrdering = 0x0000000000000080,

/// <summary>
/// Fragment barycentric coordinates are available in fragment shader.
/// </summary>
FragmentBarycentric = 0x0000000000000100,

/// <summary>
/// Graphics debugger is present.
/// </summary>
GraphicsDebugger = 0x0000000000000100,
GraphicsDebugger = 0x0000000000000200,

/// <summary>
/// HDR10 rendering is supported.
/// </summary>
Hdr10 = 0x0000000000000200,
Hdr10 = 0x0000000000000400,

/// <summary>
/// HiDPI rendering is supported.
/// </summary>
Hidpi = 0x0000000000000400,
Hidpi = 0x0000000000000800,

/// <summary>
/// Image Read/Write is supported.
/// </summary>
ImageRw = 0x0000000000000800,
ImageRw = 0x0000000000001000,

/// <summary>
/// 32-bit indices are supported.
/// </summary>
Index32 = 0x0000000000001000,
Index32 = 0x0000000000002000,

/// <summary>
/// Instancing is supported.
/// </summary>
Instancing = 0x0000000000002000,
Instancing = 0x0000000000004000,

/// <summary>
/// Occlusion query is supported.
/// </summary>
OcclusionQuery = 0x0000000000004000,
OcclusionQuery = 0x0000000000008000,

/// <summary>
/// PrimitiveID is available in fragment shader.
/// </summary>
PrimitiveId = 0x0000000000008000,
PrimitiveId = 0x0000000000010000,

/// <summary>
/// Renderer is on separate thread.
/// </summary>
RendererMultithreaded = 0x0000000000010000,
RendererMultithreaded = 0x0000000000020000,

/// <summary>
/// Multiple windows are supported.
/// </summary>
SwapChain = 0x0000000000020000,
SwapChain = 0x0000000000040000,

/// <summary>
/// Texture blit is supported.
/// </summary>
TextureBlit = 0x0000000000040000,
TextureBlit = 0x0000000000080000,

/// <summary>
/// Texture compare less equal mode is supported.
/// </summary>
TextureCompareLequal = 0x0000000000080000,
TextureCompareReserved = 0x0000000000100000,
TextureCompareLequal = 0x0000000000100000,
TextureCompareReserved = 0x0000000000200000,

/// <summary>
/// Cubemap texture array is supported.
/// </summary>
TextureCubeArray = 0x0000000000200000,
TextureCubeArray = 0x0000000000400000,

/// <summary>
/// CPU direct access to GPU texture memory.
/// </summary>
TextureDirectAccess = 0x0000000000400000,
TextureDirectAccess = 0x0000000000800000,

/// <summary>
/// Read-back texture is supported.
/// </summary>
TextureReadBack = 0x0000000000800000,
TextureReadBack = 0x0000000001000000,

/// <summary>
/// 2D texture array is supported.
/// </summary>
Texture2dArray = 0x0000000001000000,
Texture2dArray = 0x0000000002000000,

/// <summary>
/// 3D textures are supported.
/// </summary>
Texture3d = 0x0000000002000000,
Texture3d = 0x0000000004000000,

/// <summary>
/// Transparent back buffer supported.
/// </summary>
TransparentBackbuffer = 0x0000000004000000,
TransparentBackbuffer = 0x0000000008000000,

/// <summary>
/// Vertex attribute half-float is supported.
/// </summary>
VertexAttribHalf = 0x0000000008000000,
VertexAttribHalf = 0x0000000010000000,

/// <summary>
/// Vertex attribute 10_10_10_2 is supported.
/// </summary>
VertexAttribUint10 = 0x0000000010000000,
VertexAttribUint10 = 0x0000000020000000,

/// <summary>
/// Rendering with VertexID only is supported.
/// </summary>
VertexId = 0x0000000020000000,
VertexId = 0x0000000040000000,

/// <summary>
/// Viewport layer is available in vertex shader.
/// </summary>
ViewportLayerArray = 0x0000000040000000,
ViewportLayerArray = 0x0000000080000000,

/// <summary>
/// All texture compare modes are supported.
/// </summary>
TextureCompareAll = 0x0000000000180000,
TextureCompareAll = 0x0000000000300000,
}

[AllowDuplicates]
Expand Down
53 changes: 29 additions & 24 deletions bindings/cs/bgfx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,121 +1050,126 @@ public enum CapsFlags : ulong
/// </summary>
FragmentOrdering = 0x0000000000000080,

/// <summary>
/// Fragment barycentric coordinates are available in fragment shader.
/// </summary>
FragmentBarycentric = 0x0000000000000100,

/// <summary>
/// Graphics debugger is present.
/// </summary>
GraphicsDebugger = 0x0000000000000100,
GraphicsDebugger = 0x0000000000000200,

/// <summary>
/// HDR10 rendering is supported.
/// </summary>
Hdr10 = 0x0000000000000200,
Hdr10 = 0x0000000000000400,

/// <summary>
/// HiDPI rendering is supported.
/// </summary>
Hidpi = 0x0000000000000400,
Hidpi = 0x0000000000000800,

/// <summary>
/// Image Read/Write is supported.
/// </summary>
ImageRw = 0x0000000000000800,
ImageRw = 0x0000000000001000,

/// <summary>
/// 32-bit indices are supported.
/// </summary>
Index32 = 0x0000000000001000,
Index32 = 0x0000000000002000,

/// <summary>
/// Instancing is supported.
/// </summary>
Instancing = 0x0000000000002000,
Instancing = 0x0000000000004000,

/// <summary>
/// Occlusion query is supported.
/// </summary>
OcclusionQuery = 0x0000000000004000,
OcclusionQuery = 0x0000000000008000,

/// <summary>
/// PrimitiveID is available in fragment shader.
/// </summary>
PrimitiveId = 0x0000000000008000,
PrimitiveId = 0x0000000000010000,

/// <summary>
/// Renderer is on separate thread.
/// </summary>
RendererMultithreaded = 0x0000000000010000,
RendererMultithreaded = 0x0000000000020000,

/// <summary>
/// Multiple windows are supported.
/// </summary>
SwapChain = 0x0000000000020000,
SwapChain = 0x0000000000040000,

/// <summary>
/// Texture blit is supported.
/// </summary>
TextureBlit = 0x0000000000040000,
TextureBlit = 0x0000000000080000,

/// <summary>
/// Texture compare less equal mode is supported.
/// </summary>
TextureCompareLequal = 0x0000000000080000,
TextureCompareReserved = 0x0000000000100000,
TextureCompareLequal = 0x0000000000100000,
TextureCompareReserved = 0x0000000000200000,

/// <summary>
/// Cubemap texture array is supported.
/// </summary>
TextureCubeArray = 0x0000000000200000,
TextureCubeArray = 0x0000000000400000,

/// <summary>
/// CPU direct access to GPU texture memory.
/// </summary>
TextureDirectAccess = 0x0000000000400000,
TextureDirectAccess = 0x0000000000800000,

/// <summary>
/// Read-back texture is supported.
/// </summary>
TextureReadBack = 0x0000000000800000,
TextureReadBack = 0x0000000001000000,

/// <summary>
/// 2D texture array is supported.
/// </summary>
Texture2dArray = 0x0000000001000000,
Texture2dArray = 0x0000000002000000,

/// <summary>
/// 3D textures are supported.
/// </summary>
Texture3d = 0x0000000002000000,
Texture3d = 0x0000000004000000,

/// <summary>
/// Transparent back buffer supported.
/// </summary>
TransparentBackbuffer = 0x0000000004000000,
TransparentBackbuffer = 0x0000000008000000,

/// <summary>
/// Vertex attribute half-float is supported.
/// </summary>
VertexAttribHalf = 0x0000000008000000,
VertexAttribHalf = 0x0000000010000000,

/// <summary>
/// Vertex attribute 10_10_10_2 is supported.
/// </summary>
VertexAttribUint10 = 0x0000000010000000,
VertexAttribUint10 = 0x0000000020000000,

/// <summary>
/// Rendering with VertexID only is supported.
/// </summary>
VertexId = 0x0000000020000000,
VertexId = 0x0000000040000000,

/// <summary>
/// Viewport layer is available in vertex shader.
/// </summary>
ViewportLayerArray = 0x0000000040000000,
ViewportLayerArray = 0x0000000080000000,

/// <summary>
/// All texture compare modes are supported.
/// </summary>
TextureCompareAll = 0x0000000000180000,
TextureCompareAll = 0x0000000000300000,
}

[Flags]
Expand Down
Loading
Loading