Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h

Issue 2503453005: Patch the results of queries that return object IDs in the passthrough cmd decoder. (Closed)
Patch Set: Helperize GetClientID Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
index 6c3a5bdc37440d15795ece11cbfa8e58cbfb17ad..ba64f064f9acb416f8f6f40e475bcf5985458861 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
@@ -239,6 +239,45 @@ class GLES2DecoderPassthroughImpl : public GLES2Decoder {
scoped_refptr<ShaderTranslatorInterface> GetTranslator(GLenum type) override;
private:
+ void* GetScratchMemory(size_t size);
+
+ template <typename T>
+ T* GetTypedScratchMemory(size_t count) {
+ return reinterpret_cast<T*>(GetScratchMemory(count * sizeof(T)));
+ }
+
+ template <typename T, typename GLGetFunction>
+ error::Error GetNumericHelper(GLenum pname,
+ GLsizei bufsize,
+ GLsizei* length,
+ T* params,
+ GLGetFunction get_call) {
+ // Get a scratch buffer to hold the result of the query
+ T* scratch_params = GetTypedScratchMemory<T>(bufsize);
+ get_call(pname, bufsize, length, scratch_params);
+
+ // Update the results of the query, if needed
+ error::Error error = PatchGetNumericResults(pname, *length, scratch_params);
+ if (error != error::kNoError) {
+ *length = 0;
+ return error;
+ }
+
+ // Copy into the destination
+ DCHECK(*length < bufsize);
+ std::copy(scratch_params, scratch_params + *length, params);
+
+ return error::kNoError;
+ }
+
+ template <typename T>
+ error::Error PatchGetNumericResults(GLenum pname, GLsizei length, T* params);
+ error::Error PatchGetFramebufferAttachmentParameter(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei length,
+ GLint* params);
+
void BuildExtensionsString();
int commands_to_process_;
@@ -306,6 +345,9 @@ class GLES2DecoderPassthroughImpl : public GLES2Decoder {
std::vector<std::string> emulated_extensions_;
std::string extension_string_;
+ // Cache of scratch memory
+ std::vector<uint8_t> scratch_memory_;
+
// Include the prototypes of all the doer functions from a separate header to
// keep this file clean.
#include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototypes.h"
« no previous file with comments | « gpu/command_buffer/service/client_service_map.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698