Add ApplyCustomFragmentPrefix 12/260412/3
authorseungho <sbsh.baek@samsung.com>
Thu, 24 Jun 2021 07:14:29 +0000 (16:14 +0900)
committerseungho <sbsh.baek@samsung.com>
Mon, 28 Jun 2021 09:57:35 +0000 (18:57 +0900)
 - Apply suitable prefix for the native image fragment shader

Change-Id: I84b96f34060a3984b62f0250d6045a6a731182a3
Signed-off-by: seungho <sbsh.baek@samsung.com>
examples/native-image-source/native-image-source-example.cpp

index c1d0f01..90576ea 100644 (file)
@@ -43,28 +43,11 @@ const std::string CAPTURE_FILENAME = DEMO_DATA_PUBLIC_RW_DIR "native-image-captu
  */
 Shader CreateShader(NativeImageInterface& nativeImage)
 {
-  static const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
-
   std::string fragmentShader;
 
   //Get custom fragment shader prefix
-  const char* fragmentPrefix = nativeImage.GetCustomFragmentPrefix();
-  if(fragmentPrefix)
-  {
-    fragmentShader = fragmentPrefix;
-    fragmentShader += SHADER_NATIVE_IMAGE_SOURCE_TEXTURE_FRAG.data();
-  }
-  else
-  {
-    fragmentShader = SHADER_NATIVE_IMAGE_SOURCE_TEXTURE_FRAG.data();
-  }
-
-  //Get custom sampler type name
-  const char* customSamplerTypename = nativeImage.GetCustomSamplerTypename();
-  if(customSamplerTypename)
-  {
-    fragmentShader.replace(fragmentShader.find(DEFAULT_SAMPLER_TYPENAME), strlen(DEFAULT_SAMPLER_TYPENAME), customSamplerTypename);
-  }
+  fragmentShader = SHADER_NATIVE_IMAGE_SOURCE_TEXTURE_FRAG.data();
+  nativeImage.ApplyNativeFragmentShader(fragmentShader);
 
   return Shader::New(SHADER_NATIVE_IMAGE_SOURCE_TEXTURE_VERT, fragmentShader);
 }