-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rhi/mtl] update OSX metal RHI with new ShaderCompiler
[tools/shc] add docs for shader compiler [vk] * update vulkan rhi, still has memory leaks [vk] fix memory leaks on vulkan command context update third party with ci prebuilt init OpenGL RHI fix compiler warnings in "Core" [shc] update shader compiler * add serializable shader fundamentals #39 * refactor shader compiler interface [core/string] implement String * add sprintf function [ktl] fix DynArray with compiler typetraits * move dynarray test case to unit test proj * update samples Tomicyo committed 25 days ago [render] initialize font renderer #38 [rhi] update vulkan rhi * wrap raw pointer with ref count based "SharedPtr" [rhi] add typedef on RHI object's ptr [ktl] update SharedPtr [core] update SharedPtr test case [unittest] add bundle test case [core|memory] add allocator [rhi/vk] minor refactor [core] add SharedPtr [tools/dcc] add camera export for maya plugin * minor refactor on maya plugin [project] fix typo error on RHI/Vulkan/CMakeLists.txt [unittest] refactor unit tests * mayadcc: fix export error on macos [core] refactor for ENV_VARS access [mac] add bundle package script * remove "Script" plugin * fix android build [sh] add shader translator * add circleci support * update ci config * [mac|ci] add 3rdparty dependency * fix mac build [render] update [docs] add readmes TsinStudio committed on 3 Dec 2016 [sample] TexturedCube sample worked #13 [android] fix crash on textured cube [android] update RendererView TsinStudio committed with Tomicyo on 22 Nov 2016 [rhi/vk] add ShaderResourceView TsinStudio committed on 22 Nov 2016 [kawalog] implemented FileLogger and WebSocketLogger #37 [tools] add WebConsole web page #37 [log] add KawaLogModule #37 [rhi] texture upload implemented #13 * reduce parameters of resource transition interface * refactor on texture creation [core] add encoding utils (base64,sha1) * add WebSocket. * an 8K-buffered websocket implemented and applied in VulkanRHI [rhi] vkrhi texture sampler creation implemented. #13 [rhi] update texture copy impl [android] add cube sample build [project] update cmake file on android alexqzhou committed with TsinStudio on 7 Nov 2016 [android,core,asset] fix crash on spir_cross caused by invalid use of AAsset_getBuffer #35 [ut/cube & rhi/vk] update texture creation step * copy buffer to image/TODO * create image with data directly/TODO [vk] Decouple Core and RHI #33 [rhi&shrc] #28 minor refactor [android] fix crash caused by dead-lock occurred in native-activity #30 [android] use gnustil_shared instead #34 [rhi/vk] minor fix * vkswapchain clip param typo fix [unittest] add unit test for shader compiler Update CMakeLists.txt Update DXCompiler.cc [unittest] add unittest for android's VulkanRHI [shrc] GLSLCompiler updated [unittest/shrc] add vulkan-hlsl test case [core] finish module load issues [script] add v8 module support [core] move os facilities to Os.h [unittest] add textured cube [shrc] add bytecode-reflect function [shc] fix bug on android stl by replace stl with ktl [android] update SampleRHI [rhi] modulized vulkan rhi [rhi/vk] add subresource declaration [android] sample RHI worked on nexus 6p [rhi] need to implement gpu memory gabbage collection [vkrhi] fix inconsistent DSFormat with DepthImage and Attachment clean up add android appglue [android] add gradle-plugin:2.2 build support with cmake update sample triangle screenshot [android] add kaleido3d's native activity and RHISurfaceView [android] fix screen distortion on VkTriangleSample [android] minor refactor [android] fix gradle build [ktl] add more interface for DynArray [unittest/cube] update texture upload step [rhi] update rhi::ResourceState enums [android] add "CPUMonitorView" [android] avoid crash by assetmanager [project] update build.gradle Tomicyo committed with TsinStudio on 8 Sep 2016
- Loading branch information
0 parents
commit f81e444
Showing
521 changed files
with
85,101 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
environment: | ||
matrix: | ||
- TOOLSET: vs2015 | ||
|
||
build_script: make.cmd nopause |
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,63 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
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,74 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
Binary | ||
Lib | ||
**/build/** | ||
Source/ThirdParty_Prebuilt/** | ||
Build* | ||
!**/build.gradle | ||
!/Project/android/gradle/** | ||
Bin/* | ||
Source/local.properties | ||
local.properties | ||
gradle.properties | ||
|
||
# Visual Studio files | ||
debug | ||
release | ||
VisualStudio* | ||
*.sdf | ||
Makefile* | ||
*.user | ||
*.pdb | ||
*.ilk | ||
*.exp | ||
*.ini | ||
BinTmp | ||
*.iml | ||
**/.idea/** | ||
DedicatedServer/protocol/cpp/ | ||
**/.gradle/** | ||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
CMakeFiles | ||
CMakeFiles* | ||
Debug | ||
*.dir | ||
Win32 | ||
x64 | ||
*.suo | ||
vs20* | ||
|
||
*.html | ||
|
||
#ignored dirs | ||
Data/*.html | ||
/Data/Objects/* | ||
Document/html/* | ||
!ThirdParty/Dispatcher/* | ||
ThirdParty/ | ||
!ThirdParty/glew/* | ||
Shader/GLSL/* | ||
Shader/Metal/* | ||
Source/.idea/* | ||
Lib* | ||
Lib/* | ||
DedicatedServer/src/Server | ||
|
||
Swift/kaleido3d.xcodeproj/project.xcworkspace/xcuserdata/ | ||
Swift/kaleido3d.xcodeproj/xcuserdata/ | ||
.DS_Store | ||
xcshareddata | ||
/Project/xcode4 | ||
/Project/android/local.properties | ||
/Project/android/gradle.properties | ||
/Project/android/Triangle/src/main/assets/* |
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,10 @@ | ||
language: objective-c | ||
|
||
osx_image: xcode8.1 | ||
|
||
install: | ||
- brew install cmake | ||
- git clone https://github.com/Tomicyo/kaleido3d_dep_prebuilt.git -b macos_debug Source/ThirdParty_Prebuilt/MacOS_Debug | ||
|
||
script: | ||
- chmod 777 make_macos.sh && ./make_macos.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
shader SplashVS( int vec3 pos:0, out vec2 texcoord ) | ||
{ | ||
texcoord = pos.xy; | ||
gl_Position = vec4(pos, 1.0); | ||
} | ||
|
||
layout(binding = 0) uniform sampler2D splashTex; | ||
shader SplashPS( in vec2 texcoord, out vec4 FragColor:0 ) | ||
{ | ||
FragColor = texture(splashTex, texcoord); | ||
} | ||
|
||
program Splash | ||
{ | ||
vs(430) = SplashVS(); | ||
fs(430) = SplashPS(); | ||
}; |
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,86 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// Constant Buffers | ||
///////////////////////////////////////////////////////////////////////////// | ||
cbuffer cbPerObjectVS : register( b0 ) // Model constants | ||
{ | ||
matrix WorldViewProjection : packoffset( c0 ); | ||
matrix World : packoffset( c4 ); | ||
} | ||
|
||
cbuffer cbDirLightPS : register( b1 ) // Ambient light constants | ||
{ | ||
float3 AmbientDown : packoffset( c0 ); | ||
float3 AmbientRange : packoffset( c1 ); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// Diffuse texture and linear sampler | ||
///////////////////////////////////////////////////////////////////////////// | ||
Texture2D DiffuseTexture : register( t0 ); | ||
SamplerState LinearSampler : register( s0 ); | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// shader input/output structure | ||
///////////////////////////////////////////////////////////////////////////// | ||
struct VS_INPUT | ||
{ | ||
float4 Position : POSITION; // vertex position | ||
float3 Normal : NORMAL; // vertex normal | ||
float2 UV : TEXCOORD0; // vertex texture coords | ||
}; | ||
|
||
struct VS_OUTPUT | ||
{ | ||
float4 Position : SV_POSITION; // vertex position | ||
float2 UV : TEXCOORD0; // vertex texture coords | ||
float3 Normal : TEXCOORD1; // vertex normal | ||
}; | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// Vertex shader | ||
///////////////////////////////////////////////////////////////////////////// | ||
VS_OUTPUT RenderSceneVS( VS_INPUT input ) | ||
{ | ||
VS_OUTPUT Output; | ||
float3 vNormalWorldSpace; | ||
|
||
// Transform the position from object space to homogeneous projection space | ||
Output.Position = mul( input.Position, WorldViewProjection ); | ||
|
||
// Just copy the texture coordinate through | ||
Output.UV = input.UV; | ||
|
||
Output.Normal = mul(input.Normal, (float3x3)World); | ||
|
||
return Output; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// Pixel shaders | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
// Ambient calculation helper function | ||
float3 CalcAmbient(float3 normal, float3 color) | ||
{ | ||
// Convert from [-1, 1] to [0, 1] | ||
float up = normal.y * 0.5 + 0.5; | ||
|
||
// Calculate the ambient value | ||
float3 ambient = AmbientDown + up * AmbientRange; | ||
|
||
// Apply the ambient value to the color | ||
return ambient * color; | ||
} | ||
|
||
float4 AmbientLightPS( VS_OUTPUT In ) : SV_TARGET0 | ||
{ | ||
// Sample the texture and convert to linear space | ||
float3 DiffuseColor = DiffuseTexture.Sample( LinearSampler, In.UV ).rgb; | ||
DiffuseColor *= DiffuseColor; | ||
|
||
// Calculate the ambient color | ||
float3 AmbientColor = CalcAmbient(In.Normal, DiffuseColor); | ||
|
||
// Return the ambient color | ||
return float4(AmbientColor, 1.0); | ||
} |
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,38 @@ | ||
[ | ||
{ | ||
"Table": "Graphics_PS_SRVs", | ||
"ShaderVisibility": 5, | ||
"DescriptorRangeType": 0, | ||
"Count": 16, | ||
"BaseShaderReg": 0 | ||
}, | ||
{ | ||
"Table": "Graphics_PS_CBVs", | ||
"ShaderVisibility": 5, | ||
"DescriptorRangeType": 2, | ||
"Count": 8, | ||
"BaseShaderReg": 0 | ||
}, | ||
{ | ||
"Table": "Graphics_PS_Samplers", | ||
"ShaderVisibility": 5, | ||
"DescriptorRangeType": 3, | ||
"Count": 16, | ||
"BaseShaderReg": 0 | ||
}, | ||
|
||
{ | ||
"Table": "Graphics_VS_SRVs", | ||
"ShaderVisibility": 1, | ||
"DescriptorRangeType": 0, | ||
"Count": 16, | ||
"BaseShaderReg": 0 | ||
}, | ||
{ | ||
"Table": "Graphics_VS_CBVs", | ||
"ShaderVisibility": 1, | ||
"DescriptorRangeType": 2, | ||
"Count": 8, | ||
"BaseShaderReg": 0 | ||
} | ||
] |
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,57 @@ | ||
// | ||
// Shaders.metal | ||
// metal | ||
// | ||
// Created by QinZhou on 2016/12/18. | ||
// Copyright (c) 2016年 TsinStudio. All rights reserved. | ||
// | ||
|
||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
typedef struct __attribute__((__aligned__(256))) | ||
{ | ||
matrix_float4x4 modelview_projection_matrix; | ||
matrix_float4x4 normal_matrix; | ||
} uniforms_t; | ||
|
||
using namespace metal; | ||
|
||
// Variables in constant address space | ||
constant float3 light_position = float3(0.0, 1.0, -1.0); | ||
constant float4 ambient_color = float4(0.18, 0.24, 0.8, 1.0); | ||
constant float4 diffuse_color = float4(0.4, 0.4, 1.0, 1.0); | ||
|
||
typedef struct | ||
{ | ||
float3 position [[attribute(0)]]; | ||
float3 normal [[attribute(1)]]; | ||
} vertex_t; | ||
|
||
typedef struct { | ||
float4 position [[position]]; | ||
half4 color; | ||
} ColorInOut; | ||
|
||
// Vertex shader function | ||
vertex ColorInOut lighting_vertex(vertex_t vertex_array [[stage_in]], | ||
constant uniforms_t& uniforms [[ buffer(1) ]]) | ||
{ | ||
ColorInOut out; | ||
|
||
float4 in_position = float4(vertex_array.position, 1.0); | ||
out.position = uniforms.modelview_projection_matrix * in_position; | ||
|
||
float4 eye_normal = normalize(uniforms.normal_matrix * float4(vertex_array.normal, 0.0)); | ||
float n_dot_l = dot(eye_normal.rgb, normalize(light_position)); | ||
n_dot_l = fmax(0.0, n_dot_l); | ||
|
||
out.color = half4(ambient_color + diffuse_color * n_dot_l); | ||
return out; | ||
} | ||
|
||
// Fragment shader function | ||
fragment half4 lighting_fragment(ColorInOut in [[stage_in]]) | ||
{ | ||
return in.color; | ||
} |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.