Developer Central
China
  • Home
  • Tools & SDKs
  • Resources
  • Community
  • Partners
  • Support
  • Home
  • Tools & SDKs
  • Resources
  • Community
  • Partners
  • Support
  • Home
  • Tools & SDKs
  • Resources
  • Community
  • Partners
  • Support
  • Home
  • Tools & SDKs
  • Resources
  • Community
  • Partners
  • Support

Tools & SDKs

  • Heterogeneous Computing
    • Aparapi
    • APP Kernel Analyzer
    • APP Profiler
      • Getting Started
        • System Requirements
        • Installation
        • Successful Installation
        • Using The Visual Studio Plugin
        • Using the Command Line Interface
        • Known Issues
        • Support
      • User Guide
        • APP Profiler Session Explorer
        • APP Profiler Session
        • APP Profiler Timeline
        • APP Profiler Summary Pages
        • APP Profiler Code Viewer
        • APP Profiler Kernel Occupancy Viewer
        • APP Profiler Settings
        • APP Profiler Session Parameters
        • Description of Configuration Files
        • APP Profiler Kernel Occupancy
        • CLPerfMarkerAMD Library
    • Accelerated Parallel Processing (APP) SDK
      • Downloads
        • Download Archive
      • System Requirements & Driver Compatibility
      • Documentation
      • Bolt C++ Template Library
        • AMD Bolt Sample Code Contest Official Rules
      • Samples & Demos
      • Compute System Recommendations
      • Intro OpenCL Tutorial
      • Open Source Libraries
      • Support
    • Accelerated Parallel Processing Math Libraries (APPML)
    • CodeAnalyst Performance Analyzer
      • CodeAnalyst for Linux®
      • CodeAnalyst for Windows®
      • PMU Extension Driver
      • CodeAnalyst Archive
    • CodeXL
    • gDEBugger
      • gDEBugger User Guide
        • Getting started with gDEBugger
        • Toolbars
        • Views
        • Dialogs
        • How Do I…
        • FAQ
        • Supported Extensions
        • System Requirements & Installation
        • Legal Information
        • Contact Information
  • CPU Development
    • Advanced Platform Management Link (APML)
    • Core Math Library (ACML)
      • Downloads & Resources
        • Building with ACML
        • How to use ACML with different versions of GCC/GFORTRAN
      • Archive Downloads
      • Product Features
      • Redistribution Agreements
    • LibM
      • ACML_MV
      • LibM Functions
    • Open64 SDK
      • Building with ACML
    • SimNow™ Simulator
    • Tools for DMTF DASH
    • x86 Open64 Compiler Suite
      • Developer Guide
      • Apps & Libraries Built by x86 Open64
      • Inactive Files
  • Graphics Development
    • Display Library (ADL) SDK
    • ATI GPU Services (AGS) Library
    • GPU PerfStudio 2
      • API Trace
      • Frame Debugger
      • Frame Profiler
      • Shader Debugger
      • Shader Editor
      • Previous versions
    • GPU ShaderAnalyzer
    • GPUPerfAPI
    • OpenGL ES SDK
    • Quad-Buffer SDK
    • FirePro SDK
      • FirePro News & Events
    • Radeon™ SDK
  • Open Source
    • GCC & GNU Toolchains
    • OpenCL™ Emulator-Debugger
    • Tapper

Home > Tools & SDKs > Graphics Development > GPU PerfStudio 2 > Shader Editor

Shader Editor

PerfStudio 2.5 introduces shader editing as a new feature to help the developer author and debug shaders from inside a running applications. The user is able to edit DirectX11 HLSL code in the shader Code Window, re-compile it using the original or modified compiler flags, and insert the new shader into the application being debugged. This can significantly speed up the edit/save/app-restart cycle as multiple edits can applied in one debug session without having to restart the app or the debug tools. Re-insertion of the modified shader into the running application allows the user to immediately see the results of their edits and quickly assess their impact. Coupled with the profiler it is possible to measure the performance impact of an edit by doing before and after edit profiles and comparing the results.

Shader Editing Features

  • All DirectX11 shader types are editable including ID3D11ComputeShader, ID3D11VertexShader, ID3D11HullShader, ID3D11DomainShader, ID3D11GeometryShader, and ID3D11PixelShader.
  • The compiler flags used in a shader’s re-compilation can be edited in the Shader Compiler Options window (see below).
  • Edits can be reverted back to the original application shader.
  • PerfStudio keeps a copy of all currently edited shader files in PerfStudio server directory (in a sub-directory named “shaderCache”).
  • Includes are supported if the user copies the dependency files into the shaderCache directory. The user is prompted for this if the dependency files are not located.

Can I edit all shaders?

Currently, shader editing is supported only in DX11 with one shader usage scenario: when the shaders are compiled at runtime using D3DCompile() and the DX11 create shader functions (CreateComputeShader etc.). Please note that D3DCompileFromFile(), D3DCompileFromMemory(), and D3DCompileFromResource() eventually call D3DCompile() and therefor support shader editing.

What about pre-compiled shaders?

PerfStudio 2 does not support the editing of pre-compiled shaders at the moment.

The Shader Editing Operating Model

Currently, shader editing operates on a per shader object basis. How this works is as follows:

  • PerfStudio tracks all function calls to D3DCompile and records the compile arguments including the shader source.
  • PerfStudio also tracks all function calls to create shader functions e.g. CreateComputeShader, CreateVertexShader, CreateHullShader, CreateDomainShader, CreateGeometryShader, CreatePixelShader.
  • The user selects a shader for editing, makes changes, and clicks on the Compile Shader button. A new shader object is created and is mapped to the applications original shader.
  • When the application calls a set shader function (e.g. CSSetShader, VSSetShader, HSSetShader, DSSetShader, GSSetShader, PSSetShader) PerfStudio replaces the application’s shader object pointer with PerfStudio’s currently edited version.

What this means in practice is that if the app re-uses a shader object pointer in multiple draw calls then all instances of that shader will be replaced with the edited version. This is useful if the task is to optimize an application as a single shader edit can be applied to many draw calls in the frame allowing the user to see the overall performance impact in the scene.

When editing a shader you are not editing the original hlsl file, you are editing that shader object itself – so if the HLSL file gets compiled multiple times (for instance to use a different entrypoint or set different preprocessor definitions), then you may need to make the changes several times – once for each of the different shader objects that were originally compiled.

How to Edit a Shader

Shader editing is supported in the Code Window. The image below shows the code window for a DX11 pixel shader. Along the top of the Code Window there is a new button showing a pen and paper in blue. Clicking this button will enable the user to make changes to the shader code in the window.

Enables or disables shader editing

The following image shows the state of the shader code window when the shader is first loaded.

When shader editing is enabled four more buttons become active:

Compiles the current shader and inserts it into the running application
Reverts all edits and switched back to the apps original shader
Opens the Compiler Options window
Save the current shader to disk

The following image shows the state of the shader code window when shader editing is enabled.

It is now possible to change the shader code. Note in the image below the return value from the shader function has been multiplied by 8.0f. After your edits have been made click on the compile shader button to open the shader compiler options.

The following image shows the shader compiler options user interface. Make changes to the compiler options prior to compiling your shader. Please note that some compiler options are mutually exclusive and selecting all options may result in a compile error. Compile errors are reported by a popup dialog on the client.

After selecting the options click the Compile button to compile and insert your modified shader.

Click on the revert button to revert back to the original shader.

GPU PerfStudio Main Page

Feedback or questions?

  • Developer Forum

Get the hcNewsFlash.

Your email address:

No SPAM.
Easy unsubscribe.

HSA is going to rock your world.

Learn more about Heterogeneous System Architecture.

Got Questions?

Ask the Developer Forums Community. They’ve got answers.

Tools & SDKs

  • Heterogeneous Computing
    • Aparapi
    • APP Kernel Analyzer
    • APP Profiler
      • Getting Started
        • System Requirements
        • Installation
        • Successful Installation
        • Using The Visual Studio Plugin
        • Using the Command Line Interface
        • Known Issues
        • Support
      • User Guide
        • APP Profiler Session Explorer
        • APP Profiler Session
        • APP Profiler Timeline
        • APP Profiler Summary Pages
        • APP Profiler Code Viewer
        • APP Profiler Kernel Occupancy Viewer
        • APP Profiler Settings
        • APP Profiler Session Parameters
        • Description of Configuration Files
        • APP Profiler Kernel Occupancy
        • CLPerfMarkerAMD Library
    • Accelerated Parallel Processing (APP) SDK
      • Downloads
        • Download Archive
      • System Requirements & Driver Compatibility
      • Documentation
      • Bolt C++ Template Library
        • AMD Bolt Sample Code Contest Official Rules
      • Samples & Demos
      • Compute System Recommendations
      • Intro OpenCL Tutorial
      • Open Source Libraries
      • Support
    • Accelerated Parallel Processing Math Libraries (APPML)
    • CodeAnalyst Performance Analyzer
      • CodeAnalyst for Linux®
      • CodeAnalyst for Windows®
      • PMU Extension Driver
      • CodeAnalyst Archive
    • CodeXL
    • gDEBugger
      • gDEBugger User Guide
        • Getting started with gDEBugger
        • Toolbars
        • Views
        • Dialogs
        • How Do I…
        • FAQ
        • Supported Extensions
        • System Requirements & Installation
        • Legal Information
        • Contact Information
  • CPU Development
    • Advanced Platform Management Link (APML)
    • Core Math Library (ACML)
      • Downloads & Resources
        • Building with ACML
        • How to use ACML with different versions of GCC/GFORTRAN
      • Archive Downloads
      • Product Features
      • Redistribution Agreements
    • LibM
      • ACML_MV
      • LibM Functions
    • Open64 SDK
      • Building with ACML
    • SimNow™ Simulator
    • Tools for DMTF DASH
    • x86 Open64 Compiler Suite
      • Developer Guide
      • Apps & Libraries Built by x86 Open64
      • Inactive Files
  • Graphics Development
    • Display Library (ADL) SDK
    • ATI GPU Services (AGS) Library
    • GPU PerfStudio 2
      • API Trace
      • Frame Debugger
      • Frame Profiler
      • Shader Debugger
      • Shader Editor
      • Previous versions
    • GPU ShaderAnalyzer
    • GPUPerfAPI
    • OpenGL ES SDK
    • Quad-Buffer SDK
    • FirePro SDK
      • FirePro News & Events
    • Radeon™ SDK
  • Open Source
    • GCC & GNU Toolchains
    • OpenCL™ Emulator-Debugger
    • Tapper

©2013 Advanced Micro Devices, Inc. OpenCL and the OpenCL logo are trademarks of Apple, Inc., used with permission by Khronos.

  • Contact Us
  • |
  • Careers
  • |
  • Site Map
  • |
  • Terms and Conditions
  • |
  • Privacy
  • |
  • Trademarks