Branimir Karadžić 10 年之前
父節點
當前提交
0283c83c0a

+ 4 - 4
examples/13-stencil/fs_stencil_color_texture.sc

@@ -7,16 +7,16 @@ $input v_texcoord0
 
 #include "../common/common.sh"
 uniform vec4 u_color;
-SAMPLER2D(u_texColor, 0);
+SAMPLER2D(s_texColor, 0);
 
 void main()
 {
-	vec4 tcolor = toLinear(texture2D(u_texColor, v_texcoord0));
+	vec4 color = toLinear(texture2D(s_texColor, v_texcoord0) );
 
-	if (tcolor.x < 0.1) //OK for now.
+	if (color.x < 0.1)
 	{
 		discard;
 	}
 
-	gl_FragColor = toGamma(tcolor + u_color);
+	gl_FragColor = toGamma(color + u_color);
 }

+ 2 - 2
examples/13-stencil/fs_stencil_texture.sc

@@ -6,9 +6,9 @@ $input v_texcoord0
  */
 
 #include "../common/common.sh"
-SAMPLER2D(u_texColor, 0);
+SAMPLER2D(s_texColor, 0);
 
 void main()
 {
-	gl_FragColor = texture2D(u_texColor, v_texcoord0);
+	gl_FragColor = texture2D(s_texColor, v_texcoord0);
 }

+ 4 - 4
examples/13-stencil/stencil.cpp

@@ -149,7 +149,7 @@ static const uint16_t s_planeIndices[] =
 static bool s_flipV = false;
 static uint32_t s_viewMask = 0;
 static uint32_t s_clearMask = 0;
-static bgfx::UniformHandle u_texColor;
+static bgfx::UniformHandle s_texColor;
 
 inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far)
 {
@@ -809,7 +809,7 @@ struct Mesh
 			// Set texture
 			if (bgfx::invalidHandle != _texture.idx)
 			{
-				bgfx::setTexture(0, u_texColor, _texture);
+				bgfx::setTexture(0, s_texColor, _texture);
 			}
 
 			// Apply render state
@@ -864,7 +864,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 	s_uniforms.init();
 	s_uniforms.submitConstUniforms();
 
-	u_texColor = bgfx::createUniform("u_texColor", bgfx::UniformType::Int1);
+	s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1);
 
 	bgfx::ProgramHandle programTextureLightning = loadProgram("vs_stencil_texture_lightning", "fs_stencil_texture_lightning");
 	bgfx::ProgramHandle programColorLightning   = loadProgram("vs_stencil_color_lightning",   "fs_stencil_color_lightning"  );
@@ -1397,7 +1397,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 	bgfx::destroyProgram(programColorBlack);
 	bgfx::destroyProgram(programTexture);
 
-	bgfx::destroyUniform(u_texColor);
+	bgfx::destroyUniform(s_texColor);
 
 	s_uniforms.destroy();
 

二進制
examples/runtime/shaders/dx9/fs_stencil_color_texture.bin


二進制
examples/runtime/shaders/dx9/fs_stencil_texture.bin


二進制
examples/runtime/shaders/gles/fs_stencil_color_texture.bin


二進制
examples/runtime/shaders/gles/fs_stencil_texture.bin


二進制
examples/runtime/shaders/glsl/fs_stencil_color_texture.bin


二進制
examples/runtime/shaders/glsl/fs_stencil_texture.bin