-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Metal] Started implementing QueryHeap interface in Metal backend.
- Started with MTQueryHeap implementation; Currently only for occlusion queries implemented as wrapper of MTLBuffer for visibility results. - Replaced ResourceHeap in Queries example with single resource. - Also exclude new compressed texture formats ASTC/ETC2 from Mac for now (they are available in macOS 11+).
- Loading branch information
1 parent
daa7814
commit 8a2e866
Showing
16 changed files
with
299 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Metal shader for queries example | ||
|
||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
// VERTEX SHADER | ||
|
||
struct InputVS | ||
{ | ||
float3 position [[attribute(0)]]; | ||
float3 normal [[attribute(1)]]; | ||
}; | ||
|
||
struct OutputVS | ||
{ | ||
float4 position [[position]]; | ||
float3 normal; | ||
}; | ||
|
||
struct Scene | ||
{ | ||
float4x4 wvpMatrix; | ||
float4x4 wMatrix; | ||
float4 color; | ||
}; | ||
|
||
vertex OutputVS VS( | ||
InputVS inp [[stage_in]], | ||
constant Scene& scene [[buffer(1)]]) | ||
{ | ||
OutputVS outp; | ||
outp.position = scene.wvpMatrix * float4(inp.position, 1); | ||
outp.normal = (scene.wMatrix * float4(inp.normal, 0)).xyz; | ||
return outp; | ||
} | ||
|
||
|
||
// PIXEL SHADER | ||
|
||
fragment float4 PS( | ||
OutputVS inp [[stage_in]], | ||
constant Scene& scene [[buffer(1)]]) | ||
{ | ||
float3 lightDir = float3(0, 0, -1); | ||
float NdotL = dot(lightDir, normalize(inp.normal)); | ||
float intensity = max(0.2, NdotL); | ||
return scene.color * float4((float3)intensity, 1); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.