# US 2016/0364830 A1 · Asynchronous translation of computer program resources in graphics processing unit emulation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2016/0364830 A1
- Document ID: US20160364830A1
- Status: Published application
- Kind: A1
- Application number: 14/739,988
- Filed: 2015-06-15
- Published: 2016-12-15
- Earliest claimed: 2015-06-15
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Ke Deng; Eric Heutchy
- Web page: https://patentgrep.com/patent/US20160364830A1

## CPC

- G06T 1/20: Processor architectures; Processor configuration, e.g. pipelining
- G06F 8/41: Compilation
- G06F 8/53: Decompilation; Disassembly
- G06F 9/44: Arrangements for executing specific programs
- G06F 9/45504: {Abstract machines for program code execution, e.g. Java virtual machine [JVM], interpreters or emulators}
- G06F 9/4552: {Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM}
- G06T 15/005: {General purpose rendering architectures}
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Resource processing during run time can be performed asynchronously from emulation of an application by a central processing unit. For example, an emulator can include a main processing thread that performs emulation processes. In response to encountering a shader, or other resource, to be processed, the emulator can invoke a separate asynchronous thread to perform such processing. Processed resources, such as translated shaders and generated textures, can be stored in a cache. In response to a command that uses a resource, such as a draw command that invokes a shader or other resource, the emulator can use the processed resource in the cache. If the processed resource is not in the cache, the emulator can skip processing the command that uses the resource. If processed resources can be obtained from other sources and loaded in the cache, processing of resources by the emulator can be eliminated.

## Claims

### Claim 1

A computer configured to emulate execution of a graphics application for a first graphics processing unit, the computer comprising:
a second graphics processing unit;
storage;
one or more central processing units configured to execute an emulator application, the emulator application configuring the computer to:
convert first commands for the first graphics processing unit, generated by execution of the graphics application by the emulator application, to second commands that instruct the second graphics processing unit;
manage a resource cache including translated resources for the second graphics processing unit for a plurality of resources; and
in response to a first command being a draw command using a resource, and a determination that a translated resource for the second graphics processing unit corresponding to the resource used by the draw command is not in the resource cache, skip rendering a second command corresponding to the draw command and continue processing by the emulator application.

### Claim 2 (depends on 1)

The computer of claim 1, wherein the resource comprises a shader and the resource cache comprises a shader cache.

### Claim 3 (depends on 2)

The computer of claim 2, wherein the computer is further configured by the emulator application to:
detect a first command providing an indication of a shader;
determine whether the executable code for the second graphics processing unit for the shader is available in the shader cache;
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, translate the shader indicated in the first command.

### Claim 4 (depends on 3)

The computer of claim 3, wherein the emulator application, when executed by the computer, is configured to implement a first thread to convert first commands to second commands and at least one second thread, asynchronous to the first thread, to translate shaders.

### Claim 5 (depends on 3)

The computer of claim 3, wherein the shader cache comprises a memory configured to store executable code for the second graphics processing unit and a cache index configured to store, for each shader of the plurality of shaders, a location in the memory of the executable code for the shader.

### Claim 6 (depends on 5)

The computer of claim 5, wherein the computer is further configured by the emulator application to:
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, add an entry in the cache index for the shader, the entry indicating that the executable code for the second graphics processing unit for the shader is not in the memory.

### Claim 7 (depends on 6)

The computer of claim 6, wherein the computer is further configured by the emulator application to:
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, add an indication of the shader to a queue for translation.

### Claim 8 (depends on 7)

The computer of claim 7, wherein the computer is further configured by the emulator application to:
in response to translation of the shader to provide the executable code for the second graphics processing unit for the shader, update the entry in the cache index for the shader to provide an indication of the location in the memory of the executable code for the second graphics processing unit for the shader.

### Claim 9

A computer-implemented process for emulating execution of a graphics application for a first graphics processing unit on a computer comprising a second graphics processing unit, the computer-implemented process comprising:
converting first commands for the first graphics processing unit, in response to execution of the graphics application using an emulator application, to second commands that instruct the second graphics processing unit;
accessing a resource cache including translated resources for the second graphics processing unit for a plurality of resources; and
in response to a first command being a draw command using a resource, and a determination that a translated resource for the second graphics processing unit corresponding to the resource used by the draw command is not in the resource cache, skipping rendering a second command corresponding to the draw command and continuing processing by the emulator application.

### Claim 10 (depends on 9)

The computer-implemented process of claim 9, wherein the resource comprises a shader and the resource cache comprises a shader cache.

### Claim 11 (depends on 9)

The computer-implemented process of claim 9, further comprising:
detecting a first command providing an indication of a shader;
determining whether the executable code for the second graphics processing unit for the shader is available in the shader cache; and
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, translating the shader indicated in the first command.

### Claim 12 (depends on 11)

The computer-implemented process of claim 11, wherein converting first commands to second commands is performed by a first thread executed on the computer and translating a shader is performed by a second thread, asynchronous to the first thread.

### Claim 13 (depends on 11)

The computer-implemented process of claim 11, wherein the shader cache comprises a memory configured to store executable code for the second graphics processing unit and a cache index configured to store, for each shader of the plurality of shaders, a location in the memory of the executable code for the shader.

### Claim 14 (depends on 13)

The computer-implemented process of claim 13, further comprising:
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, adding an entry in the cache index for the shader, the entry indicating that the executable code for the second graphics processing unit for the shader is not in the memory.

### Claim 15 (depends on 14)

The computer-implemented process of claim 14, further comprising:
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, adding an indication of the shader to a queue for translation.

### Claim 16 (depends on 15)

The computer-implemented process of claim 15, further comprising:
in response to translation of the shader to provide the executable code for the second graphics processing unit for the shader is not in the shader cache, updating the entry in the cache index for the shader to provide an indication of the location in the memory of the executable code for the second graphics processing unit for the shader.

### Claim 17

A computer program product, comprising:
a computer storage medium configured to store computer program instructions of an emulator application, for emulating execution of a graphics application for a first graphics processing unit on a computer comprising a second graphics processing unit, storage, and one or more central processing units configured to execute the emulator application, the emulator application configuring the computer to:
convert first commands for the first graphics processing unit, generated by execution of the graphics application by the emulator application, to second commands that instruct the second graphics processing unit;
manage a resource cache including translated resources for the second graphics processing unit for a plurality of resources; and
in response to a first command being a draw command using a resource, and a determination that a translated resource for the second graphics processing unit corresponding to the resource used by the draw command is not in the resource cache, skip rendering a second command corresponding to the draw command and continue processing by the emulator application.

### Claim 18 (depends on 17)

The computer program product of claim 17 wherein the resource comprises a shader and the resource cache comprises a shader cache.

### Claim 19 (depends on 18)

The computer program product of claim 18, wherein the emulator application further configures the computer to:
detect a first command providing an indication of a shader;
determine whether the executable code for the second graphics processing unit for the shader is available in the shader cache;
in response to a determination that the executable code for the second graphics processing unit for the shader is not in the shader cache, translate the shader indicated in the first command.

### Claim 20 (depends on 19)

The computer program product of claim 19, wherein the emulator application further configures the computer to implement a first thread to convert first commands to second commands and at least one second thread, asynchronous to the first thread, to translate shaders.
