Misc tweaks.

This commit is contained in:
Ben Vanik
2015-01-04 04:59:26 -08:00
parent 34fb0e4a8a
commit eda38a7428
6 changed files with 14 additions and 5 deletions

View File

@@ -47,7 +47,7 @@ bool CircularBuffer::Initialize() {
if (FLAGS_vendor_gl_extensions && GLEW_NV_shader_buffer_load) {
// To use this bindlessly we must make it resident.
glMakeNamedBufferResidentNV(buffer_, GL_WRITE_ONLY);
glMakeNamedBufferResidentNV(buffer_, GL_READ_ONLY);
glGetNamedBufferParameterui64vNV(buffer_, GL_BUFFER_GPU_ADDRESS_NV,
&gpu_base_);
}
@@ -90,11 +90,16 @@ CircularBuffer::Allocation CircularBuffer::Acquire(size_t length) {
return allocation;
}
void CircularBuffer::Discard(Allocation allocation) {
write_head_ -= allocation.aligned_length;
}
void CircularBuffer::Commit(Allocation allocation) {
uintptr_t start = allocation.gpu_ptr - gpu_base_;
uintptr_t end = start + allocation.aligned_length;
dirty_start_ = std::min(dirty_start_, start);
dirty_end_ = std::max(dirty_end_, end);
assert_true(dirty_end_ <= capacity_);
}
void CircularBuffer::Flush() {

View File

@@ -38,6 +38,7 @@ class CircularBuffer {
bool CanAcquire(size_t length);
Allocation Acquire(size_t length);
void Discard(Allocation allocation);
void Commit(Allocation allocation);
void Flush();

View File

@@ -163,7 +163,6 @@ void CommandProcessor::WorkerMain() {
}
bool CommandProcessor::SetupGL() {
glViewport(0, 0, 1280, 720);
// Circular buffer holding scratch vertex/index data.
if (!scratch_buffer_.Initialize()) {
@@ -1580,6 +1579,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateRenderTargets(
// TODO(benvanik): can we do this all named?
// TODO(benvanik): do we want this on READ too?
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, cached_framebuffer->framebuffer);
glViewport(0, 0, 1280, 720);
}
return UpdateStatus::kMismatch;

View File

@@ -936,7 +936,8 @@ bool GL4ShaderTranslator::TranslateALU_RECIP_IEEE(const instr_alu_t& alu) {
return true;
}
bool GL4ShaderTranslator::TranslateALU_RECIPSQ_IEEE(const ucode::instr_alu_t& alu) {
bool GL4ShaderTranslator::TranslateALU_RECIPSQ_IEEE(
const ucode::instr_alu_t& alu) {
AppendDestReg(alu.scalar_dest, alu.scalar_write_mask, alu.export_data);
Append(" = ");
if (alu.scalar_clamp) {
@@ -1298,8 +1299,7 @@ bool GL4ShaderTranslator::TranslateALU(const instr_alu_t* alu, int sync) {
} else {
Append("\t \tOP(%u)\t", alu->scalar_opc);
}
PrintDstReg(alu->scalar_dest, alu->scalar_write_mask,
alu->export_data);
PrintDstReg(alu->scalar_dest, alu->scalar_write_mask, alu->export_data);
Append(" = ");
if (is.num_srcs == 2) {
// ADD_CONST_0 dest, [const], [reg]