Browse Source

Update test programs and filters

The test program and test filter wasn't working properly because the ID
for it had actually changed.

The test programs also weren't updated for the new main render callbacks
which must be used when making a program.
jp9000 11 years ago
parent
commit
dbd8b2167d
3 changed files with 37 additions and 5 deletions
  1. 3 3
      build/data/obs-plugins/test-input/test.effect
  2. 18 1
      test/osx/test.mm
  3. 16 1
      test/win/test.cpp

+ 3 - 3
build/data/obs-plugins/test-input/test.effect

@@ -1,5 +1,5 @@
 uniform float4x4 ViewProj;
-uniform texture2d diffuse;
+uniform texture2d image;
 
 uniform float4 color = {0.0, 1.0, 0.0, 1.0};
 
@@ -24,10 +24,10 @@ VertexInOut VShader(VertexInOut vert_in)
 
 float4 PShader(VertexInOut fragment_in) : TARGET
 {
-	return diffuse.Sample(texSampler, fragment_in.uv) * color;
+	return image.Sample(texSampler, fragment_in.uv) * color;
 }
 
-technique DrawRGB
+technique Draw
 {
 	pass
 	{

+ 18 - 1
test/osx/test.mm

@@ -133,6 +133,19 @@ static NSWindow *CreateTestWindow()
 	return win;
 }
 
+/* --------------------------------------------------- */
+
+static void RenderWindow(void *data, uint32_t cx, uint32_t cy)
+{
+	obs_render_main_view();
+
+	UNUSED_PARAMETER(data);
+	UNUSED_PARAMETER(cx);
+	UNUSED_PARAMETER(cy);
+}
+
+/* --------------------------------------------------- */
+
 static void test()
 {
 	try {
@@ -157,7 +170,7 @@ static void test()
 		/* ------------------------------------------------------ */
 		/* create filter */
 		SourceContext filter{obs_source_create(OBS_SOURCE_TYPE_FILTER,
-				"test", "a test filter", NULL)};
+				"test_filter", "a test filter", NULL)};
 		if (!filter)
 			throw "Couldn't create test filter";
 		obs_source_filter_add(source, filter);
@@ -174,6 +187,10 @@ static void test()
 		/* set the scene as the primary draw source and go */
 		obs_set_output_source(0, obs_scene_getsource(scene));
 
+		/* ------------------------------------------------------ */
+		/* set the main output render callback */
+		obs_add_draw_callback(RenderWindow, nullptr);
+
 		[NSApp run];
 
 		obs_set_output_source(0, NULL);

+ 16 - 1
test/win/test.cpp

@@ -120,6 +120,17 @@ static HWND CreateTestWindow(HINSTANCE instance)
 
 /* --------------------------------------------------- */
 
+static void RenderWindow(void *data, uint32_t cx, uint32_t cy)
+{
+	obs_render_main_view();
+
+	UNUSED_PARAMETER(data);
+	UNUSED_PARAMETER(cx);
+	UNUSED_PARAMETER(cy);
+}
+
+/* --------------------------------------------------- */
+
 int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine,
 		int numCmd)
 {
@@ -150,7 +161,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine,
 		/* ------------------------------------------------------ */
 		/* create filter */
 		SourceContext filter = obs_source_create(OBS_SOURCE_TYPE_FILTER,
-				"test", "a nice little green filter", NULL);
+				"test_filter", "a nice green filter", NULL);
 		if (!filter)
 			throw "Couldn't create test filter";
 		obs_source_filter_add(source, filter);
@@ -167,6 +178,10 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine,
 		/* set the scene as the primary draw source and go */
 		obs_set_output_source(0, source);
 
+		/* ------------------------------------------------------ */
+		/* set the main output render callback */
+		obs_add_draw_callback(RenderWindow, nullptr);
+
 		MSG msg;
 		while (GetMessage(&msg, NULL, 0, 0)) {
 			TranslateMessage(&msg);