diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-03-20 17:14:12 -0400 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-03-20 14:14:12 -0700 |
| commit | 98b8e0c809ceab84cee25389e54f3f37d220d95e (patch) | |
| tree | 7df9954689a6a727c39997c944c86003ce9018c0 /tools/render-test/render-gl.cpp | |
| parent | 72562144254145612c68534c6b7457764c28acf5 (diff) | |
SlangResult and small bug/typos fixes (#448)
* Fixed some small typos in api-users-guide.md
* Fix some small typos in slang-test/main.cpp, render-test/render-d3d11.cpp
* Remove exit() calls from test code. Added Slang::Result, which works in the same way as COM HRESULT.
* FIx bug introduced when moving to Slang::Result - handling E_INVALIDARG on Dx11.
* Fix the testing of feature levels on Dx11 renderer.
* First attempt at README.md for slang-test.
* Tidied up the slang-test README.md file.
* Fix some small typos in tools/slang-test/main.cpp
* Fix spaces -> tabs problems.
Fix some small types.
Diffstat (limited to 'tools/render-test/render-gl.cpp')
| -rw-r--r-- | tools/render-test/render-gl.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/render-test/render-gl.cpp b/tools/render-test/render-gl.cpp index 99b61c03c..c2195f4f0 100644 --- a/tools/render-test/render-gl.cpp +++ b/tools/render-test/render-gl.cpp @@ -86,7 +86,7 @@ public: // Renderer interface - virtual void initialize(void* inWindowHandle) override + virtual SlangResult initialize(void* inWindowHandle) override { auto windowHandle = (HWND) inWindowHandle; @@ -127,6 +127,8 @@ public: glEnable(GL_DEBUG_OUTPUT); glDebugMessageCallback(staticDebugCallback, this); } + + return SLANG_OK; } void debugCallback( @@ -181,7 +183,7 @@ public: SwapBuffers(deviceContext); } - virtual void captureScreenShot(char const* outputPath) override + virtual SlangResult captureScreenShot(char const* outputPath) override { int width = gWindowWidth; int height = gWindowHeight; @@ -189,7 +191,7 @@ public: int components = 4; int rowStride = width*components; - GLubyte* buffer = (GLubyte*)malloc(components * width * height); + GLubyte* buffer = (GLubyte*)::malloc(components * width * height); glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); @@ -222,12 +224,16 @@ public: components, buffer, rowStride); - if( !stbResult ) + + ::free(buffer); + + if( !stbResult ) { assert(!"unexpected"); + return SLANG_FAIL; } - delete(buffer); + return SLANG_OK; } virtual ShaderCompiler* getShaderCompiler() override @@ -483,7 +489,7 @@ public: int maxSize = 0; glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &maxSize); - auto infoBuffer = (char*) malloc(maxSize); + auto infoBuffer = (char*)::malloc(maxSize); int infoSize = 0; glGetProgramInfoLog(programID, maxSize, &infoSize, infoBuffer); @@ -493,8 +499,10 @@ public: OutputDebugStringA(infoBuffer); } + ::free(infoBuffer); + glDeleteProgram(programID); - return 0; + return nullptr; } return (ShaderProgram*) (uintptr_t) programID; |
